Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ZSH functions to start/stop OpenConnect
#
# 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