alpha
Login
or
Join now
j3s.sh
/
dotfiles
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
my dotz
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
vpn updoot
author
Jes Olson
date
3 years ago
(May 3, 2023, 3:56 PM -0700)
commit
2efb6dbd
2efb6dbd62c75ef50f9e6375264ae995c87482b4
parent
8282b000
8282b000af6f53b56be92d876a756ca4dd106100
+24
-12
1 changed file
Expand all
Collapse all
Unified
Split
bin
zora
vpn
+24
-12
bin/zora/vpn
Reviewed
···
3
3
# connects or kills the gp
4
4
# vpn tunnel
5
5
6
6
+
die() {
7
7
+
notify-send "💀 $1" -t 2000
8
8
+
sleep 1
9
9
+
exit 1
10
10
+
}
11
11
+
12
12
+
vpn_running() {
13
13
+
pgrep openconnect >/dev/null
14
14
+
}
15
15
+
6
16
if [ "$1" = "kill" ]; then
7
7
-
notify-send '🤬 killing vpn' -t 2000
8
8
-
sudo pkill openconnect
17
17
+
vpn_running ||
18
18
+
die 'vpn is already dead'
19
19
+
notify-send '🔪 killing vpn' -t 1000
20
20
+
sudo pkill openconnect
9
21
else
10
10
-
notify-send '👼 connecting vpn' -t 1000
11
11
-
# the two-line pipe method used here was described
12
12
-
# in this issue: https://github.com/dlenski/openconnect/issues/103#issuecomment-383416545
13
13
-
if pgrep openconnect; then
14
14
-
sleep 1
15
15
-
notify-send '😳 vpn already running' -t 2000
16
16
-
exit
17
17
-
fi
18
18
-
printf "%s\n%s" "$(pa show vpn)" "1" |
19
19
-
sudo openconnect -u jolson --passwd-on-stdin --protocol=gp https://vpn-nyc3.digitalocean.com/ssl-vpn
22
22
+
vpn_running &&
23
23
+
die 'vpn is already running'
24
24
+
notify-send '🛡️ vpn connecting' -t 500
25
25
+
# ty katco 🙌
26
26
+
openconnect-gp-okta \
27
27
+
-username jolson \
28
28
+
-password-command 'pa show vpn' \
29
29
+
-vpn-endpoint vpn-nyc3.digitalocean.com \
30
30
+
-openconnect-args='--reconnect-timeout --csd-wrapper=/usr/lib/openconnect/hipreport.sh'
31
31
+
notify-send '🛡️ vpn connected' -t 500
20
32
fi