Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #copyright all right reserved by hjyy
- YOUR_VPN_USERNAME=''
- YOUR_PASSWORD=''
- YOUR_USER_ID=''
- [ -n "$VPN_USERNAME" ] && VPN_USER="$YOUR_VPN_USERNAME"
- [ -n "$PASSWORD" ] && VPN_PASSWORD="$YOUR_PASSWORD"
- [ -n "$USER" ] && USER_ID="$YOUR_USER_ID"
- if [ -z "$VPN_EMAIL" ] && [ -z "$VPN_USER" ] && [ -z "$VPN_PASSWORD" ]; then
- echo "VPN credentials not set by VPN_USER. Generating random password..."
- echo
- VPN_USER="$(LC_CTYPE=C tr -dc 'a-z2-9' < /dev/urandom | head -c 5)"
- VPN_PASSWORD="$(LC_CTYPE=C tr -dc '2-9' < /dev/urandom | head -c 5)"
- USER_ID="$(LC_CTYPE=C tr -dc '1-9' < /dev/urandom | head -c 8)"
- fi
- if [ -z "$VPN_USER" ] || [ -z "$VPN_PASSWORD" ]; then
- exiterr "All VPN credentials must be specified. Edit the script and re-enter them."
- fi
- echo "Adding VPN_USER setup in progress... Please be patient."
- echo
- cd /etc/ || exiterr "Cannot enter /etc/strongswan/."
- sudo sh -c "echo ' : RSA ike.ovpadd.com.key
- $VPN_USER : EAP "$VPN_PASSWORD"' >> /var/lib/strongswan/$VPN_USER.secrets.inc"
- sudo sh -c "echo 'include /var/lib/strongswan/$VPN_USER.secrets.inc' >> /etc/ipsec.secrets"
- chmod -Rf 775 include /var/lib/strongswan/$VPN_USER.secrets.inc
- echo "Copyright all right reserved by securedv.net"
- echo "username is: $VPN_USER and password is :$VPN_PASSWORD"
- echo "please run this code for delete user after <time> : bash d.sh /var/lib/strongswan/$VPN_USER.secrets.inc <time> "
- sudo service strongswan restart
- exit 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement