Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.86 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Original script by fornesia, rzengineer and fawzya
  4. # Mod by Bustami Arifin
  5. # Translation by _Dreyannz_
  6. #Remodified by PHCarl
  7. # ==================================================
  8.  
  9. # Initializing Var
  10. export DEBIAN_FRONTEND=noninteractive
  11. OS=`uname -m`;
  12. MYIP=$(wget -qO- ipv4.icanhazip.com);
  13. MYIP2="s/xxxxxxxxx/$MYIP/g";
  14.  
  15. # Details of PHCarl
  16. country=PH
  17. state=Manila
  18. locality=Manila
  19. organization=PHCorner
  20. organizationalunit=PHCorner
  21. commonname=PHC
  22. email=phc.phcorner@gmail.com
  23.  
  24. # go to root
  25. cd
  26.  
  27. # disable ipv6
  28. echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
  29. sed -i '$ i\echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6' /etc/rc.local
  30.  
  31. # install wget and curl
  32. apt-get update;apt-get -y install wget curl;
  33.  
  34. # set time GMT +7
  35. ln -fs /usr/share/zoneinfo/Asia/Manila /etc/localtime
  36.  
  37. # set locale
  38. sed -i 's/AcceptEnv/#AcceptEnv/g' /etc/ssh/sshd_config
  39. service ssh restart
  40.  
  41. # set repo
  42. wget -O /etc/apt/sources.list "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/sources.list.debian7"
  43. wget "http://www.dotdeb.org/dotdeb.gpg"
  44. cat dotdeb.gpg | apt-key add -;rm dotdeb.gpg
  45. sh -c 'echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list'
  46. wget -qO - http://www.webmin.com/jcameron-key.asc | apt-key add -
  47.  
  48. # update
  49. apt-get update
  50.  
  51. # install webserver
  52. apt-get -y install nginx
  53.  
  54. # install essential package
  55. apt-get -y install nano iptables dnsutils openvpn screen whois ngrep unzip unrar
  56.  
  57. echo "clear" >> .bashrc
  58. echo -e "\e[94m _|_|_| _| _| _|_|_| _| "
  59. echo -e "\e[94m _| _| _| _| _| _|_|_| _| _|_| _| "
  60. echo -e "\e[94m _|_|_| _|_|_|_| _| _| _| _|_| _| "
  61. echo -e "\e[94m _| _| _| _| _| _| _| _| "
  62. echo -e "\e[94m _| _| _| _|_|_| _|_|_| _| _| "
  63. echo -e "\e[94m. --------------------------------------------------------------- "
  64. echo 'echo -e "\e[94m ######### ########## ######### ### "' >> .bashrc
  65. echo 'echo -e "\e[94m VPSAutoScript by PHCarl "' >> .bashrc
  66. echo 'echo -e "\e[0m"' >> .bashrc
  67. echo 'echo -e "\e[94m##################################################"' >> .bashrc
  68. echo 'echo -e "\e[94m# Commands Description #"' >> .bashrc
  69. echo 'echo -e "\e[94m# #"' >> .bashrc
  70. echo 'echo -e "\e[94m# menu ---- Show Commands #"' >> .bashrc
  71. echo 'echo -e "\e[94m# add ---- Create User Account #"' >> .bashrc
  72. echo 'echo -e "\e[94m# trial ---- Create Trial Account #"' >> .bashrc
  73. echo 'echo -e "\e[94m# remove ---- Remove Account #"' >> .bashrc
  74. echo 'echo -e "\e[94m# check ---- Check Account Login #"' >> .bashrc
  75. echo 'echo -e "\e[94m# member ---- Check Users #"' >> .bashrc
  76. echo 'echo -e "\e[94m# banner ---- Configure Server Message #"' >> .bashrc
  77. echo 'echo -e "\e[94m# restart ---- Restart Services #"' >> .bashrc
  78. echo 'echo -e "\e[94m# reboot ---- Reboot VPS #"' >> .bashrc
  79. echo 'echo -e "\e[94m# speedtest ---- Speedtest VPS #"' >> .bashrc
  80. echo 'echo -e "\e[94m# info ---- System Information #"' >> .bashrc
  81. echo 'echo -e "\e[94m# about ---- Deb7AutoScriptVPS Info #"' >> .bashrc
  82. echo 'echo -e "\e[94m# exit ---- Close Putty / JuiceSSH #"' >> .bashrc
  83. echo 'echo -e "\e[94m# #"' >> .bashrc
  84. echo 'echo -e "\e[94m##################################################"' >> .bashrc
  85. echo 'echo -e "\e[0m "' >> .bashrc
  86.  
  87. # install webserver
  88. cd
  89. rm /etc/nginx/sites-enabled/default
  90. rm /etc/nginx/sites-available/default
  91. wget -O /etc/nginx/nginx.conf "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/nginx.conf"
  92. mkdir -p /home/vps/public_html
  93. echo "<pre>Setup by Bustami Arifin</pre>" > /home/vps/public_html/index.html
  94. echo "<pre>Translation by _Dreyannz_</pre>" > /home/vps/public_html/index.html
  95. echo "<pre>Remodified by PHCarl </pre>"> /home/vps/public_html/index.html
  96. wget -O /etc/nginx/conf.d/vps.conf "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/vps.conf"
  97. service nginx restart
  98.  
  99. # install openvpn
  100. wget -O /etc/openvpn/openvpn.tar "https://github.com/PHCarl10/Deb7AutoScriptVPS/raw/master/openvpn-debian.tar"
  101. cd /etc/openvpn/
  102. tar xf openvpn.tar
  103. wget -O /etc/openvpn/1194.conf "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/1194.conf"
  104. service openvpn restart
  105. sysctl -w net.ipv4.ip_forward=1
  106. sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
  107. iptables -t nat -I POSTROUTING -s 192.168.100.0/24 -o eth0 -j MASQUERADE
  108. iptables-save > /etc/iptables_yg_baru_dibikin.conf
  109. wget -O /etc/network/if-up.d/iptables "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/iptables"
  110. chmod +x /etc/network/if-up.d/iptables
  111. service openvpn restart
  112.  
  113. # openvpn configuration
  114. cd /etc/openvpn/
  115. wget -O /etc/openvpn/client.ovpn "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/client-1194.conf"
  116. sed -i $MYIP2 /etc/openvpn/client.ovpn;
  117. cp client.ovpn /home/vps/public_html/
  118.  
  119. # install badvpn
  120. cd
  121. wget -O /usr/bin/badvpn-udpgw "https://github.com/PHCarl10/Deb7AutoScriptVPS/raw/master/badvpn-udpgw"
  122. if [ "$OS" == "x86_64" ]; then
  123. wget -O /usr/bin/badvpn-udpgw "https://github.com/PHCarl10/Deb7AutoScriptVPS/raw/master/badvpn-udpgw64"
  124. fi
  125. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7300' /etc/rc.local
  126. chmod +x /usr/bin/badvpn-udpgw
  127. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7300
  128.  
  129. # setting port ssh
  130. cd
  131. sed -i 's/Port 22/Port 22/g' /etc/ssh/sshd_config
  132. sed -i '/Port 22/a Port 143' /etc/ssh/sshd_config
  133. service ssh restart
  134.  
  135. # install dropbear
  136. apt-get -y install dropbear
  137. sed -i 's/NO_START=1/NO_START=0/g' /etc/default/dropbear
  138. sed -i 's/DROPBEAR_PORT=22/DROPBEAR_PORT=443/g' /etc/default/dropbear
  139. sed -i 's/DROPBEAR_EXTRA_ARGS=/DROPBEAR_EXTRA_ARGS="-p 80"/g' /etc/default/dropbear
  140. echo "/bin/false" >> /etc/shells
  141. echo "/usr/sbin/nologin" >> /etc/shells
  142. service ssh restart
  143. service dropbear restart
  144.  
  145. # install squid3
  146. cd
  147. apt-get -y install squid3
  148. wget -O /etc/squid3/squid.conf "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/squid3.conf"
  149. sed -i $MYIP2 /etc/squid3/squid.conf;
  150. service squid3 restart
  151.  
  152. # install webmin
  153. cd
  154. apt-get -y install webmin
  155. sed -i 's/ssl=1/ssl=0/g' /etc/webmin/miniserv.conf
  156. service webmin restart
  157.  
  158. # install stunnel
  159. apt-get -y install stunnel4
  160. wget -O /etc/stunnel/stunnel.pem "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/stunnel.pem"
  161. wget -O /etc/stunnel/stunnel.conf "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/stunnel.conf"
  162. sed -i $MYIP2 /etc/stunnel/stunnel.conf
  163. sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/stunnel4
  164. service stunnel4 restart
  165.  
  166. # install fail2ban
  167. apt-get -y install fail2ban;
  168. service fail2ban restart
  169.  
  170. # install ddos deflate
  171. cd
  172. apt-get -y install dnsutils dsniff
  173. wget https://github.com/PHCarl10/Deb7AutoScriptVPS/raw/master/ddos-deflate-master.zip
  174. unzip ddos-deflate-master.zip
  175. cd ddos-deflate-master
  176. ./install.sh
  177. rm -rf /root/ddos-deflate-master.zip
  178.  
  179. # banner
  180. rm /etc/issue.net
  181. wget -O /etc/issue.net "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master41412"
  182. sed -i 's@#Banner@Banner@g' /etc/ssh/sshd_config
  183. sed -i 's@DROPBEAR_BANNER=""@DROPBEAR_BANNER="/etc/issue.net"@g' /etc/default/dropbear
  184. service ssh restart
  185. service dropbear restart
  186.  
  187. #xml parser
  188. cd
  189. apt-get -y --force-yes -f install libxml-parser-perl
  190.  
  191. #block torrent
  192. iptables -A OUTPUT -p tcp --dport 6881:6889 -j DROP
  193. iptables -A OUTPUT -p udp --dport 1024:65534 -j DROP
  194. iptables -A FORWARD -m string --string "get_peers" --algo bm -j DROP
  195. iptables -A FORWARD -m string --string "announce_peer" --algo bm -j DROP
  196. iptables -A FORWARD -m string --string "find_node" --algo bm -j DROP
  197. iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j DROP
  198. iptables -A FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP
  199. iptables -A FORWARD -m string --algo bm --string "peer_id=" -j DROP
  200. iptables -A FORWARD -m string --algo bm --string ".torrent" -j DROP
  201. iptables -A FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP
  202. iptables -A FORWARD -m string --algo bm --string "torrent" -j DROP
  203. iptables -A FORWARD -m string --algo bm --string "announce" -j DROP
  204. iptables -A FORWARD -m string --algo bm --string "info_hash" -j DROP
  205.  
  206. # download script
  207. cd /usr/bin
  208. wget -O menu "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/menu.sh"
  209. wget -O add "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/usernew.sh"
  210. wget -O trial "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/trial.sh"
  211. wget -O remove "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/hapus.sh"
  212. wget -O check "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/user-login.sh"
  213. wget -O member "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/user-list.sh"
  214. wget -O banner "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/servermessage.sh"
  215. wget -O restart "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/resvis.sh"
  216. wget -O speedtest "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/speedtest_cli.py"
  217. wget -O info "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/info.sh"
  218. wget -O about "https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/about.sh"
  219.  
  220.  
  221. echo "0 0 * * * root /sbin/reboot" > /etc/cron.d/reboot
  222.  
  223. chmod +x menu
  224. chmod +x add
  225. chmod +x trial
  226. chmod +x remove
  227. chmod +x check
  228. chmod +x member
  229. chmod +x banner
  230. chmod +x restart
  231. chmod +x speedtest
  232. chmod +x info
  233. chmod +x about
  234.  
  235. # finishing
  236. cd
  237. chown -R www-data:www-data /home/vps/public_html
  238. service nginx start
  239. service openvpn restart
  240. service cron restart
  241. service ssh restart
  242. service dropbear restart
  243. service squid3 restart
  244. service webmin restart
  245. rm -rf ~/.bash_history && history -c
  246. echo "unset HISTFILE" >> /etc/profile
  247.  
  248. # install Screenfetch
  249. apt-get -y install lsb-release scrot
  250. wget -O screenfetch 'https://raw.githubusercontent.com/PHCarl10/Deb7AutoScriptVPS/master/screenfetch'
  251. chmod +x screenfetch
  252.  
  253. # info
  254. clear
  255. echo -e ""
  256. echo -e "\e[94m _|_|_| _| _| _|_|_| _| "
  257. echo -e "\e[94m _| _| _| _| _| _|_|_| _| _|_| _| "
  258. echo -e "\e[94m _|_|_| _|_|_|_| _| _| _| _|_| _| "
  259. echo -e "\e[94m _| _| _| _| _| _| _| _| "
  260. echo -e "\e[94m _| _| _| _|_|_| _|_|_| _| _| "
  261. echo -e "\e[94m. --------------------------------------------------------------- "
  262. echo -e "\e[94m##################################################"
  263. echo -e "\e[94m VPSAutoScript by PHCarl "
  264. echo -e "\e[94m "
  265. echo -e "\e[94m Services "
  266. echo -e "\e[94m "
  267. echo -e "\e[94m OpenSSH : 22, 143 "
  268. echo -e "\e[94m Dropbear : 80, 443 "
  269. echo -e "\e[94m SSL : 442 "
  270. echo -e "\e[94m Squid3 : 3128, 8000, 8080 "
  271. echo -e "\e[94m OpenVPN : TCP 1194 "
  272. echo -e "\e[94m BadVPN : UDPGW 7300 "
  273. echo -e "\e[94m Nginx : 80 "
  274. echo -e "\e[94m "
  275. echo -e "\e[94m Other Features Included "
  276. echo -e "\e[94m "
  277. echo -e "\e[94m Timezone : Asia/Manila (GMT +7) "
  278. echo -e "\e[94m Webmin : http://$MYIP:10000/ "
  279. echo -e "\e[94m IPV6 : [OFF] "
  280. echo -e "\e[94m Cron Scheduler : [ON] "
  281. echo -e "\e[94m Fail2Ban : [ON] "
  282. echo -e "\e[94m DDOS Deflate : [ON] "
  283. echo -e "\e[94m LibXML Parser : {ON] "
  284. echo -e "\e[94m##################################################"
  285. echo -e "\e[0m "
  286. read -n1 -r -p " Press Enter To Show Commands "
  287. menu
  288. cd
  289. rm -f /root/Deb7_AutoScript_VPS.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement