centos8 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. #!/bin/bash
  2. # Script Auto Installer by HideSSH
  3. # HideSSH
  4. # initialisasi var
  5. #Requirement
  6. if [ ! -e /usr/bin/curl ]; then
  7. yum -y update && yum -y upgrade
  8. yum -y install curl
  9. fi
  10. # initializing var
  11. OS=`uname -m`;
  12. MYIP=$(curl -4 icanhazip.com)
  13. if [ $MYIP = "" ]; then
  14. MYIP=`ifconfig | grep 'inet addr:' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d: -f2 | awk '{ print $1}' | head -1`;
  15. fi
  16. MYIP2="s/xxxxxxxxx/$MYIP/g";
  17. # update software server
  18. yum update -y
  19. # set time GMT +7
  20. ln -fs /usr/share/zoneinfo/Asia/Jakarta /etc/localtime
  21. # go to root
  22. cd
  23. # set locale
  24. sed -i 's/AcceptEnv/#AcceptEnv/g' /etc/ssh/sshd_config
  25. service sshd restart
  26. # disable ipv6
  27. echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
  28. sed -i '$ i\echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6' /etc/rc.local
  29. sed -i '$ i\echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6' /etc/rc.d/rc.local
  30. # install wget and curl
  31. yum -y install wget curl
  32. # remove unused
  33. yum -y remove sendmail;
  34. yum -y remove httpd;
  35. yum -y remove cyrus-sasl
  36. # update
  37. yum -y update
  38. # install webserver
  39. yum -y install nginx php-fpm php-cli
  40. service nginx restart
  41. service php-fpm restart
  42. chkconfig nginx on
  43. chkconfig php-fpm on
  44. # install essential package
  45. yum -y install rrdtool screen iftop htop nmap bc nethogs vnstat ngrep mtr git zsh mrtg unrar rsyslog rkhunter mrtg net-snmp net-snmp-utils expect nano bind-utils
  46. yum -y groupinstall 'Development Tools'
  47. yum -y install cmake
  48. yum -y --enablerepo=rpmforge install axel sslh ptunnel unrar
  49. # matiin exim
  50. service exim stop
  51. chkconfig exim off
  52. #install Netstat
  53. cd
  54. yum -y install net-tools
  55. # setting vnstat
  56. vnstat -u -i eth0
  57. echo "MAILTO=root" > /etc/cron.d/vnstat
  58. echo "*/5 * * * * root /usr/sbin/vnstat.cron" >> /etc/cron.d/vnstat
  59. service vnstat restart
  60. chkconfig vnstat on
  61. # install screenfetch
  62. cd
  63. wget https://raw.githubusercontent.com/khairilg/script-jualan-ssh-vpn/master/app/screenfetch-dev
  64. mv screenfetch-dev /usr/bin/screenfetch
  65. chmod +x /usr/bin/screenfetch
  66. echo "clear" >> .bash_profile
  67. echo "screenfetch" >> .bash_profile
  68. # install badvpn
  69. cd
  70. wget https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/bad.sh
  71. wget -O /usr/bin/badvpn-udpgw "https://github.com/ForNesiaFreak/FNS/raw/master/sett/badvpn-udpgw"
  72. if [ "$OS" == "x86_64" ]; then
  73. wget -O /usr/bin/badvpn-udpgw "https://github.com/ForNesiaFreak/FNS/raw/master/sett/badvpn-udpgw64"
  74. fi
  75. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7500' /etc/rc.local
  76. chmod +x /usr/bin/badvpn-udpgw
  77. #port BadVPN 7300
  78. sed -i '$ i\/root/bad.sh' /etc/rc.local
  79. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7500' /etc/rc.local
  80. #pasang badvpn
  81. chmod +x /usr/bin/badvpn-udpgw
  82. chmod +x /root/bad.sh
  83. cd
  84. bash bad.sh
  85. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7500
  86. # install fail2ban
  87. cd
  88. yum -y install fail2ban
  89. service fail2ban restart
  90. chkconfig fail2ban on
  91. #setting dasar SSH Web
  92. #banner SSH
  93. wget -O /etc/banner-akun "https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/banner"
  94. chmod +x banner
  95. cd
  96. sed -i '/Banner none/a Banner /etc/banner-akun' /etc/ssh/sshd_config
  97. # setting port ssh
  98. cd
  99. sed -i '/Port 22/a Port 143' /etc/ssh/sshd_config
  100. sed -i 's/#Port 22/Port 22/g' /etc/ssh/sshd_config
  101. service sshd restart
  102. chkconfig sshd on
  103. # install dropbear
  104. yum -y install dropbear
  105. echo "OPTIONS=\"-b /etc/banner-akun -p 44 -p 77\"" > /etc/sysconfig/dropbear
  106. echo "/bin/false" >> /etc/shells
  107. service dropbear restart
  108. chkconfig dropbear on
  109. # install squid
  110. yum -y install squid
  111. wget -O /etc/squid/squid.conf "https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/squid.conf"
  112. sed -i $MYIP2 /etc/squid/squid.conf;
  113. service squid restart
  114. chkconfig squid on
  115. #install stunnel
  116. cd
  117. yum -y install stunnel
  118. wget -O /etc/rc.d/init.d/stunnel "https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/stunnel-init"
  119. wget -O /etc/stunnel/stunnel.conf "https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/stunnel-sslport"
  120. wget -O /etc/stunnel/stunnel.pem "https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/stunnel.pem"
  121. chmod +x /etc/init.d/stunnel
  122. service stunnel restart
  123. chkconfig stunnel on
  124. # download script all Menu
  125. cd
  126. wget https://raw.githubusercontent.com/shigeno143/OCSPanelCentos6/master/install-premiumscript.sh -O - -o /dev/null|sh
  127. chmod +x premiumscript.sh
  128. bash premiumscript.sh
  129. # cron
  130. cd
  131. chkconfig crond on
  132. service crond stop
  133. #autoreboot
  134. echo "0 */12 * * * root /bin/sh /usr/bin/reboot" > /etc/cron.d/reboot
  135. # finalizing
  136. service nginx start
  137. service php-fpm start
  138. service vnstat restart
  139. service snmpd restart
  140. service sshd restart
  141. service dropbear restart
  142. service fail2ban restart
  143. service squid restart
  144. service crond start
  145. chkconfig crond on
  146. #clearing history
  147. history -c
  148. # info
  149. clear
  150. echo " "
  151. echo "INSTALLATION COMPLETE!"
  152. echo " "
  153. echo "--------------------------- Setup Server Information ---------------------------"
  154. echo " Copyright HideSSH "
  155. echo "--------------------------------------------------------------------------------"
  156. echo "Server Included" | tee -a log-install.txt
  157. echo " - Timezone : Asia/jakarta (GMT +8)" | tee -a log-install.txt
  158. echo " - Fail2Ban : [ON]" | tee -a log-install.txt
  159. echo " - IPtables : [ON]" | tee -a log-install.txt
  160. echo " - DDeflate : [ON]" | tee -a log-install.txt
  161. echo " - Auto-Reboot : [OFF]" | tee -a log-install.txt
  162. echo " - IPv6 : [OFF]" | tee -a log-install.txt
  163. echo "" | tee -a log-install.txt
  164. echo " - Stunnel : 443, 222, 777, 444" | tee -a log-install.txt
  165. echo " - Dropbear : 44, 77" | tee -a log-install.txt
  166. echo " - Squid Proxy : 3128 (limit to IP Server)" | tee -a log-install.txt
  167. echo " - Squid Proxy SSL : 9090 (limit to IP Server)" | tee -a log-install.txt
  168. echo " - Badvpn : 7300" | tee -a log-install.txt
  169. echo " - Nginx : 85" | tee -a log-install.txt
  170. echo "" | tee -a log-install.txt
  171. echo "Server Tools" | tee -a log-install.txt
  172. echo " - htop" | tee -a log-install.txt
  173. echo " - iftop" | tee -a log-install.txt
  174. echo " - mtr" | tee -a log-install.txt
  175. echo " - nethogs" | tee -a log-install.txt
  176. echo " - screenfetch" | tee -a log-install.txt
  177. echo "------------------------------ HideSSH -----------------------------"
  178. #install firewall all port
  179. cd
  180. wget https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/firewall.sh
  181. bash firewall.sh
  182. rm -rf centos7.sh