Last active
January 27, 2021 18:29
-
-
Save notpike/728700e46d3ad5db38081f6633d888ca to your computer and use it in GitHub Desktop.
Import OpenVPN config files into Network Manager from current directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #Update UNAME and PASS and run from the directory where the .ovpn files reside | |
| UNAME="" | |
| PASS='' | |
| echo "== START ==" | |
| for file in *; do | |
| if [ -f "$file" ]; then | |
| if [ ${file: -5} == ".ovpn" ]; then | |
| echo "Importing" ${file::-5} | |
| nmcli connection import type openvpn file "$file" | |
| nmcli con modify "${file::-5}" vpn.user-name $UNAME | |
| nmcli con modify "${file::-5}" vpn.secrets password=$PASS | |
| fi | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment