Skip to content

Instantly share code, notes, and snippets.

@stibi
Created December 28, 2018 10:45
Show Gist options
  • Save stibi/20b0a5d496bdbd5073dde50662fa9b25 to your computer and use it in GitHub Desktop.
Save stibi/20b0a5d496bdbd5073dde50662fa9b25 to your computer and use it in GitHub Desktop.
Open VPN connection, read oauth token from yubikey
#!/usr/bin/expect
set username "mstiborsky\r"
set config "/etc/openvpn/client/zonky.conf"
set vpn_oauth_token [exec ykman oath code -s vpn]
spawn openvpn --config $config --auth-user-pass
expect "Enter Auth Username:"
send $username
expect "Enter Auth Password:"
send $vpn_oauth_token
send "\r"
interact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment