is there a way to download .ovpn file from terminal?
-
Is there a way to download .ovpn file or whole bundle (OpenVPN/Client Export Utility) from some ubuntu terminal?
i found this here link
but problem here is that download is only for .key and .crt file.
Have anyone idea how to download ovpn file, cause i need to download whole bundle.BACKUPDIR="where the cert will go" USERNAME="pfsense user" PASSWORD="pfsense password" PORT="pfsense port" SITE="pfsense ip or address" wget -qO- --keep-session-cookies --save-cookies /tmp/pfsense_cookies.txt \ --no-check-certificate https://$SITE/system_certmanager.php \ | grep "name='__csrf_magic'" | sed 's/.*value="\(.*\)".*/\1/' > /tmp/pfsense_csrf.txt wget -qO- --keep-session-cookies --load-cookies /tmp/pfsense_cookies.txt \ --save-cookies /tmp/pfsense_cookies.txt --no-check-certificate \ --post-data "login=Login&usernamefld="$USERNAME"&passwordfld="$PASSWORD"&__csrf_magic=$(cat /tmp/pfsense_csrf.txt)" \ https://$SITE/system_certmanager.php | grep "name='__csrf_magic'" \ | sed 's/.*value="\(.*\)".*/\1/' > /tmp/pfsense_csrf2.txt if [ -e /tmp/pfsense_cookies.txt ]; then FILENAME="$BACKUPDIR/certname.crt" wget --keep-session-cookies --load-cookies /tmp/pfsense_cookies.txt --no-check-certificate \ --post-data "act=exp&id=1&__csrf_magic=$(head -n 1 /tmp/pfsense_csrf2.txt)" \ https://$SITE/system_certmanager.php -O $FILENAME FILENAME2="$BACKUPDIR/certname.key" wget --keep-session-cookies --load-cookies /tmp/pfsense_cookies.txt --no-check-certificate \ --post-data "act=key&id=1&__csrf_magic=$(head -n 1 /tmp/pfsense_csrf2.txt)" \ https://$SITE/system_certmanager.php -O $FILENAME2 #rm -f /tmp/pfsense_cookies.txt #rm -f /tmp/pfsense_csrf.txt #rm -f /tmp/pfsense_csrf2.txt else echo "Failed to retrieve cert from $SITE" fi done
Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.