Last active
July 4, 2023 15:35
-
-
Save daniepetrov/44513c8846a1169b7a93f51767cc223a to your computer and use it in GitHub Desktop.
This file contains 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
# add your vpn password to .vpn_password file | |
echo "mypassword > ~/.vpn_password | |
chmod 600 ~/.vpn_password | |
# add these lines to .zshrc or .zprofile | |
function vpn-up() { | |
local VPN_HOST="host" | |
local VPN_USER="username" | |
local SERVER_CERT="pin-sha256:87+Hf09J6X30/vKmSGLPA35scH/jey/aP7zL4sQ+5+i=" | |
local VPN_AUTH_GROUP="authgroup" | |
if [ ! -f ~/.vpn_password ]; then | |
echo "Error: missing ~/.vpn_password" | |
return | |
fi | |
echo "Starting the vpn ..." | |
echo $(cat ~/.vpn_password) | sudo openconnect --background --passwd-on-stdin --user=$VPN_USER --servercert=$SERVER_CERT --authgroup=$VPN_AUTH_GROUP $VPN_HOST | |
} | |
function vpn-down() { | |
sudo kill -2 `pgrep openconnect` | |
echo "\n" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment