New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #31625 (new enhancement)

Opened 3 years ago

Last modified 3 years ago

OpenVPN Example Scripts

Reported by: mmpestorich@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: openvpn2

Description

I recently setup an OpenVPN environment for various computers in remote locations within my organization. Originally I fooled around with Tunnelblick and while I learned a lot about OpenVPN in doing so, ultimately I decided that I just wanted to keep things simple and install the OpenVPN port and set it up to run at boot. Simple right? Nope. Then it became a challenge. Namely the interaction with DHCP and DNS that occurs between OpenVPN and OS X's rather dynamic SystemConfiguration framework. After a lot of research online about how OS X's SystemConfiguration framework works (and has evolved over time) and looking through Tunnelblick's source, I got things to work well and wanted to contribute some example scripts.

Currently this port installs with not much information regarding how to use it with OS X. It would be nice if there were some examples to point people in the right direction.

Attached are:

net.openvpn2.server.plist

Starts an OpenVPN server:

  • Goes into /Library/LaunchDaemons
  • Runs on load once a Network is available
  • Loads a configuration file from /opt/local/etc/openvpn2/example/server.conf
  • Logs to /opt/local/var/log/openvpn2/server.log and /opt/local/var/log/openvpn2/status.log

net.openvpn2.client.plist

Connects to an OpenVPN server:

  • Goes into /Library/LaunchDaemons
  • Runs on load once a Network is available
  • Loads a configuration file from /opt/local/etc/openvpn2/example/client.conf
  • Logs to /opt/local/var/log/openvpn2/client.log and /opt/local/var/log/openvpn2/status.log

net.openvpn2.watcher.plist

Loads a watcher utility that loads on changes to /Library/Preferences/SystemConfiguration

  • Goes into /Library/LaunchDaemons
  • Reloads OpenVPN's configuration when the network configuration changes

up.sh

Runs after a client successfully connects to a server:

  • Goes into /opt/local/etc/openvpn2
  • A script that configures OS X's DNS and Search Domain settings for the vpn
  • This is a modified version of a Tunnelblick script sans the Tunnelblick specific stuff

down.sh

Runs after a client successfully disconnects from a server:

  • Goes into /opt/local/etc/openvpn2
  • A script that restores OS X's DNS and Search Domain settings to its previous state
  • This is a modified version of a Tunnelblick script sans the Tunnelblick specific stuff

watcher

The utility loaded by the net.openvpn2.watcher.plist on a network change:

  • Goes into /opt/local/etc/openvpn2
  • Checks to see if the change to the network requires OpenVPN to reload its configuration
  • Reconfigures the vpn's DNS and Domain Search settings if necessary
  • This is a modified version of a Tunnelblick script sans the Tunnelblick specific stuff

server.conf

An example server configuration:

  • Goes into /opt/local/etc/openvpn2/example
  • User still needs to create necessary certificates and keys in /opt/local/etc/openvpn2/example

client.conf

An example client configuation:

  • Goes into /opt/local/etc/openvpn2/example
  • User still needs to create necessary certificates and keys in /opt/local/etc/openvpn2/example

Attachments

net.openvpn2.server.plist (1.2 KB) - added by mmpestorich@… 3 years ago.
net.openvpn2.client.plist (1013 bytes) - added by mmpestorich@… 3 years ago.
net.openvpn2.watcher.plist (615 bytes) - added by mmpestorich@… 3 years ago.
up.sh (18.2 KB) - added by mmpestorich@… 3 years ago.
down.sh (3.3 KB) - added by mmpestorich@… 3 years ago.
watcher (6.9 KB) - added by mmpestorich@… 3 years ago.
server.conf (489 bytes) - added by mmpestorich@… 3 years ago.
client.conf (384 bytes) - added by mmpestorich@… 3 years ago.

Change History

Changed 3 years ago by mmpestorich@…

Changed 3 years ago by mmpestorich@…

Changed 3 years ago by mmpestorich@…

Changed 3 years ago by mmpestorich@…

Changed 3 years ago by mmpestorich@…

Changed 3 years ago by mmpestorich@…

Changed 3 years ago by mmpestorich@…

Changed 3 years ago by mmpestorich@…

comment:1 Changed 3 years ago by mmpestorich@…

  • Cc mmpestorich@… added

Cc Me!

comment:2 Changed 3 years ago by macsforever2000@…

  • Keywords scripts removed
  • Cc mmpestorich@… removed
  • Milestone MacPorts Future deleted
Note: See TracTickets for help on using tickets.