Guest User

Untitled

a guest
Jul 17th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #First import all the files
  2. for i in *.ovpn; do nmcli connection import file "$i" type openvpn; done
  3.  
  4. #Now save the script below on some location:
  5.  
  6.  
  7.  
  8.  
  9. #!/bin/bash
  10.  
  11. # Changes password-flags from 1 to 0
  12. sed -i 's/password-flags=1/password-flags=0/g' $1
  13.  
  14. # Adds in a username entry after reneg-seconds
  15. sed -i '/reneg-seconds=0/a username=USERNAME_HERE' $1
  16.  
  17. # Adds in password into the config file after [vpn-secrets]
  18. sed -i '/service-type=/a\
  19. \
  20. [vpn-secrets]' $1
  21. sed -i '/\[vpn-secrets]/a password=PASSWORD_HERE' $1
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. #Now go to /etc/NetworkManager/system-connections
  29.  
  30. for i in "*"; do <script location> "$i"; done
Add Comment
Please, Sign In to add comment