sstp.sh 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/bin/bash
  2. # SL
  3. # ==========================================
  4. # Color
  5. RED='\033[0;31m'
  6. NC='\033[0m'
  7. GREEN='\033[0;32m'
  8. ORANGE='\033[0;33m'
  9. BLUE='\033[0;34m'
  10. PURPLE='\033[0;35m'
  11. CYAN='\033[0;36m'
  12. LIGHT='\033[0;37m'
  13. # ==========================================
  14. # Getting
  15. MYIP=$(wget -qO- ipinfo.io/ip);
  16. echo "Checking VPS"
  17. IZIN=$( curl ipinfo.io/ip | grep $MYIP )
  18. if [ $MYIP = $MYIP ]; then
  19. echo -e "${NC}${GREEN}Permission Accepted...${NC}"
  20. else
  21. echo -e "${NC}${RED}Permission Denied!${NC}";
  22. echo -e "${NC}${LIGHT}Fuck You!!"
  23. exit 0
  24. fi
  25. # Link Hosting Kalian
  26. akbarvpn="raw.githubusercontent.com/fisabiliyusri/Mantap/main/sstp"
  27. MYIP=$(wget -qO- ipinfo.io/ip);
  28. MYIP2="s/xxxxxxxxx/$MYIP/g";
  29. NIC=$(ip -o $ANU -4 route show to default | awk '{print $5}');
  30. source /etc/os-release
  31. OS=$ID
  32. ver=$VERSION_ID
  33. if [[ $OS == 'ubuntu' ]]; then
  34. if [[ "$ver" = "18.04" ]]; then
  35. yoi=Ubuntu18
  36. elif [[ "$ver" = "20.04" ]]; then
  37. yoi=Ubuntu20
  38. fi
  39. elif [[ $OS == 'debian' ]]; then
  40. if [[ "$ver" = "9" ]]; then
  41. yoi=Debian9
  42. elif [[ "$ver" = "10" ]]; then
  43. yoi=Debian10
  44. fi
  45. fi
  46. mkdir /home/sstp
  47. touch /home/sstp/sstp_account
  48. touch /var/lib/crot/data-user-sstp
  49. #detail nama perusahaan
  50. country=ID
  51. state=Indonesia
  52. locality=Indonesia
  53. organization=infinity
  54. organizationalunit=infinity
  55. commonname=cdn.covid19.go.id
  56. email=hayuk69@gmail.com
  57. #install sstp
  58. apt-get install -y build-essential cmake gcc linux-headers-`uname -r` git libpcre3-dev libssl-dev liblua5.1-0-dev ppp
  59. git clone https://github.com/accel-ppp/accel-ppp.git /opt/accel-ppp-code
  60. mkdir /opt/accel-ppp-code/build
  61. cd /opt/accel-ppp-code/build/
  62. 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 ..
  63. make
  64. cpack -G DEB
  65. dpkg -i accel-ppp.deb
  66. mv /etc/accel-ppp.conf.dist /etc/accel-ppp.conf
  67. wget -O /etc/accel-ppp.conf "https://${akbarvpn}/accel.conf"
  68. sed -i $MYIP2 /etc/accel-ppp.conf
  69. chmod +x /etc/accel-ppp.conf
  70. systemctl start accel-ppp
  71. systemctl enable accel-ppp
  72. #gen cert sstp
  73. cd /home/sstp
  74. openssl genrsa -out ca.key 4096
  75. openssl req -new -x509 -days 3650 -key ca.key -out ca.crt \
  76. -subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$organizationalunit/CN=$commonname/emailAddress=$email"
  77. openssl genrsa -out server.key 4096
  78. openssl req -new -key server.key -out ia.csr \
  79. -subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$organizationalunit/CN=$commonname/emailAddress=$email"
  80. openssl x509 -req -days 3650 -in ia.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
  81. cp /home/sstp/server.crt /home/vps/public_html/server.crt
  82. iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 444 -j ACCEPT
  83. iptables -I INPUT -m state --state NEW -m udp -p udp --dport 444 -j ACCEPT
  84. iptables-save > /etc/iptables.up.rules
  85. iptables-restore -t < /etc/iptables.up.rules
  86. netfilter-persistent save > /dev/null
  87. netfilter-persistent reload > /dev/null
  88. #input perintah sstp
  89. wget -O /usr/bin/addsstp https://${akbarvpn}/addsstp.sh && chmod +x /usr/bin/addsstp
  90. wget -O /usr/bin/delsstp https://${akbarvpn}/delsstp.sh && chmod +x /usr/bin/delsstp
  91. wget -O /usr/bin/ceksstp https://${akbarvpn}/ceksstp.sh && chmod +x /usr/bin/ceksstp
  92. wget -O /usr/bin/renewsstp https://${akbarvpn}/renewsstp.sh && chmod +x /usr/bin/renewsstp
  93. rm -f /root/sstp.sh