small pixel drawing of a pufferfish dotfiles

bin/zora/vpn

#!/bin/sh
#
# 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
	vpn_running ||
		die 'vpn is already dead'
	notify-send '🔪 killing vpn' -t 1000
	sudo pkill openconnect
else
	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