vpn updoot
Jes Olson j3s@c3f.net
Wed, 03 May 2023 15:56:06 -0700
1 files changed,
24 insertions(+),
12 deletions(-)
jump to
M
bin/zora/vpn
→
bin/zora/vpn
@@ -3,18 +3,30 @@ #
# connects or kills the gp # vpn tunnel +die() { + notify-send "💀 $1" -t 2000 + sleep 1 + exit 1 +} + +vpn_running() { + pgrep openconnect >/dev/null +} + if [ "$1" = "kill" ]; then - notify-send '🤬 killing vpn' -t 2000 - sudo pkill openconnect + vpn_running || + die 'vpn is already dead' + notify-send '🔪 killing vpn' -t 1000 + sudo pkill openconnect else - notify-send '👼 connecting vpn' -t 1000 - # the two-line pipe method used here was described - # in this issue: https://github.com/dlenski/openconnect/issues/103#issuecomment-383416545 - if pgrep openconnect; then - sleep 1 - notify-send '😳 vpn already running' -t 2000 - exit - fi - printf "%s\n%s" "$(pa show vpn)" "1" | - sudo openconnect -u jolson --passwd-on-stdin --protocol=gp https://vpn-nyc3.digitalocean.com/ssl-vpn + vpn_running && + die 'vpn is already running' + notify-send '🛡️ vpn connecting' -t 500 + # ty katco 🙌 + openconnect-gp-okta \ + -username jolson \ + -password-command 'pa show vpn' \ + -vpn-endpoint vpn-nyc3.digitalocean.com \ + -openconnect-args='--reconnect-timeout --csd-wrapper=/usr/lib/openconnect/hipreport.sh' + notify-send '🛡️ vpn connected' -t 500 fi