diff options
| author | Arpit Chakladar <arpitchakladar@proton.me> | 2026-04-13 15:50:39 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar@proton.me> | 2026-04-13 15:50:39 +0530 |
| commit | e871cd49cca8843b1408be2e7999dba44a370eaf (patch) | |
| tree | 10d48f797141dbc9e1f8fefba48cedb8fdee6aeb /modules/scripts/vpn-connect.sh | |
| parent | 93f59b9fffd4cdd7b29813b6eb06f4d1e6475156 (diff) | |
| download | home-manager-config-e871cd49cca8843b1408be2e7999dba44a370eaf.tar.gz home-manager-config-e871cd49cca8843b1408be2e7999dba44a370eaf.zip | |
added convenience script to connect to a vpn server with openvpn
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" |
