port-sstp.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. red='\e[1;31m'
  3. green='\e[0;32m'
  4. NC='\e[0m'
  5. MYIP=$(wget -qO- icanhazip.com);
  6. echo "Checking VPS"
  7. clear
  8. sstp="$(cat ~/log-install.txt | grep -i SSTP | cut -d: -f2|sed 's/ //g')"
  9. echo -e " Change Port $sstp"
  10. read -p "New Port sstp: " sstp2
  11. if [ -z $sstp2 ]; then
  12. echo "Please Input Port"
  13. exit 0
  14. fi
  15. cek=$(netstat -nutlp | grep -w $sstp2)
  16. if [[ -z $cek ]]; then
  17. sed -i "s/$sstp/$sstp2/g" /etc/accel-ppp.conf
  18. sed -i "s/ - SSTP VPN : $sstp/ - SSTP VPN : $sstp2/g" /root/log-install.txt
  19. iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport $sstp -j ACCEPT
  20. iptables -D INPUT -m state --state NEW -m udp -p udp --dport $sstp -j ACCEPT
  21. iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport $sstp2 -j ACCEPT
  22. iptables -I INPUT -m state --state NEW -m udp -p udp --dport $sstp2 -j ACCEPT
  23. iptables-save > /etc/iptables.up.rules
  24. iptables-restore -t < /etc/iptables.up.rules
  25. netfilter-persistent save > /dev/null
  26. netfilter-persistent reload > /dev/null
  27. systemctl restart accel-ppp> /dev/null
  28. echo -e "\e[032;1mPort $sstp2 modified successfully\e[0m"
  29. else
  30. echo "Port $sstp2 is used"
  31. fi