centos7.sh 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. # setting repo centos 64bit
  33. yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  34. yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  35. # setting rpmforge
  36. wget https://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el7/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
  37. rpm -Uvh rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
  38. # remove unused
  39. yum -y remove sendmail;
  40. yum -y remove httpd;
  41. yum -y remove cyrus-sasl
  42. # update
  43. yum -y update
  44. # install webserver
  45. yum -y install nginx php-fpm php-cli
  46. service nginx restart
  47. service php-fpm restart
  48. chkconfig nginx on
  49. chkconfig php-fpm on
  50. # install essential package
  51. 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
  52. yum -y groupinstall 'Development Tools'
  53. yum -y install cmake
  54. yum -y --enablerepo=rpmforge install axel sslh ptunnel unrar
  55. # matiin exim
  56. service exim stop
  57. chkconfig exim off
  58. #install Netstat
  59. cd
  60. yum -y install net-tools
  61. # setting vnstat
  62. vnstat -u -i eth0
  63. echo "MAILTO=root" > /etc/cron.d/vnstat
  64. echo "*/5 * * * * root /usr/sbin/vnstat.cron" >> /etc/cron.d/vnstat
  65. service vnstat restart
  66. chkconfig vnstat on
  67. # install screenfetch
  68. cd
  69. wget https://raw.githubusercontent.com/khairilg/script-jualan-ssh-vpn/master/app/screenfetch-dev
  70. mv screenfetch-dev /usr/bin/screenfetch
  71. chmod +x /usr/bin/screenfetch
  72. echo "clear" >> .bash_profile
  73. echo "screenfetch" >> .bash_profile
  74. # install badvpn
  75. cd
  76. wget https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/bad.sh
  77. wget -O /usr/bin/badvpn-udpgw "https://github.com/ForNesiaFreak/FNS/raw/master/sett/badvpn-udpgw"
  78. if [ "$OS" == "x86_64" ]; then
  79. wget -O /usr/bin/badvpn-udpgw "https://github.com/ForNesiaFreak/FNS/raw/master/sett/badvpn-udpgw64"
  80. fi
  81. chmod +x /usr/bin/badvpn-udpgw
  82. #port BadVPN 7300
  83. sed -i '$ i\/root/bad.sh' /etc/rc.local
  84. sed -i '$ i\/root/bad.sh' /etc/rc.d/rc.local
  85. #pasang badvpn
  86. chmod +x /etc/rc.d/rc.local
  87. chmod +x /usr/bin/badvpn-udpgw
  88. chmod +x /root/bad.sh
  89. cd
  90. bash bad.sh
  91. # install fail2ban
  92. cd
  93. yum -y install fail2ban
  94. service fail2ban restart
  95. chkconfig fail2ban on
  96. #setting dasar SSH Web
  97. #banner SSH
  98. wget -O /etc/banner-akun "https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/banner"
  99. chmod +x banner
  100. cd
  101. sed -i '/Banner none/a Banner /etc/banner-akun' /etc/ssh/sshd_config
  102. # setting port ssh
  103. cd
  104. sed -i '/Port 22/a Port 143' /etc/ssh/sshd_config
  105. sed -i 's/#Port 22/Port 22/g' /etc/ssh/sshd_config
  106. service sshd restart
  107. chkconfig sshd on
  108. # install dropbear
  109. yum -y install dropbear
  110. echo "OPTIONS=\"-b /etc/banner-akun -p 44 -p 77\"" > /etc/sysconfig/dropbear
  111. echo "/bin/false" >> /etc/shells
  112. service dropbear restart
  113. chkconfig dropbear on
  114. # install squid
  115. yum -y install squid
  116. wget -O /etc/squid/squid.conf "https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/squid.conf"
  117. sed -i $MYIP2 /etc/squid/squid.conf;
  118. service squid restart
  119. chkconfig squid on
  120. #install stunnel
  121. cd
  122. yum -y install stunnel
  123. wget -O /etc/rc.d/init.d/stunnel "https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/stunnel-init"
  124. wget -O /etc/stunnel/stunnel.conf "https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/stunnel-sslport"
  125. wget -O /etc/stunnel/stunnel.pem "https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/stunnel.pem"
  126. chmod +x /etc/init.d/stunnel
  127. service stunnel restart
  128. chkconfig stunnel on
  129. # download script all Menu
  130. cd
  131. wget https://raw.githubusercontent.com/shigeno143/OCSPanelCentos6/master/install-premiumscript.sh -O - -o /dev/null|sh
  132. chmod +x premiumscript.sh
  133. bash premiumscript.sh
  134. # cron
  135. cd
  136. chkconfig crond on
  137. service crond stop
  138. #autoreboot
  139. echo "0 */12 * * * root /bin/sh /usr/bin/reboot" > /etc/cron.d/reboot
  140. # finalizing
  141. service nginx start
  142. service php-fpm start
  143. service vnstat restart
  144. service snmpd restart
  145. service sshd restart
  146. service dropbear restart
  147. service fail2ban restart
  148. service squid restart
  149. service crond start
  150. chkconfig crond on
  151. #clearing history
  152. history -c
  153. # info
  154. clear
  155. echo " "
  156. echo "INSTALLATION COMPLETE!"
  157. echo " "
  158. echo "--------------------------- Setup Server Information ---------------------------"
  159. echo " Copyright HideSSH "
  160. echo "--------------------------------------------------------------------------------"
  161. echo "Server Included" | tee -a log-install.txt
  162. echo " - Timezone : Asia/jakarta (GMT +8)" | tee -a log-install.txt
  163. echo " - Fail2Ban : [ON]" | tee -a log-install.txt
  164. echo " - IPtables : [ON]" | tee -a log-install.txt
  165. echo " - DDeflate : [ON]" | tee -a log-install.txt
  166. echo " - Auto-Reboot : [OFF]" | tee -a log-install.txt
  167. echo " - IPv6 : [OFF]" | tee -a log-install.txt
  168. echo "" | tee -a log-install.txt
  169. echo " - Stunnel : 443, 222, 777, 444" | tee -a log-install.txt
  170. echo " - Dropbear : 44, 77" | tee -a log-install.txt
  171. echo " - Squid Proxy : 3128 (limit to IP Server)" | tee -a log-install.txt
  172. echo " - Squid Proxy SSL : 9090 (limit to IP Server)" | tee -a log-install.txt
  173. echo " - Badvpn : 7300" | tee -a log-install.txt
  174. echo " - Nginx : 85" | tee -a log-install.txt
  175. echo "" | tee -a log-install.txt
  176. echo "Server Tools" | tee -a log-install.txt
  177. echo " - htop" | tee -a log-install.txt
  178. echo " - iftop" | tee -a log-install.txt
  179. echo " - mtr" | tee -a log-install.txt
  180. echo " - nethogs" | tee -a log-install.txt
  181. echo " - screenfetch" | tee -a log-install.txt
  182. echo "------------------------------ HideSSH -----------------------------"
  183. #install firewall all port
  184. cd
  185. wget https://raw.githubusercontent.com/kumpulanremaja/Centos-SSH/master/firewall.sh
  186. bash firewall.sh
  187. rm -rf centos7.sh