diff options
author | Saumit <justsaumit@protonmail.com> | 2024-09-21 16:15:45 +0530 |
---|---|---|
committer | Saumit <justsaumit@protonmail.com> | 2024-09-21 16:15:45 +0530 |
commit | 9997f059b41ffb09bfdf81b3cf2c9612aa622643 (patch) | |
tree | 71f63df209d4b1232221b0ab5a950bced5ce449d /.scripts/spunup-vpn | |
parent | 1fdfb860b451de8e563c886e365ae24b9a353ca7 (diff) |
Diffstat (limited to '.scripts/spunup-vpn')
-rwxr-xr-x | .scripts/spunup-vpn | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/.scripts/spunup-vpn b/.scripts/spunup-vpn new file mode 100755 index 0000000..80cd0dc --- /dev/null +++ b/.scripts/spunup-vpn @@ -0,0 +1,13 @@ +#!/bin/bash +VPN_USER=$(pass show OpenVPN-user) +VPN_PASSWORD=$(pass show OpenVPN-pass) + +OVPN_FILES=(*.ovpn) +if [ ${#OVPN_FILES[@]} -eq 0 ]; then + echo "No .ovpn files found in $OVPN_DIR." + exit 1 +fi +CONFIG_FILE=${OVPN_FILES[RANDOM % ${#OVPN_FILES[@]}]} + + +sudo bash -c 'openvpn --config '"$CONFIG_FILE"' --auth-user-pass <(echo -e "'"$VPN_USER"'\n'"$VPN_PASSWORD"'")' |