diff options
Diffstat (limited to 'modules/scripts/vpn-connect.sh')
| -rw-r--r-- | modules/scripts/vpn-connect.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/scripts/vpn-connect.sh b/modules/scripts/vpn-connect.sh new file mode 100644 index 0000000..f325e17 --- /dev/null +++ b/modules/scripts/vpn-connect.sh @@ -0,0 +1,20 @@ +# Define directories +CONF_DIR="$HOME/.config/openvpn" +CREDS_DIR="$CONF_DIR/credentials" +SERVERS_DIR="$CONF_DIR/servers" + +# Create directories if they don't exist +mkdir -p "$CREDS_DIR" "$SERVERS_DIR" + +# Select the credential file +CRED=$(find "$CREDS_DIR" -type f | fzf --prompt="Select Credentials > ") +[ -z "$CRED" ] && exit 1 + +# Select the VPN server config +SERVER=$(find "$SERVERS_DIR" -type f \( -name "*.conf" -o -name "*.ovpn" \) | fzf --prompt="Select VPN Server > ") +[ -z "$SERVER" ] && exit 1 + +echo "Connecting to $SERVER using $CRED..." + +# Execute openvpn +sudo openvpn --config "$SERVER" --auth-user-pass "$CRED" |
