forked from Tharuka-Sandaruwan/Debian_SSH_VPS_script
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoscript_autokill_enabled
More file actions
145 lines (113 loc) · 5.2 KB
/
autoscript_autokill_enabled
File metadata and controls
145 lines (113 loc) · 5.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
# ***********************************************
# Simple Script to setup Debian VPS *
# This Script only setup SSH,SSl,Dropbear,squid *
# Script by : Tharuka Sandaruwan *
# ***********************************************
#
#getting things ready
apt-get update
apt-get upgrade -y
clear
# downloading menu
wget -O /usr/local/bin/menu "https://raw.githubusercontent.com/Tharuka-Sandaruwan/Debian_SSH_VPS_script/main/files/menu"
chmod +x /usr/local/bin/menu
#setting the time zone to Sri Lankan (GTM +0530)
ln -fs /usr/share/zoneinfo/Asia/Colombo /etc/localtime;
clear
#enabling ip4 and ipv6
apt-get install -y gnupg2 gnupg gnupg1
echo ipv4 >> /etc/modules
echo ipv6 >> /etc/modules
sysctl -w net.ipv4.ip_forward=1
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
sed -i 's/#net.ipv6.conf.all.forwarding=1/net.ipv6.conf.all.forwarding=1/g' /etc/sysctl.conf
sysctl -p
clear
#purging packages
apt-get -y --purge remove samba*;
apt-get -y --purge remove apache2*;
apt-get -y --purge remove sendmail*;
apt-get -y --purge remove postfix*;
apt-get -y --purge remove bind*;
apt-get -y remove unscd*;
clear
#getting required libraries
apt-get -y autoremove;
apt-get -y install wget curl;
apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-transport-https apt-show-versions python unzip -y
clear
# ssh
sed -i 's/#Banner/Banner/g' /etc/ssh/sshd_config
sed -i 's/AcceptEnv/#AcceptEnv/g' /etc/ssh/sshd_config
wget -O /etc/issue.net "https://raw.githubusercontent.com/Tharuka-Sandaruwan/Debian_SSH_VPS_script/main/files/issue.net"
# dropbear
apt-get -y install dropbear
wget -O /etc/default/dropbear "https://raw.githubusercontent.com/Tharuka-Sandaruwan/Debian_SSH_VPS_script/main/files/dropbear"
echo "/bin/false" >> /etc/shells
echo "/usr/sbin/nologin" >> /etc/shells
/etc/init.d/dropbear restart
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`;
myint=`ifconfig | grep -B1 "inet addr:$myip" | head -n1 | awk '{print $1}'`;
# squid3
apt-get -y install squid
wget -O /etc/squid/squid.conf "https://raw.githubusercontent.com/Tharuka-Sandaruwan/Debian_SSH_VPS_script/main/files/squid.conf"
sed -i "s/ipserver/$myip/g" /etc/squid/squid.conf
# Setting Server
wget -O /etc/rc.local "https://raw.githubusercontent.com/Tharuka-Sandaruwan/Debian_SSH_VPS_script/main/files/rc.local"
chmod +x /etc/rc.local
#getting things ready to compile badvpn
apt-get update >/dev/null 2>/dev/null
apt-get install -y nano >/dev/null 2>/dev/null
apt-get install -y sudo >/dev/null 2>/dev/null
apt-get install -y gcc >/dev/null 2>/dev/null
apt-get install -y make >/dev/null 2>/dev/null
apt-get install -y g++ >/dev/null 2>/dev/null
apt-get install -y openssl >/dev/null 2>/dev/null
apt-get install -y build-essential >/dev/null 2>/dev/null
apt-get install -y cmake >/dev/null 2>/dev/null
# compiling and installing badvpn
wget https://github.com/Tharuka-Sandaruwan/Debian_SSH_VPS_script/raw/main/badvpn/badvpn-1.999.128.tar.bz2 -o /dev/null
tar -xf badvpn-1.999.128.tar.bz2
mkdir /etc/badvpn-install
cd /etc/badvpn-install
cmake ~/badvpn-1.999.128 -DBUILD_NOTHING_BY_DEFAULT=1 -DBUILD_UDPGW=1 >/dev/null 2>/dev/null
make install
clear
rm -rf /etc/badvpn-install
cd ; rm -rf badvpn.sh badvpn-1.999.128/ badvpn-1.999.128.tar.bz2 >/dev/null 2>/dev/null
# Stunnel installing
apt-get install stunnel4 -y
wget -P /etc/stunnel/ "https://raw.githubusercontent.com/Tharuka-Sandaruwan/Debian_SSH_VPS_script/main/files/stunnel.conf"
# Creating stunnel certifcate using openssl
openssl req -new -x509 -days 9999 -nodes -subj "/C=US/ST=SBH/L=TWU/O=THARUKA/OU=SANDARUWAN/CN=THARUKA" -out /etc/stunnel/stunnel.pem -keyout /etc/stunnel/stunnel.pem &> /dev/null
## > /dev/null 2>&1
sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/stunnel4
# Allowing ALL TCP ports for VPS (Simple workaround for policy-based VPS)
#iptables -A INPUT -s $(wget -4qO- http://ipinfo.io/ip) -p tcp -m multiport --dport 1:65535 -j ACCEPT
#cleaning unnecessary items
rm *.txt;rm *.tar.gz;rm *.deb;rm *.asc;rm *.zip;rm ddos*;
#speedtest
sudo apt-get update
curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
sudo apt-get install speedtest
#setting up the autokill
cd /usr/bin
wget -O kick "https://raw.githubusercontent.com/Tharuka-Sandaruwan/Debian_SSH_VPS_script/main/files/kick.sh"
chmod +x kick
cd
echo "* * * * * root /usr/bin/kick" >> /etc/crontab
echo "* * * * * root sleep 5; /usr/bin/kick" >> /etc/crontab
echo "* * * * * root sleep 10; /usr/bin/kick" >> /etc/crontab
echo "* * * * * root sleep 15; /usr/bin/kick" >> /etc/crontab
echo "* * * * * root sleep 20; /usr/bin/kick" >> /etc/crontab
echo "* * * * * root sleep 25; /usr/bin/kick" >> /etc/crontab
echo "* * * * * root sleep 30; /usr/bin/kick" >> /etc/crontab
echo "* * * * * root sleep 35; /usr/bin/kick" >> /etc/crontab
echo "* * * * * root sleep 40; /usr/bin/kick" >> /etc/crontab
echo "* * * * * root sleep 45; /usr/bin/kick" >> /etc/crontab
echo "* * * * * root sleep 50; /usr/bin/kick" >> /etc/crontab
echo "* * * * * root sleep 55; /usr/bin/kick" >> /etc/crontab
service cron restart
read -n1 -r -p " Setting up the VPS is complete! Press Any Key To Reboot.... "
reboot