-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.sh
More file actions
342 lines (313 loc) · 10.3 KB
/
main.sh
File metadata and controls
342 lines (313 loc) · 10.3 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
#!/bin/bash
clear
REPO="https://raw.githubusercontent.com/elsangithub/Auto-SC/main/"
red='\e[1;31m'
green='\e[1;32m'
yell='\e[1;33m'
tyblue='\e[1;36m'
NC='\e[0m'
purple() { echo -e "\\033[35;1m${*}\\033[0m"; }
tyblue() { echo -e "\\033[36;1m${*}\\033[0m"; }
yellow() { echo -e "\\033[33;1m${*}\\033[0m"; }
green() { echo -e "\\033[32;1m${*}\\033[0m"; }
red() { echo -e "\\033[31;1m${*}\\033[0m"; }
date=$(date -R | cut -d " " -f -5)
IP=$(wget -qO- ipinfo.io/ip);
domain=$(cat /etc/xray/domain)
date=$(date +"%Y-%m-%d")
cd /root
#System version number
if [ "${EUID}" -ne 0 ]; then
echo "You need to run this script as root"
exit 1
fi
if [ "$(systemd-detect-virt)" == "openvz" ]; then
echo "OpenVZ is not supported"
exit 1
fi
if [[ -e /etc/debian_version ]]; then
source /etc/os-release
OS=$ID # debian or ubuntu
elif [[ -e /etc/centos-release ]]; then
source /etc/os-release
OS=centos
fi
echo -e "[ ${green}INFO${NC} ] Memasang Paket Yg Dibutuhkan..."
sleep 2
apt update -y
apt update -y
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1
apt install -y bzip2 gzip coreutils screen curl unzip
apt install wget -y
apt install curl -y
apt install ruby -y
gem install lolcat -y
apt dist-upgrade -y
apt-get remove --purge ufw firewalld -y
apt-get remove --purge exim4 -y
apt install -y screen curl jq bzip2 gzip coreutils rsyslog iftop \
htop zip unzip net-tools sed gnupg gnupg1 \
bc sudo apt-transport-https build-essential dirmngr libxml-parser-perl neofetch screenfetch git lsof \
openssl openvpn easy-rsa fail2ban tmux \
stunnel4 vnstat squid3 \
dropbear libsqlite3-dev \
socat cron bash-completion ntpdate xz-utils sudo apt-transport-https \
gnupg2 dnsutils lsb-release chrony
sudo apt-get install nodejs -y
sudo apt install -y libnss3-dev libnspr4-dev pkg-config libpam0g-dev libcap-ng-dev libcap-ng-utils libselinux1-dev libcurl4-nss-dev flex bison make libnss3-tools libevent-dev xl2tpd pptpd
apt install git curl -y >/dev/null 2>&1
apt install python -y >/dev/null 2>&1
sysctl -w net.ipv6.conf.all.disable_ipv6=1 >/dev/null 2>&1
sysctl -w net.ipv6.conf.default.disable_ipv6=1 >/dev/null 2>&1
curl ipinfo.io/org > /root/.isp
curl ipinfo.io/city > /root/.city
curl ifconfig.me > /root/.ip
curl ipinfo.io/region > /root/.region
sleep 2
localip=$(hostname -I | cut -d\ -f1)
hst=( `hostname` )
dart=$(cat /etc/hosts | grep -w `hostname` | awk '{print $2}')
if [[ "$hst" != "$dart" ]]; then
echo "$localip $(hostname)" >> /etc/hosts
fi
mkdir -p /etc/xray
mkdir -p /etc/v2ray
mkdir -p /etc/user-create
touch /etc/xray/domain
touch /etc/v2ray/domain
touch /etc/xray/scdomain
touch /etc/v2ray/scdomain
mkdir -p /var/lib/SIJA >/dev/null 2>&1
echo "IP=" >> /var/lib/SIJA/ipvps.conf
secs_to_human() {
echo "Installation time : $(( ${1} / 3600 )) hours $(( (${1} / 60) % 60 )) minute's $(( ${1} % 60 )) seconds"
}
start=$(date +%s)
ln -fs /usr/share/zoneinfo/Asia/Jakarta /etc/localtime
echo -e "[ ${green}INFO${NC} ] Memasang Swap Sebesar 1Gb..."
sleep 2
gotop_latest="$(curl -s https://api.github.com/repos/xxxserxxx/gotop/releases | grep tag_name | sed -E 's/.*"v(.*)".*/\1/' | head -n 1)"
gotop_link="https://github.com/xxxserxxx/gotop/releases/download/v$gotop_latest/gotop_v"$gotop_latest"_linux_amd64.deb"
curl -sL "$gotop_link" -o /tmp/gotop.deb
dpkg -i /tmp/gotop.deb >/dev/null 2>&1
# > Buat swap sebesar 1G
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
mkswap /swapfile
chown root:root /swapfile
chmod 0600 /swapfile >/dev/null 2>&1
swapon /swapfile >/dev/null 2>&1
sed -i '$ i\/swapfile swap swap defaults 0 0' /etc/fstab
# > Singkronisasi jam
chronyd -q 'server 0.id.pool.ntp.org iburst'
chronyc sourcestats -v
chronyc tracking -v
wget ${REPO}fodder/bbr.sh && chmod +x bbr.sh && ./bbr.sh && rm -rf bbr.sh
clear
echo ""
clear
echo ""
echo ""
yellow "Note : SEBELUM MEMASUKAN DOMAIN, HARAP POINTING DULU IP VPS KAMU !"
echo " "
read -rp "Input ur domain : " -e pp
if [ -z $pp ]; then
echo -e "
Nothing input for domain!
Then a random domain will be created"
else
echo "$pp" > /root/scdomain
echo "$pp" > /etc/xray/scdomain
echo "$pp" > /etc/xray/domain
echo "$pp" > /etc/v2ray/domain
echo "$pp" > /root/domain
echo "IP=$pp" > /var/lib/SIJA/ipvps.conf
fi
clear
echo -e "[ ${green}INFO${NC} ] Memasang Service SSH..."
sleep 2
### ALL SERVICE ###
wget -q ${REPO}ssh/ins-ssh && chmod +x ins-ssh && ./ins-ssh
rm -rf ins-ssh
clear
echo -e "[ ${green}INFO${NC} ] Memasang Service Backup..."
sleep 2
wget -q ${REPO}backup/set-br.sh && chmod +x set-br.sh && ./set-br.sh
rm -rf set-br.sh
clear
echo -e "[ ${green}INFO${NC} ] Memasang Service Xray..."
sleep 2
wget -q ${REPO}ssh/ins-xray && chmod +x ins-xray && ./ins-xray
rm -rf ins-xray
echo -e "[ ${green}INFO${NC} ] Memasang Service Udp Custom..."
sleep 2
wget -q ${REPO}fodder/ins-udp && chmod +x ins-udp && ./ins-udp
rm -rf ins-udp
clear
echo -e "[ ${green}INFO${NC} ] Download & Pasang File Menu..."
sleep 2
### menu ###
wget -q ${REPO}menu/menu.zip
unzip menu.zip
chmod +x menu/*
mv menu/* /usr/local/sbin
rm -rf menu.zip
rm -rf menu
clear
echo -e "[ ${green}INFO${NC} ] Memasang Service Websocket..."
sleep 2
### Websocket ###
cd /usr/local/bin
wget -q ${REPO}ws/ws.zip
unzip ws.zip
chmod +x *
rm -rf ws.zip
### Service Websocket ###
cd /etc/systemd/system
wget -q ${REPO}ws/service.zip
unzip service.zip
chmod +x *
rm -rf service.zip
cd
clear
echo -e "[ ${green}INFO${NC} ] Memasang Service Vnstat..."
sleep 2
### SERVICE VNSTAT ###
apt -y install vnstat > /dev/null 2>&1
/etc/init.d/vnstat restart
apt -y install libsqlite3-dev > /dev/null 2>&1
wget https://humdi.net/vnstat/vnstat-2.6.tar.gz
tar zxvf vnstat-2.6.tar.gz
cd vnstat-2.6
./configure --prefix=/usr --sysconfdir=/etc && make && make install
cd
vnstat -u -i $NET
sed -i 's/Interface "'""eth0""'"/Interface "'""$NET""'"/g' /etc/vnstat.conf
chown vnstat:vnstat /var/lib/vnstat -R
systemctl enable vnstat
/etc/init.d/vnstat restart
/etc/init.d/vnstat status
rm -f /root/vnstat-2.6.tar.gz
rm -rf /root/vnstat-2.6
clear
cat > /etc/cron.d/re_otm <<-END
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 2 * * * root /sbin/reboot
END
cat > /etc/cron.d/xp_otm <<-END
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 0 * * * root /usr/bin/xp
END
cat > /etc/cron.d/cl_otm <<-END
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
2 1 * * * root /usr/bin/clearlog
END
cat > /home/re_otm <<-END
7
END
service cron restart >/dev/null 2>&1
service cron reload >/dev/null 2>&1
clear
cat> /root/.profile << END
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
mesg n || true
clear
menu
END
chmod 644 /root/.profile
# Cek dan install haproxy jika belum terinstall
if ! dpkg -l | grep -q haproxy; then
sudo apt install -y haproxy
else
echo "haproxy sudah terinstall"
fi
# Fungsi untuk membuat sertifikat self-signed baru
create_self_signed_cert() {
sudo mkdir -p /etc/xray
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/xray/xray.key -out /etc/xray/xray.crt -subj "/C=AU/ST=Some-State/L=City/O=Organization/OU=OrganizationalUnit/CN=common.name.com/emailAddress=email@example.com"
echo "Sertifikat self-signed telah dibuat"
}
# Cek apakah sertifikat sudah ada
if [ -f /etc/xray/xray.key ] && [ -f /etc/xray/xray.crt ]; then
echo "Sertifikat self-signed sudah ada, membuat yang baru..."
sudo rm /etc/xray/xray.key /etc/xray/xray.crt
create_self_signed_cert
else
create_self_signed_cert
fi
# // Enable & Start & Restart Websocket Service
systemctl enable ws-dropbear.service
systemctl enable ws-stunnel.service
systemctl start ws-dropbear.service
systemctl start ws-stunnel.service
systemctl restart ws-stunnel.service
systemctl restart ws-dropbear.service
if [ -f "/root/log-install.txt" ]; then
rm /root/log-install.txt > /dev/null 2>&1
fi
if [ -f "/etc/afak.conf" ]; then
rm /etc/afak.conf > /dev/null 2>&1
fi
if [ ! -f "/etc/log-create-user.log" ]; then
echo "Log All Account " > /etc/log-create-user.log
fi
history -c
aureb=$(cat /home/re_otm)
b=11
if [ $aureb -gt $b ]
then
gg="PM"
else
gg="AM"
fi
curl -sS ifconfig.me > /etc/myipvps
echo "------------------------------------------------------------"
echo ""
echo " >>> Service & Port" | tee -a log-install.txt
echo " - OpenSSH : 22" | tee -a log-install.txt
echo " - SSH Websocket : 80, 8080, 2082" | tee -a log-install.txt
echo " - SSH SSL Websocket : 443, 8443" | tee -a log-install.txt
echo " - Stunnel4 : 447, 777" | tee -a log-install.txt
echo " - Dropbear : 109, 143" | tee -a log-install.txt
echo " - Badvpn : 7100-7300" | tee -a log-install.txt
echo " - Nginx : 81" | tee -a log-install.txt
echo " - Vmess TLS : 443, 8443" | tee -a log-install.txt
echo " - Vmess None TLS : 80, 8080, 2082" | tee -a log-install.txt
echo " - Vless TLS : 443, 8443" | tee -a log-install.txt
echo " - Vless None TLS : 80, 8080, 2082" | tee -a log-install.txt
echo " - Trojan GRPC : 443, 8443" | tee -a log-install.txt
echo " - Trojan WS : 443, 8443" | tee -a log-install.txt
echo " - Trojan Go : 443, 8443" | tee -a log-install.txt
echo "" | tee -a log-install.txt
echo " >>> Server Information & Other Features" | tee -a log-install.txt
echo " - Timezone : Asia/Jakarta (GMT +7)" | tee -a log-install.txt
echo " - Fail2Ban : [ON]" | tee -a log-install.txt
echo " - Dflate : [ON]" | tee -a log-install.txt
echo " - IPtables : [ON]" | tee -a log-install.txt
echo " - Auto-Reboot : [ON]" | tee -a log-install.txt
echo " - IPv6 : [OFF]" | tee -a log-install.txt
echo " - Autoreboot On : $aureb:00 $gg GMT +7" | tee -a log-install.txt
echo " - AutoKill Multi Login User" | tee -a log-install.txt
echo " - Auto Delete Expired Account" | tee -a log-install.txt
echo " - Fully automatic script" | tee -a log-install.txt
echo " - VPS settings" | tee -a log-install.txt
echo " - Admin Control" | tee -a log-install.txt
echo " - Change port" | tee -a log-install.txt
echo " - Full Orders For Various Services" | tee -a log-install.txt
echo ""
echo "------------------------------------------------------------"
echo ""
echo "" | tee -a log-install.txt
touch /root/.system
secs_to_human "$(($(date +%s) - ${start}))" | tee -a log-install.txt
echo -e ""
read -p "Pencet [ Enter ] Untuk Reboot"
reboot