Skip to content

Instantly share code, notes, and snippets.

@cyxou
Last active October 19, 2023 12:17
Show Gist options
  • Save cyxou/880780195ca93fd8cf0fa487ed53e28f to your computer and use it in GitHub Desktop.
Save cyxou/880780195ca93fd8cf0fa487ed53e28f to your computer and use it in GitHub Desktop.
Openconnect and OpenVPN connections scripts
#!/usr/bin/env bash
set -e
echo "Starting connection..."
USERNAME=<USERNAME>
PASSWORD=<PASSWORD>
VPN_HOST=<VPN_HOST>
TOTP_SECRET="sha1:base32:<SECRET>"
openconnect --background --token-mode=totp --token-secret=$TOTP_SECRET --user=$USERNAME $VPN_HOST
printf "%s\n" $PASSWORD | openconnect --background --token-mode=totp --token-secret=$TOTP_SECRET --user=$USERNAME --passwd-on-stdin $VPN_HOST
#!/usr/bin/env bash
set -e
echo "Starting connection..."
openvpn3 session-start --config /home/ubuntu/<YOUR_OPENVPN_PROFILE>.ovpn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment