blob: f325e17d1ed08b7305a63a0ac4eee3c4f0ca7b3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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"
|