Skip to content

Instantly share code, notes, and snippets.

@zdj
Last active November 1, 2017 17:56
Show Gist options
  • Save zdj/9477257 to your computer and use it in GitHub Desktop.
Save zdj/9477257 to your computer and use it in GitHub Desktop.
Use openconnect as an alternative to Cisco AnyConnect VPN client.
export VPN_USER=$YOUR_VPN_USER
export VPN_HOST=$YOUR_VPN_HOST
brew install openconnect
brew search tuntap
brew install tuntap
sudo cp -pR /usr/local/Cellar/tuntap/20111101/Library/Extensions/tap.kext /Library/Extensions/
sudo cp -pR /usr/local/Cellar/tuntap/20111101/Library/Extensions/tun.kext /Library/Extensions/
sudo chown -R root:wheel /Library/Extensions/tap.kext
sudo chown -R root:wheel /Library/Extensions/tun.kext
sudo touch /Library/Extensions/
sudo cp -pR /usr/local/Cellar/tuntap/20111101/tap /Library/StartupItems/
sudo chown -R root:wheel /Library/StartupItems/tap
sudo cp -pR /usr/local/Cellar/tuntap/20111101/tun /Library/StartupItems/
sudo chown -R root:wheel /Library/StartupItems/tun
sudo mkdir /var/run/vpnc
cd /usr/local/bin
ln -s /usr/local/opt/tuntap/tap .
ln -s /usr/local/opt/tuntap/tun .
cd /Library/Extensions
sudo kextload -v tun.kext
touch ~/openconnect.pid
sudo openconnect -u $VPN_USER -b -l --pid-file=$HOME/openconnect.pid $VPN_HOST
sudo kill `cat ~/openconnect.pid`
@zdj
Copy link
Author

zdj commented Mar 11, 2014

vpn_connect.zsh will run the VPN connection in the background and log to the system log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment