add-sstp.sh 937 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. IP=$(wget -qO- ipinfo.io/ip);
  3. sstp="$(cat ~/log-install.txt | grep -i SSTP | cut -d: -f2|sed 's/ //g')"
  4. until [[ $user =~ ^[a-zA-Z0-9_]+$ && ${CLIENT_EXISTS} == '0' ]]; do
  5. read -rp "Usernew: " -e user
  6. CLIENT_EXISTS=$(grep -w $user /var/lib/premium-script/data-user-sstp | wc -l)
  7. if [[ ${CLIENT_EXISTS} == '1' ]]; then
  8. echo ""
  9. echo "A client with the specified name was already created, please choose another name."
  10. exit 1
  11. fi
  12. done
  13. read -p "Password: " pass
  14. read -p "Expired (days): " masaaktif
  15. exp=`date -d "$masaaktif days" +"%Y-%m-%d"`
  16. cat >> /home/sstp/sstp_account <<EOF
  17. $user * $pass *
  18. EOF
  19. echo -e "### $user $exp">>"/var/lib/premium-script/data-user-sstp"
  20. clear
  21. cat <<EOF
  22. ================================
  23. SSTP VPN
  24. Server IP : $IP
  25. Username : $user
  26. Password : $pass
  27. Port : $sstp
  28. Cert : http://$IP:81/server.crt
  29. Expired On : $exp
  30. ================================
  31. EOF