Skip to content

Instantly share code, notes, and snippets.

@edgar
Created August 10, 2020 16:47
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save edgar/39b12003babe938c90a7f432fff7d4de to your computer and use it in GitHub Desktop.
Save edgar/39b12003babe938c90a7f432fff7d4de to your computer and use it in GitHub Desktop.
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