sstp.sh 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. MYIP=$(wget -qO- ipinfo.io/ip);
  3. MYIP2="s/xxxxxxxxx/$MYIP/g";
  4. NIC=$(ip -o $ANU -4 route show to default | awk '{print $5}');
  5. source /etc/os-release
  6. OS=$ID
  7. ver=$VERSION_ID
  8. if [[ $OS == 'ubuntu' ]]; then
  9. if [[ "$ver" = "18.04" ]]; then
  10. yoi=Ubuntu18
  11. elif [[ "$ver" = "20.04" ]]; then
  12. yoi=Ubuntu20
  13. fi
  14. elif [[ $OS == 'debian' ]]; then
  15. if [[ "$ver" = "9" ]]; then
  16. yoi=Debian9
  17. elif [[ "$ver" = "10" ]]; then
  18. yoi=Debian10
  19. fi
  20. fi
  21. mkdir /home/sstp
  22. touch /home/sstp/sstp_account
  23. touch /var/lib/premium-script/data-user-sstp
  24. #detail nama perusahaan
  25. country=MY
  26. state=Malaysia
  27. locality=Malaysia
  28. organization=RAHCHIEL.xyz
  29. organizationalunit=RAHCHIEL.xyz
  30. commonname=RAHCHIEL.xyz
  31. #install sstp
  32. apt-get install -y build-essential cmake gcc linux-headers-`uname -r` git libpcre3-dev libssl-dev liblua5.1-0-dev ppp
  33. git clone https://github.com/accel-ppp/accel-ppp.git /opt/accel-ppp-code
  34. mkdir /opt/accel-ppp-code/build
  35. cd /opt/accel-ppp-code/build/
  36. cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr -DKDIR=/usr/src/linux-headers-`uname -r` -DLUA=TRUE -DCPACK_TYPE=$yoi ..
  37. make
  38. cpack -G DEB
  39. dpkg -i accel-ppp.deb
  40. mv /etc/accel-ppp.conf.dist /etc/accel-ppp.conf
  41. wget -O /etc/accel-ppp.conf "https://raw.githubusercontent.com/alifnurmareta/bc/main/accel.conf"
  42. sed -i $MYIP2 /etc/accel-ppp.conf
  43. chmod +x /etc/accel-ppp.conf
  44. systemctl start accel-ppp
  45. systemctl enable accel-ppp
  46. #gen cert sstp
  47. cd /home/sstp
  48. openssl genrsa -out ca.key 4096
  49. openssl req -new -x509 -days 3650 -key ca.key -out ca.crt \
  50. -subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$organizationalunit/CN=$commonname/emailAddress=$email"
  51. openssl genrsa -out server.key 4096
  52. openssl req -new -key server.key -out ia.csr \
  53. -subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$organizationalunit/CN=$commonname/emailAddress=$email"
  54. openssl x509 -req -days 3650 -in ia.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
  55. cp /home/sstp/server.crt /home/vps/public_html/server.crt
  56. iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 444 -j ACCEPT
  57. iptables -I INPUT -m state --state NEW -m udp -p udp --dport 444 -j ACCEPT
  58. iptables-save > /etc/iptables.up.rules
  59. iptables-restore -t < /etc/iptables.up.rules
  60. netfilter-persistent save > /dev/null
  61. netfilter-persistent reload > /dev/null
  62. #input perintah sstp
  63. wget -O /usr/bin/add-sstp https://raw.githubusercontent.com/alifnurmareta/bc/main/add-sstp.sh && chmod +x /usr/bin/add-sstp
  64. wget -O /usr/bin/del-sstp https://raw.githubusercontent.com/alifnurmareta/bc/main/del-sstp.sh && chmod +x /usr/bin/del-sstp
  65. wget -O /usr/bin/cek-sstp https://raw.githubusercontent.com/alifnurmareta/bc/main/cek-sstp.sh && chmod +x /usr/bin/cek-sstp
  66. wget -O /usr/bin/renew-sstp https://raw.githubusercontent.com/alifnurmareta/bc/main/renew-sstp.sh && chmod +x /usr/bin/renew-sstp
  67. rm -f /root/sstp.sh