-
Notifications
You must be signed in to change notification settings - Fork 101
/
ssl.sh
167 lines (155 loc) · 5.39 KB
/
ssl.sh
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
#!/bin/bash
def_port=$(grep "PORT_PANEL=" /var/www/html/app/.env | awk -F "=" '{print $2}')
read -rp "Please enter the pointed domain / sub-domain name: " domain
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d $domain
sudo tee /etc/nginx/sites-available/default <<'EOF'
server {
listen 80;
server_name example.com;
root /var/www/html/example;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_param PHP_VALUE "memory_limit=4096M";
}
location ~ /\.ht {
deny all;
}
location /ws
{
proxy_pass http://127.0.0.1:8880/;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 52w;
}
}
server {
listen 443 ssl;
server_name example.com;
root /var/www/html/example;
index index.php index.html;
ssl_certificate /etc/letsencrypt/live/domin/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domin/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_param PHP_VALUE "memory_limit=4096M";
}
location ~ /\.ht {
deny all;
}
location /ws {
if ($http_upgrade != "websocket") {
return 404;
}
proxy_pass http://127.0.0.1:8880;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 52w;
}
}
server {
listen serverPort ssl;
server_name example.com;
root /var/www/html/cp;
index index.php index.html;
ssl_certificate /etc/letsencrypt/live/domin/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domin/privkey.pem;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_param PHP_VALUE "memory_limit=4096M";
}
location ~ /\.ht {
deny all;
}
}
EOF
sed -i "s/serverPort/$def_port/g" /etc/nginx/sites-available/default
sed -i "s/domin/$domain/g" /etc/nginx/sites-available/default
sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl reload nginx
multiin=$(echo "https://${domain}:$def_port/fixer/multiuser")
cat > /var/www/html/kill.sh << ENDOFFILE
#!/bin/bash
#By Alireza
i=0
while [ 1i -lt 10 ]; do
cmd=(bbh '$multiin')
echo cmd &
sleep 6
i=(( i + 1 ))
done
ENDOFFILE
wait
sudo sed -i 's/(bbh/$(curl -v -H "A: B"/' /var/www/html/kill.sh
wait
sudo sed -i 's/cmd/$cmd/' /var/www/html/kill.sh
wait
sudo sed -i 's/1i/$i/' /var/www/html/kill.sh
wait
sudo sed -i 's/((/$((/' /var/www/html/kill.sh
chmod +x /var/www/html/kill.sh
wait
othercron=$(echo "https://${domain}:$def_port/fixer/other")
cat >/var/www/html/other.sh <<ENDOFFILE
#!/bin/bash
#By Alireza
i=0
while [ 1i -lt 3 ]; do
cmd=(bbh '$othercron')
echo cmd &
sleep 17
i=(( i + 1 ))
done
ENDOFFILE
wait
sudo sed -i 's/(bbh/$(curl -v -H "A: B"/' /var/www/html/other.sh
wait
sudo sed -i 's/cmd/$cmd/' /var/www/html/other.sh
wait
sudo sed -i 's/1i/$i/' /var/www/html/other.sh
wait
sudo sed -i 's/((/$((/' /var/www/html/other.sh
wait
chmod +x /var/www/html/other.sh
crontab -r
(crontab -l | grep . ; echo -e "* * * * * /var/www/html/kill.sh") | crontab -
(crontab -l | grep . ; echo -e "* * * * * /var/www/html/other.sh") | crontab -
(crontab -l | grep . ; echo -e "0 */1 * * * /var/www/html/killlog.sh") | crontab -
(crontab -l ; echo "* * * * * wget -q -O /dev/null 'https://${domain}:$def_port/fixer/exp' > /dev/null 2>&1") | crontab -
(crontab -l ; echo "0 * * * * wget -q -O /dev/null 'https://${domain}:$def_port/fixer/checkhurly' > /dev/null 2>&1") | crontab -
(crontab -l ; echo "*/10 * * * * wget -q -O /dev/null 'https://${domain}:$def_port/fixer/checktraffic' > /dev/null 2>&1") | crontab -
(crontab -l ; echo "*/15 * * * * wget -q -O /dev/null 'https://${domain}:$def_port/fixer/checkfilter' > /dev/null 2>&1") | crontab -
(crontab -l ; echo "0 0 * * * wget -q -O /dev/null ''https://${domain}:$def_port/fixer/send/email/3day' > /dev/null 2>&1") | crontab -
(crontab -l ; echo "0 0 * * * wget -q -O /dev/null ''https://${domain}:$def_port/fixer/send/email/24h' > /dev/null 2>&1") | crontab -
if dpkg -l | grep -q dropbear; then
(crontab -l | grep . ; echo -e "* * * * * /var/www/html/dropbear.sh") | crontab -
fi
clear
printf "\nHTTPS Address : https://${domain}:$def_port/login \n"