Created
August 10, 2020 16:47
-
-
Save edgar/39b12003babe938c90a7f432fff7d4de to your computer and use it in GitHub Desktop.
ZSH functions to start/stop OpenConnect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ZSH functions to start/stop OpenConnect VPN client | |
# | |
# In my setup the VPN username is the same as $USER | |
# | |
export VPN_HOST=<your VPN host> | |
function vpn-up() { | |
if [[ -z $VPN_HOST ]] | |
then | |
echo "Please set VPN_HOST env var" | |
return | |
fi | |
echo "Starting the vpn ..." | |
sudo openconnect --background --user=$USER $VPN_HOST | |
} | |
function vpn-down() { | |
sudo kill -2 `pgrep openconnect` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment