ssh-baru.sh 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #auto installer SSH + Dropbear +Stunnel + SSLH Multi Port
  2. # initializing var
  3. export DEBIAN_FRONTEND=noninteractive
  4. OS=`uname -m`;
  5. MYIP=$(wget -qO- ipv4.icanhazip.com);
  6. MYIP2="s/xxxxxxxxx/$MYIP/g";
  7. # Delete Acount SSH Expired
  8. echo "================ Auto deleted Account Expired ======================"
  9. wget -O /usr/local/bin/userdelexpired "https://raw.githubusercontent.com/4hidessh/sshtunnel/master/userdelexpired" && chmod +x /usr/local/bin/userdelexpired
  10. #tambahan installer
  11. apt-get -y install gcc
  12. apt-get -y install make
  13. apt-get install cmake -y
  14. apt-get -y install git
  15. apt-get -y install wget
  16. apt-get install screen -y
  17. apt-get -y install unzip
  18. apt-get -y install curl
  19. apt-get -y install unrar
  20. apt-get -y install dnsutils net-tools tcpdump grepcidr
  21. apt-get install dsniff -y
  22. # nano /etc/rc.local
  23. cat > /etc/rc.local <<-END
  24. #!/bin/sh -e
  25. # rc.local
  26. # By default this script does nothing.
  27. exit 0
  28. END
  29. # Ubah izin akses
  30. chmod +x /etc/rc.local
  31. # enable rc local
  32. systemctl enable rc-local
  33. # detail nama perusahaan
  34. country=ID
  35. state=Semarang
  36. locality=JawaTengah
  37. organization=hidessh
  38. organizationalunit=HideSSH
  39. commonname=hidessh.com
  40. email=admin@hidessh.com
  41. cd
  42. # set time GMT +7 jakarta
  43. ln -fs /usr/share/zoneinfo/Asia/Jakarta /etc/localtime
  44. # set locale SSH
  45. echo "================= Setting Port SSH ======================"
  46. cd
  47. sed -i 's/#Port 22/Port 22/g' /etc/ssh/sshd_config
  48. sed -i '/Port 22/a Port 80' /etc/ssh/sshd_config
  49. sed -i 's/AcceptEnv/#AcceptEnv/g' /etc/ssh/sshd_config
  50. /etc/init.d/ssh restart
  51. echo "================ install Dropbear ======================"
  52. echo "========================================================="
  53. # install dropbear
  54. apt-get -y install dropbear
  55. sed -i 's/NO_START=1/NO_START=0/g' /etc/default/dropbear
  56. sed -i 's/DROPBEAR_PORT=22/DROPBEAR_PORT=44/g' /etc/default/dropbear
  57. sed -i 's/DROPBEAR_EXTRA_ARGS=/DROPBEAR_EXTRA_ARGS="-p 77 "/g' /etc/default/dropbear
  58. echo "/bin/false" >> /etc/shells
  59. echo "/usr/sbin/nologin" >> /etc/shells
  60. /etc/init.d/ssh restart
  61. /etc/init.d/dropbear restart
  62. # install squid3
  63. echo "================ konfigurasi Squid3 ======================"
  64. cd
  65. apt-get -y install squid3
  66. wget -O /etc/squid/squid.conf "https://raw.githubusercontent.com/idtunnel/sshtunnel/master/debian9/squid3.conf"
  67. sed -i $MYIP2 /etc/squid/squid.conf;
  68. /etc/init.d/squid restart
  69. echo "================= install stunnel ====================="
  70. echo "========================================================="
  71. # install stunnel
  72. apt-get install stunnel4 -y
  73. cat > /etc/stunnel/stunnel.conf <<-END
  74. cert = /etc/stunnel/stunnel.pem
  75. client = no
  76. socket = a:SO_REUSEADDR=1
  77. socket = l:TCP_NODELAY=1
  78. socket = r:TCP_NODELAY=1
  79. [dropbear]
  80. accept = 222
  81. connect = 127.0.0.1:22
  82. [dropbear]
  83. accept = 444
  84. connect = 127.0.0.1:44
  85. [dropbear]
  86. accept = 777
  87. connect = 127.0.0.1:77
  88. END
  89. echo "================= membuat Sertifikat OpenSSL ======================"
  90. echo "========================================================="
  91. #membuat sertifikat
  92. openssl genrsa -out key.pem 2048
  93. openssl req -new -x509 -key key.pem -out cert.pem -days 1095 \
  94. -subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$organizationalunit/CN=$commonname/emailAddress=$email"
  95. cat key.pem cert.pem >> /etc/stunnel/stunnel.pem
  96. # konfigurasi stunnel
  97. sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/stunnel4
  98. /etc/init.d/stunnel4 restart
  99. #install Dns Server
  100. echo "================= DNS Server ======================"
  101. apt-get install resolvconf -y
  102. wget -O /etc/resolvconf/resolv.conf.d/head "https://raw.githubusercontent.com/4hidessh/sshtunnel/master/dns" && chmod +x /etc/resolvconf/resolv.conf.d/head
  103. #install sslh
  104. echo "================= Install Multi Port ======================"
  105. apt-get install sslh -y
  106. #konfigurasi
  107. wget -O /etc/default/sslh "https://raw.githubusercontent.com/idtunnel/sslh/master/sslh-conf"
  108. service sslh restart
  109. cd
  110. # common password debian
  111. wget -O /etc/pam.d/common-password "https://raw.githubusercontent.com/idtunnel/sshtunnel/master/debian9/common-password-deb9"
  112. chmod +x /etc/pam.d/common-password
  113. # Custom Banner SSH
  114. echo "================ Banner ======================"
  115. wget -O /etc/issue.net "https://github.com/idtunnel/sshtunnel/raw/master/debian9/banner-custom.conf"
  116. chmod +x /etc/issue.net
  117. echo "Banner /etc/issue.net" >> /etc/ssh/sshd_config
  118. echo "DROPBEAR_BANNER="/etc/issue.net"" >> /etc/default/dropbear
  119. # Instal DDOS Flate
  120. wget https://github.com/jgmdev/ddos-deflate/archive/master.zip -O ddos.zip
  121. unzip ddos.zip
  122. cd ddos-deflate-master
  123. ./install.sh
  124. echo "================= Auto Installer Disable badVPN V 3 ======================"
  125. # buat directory badvpn
  126. cd /usr/bin
  127. mkdir build
  128. cd build
  129. wget https://github.com/ambrop72/badvpn/archive/1.999.130.tar.gz
  130. tar xvzf 1.999.130.tar.gz
  131. cd badvpn-1.999.130
  132. cmake -DBUILD_NOTHING_BY_DEFAULT=1 -DBUILD_TUN2SOCKS=1 -DBUILD_UDPGW=1
  133. make install
  134. make -i install
  135. cd
  136. # auto start badvpn single port
  137. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 1000 --max-connections-for-client 100' /etc/rc.local
  138. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 500 --max-connections-for-client 20
  139. cd
  140. # permition
  141. chmod +x /usr/local/bin/badvpn-udpgw
  142. chmod +x /usr/local/share/man/man7/badvpn.7
  143. chmod +x /usr/local/bin/badvpn-tun2socks
  144. chmod +x /usr/local/share/man/man8/badvpn-tun2socks.8
  145. chmod +x /usr/bin/build
  146. chmod +x /etc/rc.local
  147. # autoreboot 12 jam
  148. echo "================ Auto Reboot ======================"
  149. echo "0 0 * * * root /sbin/reboot" > /etc/cron.d/reboot