Advertisement
Guest User

Untitled

a guest
Nov 13th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #!/bin/bash
  2. #copyright all right reserved by hjyy
  3. YOUR_VPN_USERNAME=''
  4. YOUR_PASSWORD=''
  5. YOUR_USER_ID=''
  6. [ -n "$VPN_USERNAME" ] && VPN_USER="$YOUR_VPN_USERNAME"
  7. [ -n "$PASSWORD" ] && VPN_PASSWORD="$YOUR_PASSWORD"
  8. [ -n "$USER" ] && USER_ID="$YOUR_USER_ID"
  9. if [ -z "$VPN_EMAIL" ] && [ -z "$VPN_USER" ] && [ -z "$VPN_PASSWORD" ]; then
  10. echo "VPN credentials not set by VPN_USER. Generating random password..."
  11. echo
  12. VPN_USER="$(LC_CTYPE=C tr -dc 'a-z2-9' < /dev/urandom | head -c 5)"
  13. VPN_PASSWORD="$(LC_CTYPE=C tr -dc '2-9' < /dev/urandom | head -c 5)"
  14. USER_ID="$(LC_CTYPE=C tr -dc '1-9' < /dev/urandom | head -c 8)"
  15.  
  16. fi
  17.  
  18. if [ -z "$VPN_USER" ] || [ -z "$VPN_PASSWORD" ]; then
  19. exiterr "All VPN credentials must be specified. Edit the script and re-enter them."
  20. fi
  21. echo "Adding VPN_USER setup in progress... Please be patient."
  22. echo
  23. cd /etc/ || exiterr "Cannot enter /etc/strongswan/."
  24. sudo sh -c "echo ' : RSA ike.ovpadd.com.key
  25. $VPN_USER : EAP "$VPN_PASSWORD"' >> /var/lib/strongswan/$VPN_USER.secrets.inc"
  26. sudo sh -c "echo 'include /var/lib/strongswan/$VPN_USER.secrets.inc' >> /etc/ipsec.secrets"
  27. chmod -Rf 775 include /var/lib/strongswan/$VPN_USER.secrets.inc
  28. echo "Copyright all right reserved by securedv.net"
  29. echo "username is: $VPN_USER and password is :$VPN_PASSWORD"
  30. echo "please run this code for delete user after <time> : bash d.sh /var/lib/strongswan/$VPN_USER.secrets.inc <time> "
  31. sudo service strongswan restart
  32. exit 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement