# Remember to first import the config into openvpn3. Change the $CONFIG_NAME into name that makes sense to you # openvpn3 config-import --config profile.ovpn --name $CONFIG_NAME # Add the code below to your shell's .rc file. Replace the strings below with the proper values. # - $CONFIG_NAME # - EMAIL_ADDRESS # - BASE64_ENCODED_PASSWORD - To avoid exposing your password vpn-off () { openvpn3 session-manage --config $CONFIG_NAME --disconnect 2> /dev/null printf "Disconnected from VPN.\n" } vpn-on () { if [ -z "$1" ]; then echo "Usage: vpn-on <2FA code>\n"; else vpn-off printf "Connecting to VPN.\n" printf "EMAIL_ADDRESS\n$(echo "BASE64_ENCODED_PASSWORD==" | base64 --decode)\n$1" | openvpn3 session-start --config $CONFIG_NAME printf "Connected to VPN.\n" fi } vpn-status () { if [ -z "$(openvpn3 sessions-list | grep "Client connected")" ]; then printf "VPN is disconnected.\n"; else printf "VPN is connected.\n"; fi }