add-sstp.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. red='\e[1;31m'
  3. green='\e[0;32m'
  4. NC='\e[0m'
  5. MYIP=$(wget -qO- https://icanhazip.com);
  6. echo "Checking VPS"
  7. clear
  8. IP=$(wget -qO- https://icanhazip.com);
  9. sstp="$(cat ~/log-install.txt | grep -i SSTP | cut -d: -f2|sed 's/ //g')"
  10. until [[ $user =~ ^[a-zA-Z0-9_]+$ && ${CLIENT_EXISTS} == '0' ]]; do
  11. read -rp "Usernew: " -e user
  12. CLIENT_EXISTS=$(grep -w $user /var/lib/premium-script/data-user-sstp | wc -l)
  13. if [[ ${CLIENT_EXISTS} == '1' ]]; then
  14. echo ""
  15. echo "A Client Username Was Already Created, Please Enter New Username"
  16. exit 1
  17. fi
  18. done
  19. read -p "Password: " pass
  20. read -p "Expired (days): " masaaktif
  21. exp=`date -d "$masaaktif days" +"%Y-%m-%d"`
  22. cat >> /home/sstp/sstp_account <<EOF
  23. $user * $pass *
  24. EOF
  25. echo -e "### $user $exp">>"/var/lib/premium-script/data-user-sstp"
  26. clear
  27. cat <<EOF
  28. ============================
  29. SSTP VPN Information Account
  30. ============================
  31. Server IP : $IP
  32. Username : $user
  33. Password : $pass
  34. Port : $sstp
  35. Cert : http://$IP:81/server.crt
  36. Expired On : $exp
  37. ============================
  38. EOF