Skip to content

Instantly share code, notes, and snippets.

@sepastian
Last active June 24, 2026 09:10
Show Gist options
  • Select an option

  • Save sepastian/67037b3c485ad7c2f5b228f27010df38 to your computer and use it in GitHub Desktop.

Select an option

Save sepastian/67037b3c485ad7c2f5b228f27010df38 to your computer and use it in GitHub Desktop.
eduvpn CLI connection
#!/bin/bash
# Command download eduVPN credentials, opening a browser window for 2FA,
# then opening a connection using wg-quick.
#
# Eduvpn is used at the University of Passau, for example.
#
# As discussed [1], eduVPN offers an undocumented CLI to download the credentials file.
# This will open a browser window for authentication, upon success, the credentials are
# printed to stdout, together with logging output.
#
# Use grep to extract the credentials only and save to a file.
#
# Note: in my case, AllowedIPs must be set to 0.0.0.0/0, or no hosts can be reached via SSH.
#
# wg-quick will run as sudo.
#
# [1] https://codeberg.org/eduVPN/linux-app/issues/614
# Obtain credentials using eduvpn-cli (undocumented, see [1]);
# strip logging output using grep;
# set AllowedIPs=0.0.0.0/0 using sed;
# store config in /tmp/wg0.conf.
#
# Note: altering AllowedIPs may not be necessary in your case.
go run codeberg.org/eduVPN/eduvpn-common/cmd/eduvpn-cli@latest -get-institute eduvpn.uni-passau.de \
| grep -v '^time' \
| sed -e 's|^AllowedIPs.*$|AllowedIPs = 0.0.0.0/0|' > /tmp/wg0.conf
# Hide config file from all but current user,
# or wg-quick will complain about world-accessible config.
chmod 700 /tmp/wg0.conf
# Open VPN connection using config from above.
# This will ask for you sudo password.
wg-quick up /tmp/wg0.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment