Skip to content

Instantly share code, notes, and snippets.

@viniciusgava
viniciusgava / .bashrc
Created June 21, 2024 06:48
Connecting to a Open VPN by fetching the username and password from 1password CLI as a bash alias
function __myvpnalias() {
sudo \
# OP read command: https://developer.1password.com/docs/cli/reference/commands/read/
VPN_USER=$(op read 'op://REFERENCE/TO/VPN/USER_NAME') \
VPN_PASSWORD=$(op read 'op://REFERENCE/TO/VPN/PASSWORD') \
VPN_CONFIG_FILE='/PATH/TO/OPENVPN/CONFIG/FILE' \
bash -c 'openvpn --script-security 2 --config $VPN_CONFIG_FILE --auth-user-pass <(echo -e "$VPN_USER\n$VPN_PASSWORD")'
}
alias myvpnalias="__myvpnalias"

Keybase proof

I hereby claim:

  • I am viniciusgava on github.
  • I am viniciusgava (https://keybase.io/viniciusgava) on keybase.
  • I have a public key whose fingerprint is BE34 7518 0C83 3826 6B72 AACF 2BB7 75C4 586E 1BD2

To claim this, I am signing this object: