Compare commits
30 Commits
v2
..
915f5179ef
| Author | SHA1 | Date | |
|---|---|---|---|
| 915f5179ef | |||
| efbe8d1215 | |||
| dd42d12564 | |||
| 9d09c37798 | |||
| d0f207c1db | |||
| 080341b9f4 | |||
| a8741748ea | |||
| 238364533e | |||
| 493bc739cb | |||
| d134f6ad1c | |||
| b38eefde23 | |||
| d04d7dcd24 | |||
| c5887201b1 | |||
| 200200249f | |||
| f822528b2d | |||
| 5f2e8c867c | |||
| 81fe187290 | |||
| 2ce209f3fd | |||
| 76401bbac8 | |||
| 96e90dac9a | |||
| c23274bd71 | |||
| d20c1b95f2 | |||
| 22dd775f52 | |||
| 51d1891976 | |||
| fcfead4725 | |||
| edab3852db | |||
| 466973036b | |||
| 48af67f447 | |||
| 9731764613 | |||
| 81a224247e |
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
name: Error report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Describe the Error**
|
|
||||||
What you expected and what you got? Please write it here.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
Make sure you include a output of your terminal where you see the error
|
|
||||||
```
|
|
||||||
|
|
||||||
*I'm not the one who created nginx or any of those modules so don't expect much if i'm not able to help your request will be forwarded somewhere else based on kind of it.*
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
@@ -1,176 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
case "`grep ID_LIKE /etc/*-release | awk -F '=' '{print $2}'`" in
|
|
||||||
archlinux)
|
|
||||||
if [ "$(whoami)" != "root" ]
|
|
||||||
then
|
|
||||||
echo "You should Login as root to use this script!";
|
|
||||||
echo "May you already have access for sudo, but commands aren't designed with sudo! so..";
|
|
||||||
echo "sudo -i";
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "/nginx/" ]; then
|
|
||||||
echo "We've detect a folder '/nginx/' which means"
|
|
||||||
echo "Maybe you have use this script before!"
|
|
||||||
echo "You can fix this by executing!"
|
|
||||||
echo "./setup clean"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "/etc/nginx" ]; then
|
|
||||||
echo "We've detect a folder '/etc/nginx' which means"
|
|
||||||
echo "Maybe you have use this script before!"
|
|
||||||
echo "./setup clean"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "/opt/nginx/" ]; then
|
|
||||||
echo "We've detect a folder '/opt/nginx/' which means"
|
|
||||||
echo "Maybe you have use this script before!"
|
|
||||||
echo "./setup clean"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p /hostdata/
|
|
||||||
mkdir -p /var/log/nginx/
|
|
||||||
mkdir -p /opt/nginx/modules/
|
|
||||||
useradd -m -g users -s /bin/bash $user
|
|
||||||
|
|
||||||
yes|pacman -Syy
|
|
||||||
yes|pacman -Syyu
|
|
||||||
yes|pacman -S curl wget zip unzip git gcc make cmake automake sudo
|
|
||||||
yes|pacman -S geoip geoip-database zlib geoip-database-extra autoconf libtool
|
|
||||||
yes|pacman -S yajl lmdb glibc libxml2 icu ncurses readline xz python3 python-pip
|
|
||||||
yes|pacman -S net-tools lua htop iftop gd
|
|
||||||
yes|pacman -S libmaxminddb geoip2-database mmdblookup libxml2 libxslt
|
|
||||||
|
|
||||||
su $user <<'EOF'
|
|
||||||
git clone https://aur.archlinux.org/ssdeep.git /home/$user/ssdeep
|
|
||||||
cd /home/$user/ssdeep/ && makepkg --syncdeps
|
|
||||||
yes|makepkg --install
|
|
||||||
makepkg --clean
|
|
||||||
rm -Rf /home/$user/ssdeep
|
|
||||||
EOF
|
|
||||||
cd /opt/
|
|
||||||
git clone https://github.com/SpiderLabs/ModSecurity
|
|
||||||
cd /opt/ModSecurity/
|
|
||||||
git checkout -b v3/master origin/v3/master
|
|
||||||
sh build.sh
|
|
||||||
git submodule init
|
|
||||||
git submodule update
|
|
||||||
./configure
|
|
||||||
make -j`nproc`
|
|
||||||
make install
|
|
||||||
|
|
||||||
cd /opt/nginx/modules/
|
|
||||||
wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.zip
|
|
||||||
unzip v0.3.0.zip; rm -Rf v0.3.0.zip
|
|
||||||
mv /opt/nginx/modules/ngx_devel_kit-0.3.0/ /opt/nginx/modules/ngx_devel_kit/
|
|
||||||
|
|
||||||
#Pagespeed Library
|
|
||||||
cd /opt/nginx/modules/
|
|
||||||
wget https://github.com/pagespeed/ngx_pagespeed/archive/v1.13.35.1-beta.zip
|
|
||||||
unzip v1.13.35.1-beta.zip
|
|
||||||
rm -Rf v1.13.35.1-beta.zip
|
|
||||||
|
|
||||||
mv /opt/nginx/modules/incubator-pagespeed-ngx-1.13.35.1-beta /opt/nginx/modules/ngx_pagespeed-1.13.35.1-beta
|
|
||||||
cd /opt/nginx/modules/ngx_pagespeed-1.13.35.1-beta
|
|
||||||
wget https://dl.google.com/dl/page-speed/psol/1.13.35.1-x64.tar.gz
|
|
||||||
tar -xzvf 1.13.35.1-x64.tar.gz; rm -Rf 1.13.35.1-x64.tar.gz
|
|
||||||
|
|
||||||
#LuaJIT Library
|
|
||||||
cd /opt/nginx/modules/
|
|
||||||
git clone http://luajit.org/git/luajit-2.0.git
|
|
||||||
cd luajit-2.0/
|
|
||||||
make -j`nproc`
|
|
||||||
sudo make install
|
|
||||||
ldconfig
|
|
||||||
|
|
||||||
#Naxsi Mod
|
|
||||||
cd /opt/nginx/modules/
|
|
||||||
wget https://github.com/nbs-system/naxsi/archive/master.zip
|
|
||||||
unzip master.zip; rm -Rf master.zip
|
|
||||||
mv /opt/nginx/modules/naxsi-master /opt/nginx/modules/naxsi
|
|
||||||
|
|
||||||
mkdir -p /opt/nginx/modules/
|
|
||||||
cd /opt/nginx/modules/
|
|
||||||
rm -Rf nginx_redis/
|
|
||||||
git clone https://github.com/openresty/set-misc-nginx-module.git
|
|
||||||
git clone https://github.com/FRiCKLE/ngx_cache_purge.git
|
|
||||||
git clone https://github.com/kyprizel/testcookie-nginx-module.git
|
|
||||||
git clone https://github.com/openresty/headers-more-nginx-module.git
|
|
||||||
git clone https://github.com/openresty/echo-nginx-module.git
|
|
||||||
git clone https://github.com/leev/ngx_http_geoip2_module.git
|
|
||||||
git clone https://github.com/openresty/lua-nginx-module.git
|
|
||||||
git clone https://github.com/arut/nginx-mtask-module.git
|
|
||||||
git clone https://github.com/arut/nginx-mysql-module.git
|
|
||||||
git clone https://github.com/SpiderLabs/ModSecurity-nginx.git
|
|
||||||
git clone https://github.com/openresty/encrypted-session-nginx-module.git
|
|
||||||
git clone https://github.com/flant/nginx-http-rdns.git
|
|
||||||
|
|
||||||
# OpenSSL 1.0.2h
|
|
||||||
mkdir -p /opt/nginx/
|
|
||||||
cd /opt/nginx/; wget wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_2h.zip
|
|
||||||
unzip OpenSSL_1_0_2h.zip; rm -Rf OpenSSL_1_0_2h.zip
|
|
||||||
|
|
||||||
# Download Nginx
|
|
||||||
mkdir -p /opt/nginx/sources/
|
|
||||||
cd /opt/nginx/sources/
|
|
||||||
wget 'http://nginx.org/download/nginx-1.13.8.tar.gz'
|
|
||||||
tar -xzvf nginx-1.13.8.tar.gz; rm -Rf nginx-1.13.8.tar.gz
|
|
||||||
cd /opt/nginx/sources/nginx-1.13.8/
|
|
||||||
wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/nbuild.sh
|
|
||||||
chmod +x nbuild.sh
|
|
||||||
./nbuild.sh
|
|
||||||
make -j`nproc`
|
|
||||||
make install
|
|
||||||
ldconfig
|
|
||||||
|
|
||||||
mkdir -p /nginx
|
|
||||||
mkdir -p /nginx/live
|
|
||||||
mkdir -p /nginx/logs
|
|
||||||
mkdir -p /nginx/cache
|
|
||||||
mkdir -p /nginx/conf.d
|
|
||||||
touch /nginx/logs/access.log
|
|
||||||
touch /nginx/logs/error.log
|
|
||||||
useradd -r nginx
|
|
||||||
rm -Rf /etc/init.d/nginx
|
|
||||||
cd /etc/init.d/; wget https://raw.githubusercontent.com/systemroot/my-nginx/master/nginx-as-firewall/static/nginx
|
|
||||||
chmod +x /etc/init.d/nginx
|
|
||||||
cd /nginx/; mkdir conf.d; rm -Rf nginx.conf*; wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/ArchLinux/static/nginx.conf
|
|
||||||
mkdir -p /nginx/live/
|
|
||||||
cd /nginx/live/
|
|
||||||
wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/vhost/default
|
|
||||||
|
|
||||||
mkdir -p /hostdata/default
|
|
||||||
mkdir -p /hostdata/default/public_html
|
|
||||||
mkdir -p /hostdata/default/logs
|
|
||||||
mkdir -p /hostdata/default/cache
|
|
||||||
mkdir -p /nginx/modsecurity/
|
|
||||||
cd /hostdata/default/public_html/
|
|
||||||
wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/html/index.html
|
|
||||||
sudo update-rc.d nginx defaults
|
|
||||||
|
|
||||||
mkdir -p /tmp/; cd /tmp; wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/sysctl.conf
|
|
||||||
cat /tmp/sysctl.conf >> /etc/sysctl.conf
|
|
||||||
sysctl -p
|
|
||||||
clear
|
|
||||||
|
|
||||||
cd /nginx/; mkdir db/; cd db/; wget https://github.com/theraw/The-World-Is-Yours/raw/master/static/GeoLite2-Country.mmdb
|
|
||||||
cd /nginx/; rm -Rf *.default
|
|
||||||
cp /opt/nginx/modules/naxsi/naxsi_config/naxsi_core.rules /nginx/naxsi_core.rules
|
|
||||||
cp /opt/ModSecurity/modsecurity.conf-recommended /nginx/modsecurity/modsecurity.conf
|
|
||||||
|
|
||||||
cd /opt/; git clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git
|
|
||||||
cp -a /opt/owasp-modsecurity-crs/rules/ /nginx/modsecurity/
|
|
||||||
cp -a /opt/owasp-modsecurity-crs/crs-setup.conf.example /nginx/modsecurity/crs-setup.conf
|
|
||||||
clear
|
|
||||||
#mkdir -p /tmp/; cd /tmp; wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/iptables/install
|
|
||||||
#chmod +x install; ./install
|
|
||||||
#clear
|
|
||||||
curl -s https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/ArchLinux/static/nginx.service > /usr/lib/systemd/system/nginx.service
|
|
||||||
clear
|
|
||||||
systemctl enable nginx
|
|
||||||
nginx -t
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=A high performance web server and a reverse proxy server
|
|
||||||
After=network.target network-online.target nss-lookup.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=forking
|
|
||||||
PIDFile=/var/run/nginx.pid
|
|
||||||
PrivateDevices=yes
|
|
||||||
SyslogLevel=err
|
|
||||||
|
|
||||||
ExecStart=/usr/bin/nginx -g 'pid /var/run/nginx.pid; error_log stderr;'
|
|
||||||
ExecReload=/usr/bin/nginx -s reload
|
|
||||||
KillSignal=SIGQUIT
|
|
||||||
KillMode=mixed
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
yum -y update; yum -y upgrade; yum -y install epel-release wget zip unzip git nano
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
geo $white_bot {
|
|
||||||
default 0;
|
|
||||||
include /nginx/conf.d/whitelist-ips.list;
|
|
||||||
}
|
|
||||||
@@ -1,494 +0,0 @@
|
|||||||
# ====================================
|
|
||||||
# GOOGLE.
|
|
||||||
# ====================================
|
|
||||||
108.177.8.0/21 1;
|
|
||||||
54.36.0.0/16 1;
|
|
||||||
104.132.0.0/23 1;
|
|
||||||
104.132.11.0/24 1;
|
|
||||||
104.132.141.0/24 1;
|
|
||||||
104.132.34.0/24 1;
|
|
||||||
104.132.5.0/24 1;
|
|
||||||
104.132.51.0/24 1;
|
|
||||||
104.132.7.0/24 1;
|
|
||||||
104.132.8.0/24 1;
|
|
||||||
104.133.0.0/24 1;
|
|
||||||
104.133.2.0/23 1;
|
|
||||||
104.154.0.0/15 1;
|
|
||||||
104.196.0.0/14 1;
|
|
||||||
107.167.160.0/19 1;
|
|
||||||
107.178.192.0/18 1;
|
|
||||||
108.170.192.0/18 1;
|
|
||||||
108.177.0.0/17 1;
|
|
||||||
108.177.10.0/24 1;
|
|
||||||
108.177.103.0/24 1;
|
|
||||||
108.177.104.0/24 1;
|
|
||||||
108.177.11.0/24 1;
|
|
||||||
108.177.112.0/24 1;
|
|
||||||
108.177.119.0/24 1;
|
|
||||||
108.177.120.0/24 1;
|
|
||||||
108.177.12.0/24 1;
|
|
||||||
108.177.121.0/24 1;
|
|
||||||
108.177.125.0/24 1;
|
|
||||||
108.177.126.0/24 1;
|
|
||||||
108.177.127.0/24 1;
|
|
||||||
108.177.13.0/24 1;
|
|
||||||
108.177.14.0/24 1;
|
|
||||||
108.177.15.0/24 1;
|
|
||||||
108.177.28.0/24 1;
|
|
||||||
108.177.30.0/24 1;
|
|
||||||
108.177.8.0/24 1;
|
|
||||||
108.177.9.0/24 1;
|
|
||||||
108.177.96.0/24 1;
|
|
||||||
108.177.97.0/24 1;
|
|
||||||
108.177.98.0/24 1;
|
|
||||||
108.59.80.0/20 1;
|
|
||||||
130.211.0.0/16 1;
|
|
||||||
142.250.0.0/15 1;
|
|
||||||
146.148.0.0/17 1;
|
|
||||||
162.216.148.0/22 1;
|
|
||||||
162.222.176.0/21 1;
|
|
||||||
172.102.10.0/24 1;
|
|
||||||
172.102.11.0/24 1;
|
|
||||||
172.102.12.0/23 1;
|
|
||||||
172.102.14.0/23 1;
|
|
||||||
172.102.8.0/21 1;
|
|
||||||
172.102.8.0/24 1;
|
|
||||||
172.110.32.0/21 1;
|
|
||||||
172.217.0.0/16 1;
|
|
||||||
172.217.0.0/24 1;
|
|
||||||
172.217.10.0/24 1;
|
|
||||||
172.217.1.0/24 1;
|
|
||||||
172.217.11.0/24 1;
|
|
||||||
172.217.12.0/24 1;
|
|
||||||
172.217.13.0/24 1;
|
|
||||||
172.217.14.0/24 1;
|
|
||||||
172.217.15.0/24 1;
|
|
||||||
172.217.16.0/24 1;
|
|
||||||
172.217.17.0/24 1;
|
|
||||||
172.217.18.0/24 1;
|
|
||||||
172.217.19.0/24 1;
|
|
||||||
172.217.20.0/24 1;
|
|
||||||
172.217.2.0/24 1;
|
|
||||||
172.217.21.0/24 1;
|
|
||||||
172.217.22.0/24 1;
|
|
||||||
172.217.23.0/24 1;
|
|
||||||
172.217.24.0/24 1;
|
|
||||||
172.217.25.0/24 1;
|
|
||||||
172.217.26.0/24 1;
|
|
||||||
172.217.27.0/24 1;
|
|
||||||
172.217.28.0/24 1;
|
|
||||||
172.217.29.0/24 1;
|
|
||||||
172.217.30.0/24 1;
|
|
||||||
172.217.3.0/24 1;
|
|
||||||
172.217.31.0/24 1;
|
|
||||||
172.217.4.0/24 1;
|
|
||||||
172.217.5.0/24 1;
|
|
||||||
172.217.6.0/24 1;
|
|
||||||
172.217.7.0/24 1;
|
|
||||||
172.217.8.0/24 1;
|
|
||||||
172.217.9.0/24 1;
|
|
||||||
172.253.0.0/16 1;
|
|
||||||
173.194.112.0/24 1;
|
|
||||||
173.194.113.0/24 1;
|
|
||||||
173.194.117.0/24 1;
|
|
||||||
173.194.118.0/24 1;
|
|
||||||
173.194.119.0/24 1;
|
|
||||||
173.194.120.0/24 1;
|
|
||||||
173.194.121.0/24 1;
|
|
||||||
173.194.124.0/24 1;
|
|
||||||
173.194.132.0/24 1;
|
|
||||||
173.194.136.0/24 1;
|
|
||||||
173.194.140.0/24 1;
|
|
||||||
173.194.141.0/24 1;
|
|
||||||
173.194.142.0/24 1;
|
|
||||||
173.194.175.0/24 1;
|
|
||||||
173.194.192.0/24 1;
|
|
||||||
173.194.193.0/24 1;
|
|
||||||
173.194.194.0/24 1;
|
|
||||||
173.194.195.0/24 1;
|
|
||||||
173.194.196.0/24 1;
|
|
||||||
173.194.197.0/24 1;
|
|
||||||
173.194.198.0/24 1;
|
|
||||||
173.194.199.0/24 1;
|
|
||||||
173.194.200.0/24 1;
|
|
||||||
173.194.201.0/24 1;
|
|
||||||
173.194.202.0/24 1;
|
|
||||||
173.194.203.0/24 1;
|
|
||||||
173.194.204.0/24 1;
|
|
||||||
173.194.205.0/24 1;
|
|
||||||
173.194.206.0/24 1;
|
|
||||||
173.194.207.0/24 1;
|
|
||||||
173.194.208.0/24 1;
|
|
||||||
173.194.209.0/24 1;
|
|
||||||
173.194.210.0/24 1;
|
|
||||||
173.194.211.0/24 1;
|
|
||||||
173.194.212.0/24 1;
|
|
||||||
173.194.213.0/24 1;
|
|
||||||
173.194.214.0/24 1;
|
|
||||||
173.194.215.0/24 1;
|
|
||||||
173.194.216.0/24 1;
|
|
||||||
173.194.217.0/24 1;
|
|
||||||
173.194.218.0/24 1;
|
|
||||||
173.194.219.0/24 1;
|
|
||||||
173.194.220.0/24 1;
|
|
||||||
173.194.221.0/24 1;
|
|
||||||
173.194.222.0/24 1;
|
|
||||||
173.194.223.0/24 1;
|
|
||||||
173.194.32.0/24 1;
|
|
||||||
173.194.34.0/24 1;
|
|
||||||
173.194.35.0/24 1;
|
|
||||||
173.194.36.0/24 1;
|
|
||||||
173.194.37.0/24 1;
|
|
||||||
173.194.38.0/24 1;
|
|
||||||
173.194.39.0/24 1;
|
|
||||||
173.194.40.0/24 1;
|
|
||||||
173.194.41.0/24 1;
|
|
||||||
173.194.42.0/24 1;
|
|
||||||
173.194.44.0/24 1;
|
|
||||||
173.194.46.0/24 1;
|
|
||||||
173.194.53.0/24 1;
|
|
||||||
173.194.63.0/24 1;
|
|
||||||
173.194.66.0/24 1;
|
|
||||||
173.194.67.0/24 1;
|
|
||||||
173.194.68.0/24 1;
|
|
||||||
173.194.69.0/24 1;
|
|
||||||
173.194.70.0/24 1;
|
|
||||||
173.194.7.0/24 1;
|
|
||||||
173.194.73.0/24 1;
|
|
||||||
173.194.74.0/24 1;
|
|
||||||
173.194.76.0/24 1;
|
|
||||||
173.194.78.0/24 1;
|
|
||||||
173.194.79.0/24 1;
|
|
||||||
173.255.112.0/20 1;
|
|
||||||
185.150.148.0/22 1;
|
|
||||||
185.25.28.0/23 1;
|
|
||||||
192.104.160.0/23 1;
|
|
||||||
192.158.28.0/22 1;
|
|
||||||
192.178.0.0/15 1;
|
|
||||||
199.192.112.0/22 1;
|
|
||||||
199.223.232.0/21 1;
|
|
||||||
207.223.160.0/20 1;
|
|
||||||
208.68.108.0/22 1;
|
|
||||||
208.81.188.0/22 1;
|
|
||||||
209.107.176.0/20 1;
|
|
||||||
209.107.176.0/23 1;
|
|
||||||
209.107.182.0/23 1;
|
|
||||||
209.107.184.0/23 1;
|
|
||||||
209.107.185.0/24 1;
|
|
||||||
209.85.144.0/24 1;
|
|
||||||
209.85.145.0/24 1;
|
|
||||||
209.85.147.0/24 1;
|
|
||||||
209.85.200.0/24 1;
|
|
||||||
209.85.201.0/24 1;
|
|
||||||
209.85.202.0/24 1;
|
|
||||||
209.85.203.0/24 1;
|
|
||||||
209.85.232.0/24 1;
|
|
||||||
209.85.233.0/24 1;
|
|
||||||
209.85.234.0/24 1;
|
|
||||||
209.85.235.0/24 1;
|
|
||||||
216.239.32.0/24 1;
|
|
||||||
216.239.33.0/24 1;
|
|
||||||
216.239.34.0/24 1;
|
|
||||||
216.239.35.0/24 1;
|
|
||||||
216.239.36.0/24 1;
|
|
||||||
216.239.38.0/24 1;
|
|
||||||
216.239.39.0/24 1;
|
|
||||||
216.252.220.0/22 1;
|
|
||||||
216.252.220.0/24 1;
|
|
||||||
216.252.222.0/24 1;
|
|
||||||
216.58.200.0/24 1;
|
|
||||||
216.58.208.0/24 1;
|
|
||||||
216.58.209.0/24 1;
|
|
||||||
216.58.210.0/24 1;
|
|
||||||
216.58.211.0/24 1;
|
|
||||||
216.58.212.0/24 1;
|
|
||||||
216.58.213.0/24 1;
|
|
||||||
216.58.214.0/24 1;
|
|
||||||
216.58.215.0/24 1;
|
|
||||||
216.58.216.0/24 1;
|
|
||||||
216.58.217.0/24 1;
|
|
||||||
216.58.218.0/24 1;
|
|
||||||
216.58.219.0/24 1;
|
|
||||||
216.58.220.0/24 1;
|
|
||||||
216.58.221.0/24 1;
|
|
||||||
216.58.222.0/24 1;
|
|
||||||
216.58.223.0/24 1;
|
|
||||||
216.73.80.0/20 1;
|
|
||||||
23.236.48.0/20 1;
|
|
||||||
23.251.128.0/19 1;
|
|
||||||
35.184.0.0/13 1;
|
|
||||||
35.192.0.0/13 1;
|
|
||||||
35.200.0.0/14 1;
|
|
||||||
35.204.0.0/15 1;
|
|
||||||
35.224.0.0/14 1;
|
|
||||||
35.228.0.0/14 1;
|
|
||||||
35.232.0.0/14 1;
|
|
||||||
35.236.0.0/14 1;
|
|
||||||
35.240.0.0/14 1;
|
|
||||||
35.244.0.0/14 1;
|
|
||||||
64.233.161.0/24 1;
|
|
||||||
64.233.162.0/24 1;
|
|
||||||
64.233.163.0/24 1;
|
|
||||||
64.233.164.0/24 1;
|
|
||||||
64.233.165.0/24 1;
|
|
||||||
64.233.166.0/24 1;
|
|
||||||
64.233.167.0/24 1;
|
|
||||||
64.233.168.0/24 1;
|
|
||||||
64.233.169.0/24 1;
|
|
||||||
64.233.170.0/24 1;
|
|
||||||
64.233.171.0/24 1;
|
|
||||||
64.233.176.0/24 1;
|
|
||||||
64.233.177.0/24 1;
|
|
||||||
64.233.178.0/24 1;
|
|
||||||
64.233.179.0/24 1;
|
|
||||||
64.233.180.0/24 1;
|
|
||||||
64.233.181.0/24 1;
|
|
||||||
64.233.182.0/24 1;
|
|
||||||
64.233.183.0/24 1;
|
|
||||||
64.233.184.0/24 1;
|
|
||||||
64.233.185.0/24 1;
|
|
||||||
64.233.186.0/24 1;
|
|
||||||
64.233.187.0/24 1;
|
|
||||||
64.233.188.0/24 1;
|
|
||||||
64.233.189.0/24 1;
|
|
||||||
64.233.190.0/24 1;
|
|
||||||
64.233.191.0/24 1;
|
|
||||||
66.102.1.0/24 1;
|
|
||||||
66.102.12.0/24 1;
|
|
||||||
66.102.2.0/24 1;
|
|
||||||
66.102.3.0/24 1;
|
|
||||||
66.102.4.0/24 1;
|
|
||||||
66.249.64.0/19 1;
|
|
||||||
70.32.128.0/19 1;
|
|
||||||
70.32.131.0/24 1;
|
|
||||||
70.32.145.0/24 1;
|
|
||||||
70.32.146.0/23 1;
|
|
||||||
70.32.151.0/24 1;
|
|
||||||
74.114.24.0/21 1;
|
|
||||||
74.125.124.0/24 1;
|
|
||||||
74.125.126.0/24 1;
|
|
||||||
74.125.127.0/24 1;
|
|
||||||
74.125.128.0/24 1;
|
|
||||||
74.125.129.0/24 1;
|
|
||||||
74.125.130.0/24 1;
|
|
||||||
74.125.131.0/24 1;
|
|
||||||
74.125.132.0/24 1;
|
|
||||||
74.125.133.0/24 1;
|
|
||||||
74.125.134.0/24 1;
|
|
||||||
74.125.135.0/24 1;
|
|
||||||
74.125.136.0/24 1;
|
|
||||||
74.125.138.0/24 1;
|
|
||||||
74.125.139.0/24 1;
|
|
||||||
74.125.140.0/24 1;
|
|
||||||
74.125.141.0/24 1;
|
|
||||||
74.125.143.0/24 1;
|
|
||||||
74.125.192.0/24 1;
|
|
||||||
74.125.196.0/24 1;
|
|
||||||
74.125.197.0/24 1;
|
|
||||||
74.125.198.0/24 1;
|
|
||||||
74.125.199.0/24 1;
|
|
||||||
74.125.200.0/24 1;
|
|
||||||
74.125.201.0/24 1;
|
|
||||||
74.125.202.0/24 1;
|
|
||||||
74.125.203.0/24 1;
|
|
||||||
74.125.204.0/24 1;
|
|
||||||
74.125.205.0/24 1;
|
|
||||||
74.125.206.0/24 1;
|
|
||||||
74.125.21.0/24 1;
|
|
||||||
74.125.22.0/24 1;
|
|
||||||
74.125.225.0/24 1;
|
|
||||||
74.125.226.0/24 1;
|
|
||||||
74.125.227.0/24 1;
|
|
||||||
74.125.228.0/24 1;
|
|
||||||
74.125.230.0/24 1;
|
|
||||||
74.125.23.0/24 1;
|
|
||||||
74.125.232.0/24 1;
|
|
||||||
74.125.234.0/24 1;
|
|
||||||
74.125.235.0/24 1;
|
|
||||||
74.125.236.0/24 1;
|
|
||||||
74.125.238.0/24 1;
|
|
||||||
74.125.24.0/24 1;
|
|
||||||
74.125.26.0/24 1;
|
|
||||||
74.125.27.0/24 1;
|
|
||||||
74.125.28.0/24 1;
|
|
||||||
74.125.29.0/24 1;
|
|
||||||
74.125.30.0/24 1;
|
|
||||||
74.125.31.0/24 1;
|
|
||||||
74.125.39.0/24 1;
|
|
||||||
74.125.6.0/24 1;
|
|
||||||
74.125.68.0/24 1;
|
|
||||||
74.125.69.0/24 1;
|
|
||||||
74.125.70.0/24 1;
|
|
||||||
74.125.71.0/24 1;
|
|
||||||
8.34.208.0/21 1;
|
|
||||||
8.34.216.0/21 1;
|
|
||||||
8.35.192.0/21 1;
|
|
||||||
8.35.200.0/21 1;
|
|
||||||
8.8.4.0/24 1;
|
|
||||||
8.8.8.0/24 1;
|
|
||||||
108.177.96.0/19 1;
|
|
||||||
172.217.0.0/19 1;
|
|
||||||
173.194.0.0/16 1;
|
|
||||||
2001:4860:4000::/36 1;
|
|
||||||
203.208.60.0/24 1;
|
|
||||||
207.126.144.0/20 1;
|
|
||||||
209.85.128.0/17 1;
|
|
||||||
216.239.32.0/19 1;
|
|
||||||
216.58.192.0/19 1;
|
|
||||||
2404:6800:4000::/36 1;
|
|
||||||
2607:f8b0:4000::/36 1;
|
|
||||||
2800:3f0:4000::/36 1;
|
|
||||||
2a00:1450:4000::/36 1;
|
|
||||||
2c0f:fb50:4000::/36 1;
|
|
||||||
64.18.0.0/20 1;
|
|
||||||
64.233.160.0/19 1;
|
|
||||||
64.68.80.0/21 1;
|
|
||||||
66.102.0.0/20 1;
|
|
||||||
66.249.64.0/18 1;
|
|
||||||
72.14.192.0/18 1;
|
|
||||||
74.125.0.0/16 1;
|
|
||||||
# ====================================
|
|
||||||
# END GOOGLE.
|
|
||||||
# ====================================
|
|
||||||
|
|
||||||
# ====================================
|
|
||||||
# START BING.
|
|
||||||
# ====================================
|
|
||||||
131.253.24.0/22 1;
|
|
||||||
131.253.46.0/23 1;
|
|
||||||
157.54.0.0/15 1;
|
|
||||||
157.56.0.0/14 1;
|
|
||||||
157.60.0.0/16 1;
|
|
||||||
199.30.16.0/24 1;
|
|
||||||
199.30.27.0/24 1;
|
|
||||||
207.46.0.0/16 1;
|
|
||||||
40.112.0.0/13 1;
|
|
||||||
40.120.0.0/14 1;
|
|
||||||
40.124.0.0/16 1;
|
|
||||||
40.125.0.0/17 1;
|
|
||||||
40.74.0.0/15 1;
|
|
||||||
40.76.0.0/14 1;
|
|
||||||
40.80.0.0/12 1;
|
|
||||||
40.96.0.0/12 1;
|
|
||||||
65.52.104.0/24 1;
|
|
||||||
65.52.108.0/22 1;
|
|
||||||
65.55.213.0/24 1;
|
|
||||||
65.55.217.0/24 1;
|
|
||||||
65.55.24.0/24 1;
|
|
||||||
65.55.52.0/24 1;
|
|
||||||
65.55.55.0/24 1;
|
|
||||||
# ====================================
|
|
||||||
# END BING.
|
|
||||||
# ====================================
|
|
||||||
|
|
||||||
# ====================================
|
|
||||||
# START CLOUDFLARE.
|
|
||||||
# ====================================
|
|
||||||
103.21.244.0/22 1;
|
|
||||||
103.22.200.0/22 1;
|
|
||||||
103.31.4.0/22 1;
|
|
||||||
104.16.0.0/12 1;
|
|
||||||
108.162.192.0/18 1;
|
|
||||||
131.0.72.0/22 1;
|
|
||||||
141.101.64.0/18 1;
|
|
||||||
162.158.0.0/15 1;
|
|
||||||
172.64.0.0/13 1;
|
|
||||||
173.245.48.0/20 1;
|
|
||||||
188.114.96.0/20 1;
|
|
||||||
190.93.240.0/20 1;
|
|
||||||
197.234.240.0/22 1;
|
|
||||||
198.41.128.0/17 1;
|
|
||||||
# ====================================
|
|
||||||
# END CLOUDFLARE.
|
|
||||||
# ====================================
|
|
||||||
|
|
||||||
# ====================================
|
|
||||||
# START UPTIME ROBOT.
|
|
||||||
# ====================================
|
|
||||||
216.144.250.150 1;
|
|
||||||
69.162.124.226 1;
|
|
||||||
69.162.124.227 1;
|
|
||||||
69.162.124.228 1;
|
|
||||||
69.162.124.229 1;
|
|
||||||
69.162.124.230 1;
|
|
||||||
69.162.124.231 1;
|
|
||||||
69.162.124.232 1;
|
|
||||||
69.162.124.233 1;
|
|
||||||
69.162.124.234 1;
|
|
||||||
69.162.124.235 1;
|
|
||||||
69.162.124.236 1;
|
|
||||||
69.162.124.237 1;
|
|
||||||
63.143.42.242 1;
|
|
||||||
63.143.42.243 1;
|
|
||||||
63.143.42.244 1;
|
|
||||||
63.143.42.245 1;
|
|
||||||
63.143.42.246 1;
|
|
||||||
63.143.42.247 1;
|
|
||||||
63.143.42.248 1;
|
|
||||||
63.143.42.249 1;
|
|
||||||
63.143.42.250 1;
|
|
||||||
63.143.42.251 1;
|
|
||||||
63.143.42.252 1;
|
|
||||||
63.143.42.253 1;
|
|
||||||
46.137.190.132 1;
|
|
||||||
122.248.234.23 1;
|
|
||||||
188.226.183.141 1;
|
|
||||||
178.62.52.237 1;
|
|
||||||
54.79.28.129 1;
|
|
||||||
54.94.142.218 1;
|
|
||||||
104.131.107.63 1;
|
|
||||||
54.67.10.127 1;
|
|
||||||
54.64.67.106 1;
|
|
||||||
159.203.30.41 1;
|
|
||||||
46.101.250.135 1;
|
|
||||||
18.221.56.27 1;
|
|
||||||
52.60.129.180 1;
|
|
||||||
159.89.8.111 1;
|
|
||||||
146.185.143.14 1;
|
|
||||||
139.59.173.249 1;
|
|
||||||
165.227.83.148 1;
|
|
||||||
128.199.195.156 1;
|
|
||||||
138.197.150.151 1;
|
|
||||||
34.233.66.117 1;
|
|
||||||
# ====================================
|
|
||||||
# END UPTIME ROBOT.
|
|
||||||
# ====================================
|
|
||||||
|
|
||||||
# ====================================
|
|
||||||
# START DOPEHOSTING.NET
|
|
||||||
# ====================================
|
|
||||||
54.37.223.16/30 1;
|
|
||||||
37.59.144.72/30 1;
|
|
||||||
137.74.180.224 1;
|
|
||||||
54.36.45.68 1;
|
|
||||||
46.105.102.209 1;
|
|
||||||
188.165.209.76 1;
|
|
||||||
178.32.143.180 1;
|
|
||||||
94.23.174.121 1;
|
|
||||||
145.239.109.72/30 1;
|
|
||||||
51.254.165.84/30 1;
|
|
||||||
176.31.143.0/30 1;
|
|
||||||
151.80.88.22 1;
|
|
||||||
151.80.88.23 1;
|
|
||||||
164.132.205.172 1;
|
|
||||||
91.134.123.247 1;
|
|
||||||
145.239.77.50 1;
|
|
||||||
178.33.104.93 1;
|
|
||||||
178.33.104.96 1;
|
|
||||||
178.33.104.181 1;
|
|
||||||
178.33.106.145 1;
|
|
||||||
51.254.94.129 1;
|
|
||||||
178.32.56.33 1;
|
|
||||||
164.132.30.228 1;
|
|
||||||
137.74.234.202 1;
|
|
||||||
94.23.172.79 1;
|
|
||||||
46.105.53.116 1;
|
|
||||||
91.134.201.79 1;
|
|
||||||
137.74.234.209 1;
|
|
||||||
54.36.100.120 1;
|
|
||||||
94.23.172.83 1;
|
|
||||||
46.105.51.193 1;
|
|
||||||
178.32.53.54 1;
|
|
||||||
# ====================================
|
|
||||||
# END DOPEHOSTING.NET
|
|
||||||
# ====================================
|
|
||||||
@@ -1,194 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
clean() {
|
|
||||||
mkdir -p ~/tmp; cd ~/tmp
|
|
||||||
wget https://raw.githubusercontent.com/systemroot/my-nginx/master/nginx-as-firewall/setup
|
|
||||||
chmod +x setup
|
|
||||||
./setup clean
|
|
||||||
rm -Rf ~/tmp
|
|
||||||
}
|
|
||||||
checks() {
|
|
||||||
if [ "$(whoami)" != "root" ]
|
|
||||||
then
|
|
||||||
echo "You should Login as root to use this script!";
|
|
||||||
echo "May you already have access for sudo, but commands aren't designed with sudo! so..";
|
|
||||||
echo "sudo -i";
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "/nginx/" ]; then
|
|
||||||
echo "We've detect a folder '/nginx/' which means"
|
|
||||||
echo "Maybe you have use this script before!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "/etc/nginx" ]; then
|
|
||||||
echo "We've detect a folder '/etc/nginx' which means"
|
|
||||||
echo "Maybe you have use this script before!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "/opt/nginx/" ]; then
|
|
||||||
echo "We've detect a folder '/opt/nginx/' which means"
|
|
||||||
echo "Maybe you have use this script before!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
reqs() {
|
|
||||||
apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y;
|
|
||||||
apt-get install sudo -y
|
|
||||||
apt-get install build-essential libssl-dev curl nano wget zip unzip git -y
|
|
||||||
apt-get purge --remove nginx -y
|
|
||||||
apt-get purge --remove apache2 -y
|
|
||||||
apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y
|
|
||||||
apt-get autoremove -y
|
|
||||||
apt-get install apt-utils build-essential -y
|
|
||||||
apt-get install git -y
|
|
||||||
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg libxml2 zlib1g-dev -y
|
|
||||||
apt-get install -y unzip
|
|
||||||
apt-get install -y libicu-dev libcurl4-gnutls-dev libtool
|
|
||||||
apt-get install -y libmozjs-24-dev
|
|
||||||
apt-get install -y libmozjs-24-bin; sudo ln -sf /usr/bin/js24 /usr/bin/js
|
|
||||||
apt-get install openssl libssl-dev libperl-dev libexpat-dev -y
|
|
||||||
apt-get install mercurial meld -y
|
|
||||||
apt-get install libxslt-dev -y
|
|
||||||
apt-get install libgd2-xpm -y
|
|
||||||
apt-get install libgd2-xpm-dev -y
|
|
||||||
apt-get install libgeoip-dev -y
|
|
||||||
apt-get install libssl libssl-dev -y
|
|
||||||
apt-get install dh-autoreconf -y
|
|
||||||
apt-get install -y software-properties-common
|
|
||||||
apt-get install -y python-software-properties
|
|
||||||
apt-get install -y libcairo2 libcairo2-dev
|
|
||||||
apt-get install -y python-dev
|
|
||||||
sudo add-apt-repository ppa:maxmind/ppa -y
|
|
||||||
apt-get install aptitude -y
|
|
||||||
aptitude update -y
|
|
||||||
aptitude upgrade -y
|
|
||||||
aptitude install libmaxminddb0 libmaxminddb-dev mmdb-bin -y
|
|
||||||
apt-get install libmysqlclient-dev -y
|
|
||||||
apt-get install libmariadbclient-dev -y
|
|
||||||
apt-get install g++ flex bison curl doxygen libyajl-dev libgeoip-dev libtool dh-autoreconf libcurl4-gnutls-dev libxml2 libpcre++-dev libxml2-dev -y
|
|
||||||
apt-get install libuuid1 uuid-dev -y
|
|
||||||
apt-get install libgd-dev libc6 -y
|
|
||||||
}
|
|
||||||
dirs() {
|
|
||||||
mkdir -p /hostdata/
|
|
||||||
mkdir -p /var/log/nginx/
|
|
||||||
mkdir -p /opt/nginx/modules/
|
|
||||||
}
|
|
||||||
cd /opt/
|
|
||||||
git clone https://github.com/SpiderLabs/ModSecurity
|
|
||||||
cd /opt/ModSecurity/
|
|
||||||
git checkout -b v3/master origin/v3/master
|
|
||||||
sh build.sh
|
|
||||||
git submodule init
|
|
||||||
git submodule update
|
|
||||||
./configure
|
|
||||||
make -j`nproc`
|
|
||||||
make install
|
|
||||||
|
|
||||||
cd /opt/nginx/modules/
|
|
||||||
wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.1rc1.zip
|
|
||||||
unzip v0.3.1rc1.zip; rm -Rf v0.3.1rc1.zip
|
|
||||||
mv /opt/nginx/modules/ngx_devel_kit-0.3.1rc1/ /opt/nginx/modules/ngx_devel_kit/
|
|
||||||
|
|
||||||
#Pagespeed Library
|
|
||||||
cd /opt/nginx/modules/
|
|
||||||
wget https://github.com/apache/incubator-pagespeed-ngx/archive/v1.13.35.2-stable.zip
|
|
||||||
unzip v1.13.35.2-stable.zip
|
|
||||||
rm -Rf v1.13.35.2-stable.zip
|
|
||||||
mv /opt/nginx/modules/incubator-pagespeed-ngx-1.13.35.2-stable /opt/nginx/modules/ngx_pagespeed-1.13.35.2-stable
|
|
||||||
cd /opt/nginx/modules/ngx_pagespeed-1.13.35.2-stable
|
|
||||||
wget https://dl.google.com/dl/page-speed/psol/1.13.35.2-x64.tar.gz
|
|
||||||
tar -xzvf 1.13.35.2-x64.tar.gz; rm -Rf 1.13.35.2-x64.tar.gz
|
|
||||||
|
|
||||||
#LuaJIT Library
|
|
||||||
cd /opt/nginx/modules/
|
|
||||||
git clone http://luajit.org/git/luajit-2.0.git
|
|
||||||
cd luajit-2.0/
|
|
||||||
make -j`nproc`
|
|
||||||
sudo make install
|
|
||||||
ldconfig
|
|
||||||
|
|
||||||
#Naxsi Mod
|
|
||||||
cd /opt/nginx/modules/
|
|
||||||
wget https://github.com/nbs-system/naxsi/archive/master.zip
|
|
||||||
unzip master.zip; rm -Rf master.zip
|
|
||||||
mv /opt/nginx/modules/naxsi-master /opt/nginx/modules/naxsi
|
|
||||||
|
|
||||||
mkdir -p /opt/nginx/modules/
|
|
||||||
cd /opt/nginx/modules/
|
|
||||||
rm -Rf nginx_redis/
|
|
||||||
git clone https://github.com/openresty/set-misc-nginx-module.git
|
|
||||||
git clone https://github.com/FRiCKLE/ngx_cache_purge.git
|
|
||||||
git clone https://github.com/kyprizel/testcookie-nginx-module.git
|
|
||||||
git clone https://github.com/openresty/headers-more-nginx-module.git
|
|
||||||
git clone https://github.com/openresty/echo-nginx-module.git
|
|
||||||
git clone https://github.com/leev/ngx_http_geoip2_module.git
|
|
||||||
git clone https://github.com/openresty/lua-nginx-module.git
|
|
||||||
git clone https://github.com/SpiderLabs/ModSecurity-nginx.git
|
|
||||||
git clone https://github.com/openresty/encrypted-session-nginx-module.git
|
|
||||||
git clone https://github.com/flant/nginx-http-rdns.git
|
|
||||||
|
|
||||||
# Download Nginx
|
|
||||||
mkdir -p /opt/nginx/sources/
|
|
||||||
cd /opt/nginx/sources/
|
|
||||||
wget "http://nginx.org/download/nginx-$nginxVersion.tar.gz"
|
|
||||||
tar -xzvf nginx-$nginxVersion.tar.gz; rm -Rf nginx-$nginxVersion.tar.gz
|
|
||||||
cd /opt/nginx/sources/nginx-$nginxVersion/
|
|
||||||
wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/nbuild.sh
|
|
||||||
chmod +x nbuild.sh
|
|
||||||
./nbuild.sh
|
|
||||||
make -j`nproc`
|
|
||||||
make install
|
|
||||||
ldconfig
|
|
||||||
|
|
||||||
mkdir -p /nginx/live
|
|
||||||
mkdir -p /nginx/logs
|
|
||||||
mkdir -p /nginx/conf.d
|
|
||||||
touch /nginx/logs/access.log
|
|
||||||
touch /nginx/logs/error.log
|
|
||||||
useradd -r nginx
|
|
||||||
rm -Rf /etc/init.d/nginx
|
|
||||||
cd /etc/init.d/; wget https://raw.githubusercontent.com/systemroot/my-nginx/master/nginx-as-firewall/static/nginx
|
|
||||||
chmod +x /etc/init.d/nginx
|
|
||||||
cd /nginx/; mkdir conf.d; rm -Rf nginx.conf*; wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/nginx.conf
|
|
||||||
mkdir -p /nginx/live/
|
|
||||||
cd /nginx/live/
|
|
||||||
wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/vhost/default
|
|
||||||
|
|
||||||
mkdir -p /hostdata/default
|
|
||||||
mkdir -p /hostdata/default/public_html
|
|
||||||
mkdir -p /hostdata/default/logs
|
|
||||||
mkdir -p /hostdata/default/cache
|
|
||||||
mkdir -p /nginx/modsecurity/
|
|
||||||
cd /hostdata/default/public_html/
|
|
||||||
wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/html/index.html
|
|
||||||
sudo update-rc.d nginx defaults
|
|
||||||
|
|
||||||
cd /nginx/; mkdir db/; cd db/; wget https://github.com/theraw/The-World-Is-Yours/raw/master/static/GeoLite2-Country.mmdb
|
|
||||||
cd /nginx/; rm -Rf *.default
|
|
||||||
cp /opt/nginx/modules/naxsi/naxsi_config/naxsi_core.rules /nginx/naxsi_core.rules
|
|
||||||
cp /opt/ModSecurity/modsecurity.conf-recommended /nginx/modsecurity/modsecurity.conf
|
|
||||||
|
|
||||||
cd /opt/; git clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git
|
|
||||||
cp -a /opt/owasp-modsecurity-crs/rules/ /nginx/modsecurity/
|
|
||||||
cp -a /opt/owasp-modsecurity-crs/crs-setup.conf.example /nginx/modsecurity/crs-setup.conf
|
|
||||||
clear
|
|
||||||
#mkdir -p /tmp/; cd /tmp; wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/iptables/install
|
|
||||||
#chmod +x install; ./install
|
|
||||||
clear
|
|
||||||
sudo apt-get install fail2ban -y
|
|
||||||
sudo service fail2ban stop
|
|
||||||
curl -s https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/iptables/jail.local > /etc/fail2ban/jail.local
|
|
||||||
curl -s https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/iptables/filter.d/nginx-limits.conf > /etc/fail2ban/filter.d/nginx-limits.conf
|
|
||||||
curl -s https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/iptables/filter.d/nginx-ban.conf > /etc/fail2ban/filter.d/nginx-ban.conf
|
|
||||||
touch /nginx/logs/error.log
|
|
||||||
clear
|
|
||||||
sudo service fail2ban start
|
|
||||||
clear
|
|
||||||
|
|
||||||
service fail2ban status
|
|
||||||
nginx -t
|
|
||||||
service nginx stop
|
|
||||||
service nginx start
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
sudo
|
|
||||||
build-essential
|
|
||||||
libssl-dev
|
|
||||||
curl
|
|
||||||
nano
|
|
||||||
wget
|
|
||||||
zip
|
|
||||||
unzip
|
|
||||||
git
|
|
||||||
apt-utils
|
|
||||||
build-essential
|
|
||||||
git
|
|
||||||
checkinstall
|
|
||||||
libpcre3
|
|
||||||
libpcre3-dev
|
|
||||||
zlib1g
|
|
||||||
zlib1g-dbg
|
|
||||||
libxml2
|
|
||||||
zlib1g-dev
|
|
||||||
unzip
|
|
||||||
libicu-dev
|
|
||||||
libcurl4-gnutls-dev
|
|
||||||
libtool
|
|
||||||
libmozjs-24-dev
|
|
||||||
libmozjs-24-bin
|
|
||||||
openssl
|
|
||||||
libssl-dev
|
|
||||||
libperl-dev
|
|
||||||
libexpat-dev
|
|
||||||
mercurial
|
|
||||||
meld
|
|
||||||
libxslt-dev
|
|
||||||
libgd2-xpm
|
|
||||||
libgd2-xpm-dev
|
|
||||||
libgeoip-dev
|
|
||||||
libssl
|
|
||||||
libssl-dev
|
|
||||||
dh-autoreconf
|
|
||||||
software-properties-common
|
|
||||||
python-software-properties
|
|
||||||
libcairo2
|
|
||||||
libcairo2-dev
|
|
||||||
python-dev
|
|
||||||
aptitude
|
|
||||||
libmaxminddb0
|
|
||||||
libmaxminddb-dev
|
|
||||||
mmdb-bin
|
|
||||||
libmysqlclient-dev
|
|
||||||
libmariadbclient-dev
|
|
||||||
g++
|
|
||||||
flex
|
|
||||||
bison
|
|
||||||
curl
|
|
||||||
doxygen
|
|
||||||
libyajl-dev
|
|
||||||
libgeoip-dev
|
|
||||||
libtool
|
|
||||||
dh-autoreconf
|
|
||||||
libcurl4-gnutls-dev
|
|
||||||
libxml2
|
|
||||||
libpcre++-dev
|
|
||||||
libxml2-dev
|
|
||||||
libuuid1
|
|
||||||
uuid-dev
|
|
||||||
libgd-dev
|
|
||||||
libc6
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=The-World-Is-Yours - Nginx L7 Anti-DDoS
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=forking
|
|
||||||
PIDFile=/var/run/nginx.pid
|
|
||||||
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
|
|
||||||
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
|
|
||||||
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
|
|
||||||
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /var/run/nginx.pid
|
|
||||||
TimeoutStopSec=5
|
|
||||||
KillMode=mixed
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
|
|
||||||
sudo add-apt-repository 'deb [arch=amd64] http://mirror.23media.de/mariadb/repo/10.3/ubuntu bionic main'
|
|
||||||
apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y
|
|
||||||
|
|
||||||
sudo apt install mariadb-server
|
|
||||||
|
|
||||||
mysql_secure_installation
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=The-World-Is-Yours - Nginx L7 Anti-DDoS
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=forking
|
|
||||||
PIDFile=/run/nginx.pid
|
|
||||||
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
|
|
||||||
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
|
|
||||||
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
|
|
||||||
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid
|
|
||||||
TimeoutStopSec=5
|
|
||||||
KillMode=mixed
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
export CDN=""
|
|
||||||
|
|
||||||
apt install software-properties-common -y
|
|
||||||
apt install python-software-properties -y
|
|
||||||
sudo add-apt-repository ppa:ondrej/php -y
|
|
||||||
apt update; apt upgrade -y
|
|
||||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C
|
|
||||||
apt update; apt upgrade -y
|
|
||||||
|
|
||||||
# 5.6
|
|
||||||
apt install -y php5.6-fpm
|
|
||||||
apt install -y php5.6 php5.6-common php5.6-cgi php5.6-cli php5.6-dev php5.6-curl
|
|
||||||
apt install -y php5.6-gd php5.6-imap php5.6-intl php5.6-ldap php5.6-mysql
|
|
||||||
apt install -y php5.6-pgsql php5.6-recode php5.6-tidy php5.6-json php5.6-bz2
|
|
||||||
apt install -y php5.6-mcrypt php5.6-readline php5.6-interbase php5.6-xmlrpc
|
|
||||||
apt install -y php5.6-gmp php5.6-xsl php5.6-mbstring php5.6-soap php5.6-xml php5.6-zip
|
|
||||||
|
|
||||||
service php5.6-fpm stop
|
|
||||||
|
|
||||||
curl -s $CDN/5.6/www.conf > /etc/php/5.6/fpm/pool.d/www.conf
|
|
||||||
ex -sc '%s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g|x' /etc/php/5.6/fpm/php.ini
|
|
||||||
ex -sc '%s/output_buffering = 4096/output_buffering = Off/g|x' /etc/php/5.6/fpm/php.ini
|
|
||||||
ex -sc '%s/serialize_precision = 17/serialize_precision = 100/g|x' /etc/php/5.6/fpm/php.ini
|
|
||||||
perl -pi -e 's/error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT/error_reporting = E_ALL/g' /etc/php/5.6/fpm/php.ini
|
|
||||||
perl -pi -e 's/;error_log = syslog/error_log = php_error.log/g' /etc/php/5.6/fpm/php.ini
|
|
||||||
perl -pi -e 's/;date.timezone =/date.timezone = UTC/g' /etc/php/5.6/fpm/php.ini
|
|
||||||
service php5.6-fpm start
|
|
||||||
|
|
||||||
|
|
||||||
# 7.0
|
|
||||||
apt install -y php7.0 php7.0-fpm
|
|
||||||
apt install -y php7.0-common php7.0-cgi php7.0-cli php7.0-phpdbg php7.0-dev php7.0-curl
|
|
||||||
apt install -y php7.0-enchant php7.0-gd php7.0-gmp php7.0-imap php7.0-interbase
|
|
||||||
apt install -y php7.0-intl php7.0-ldap php7.0-mcrypt php7.0-readline php7.0-odbc
|
|
||||||
apt install -y php7.0-pgsql php7.0-pspell php7.0-recode php7.0-snmp php7.0-tidy
|
|
||||||
apt install -y php7.0-xmlrpc php7.0-xsl php7.0-json php7.0-sybase php7.0-sqlite3
|
|
||||||
apt install -y php7.0-mysql php7.0-bz2 php7.0-bcmath php7.0-mbstring php7.0-soap
|
|
||||||
apt install -y php7.0-xml php7.0-zip php7.0-dba
|
|
||||||
|
|
||||||
service php7.0-fpm stop
|
|
||||||
|
|
||||||
curl -s $CDN/7.0/www.conf > /etc/php/7.0/fpm/pool.d/www.conf
|
|
||||||
ex -sc '%s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g|x' /etc/php/7.0/fpm/php.ini
|
|
||||||
ex -sc '%s/output_buffering = 4096/output_buffering = Off/g|x' /etc/php/7.0/fpm/php.ini
|
|
||||||
perl -pi -e 's/error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT/error_reporting = E_ALL/g' /etc/php/7.0/fpm/php.ini
|
|
||||||
perl -pi -e 's/;error_log = syslog/error_log = php_error.log/g' /etc/php/7.0/fpm/php.ini
|
|
||||||
perl -pi -e 's/;date.timezone =/date.timezone = UTC/g' /etc/php/7.0/fpm/php.ini
|
|
||||||
service php7.0-fpm start
|
|
||||||
|
|
||||||
|
|
||||||
#Clean up.
|
|
||||||
apt-get remove php7.3-common php7.3-xml -y; apt-get autoremove -y
|
|
||||||
rm -Rf /etc/php/7.3
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
[php56]
|
|
||||||
;prefix = /path/to/pools/$pool
|
|
||||||
user = nginx
|
|
||||||
group = nginx
|
|
||||||
listen = 127.0.0.1:9000
|
|
||||||
listen.backlog = 65535
|
|
||||||
|
|
||||||
listen.owner = nginx
|
|
||||||
listen.group = nginx
|
|
||||||
;listen.mode = 0660
|
|
||||||
;listen.acl_users =
|
|
||||||
;listen.acl_groups =
|
|
||||||
listen.allowed_clients = 127.0.0.1
|
|
||||||
|
|
||||||
pm = ondemand
|
|
||||||
pm.max_children = 200
|
|
||||||
pm.start_servers = 5
|
|
||||||
pm.min_spare_servers = 10
|
|
||||||
pm.max_spare_servers = 200
|
|
||||||
pm.process_idle_timeout = 2s;
|
|
||||||
pm.max_requests = 1000
|
|
||||||
;pm.status_path = /status
|
|
||||||
;ping.path = /ping
|
|
||||||
;ping.response = pong
|
|
||||||
;access.log = log/$pool.access.log
|
|
||||||
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
|
|
||||||
;slowlog = log/$pool.log.slow
|
|
||||||
;request_slowlog_timeout = 0
|
|
||||||
;request_terminate_timeout = 0
|
|
||||||
;rlimit_files = 1024
|
|
||||||
;rlimit_core = 0
|
|
||||||
;chroot =
|
|
||||||
;chdir = /var/www
|
|
||||||
;catch_workers_output = yes
|
|
||||||
;clear_env = no
|
|
||||||
|
|
||||||
security.limit_extensions = .php
|
|
||||||
env[HOSTNAME] = $HOSTNAME
|
|
||||||
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
|
||||||
env[TMP] = /tmp
|
|
||||||
env[TMPDIR] = /tmp
|
|
||||||
env[TEMP] = /tmp
|
|
||||||
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
|
|
||||||
;php_flag[display_errors] = off
|
|
||||||
;php_admin_value[error_log] = /var/log/fpm-php.www.log
|
|
||||||
;php_admin_flag[log_errors] = on
|
|
||||||
php_admin_value[memory_limit] = 128M
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
[php70]
|
|
||||||
;prefix = /path/to/pools/$pool
|
|
||||||
user = nginx
|
|
||||||
group = nginx
|
|
||||||
listen = 127.0.0.1:9100
|
|
||||||
listen.backlog = 65535
|
|
||||||
listen.owner = nginx
|
|
||||||
listen.group = nginx
|
|
||||||
;listen.mode = 0660
|
|
||||||
;listen.acl_users =
|
|
||||||
;listen.acl_groups =
|
|
||||||
listen.allowed_clients = 127.0.0.1
|
|
||||||
; process.priority = -19
|
|
||||||
; process.dumpable = yes
|
|
||||||
|
|
||||||
|
|
||||||
pm = ondemand
|
|
||||||
pm.max_children = 200
|
|
||||||
pm.start_servers = 5
|
|
||||||
pm.min_spare_servers = 10
|
|
||||||
pm.max_spare_servers = 200
|
|
||||||
pm.process_idle_timeout = 2s;
|
|
||||||
pm.max_requests = 1000
|
|
||||||
|
|
||||||
|
|
||||||
;pm.status_path = /status
|
|
||||||
;ping.path = /ping
|
|
||||||
;ping.response = pong
|
|
||||||
|
|
||||||
; enable those logs if you have cpu or other problems are helpful but disable after you're done
|
|
||||||
; because having a lot of logs on it means more resources will be used!
|
|
||||||
;access.log = /var/log/php_debug_70.log
|
|
||||||
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
|
|
||||||
;slowlog = log/$pool.log.slow
|
|
||||||
;request_slowlog_timeout = 0
|
|
||||||
;request_terminate_timeout = 0
|
|
||||||
;rlimit_files = 1024
|
|
||||||
;rlimit_core = 0
|
|
||||||
;chroot =
|
|
||||||
;chdir = /var/www
|
|
||||||
;catch_workers_output = yes
|
|
||||||
;clear_env = no
|
|
||||||
|
|
||||||
|
|
||||||
security.limit_extensions = .php
|
|
||||||
env[HOSTNAME] = $HOSTNAME
|
|
||||||
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
|
||||||
env[TMP] = /tmp
|
|
||||||
env[TMPDIR] = /tmp
|
|
||||||
env[TEMP] = /tmp
|
|
||||||
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
|
|
||||||
;php_flag[display_errors] = off
|
|
||||||
;php_admin_value[error_log] = /var/log/fpm-php.www.log
|
|
||||||
;php_admin_flag[log_errors] = on
|
|
||||||
php_admin_value[memory_limit] = 128M
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Pre-Builds
|
|
||||||
Binary file not shown.
@@ -1,37 +1,116 @@
|
|||||||
# Nginx L7 DDoS Protection! :boom: :zap:
|
# Nginx L7 DDoS Protection! :boom: :zap:
|
||||||
*(Please Read Whole Page, All Things Are Important Then If You Want You Can Use IT.)*
|
*(Please Read Whole Page, All Things Are Important Then If You Want You Can Use IT.)*
|
||||||
|
|
||||||
|
# This is it!
|
||||||
|
There will be no other version of this PR, This is the only and one and the best that you can find for free where you can see/do/change anything on your will and not some encrypted piece of code! This is pure open source code as you can open any file and read anything, This script automatically compiles nginx from source with lots of modules helpful but mostly who play a big role in L7 Anti-DDoS, including the L7 nginx module which you can configure as simple as https://github.com/theraw/The-World-Is-Yours/issues/10#issuecomment-442579528 more then that consider a [Donate](https://github.com/theraw/The-World-Is-Yours/blob/master/.github/FUNDING.yml) and you can contact me for further support!
|
||||||
|
|
||||||
|
Summer is here, after that i may be working and i don't see having much of free time to play with nginx!
|
||||||
|
|
||||||
# To-Do
|
# To-Do
|
||||||
|
|
||||||
- [x] Nginx V. each 10th release, current 1.60.0, next repo release 1.70.0!
|
- [x] Nginx Version, Always Latest.
|
||||||
- [x] Support Ubuntu Bionic. (18.04)
|
- [x] Support Ubuntu Trusty. (14.04)
|
||||||
|
- [x] Support Ubuntu Xenial. (16.04)
|
||||||
|
- [x] Support Ubuntu Cosmic. (18.10)
|
||||||
|
- [x] Support Arch Linux.
|
||||||
- [x] ModSecurity Support.
|
- [x] ModSecurity Support.
|
||||||
- [x] Naxsi Support.
|
- [x] Naxsi Support.
|
||||||
- [x] L7 Protection.
|
- [x] L7 Protection.
|
||||||
- [x] AutoBan System.
|
- [x] AutoBan System.
|
||||||
- [x] Integrate Fail2Ban > IpTables.
|
- [x] Integrate Fail2Ban > IpTables.
|
||||||
- [-] L7 Protection (TestCookie Module) Add Recaptcha!
|
|
||||||
- [-/x] [Suggestions](https://github.com/theraw/The-World-Is-Yours/issues)
|
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
For each new system ubuntu, centos or whatever your distro may be you need a update/upgrade then do one reboot! So outdates packages will be up to date your kernel will be up to date and not needed files will get removed.
|
|
||||||
|
|
||||||
X. **`Ubuntu`**
|
1. **`apt-get install build-essential libssl-dev curl nano wget zip unzip sudo git psmisc -y`**
|
||||||
|
|
||||||
1. **`apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; shutdown -r now`**
|
2. **`git clone https://github.com/theraw/The-World-Is-Yours.git`**
|
||||||
|
|
||||||
2. **`apt-get install build-essential libssl-dev curl nano wget zip unzip sudo git psmisc -y`**
|
3. **`cd The-World-Is-Yours/; chmod +x *`**
|
||||||
|
|
||||||
3. **[Install Docker](https://docs.docker.com/install/linux/docker-ce/ubuntu/)**
|
4. **`./install`**
|
||||||
|
|
||||||
4. **[Install Docker-Composer](https://github.com/docker/compose/releases) use latest version > execute provided cmds**
|
|
||||||
|
|
||||||
5. **`curl -s https:// > nginx.yml`**
|
|
||||||
|
|
||||||
6. **`docker-compose -f nginx.yml up -d`**
|
|
||||||
|
|
||||||
|
|
||||||
|
# Informations.
|
||||||
|
|
||||||
|
**What if installation script fails?** - Check what was the problem source fix it (mostly should be for missing packages) then remove everything under /opt/ folder and just execute again ./install
|
||||||
|
|
||||||
|
```
|
||||||
|
=> /nginx/ = Nginx Path,
|
||||||
|
=> /nginx/live/ = Vhosts Config Files Dir,
|
||||||
|
=> /nginx/logs/ = Core Logs Files,
|
||||||
|
=> /nginx/modsecurity/ = ModSecurity Rules Dir,
|
||||||
|
=> /hostdata/ = Place to store your domain folders.
|
||||||
|
=> /hostdata/yourdomain.com/ = Ex of domain dir (private folder),
|
||||||
|
=> /hostdata/yourdomain.com/public_html/ = Ex of your domain webroot (public files only),
|
||||||
|
=> /hostdata/yourdomain.com/logs/ = Place where to store your Domains logs (access.log) (private folder),
|
||||||
|
=> /hostdata/yourdomain.com/ssl/ = Place where to store domain ssl/key (private folder),
|
||||||
|
=> /hostdata/yourdomain.com/cache/ = Place where to store site cache (private folder).
|
||||||
|
|
||||||
|
// Private Folder - Means this cannot be accessed by public.
|
||||||
|
// Public Folder - Means files into this folder can be accessed by public.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
# Check.
|
||||||
|
|
||||||
|
1 . [L7 (Cookie Based Protection)](https://github.com/theraw/The-World-Is-Yours/blob/master/static/nginx.conf#L15-L42) AND [Replace "proxy2.dope.. links with yours click here to find aes](https://github.com/theraw/The-World-Is-Yours/tree/master/static/vhost) which should be stored on a external link or in a place where L7 is disabled because it will not work if you put it in main site dir!.
|
||||||
|
|
||||||
|
2 . [Auto Ban System](https://github.com/theraw/The-World-Is-Yours/blob/master/iptables/jail.local#L105-L111) based on [Connection for ip](https://github.com/theraw/The-World-Is-Yours/blob/master/static/nginx.conf#L72-L73)
|
||||||
|
|
||||||
|
3 . [Auto Ban 444 Reqs](https://github.com/theraw/The-World-Is-Yours/blob/master/iptables/jail.local#L113-L118) A day i've been under attack of multiple proxies, and even after they got banned they still was keep trying the same thing so when you ban someone when that ip tries to access your website that request will not go on `error.log` but in `access.log` so i created this rule to ban with iptables every request who have stauts `444` so nginx will not have to handle those.
|
||||||
|
|
||||||
|
4 . [Kernel Settings](https://github.com/theraw/The-World-Is-Yours/blob/master/static/sysctl.conf#L1-L34)
|
||||||
|
|
||||||
|
5 . [Naxsi Rules Included](https://github.com/theraw/The-World-Is-Yours/blob/master/static/nginx.conf#L118)
|
||||||
|
|
||||||
|
6 . [Example of Naxsi](https://github.com/theraw/The-World-Is-Yours/blob/master/static/vhost/default#L22-L29)
|
||||||
|
|
||||||
|
7 . [Check Iptables rules](https://github.com/theraw/The-World-Is-Yours/blob/master/iptables/rules) It will not be automatically enabled, because this changes based on providers in ovh it work in azure it doesn't work. so you need to manually activate iptables!
|
||||||
|
|
||||||
|
8 . ModSecurity is not loaded. However you need to set it up by yourself. you have a folder `/nginx/modsecurity/`
|
||||||
|
which ModSecurity rules are stored, open `/nginx/modsecurity/modsecurity.conf` add those
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Include crs-setup.conf
|
||||||
|
Include rules/*.conf
|
||||||
|
```
|
||||||
|
ModSecurity is by default enabled as "detect only" you can turn it on always by doing this
|
||||||
|
|
||||||
|
```bash
|
||||||
|
SecRuleEngine On
|
||||||
|
```
|
||||||
|
|
||||||
|
Using modSecurity for your site
|
||||||
|
```bash
|
||||||
|
server {
|
||||||
|
.....
|
||||||
|
modsecurity on;
|
||||||
|
modsecurity_rules_file /nginx/modsecurity/modsecurity.conf;
|
||||||
|
location / {
|
||||||
|
.....
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
**Careful** Using modsec rules like
|
||||||
|
```
|
||||||
|
location / {
|
||||||
|
modsecurity_rules_file /nginx/modsecurity/modsecurity.conf;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
it means that's enabled just for your main place `/` not for other dirs in your site ex `/admin/` (:
|
||||||
|
|
||||||
|
|
||||||
|
Test it!
|
||||||
|
`curl 'http://localhost/?q="><script>wanna hack</script>'`
|
||||||
|
```html
|
||||||
|
<html>
|
||||||
|
<head><title>403 Forbidden</title></head>
|
||||||
|
<body bgcolor="white">
|
||||||
|
<center><h1>403 Forbidden</h1></center>
|
||||||
|
<hr><center>nginx</center>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
```
|
||||||
|
|
||||||
# Keep In Mind.
|
# Keep In Mind.
|
||||||
The **L7 Protection** is the same way which **cloudflare** have that banner "Under Attack" A.K.A Cookie based authorization. Most of bots from where attacks will come doesn't support cookies so it will fail to access your site. (Test it by yourself to "curl http://yoursite.com" before you activate L7 and after you start L7 so you will understand better.)
|
The **L7 Protection** is the same way which **cloudflare** have that banner "Under Attack" A.K.A Cookie based authorization. Most of bots from where attacks will come doesn't support cookies so it will fail to access your site. (Test it by yourself to "curl http://yoursite.com" before you activate L7 and after you start L7 so you will understand better.)
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
export nginxVersion='1.16.0'
|
|
||||||
export nginxIndex='https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/html/index.html'
|
|
||||||
export nginxGeoDB='https://github.com/theraw/The-World-Is-Yours/raw/master/static/GeoLite2-Country.mmdb'
|
|
||||||
export ubuntu18build='https://github.com/theraw/The-World-Is-Yours/raw/v2/OS/Ubuntu/18.04/source/nginx.zip'
|
|
||||||
export ubuntu18nginxconf='https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/nginx.conf'
|
|
||||||
export ubuntu18defauconf='https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/vhost/default'
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
[Definition]
|
|
||||||
|
|
||||||
failregex = ^.*client: <HOST>.* 444.*$
|
|
||||||
|
|
||||||
ignoreregex =
|
|
||||||
@@ -1,472 +0,0 @@
|
|||||||
|
|
||||||
[DEFAULT]
|
|
||||||
ignoreip = 127.0.0.1/8
|
|
||||||
|
|
||||||
# "bantime" is the number of seconds that a host is banned.
|
|
||||||
bantime = 1200
|
|
||||||
|
|
||||||
# A host is banned if it has generated "maxretry" during the last "findtime"
|
|
||||||
# seconds.
|
|
||||||
findtime = 600
|
|
||||||
maxretry = 3
|
|
||||||
|
|
||||||
# "backend" specifies the backend used to get files modification.
|
|
||||||
# Available options are "pyinotify", "gamin", "polling" and "auto".
|
|
||||||
# This option can be overridden in each jail as well.
|
|
||||||
#
|
|
||||||
# pyinotify: requires pyinotify (a file alteration monitor) to be installed.
|
|
||||||
# If pyinotify is not installed, Fail2ban will use auto.
|
|
||||||
# gamin: requires Gamin (a file alteration monitor) to be installed.
|
|
||||||
# If Gamin is not installed, Fail2ban will use auto.
|
|
||||||
# polling: uses a polling algorithm which does not require external libraries.
|
|
||||||
# auto: will try to use the following backends, in order:
|
|
||||||
# pyinotify, gamin, polling.
|
|
||||||
backend = auto
|
|
||||||
|
|
||||||
# "usedns" specifies if jails should trust hostnames in logs,
|
|
||||||
# warn when reverse DNS lookups are performed, or ignore all hostnames in logs
|
|
||||||
#
|
|
||||||
# yes: if a hostname is encountered, a reverse DNS lookup will be performed.
|
|
||||||
# warn: if a hostname is encountered, a reverse DNS lookup will be performed,
|
|
||||||
# but it will be logged as a warning.
|
|
||||||
# no: if a hostname is encountered, will not be used for banning,
|
|
||||||
# but it will be logged as info.
|
|
||||||
usedns = warn
|
|
||||||
|
|
||||||
# Destination email address used solely for the interpolations in
|
|
||||||
# jail.{conf,local} configuration files.
|
|
||||||
destemail = root@localhost
|
|
||||||
|
|
||||||
# Name of the sender for mta actions
|
|
||||||
sendername = Fail2Ban
|
|
||||||
|
|
||||||
# ACTIONS
|
|
||||||
|
|
||||||
# Default banning action (e.g. iptables, iptables-new,
|
|
||||||
# iptables-multiport, shorewall, etc) It is used to define
|
|
||||||
# action_* variables. Can be overridden globally or per
|
|
||||||
# section within jail.local file
|
|
||||||
banaction = iptables-multiport
|
|
||||||
|
|
||||||
# email action. Since 0.8.1 upstream fail2ban uses sendmail
|
|
||||||
# MTA for the mailing. Change mta configuration parameter to mail
|
|
||||||
# if you want to revert to conventional 'mail'.
|
|
||||||
mta = sendmail
|
|
||||||
|
|
||||||
# Default protocol
|
|
||||||
protocol = tcp
|
|
||||||
|
|
||||||
# Specify chain where jumps would need to be added in iptables-* actions
|
|
||||||
chain = INPUT
|
|
||||||
|
|
||||||
#
|
|
||||||
# Action shortcuts. To be used to define action parameter
|
|
||||||
|
|
||||||
# The simplest action to take: ban only
|
|
||||||
action_ = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
|
|
||||||
|
|
||||||
# ban & send an e-mail with whois report to the destemail.
|
|
||||||
action_mw = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
|
|
||||||
%(mta)s-whois[name=%(__name__)s, dest="%(destemail)s", protocol="%(protocol)s", chain="%(chain)s", sendername="%(sendername)s"]
|
|
||||||
|
|
||||||
# ban & send an e-mail with whois report and relevant log lines
|
|
||||||
# to the destemail.
|
|
||||||
action_mwl = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
|
|
||||||
%(mta)s-whois-lines[name=%(__name__)s, dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s", sendername="%(sendername)s"]
|
|
||||||
|
|
||||||
# Choose default action. To change, just override value of 'action' with the
|
|
||||||
# interpolation to the chosen action shortcut (e.g. action_mw, action_mwl, etc) in jail.local
|
|
||||||
# globally (section [DEFAULT]) or per specific section
|
|
||||||
action = %(action_)s
|
|
||||||
|
|
||||||
#
|
|
||||||
# JAILS
|
|
||||||
#
|
|
||||||
|
|
||||||
# Next jails corresponds to the standard configuration in Fail2ban 0.6 which
|
|
||||||
# was shipped in Debian. Enable any defined here jail by including
|
|
||||||
#
|
|
||||||
# [SECTION_NAME]
|
|
||||||
# enabled = true
|
|
||||||
|
|
||||||
#
|
|
||||||
# in /etc/fail2ban/jail.local.
|
|
||||||
#
|
|
||||||
# Optionally you may override any other parameter (e.g. banaction,
|
|
||||||
# action, port, logpath, etc) in that section within jail.local
|
|
||||||
|
|
||||||
[ssh]
|
|
||||||
|
|
||||||
enabled = true
|
|
||||||
port = ssh
|
|
||||||
filter = sshd
|
|
||||||
logpath = /var/log/auth.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[nginx-limits]
|
|
||||||
|
|
||||||
enabled = true
|
|
||||||
port = http,https
|
|
||||||
filter = nginx-limits
|
|
||||||
logpath = /hostdata/*/logs/error.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[nginx-ban]
|
|
||||||
enabled = true
|
|
||||||
port = http,https
|
|
||||||
filter = nginx-ban
|
|
||||||
logpath = /hostdata/*/logs/access.log
|
|
||||||
maxretry = 1
|
|
||||||
|
|
||||||
[dropbear]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ssh
|
|
||||||
filter = dropbear
|
|
||||||
logpath = /var/log/auth.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
# Generic filter for pam. Has to be used with action which bans all ports
|
|
||||||
# such as iptables-allports, shorewall
|
|
||||||
[pam-generic]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
# pam-generic filter can be customized to monitor specific subset of 'tty's
|
|
||||||
filter = pam-generic
|
|
||||||
# port actually must be irrelevant but lets leave it all for some possible uses
|
|
||||||
port = all
|
|
||||||
banaction = iptables-allports
|
|
||||||
port = anyport
|
|
||||||
logpath = /var/log/auth.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[xinetd-fail]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = xinetd-fail
|
|
||||||
port = all
|
|
||||||
banaction = iptables-multiport-log
|
|
||||||
logpath = /var/log/daemon.log
|
|
||||||
maxretry = 2
|
|
||||||
|
|
||||||
|
|
||||||
[ssh-ddos]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ssh
|
|
||||||
filter = sshd-ddos
|
|
||||||
logpath = /var/log/auth.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
|
|
||||||
# Here we use blackhole routes for not requiring any additional kernel support
|
|
||||||
# to store large volumes of banned IPs
|
|
||||||
|
|
||||||
[ssh-route]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = sshd
|
|
||||||
action = route
|
|
||||||
logpath = /var/log/sshd.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
# Here we use a combination of Netfilter/Iptables and IPsets
|
|
||||||
# for storing large volumes of banned IPs
|
|
||||||
#
|
|
||||||
# IPset comes in two versions. See ipset -V for which one to use
|
|
||||||
# requires the ipset package and kernel support.
|
|
||||||
[ssh-iptables-ipset4]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ssh
|
|
||||||
filter = sshd
|
|
||||||
banaction = iptables-ipset-proto4
|
|
||||||
logpath = /var/log/sshd.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[ssh-iptables-ipset6]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ssh
|
|
||||||
filter = sshd
|
|
||||||
banaction = iptables-ipset-proto6
|
|
||||||
logpath = /var/log/sshd.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# HTTP servers
|
|
||||||
#
|
|
||||||
|
|
||||||
[apache]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = apache-auth
|
|
||||||
logpath = /var/log/apache*/*error.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
# default action is now multiport, so apache-multiport jail was left
|
|
||||||
# for compatibility with previous (<0.7.6-2) releases
|
|
||||||
[apache-multiport]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = apache-auth
|
|
||||||
logpath = /var/log/apache*/*error.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[apache-noscript]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = apache-noscript
|
|
||||||
logpath = /var/log/apache*/*error.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[apache-overflows]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = apache-overflows
|
|
||||||
logpath = /var/log/apache*/*error.log
|
|
||||||
maxretry = 2
|
|
||||||
|
|
||||||
# Ban attackers that try to use PHP's URL-fopen() functionality
|
|
||||||
# through GET/POST variables. - Experimental, with more than a year
|
|
||||||
# of usage in production environments.
|
|
||||||
|
|
||||||
[php-url-fopen]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = php-url-fopen
|
|
||||||
logpath = /var/www/*/logs/access_log
|
|
||||||
|
|
||||||
# A simple PHP-fastcgi jail which works with lighttpd.
|
|
||||||
# If you run a lighttpd server, then you probably will
|
|
||||||
# find these kinds of messages in your error_log:
|
|
||||||
# ALERT – tried to register forbidden variable ‘GLOBALS’
|
|
||||||
# through GET variables (attacker '1.2.3.4', file '/var/www/default/htdocs/index.php')
|
|
||||||
|
|
||||||
[lighttpd-fastcgi]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = lighttpd-fastcgi
|
|
||||||
logpath = /var/log/lighttpd/error.log
|
|
||||||
|
|
||||||
# Same as above for mod_auth
|
|
||||||
# It catches wrong authentifications
|
|
||||||
|
|
||||||
[lighttpd-auth]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = suhosin
|
|
||||||
logpath = /var/log/lighttpd/error.log
|
|
||||||
|
|
||||||
[nginx-http-auth]
|
|
||||||
|
|
||||||
enabled = true
|
|
||||||
filter = nginx-http-auth
|
|
||||||
port = http,https
|
|
||||||
logpath = /var/log/nginx/error.log
|
|
||||||
|
|
||||||
# Monitor roundcube server
|
|
||||||
|
|
||||||
[roundcube-auth]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = roundcube-auth
|
|
||||||
port = http,https
|
|
||||||
logpath = /var/log/roundcube/userlogins
|
|
||||||
|
|
||||||
|
|
||||||
[sogo-auth]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = sogo-auth
|
|
||||||
port = http, https
|
|
||||||
# without proxy this would be:
|
|
||||||
# port = 20000
|
|
||||||
logpath = /var/log/sogo/sogo.log
|
|
||||||
|
|
||||||
|
|
||||||
# FTP servers
|
|
||||||
|
|
||||||
[vsftpd]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ftp,ftp-data,ftps,ftps-data
|
|
||||||
filter = vsftpd
|
|
||||||
logpath = /var/log/vsftpd.log
|
|
||||||
# or overwrite it in jails.local to be
|
|
||||||
# logpath = /var/log/auth.log
|
|
||||||
# if you want to rely on PAM failed login attempts
|
|
||||||
# vsftpd's failregex should match both of those formats
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
|
|
||||||
[proftpd]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ftp,ftp-data,ftps,ftps-data
|
|
||||||
filter = proftpd
|
|
||||||
logpath = /var/log/proftpd/proftpd.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
|
|
||||||
[pure-ftpd]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ftp,ftp-data,ftps,ftps-data
|
|
||||||
filter = pure-ftpd
|
|
||||||
logpath = /var/log/syslog
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
|
|
||||||
[wuftpd]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ftp,ftp-data,ftps,ftps-data
|
|
||||||
filter = wuftpd
|
|
||||||
logpath = /var/log/syslog
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
|
|
||||||
# Mail servers
|
|
||||||
|
|
||||||
[postfix]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = smtp,ssmtp,submission
|
|
||||||
filter = postfix
|
|
||||||
logpath = /var/log/mail.log
|
|
||||||
|
|
||||||
|
|
||||||
[couriersmtp]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = smtp,ssmtp,submission
|
|
||||||
filter = couriersmtp
|
|
||||||
logpath = /var/log/mail.log
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Mail servers authenticators: might be used for smtp,ftp,imap servers, so
|
|
||||||
# all relevant ports get banned
|
|
||||||
#
|
|
||||||
|
|
||||||
[courierauth]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = smtp,ssmtp,submission,imap2,imap3,imaps,pop3,pop3s
|
|
||||||
filter = courierlogin
|
|
||||||
logpath = /var/log/mail.log
|
|
||||||
|
|
||||||
|
|
||||||
[sasl]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = smtp,ssmtp,submission,imap2,imap3,imaps,pop3,pop3s
|
|
||||||
filter = postfix-sasl
|
|
||||||
# You might consider monitoring /var/log/mail.warn instead if you are
|
|
||||||
# running postfix since it would provide the same log lines at the
|
|
||||||
# "warn" level but overall at the smaller filesize.
|
|
||||||
logpath = /var/log/mail.log
|
|
||||||
|
|
||||||
[dovecot]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = smtp,ssmtp,submission,imap2,imap3,imaps,pop3,pop3s
|
|
||||||
filter = dovecot
|
|
||||||
logpath = /var/log/mail.log
|
|
||||||
|
|
||||||
# To log wrong MySQL access attempts add to /etc/my.cnf:
|
|
||||||
# log-error=/var/log/mysqld.log
|
|
||||||
# log-warning = 2
|
|
||||||
[mysqld-auth]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = mysqld-auth
|
|
||||||
port = 3306
|
|
||||||
logpath = /var/log/mysqld.log
|
|
||||||
|
|
||||||
|
|
||||||
# DNS Servers
|
|
||||||
|
|
||||||
|
|
||||||
# These jails block attacks against named (bind9). By default, logging is off
|
|
||||||
# with bind9 installation. You will need something like this:
|
|
||||||
#
|
|
||||||
# logging {
|
|
||||||
# channel security_file {
|
|
||||||
# file "/var/log/named/security.log" versions 3 size 30m;
|
|
||||||
# severity dynamic;
|
|
||||||
# print-time yes;
|
|
||||||
# };
|
|
||||||
# category security {
|
|
||||||
# security_file;
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# in your named.conf to provide proper logging
|
|
||||||
|
|
||||||
# !!! WARNING !!!
|
|
||||||
# Since UDP is connection-less protocol, spoofing of IP and imitation
|
|
||||||
# of illegal actions is way too simple. Thus enabling of this filter
|
|
||||||
# might provide an easy way for implementing a DoS against a chosen
|
|
||||||
# victim. See
|
|
||||||
# http://nion.modprobe.de/blog/archives/690-fail2ban-+-dns-fail.html
|
|
||||||
# Please DO NOT USE this jail unless you know what you are doing.
|
|
||||||
#[named-refused-udp]
|
|
||||||
#
|
|
||||||
#enabled = false
|
|
||||||
#port = domain,953
|
|
||||||
#protocol = udp
|
|
||||||
#filter = named-refused
|
|
||||||
#logpath = /var/log/named/security.log
|
|
||||||
|
|
||||||
[named-refused-tcp]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = domain,953
|
|
||||||
protocol = tcp
|
|
||||||
filter = named-refused
|
|
||||||
logpath = /var/log/named/security.log
|
|
||||||
|
|
||||||
# Multiple jails, 1 per protocol, are necessary ATM:
|
|
||||||
# see https://github.com/fail2ban/fail2ban/issues/37
|
|
||||||
[asterisk-tcp]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = asterisk
|
|
||||||
port = 5060,5061
|
|
||||||
protocol = tcp
|
|
||||||
logpath = /var/log/asterisk/messages
|
|
||||||
|
|
||||||
[asterisk-udp]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = asterisk
|
|
||||||
port = 5060,5061
|
|
||||||
protocol = udp
|
|
||||||
logpath = /var/log/asterisk/messages
|
|
||||||
|
|
||||||
|
|
||||||
# Jail for more extended banning of persistent abusers
|
|
||||||
# !!! WARNING !!!
|
|
||||||
# Make sure that your loglevel specified in fail2ban.conf/.local
|
|
||||||
# is not at DEBUG level -- which might then cause fail2ban to fall into
|
|
||||||
# an infinite loop constantly feeding itself with non-informative lines
|
|
||||||
[recidive]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = recidive
|
|
||||||
logpath = /var/log/fail2ban.log
|
|
||||||
action = iptables-allports[name=recidive]
|
|
||||||
sendmail-whois-lines[name=recidive, logpath=/var/log/fail2ban.log]
|
|
||||||
bantime = 604800 ; 1 week
|
|
||||||
findtime = 86400 ; 1 day
|
|
||||||
maxretry = 5
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
[Definition]
|
|
||||||
|
|
||||||
failregex = ^.*client: <HOST>.* 444.*$
|
|
||||||
|
|
||||||
ignoreregex =
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
# fail2ban filter configuration for nginx limit connection for ip.
|
|
||||||
|
|
||||||
|
|
||||||
[Definition]
|
|
||||||
|
|
||||||
failregex = ^.*client: <HOST>.*$
|
|
||||||
|
|
||||||
ignoreregex =
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
[Definition]
|
|
||||||
|
|
||||||
failregex = ^.*client: <HOST>.* 400.*$
|
|
||||||
|
|
||||||
ignoreregex =
|
|
||||||
@@ -1,333 +0,0 @@
|
|||||||
[DEFAULT]
|
|
||||||
bantime = 3600
|
|
||||||
findtime = 1
|
|
||||||
maxretry = 2
|
|
||||||
|
|
||||||
backend = auto
|
|
||||||
usedns = warn
|
|
||||||
|
|
||||||
destemail = root@localhost
|
|
||||||
sendername = Fail2Ban
|
|
||||||
|
|
||||||
banaction = iptables-multiport
|
|
||||||
|
|
||||||
mta = sendmail
|
|
||||||
|
|
||||||
protocol = tcp
|
|
||||||
|
|
||||||
chain = INPUT
|
|
||||||
|
|
||||||
action_ = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
|
|
||||||
action_mw = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
|
|
||||||
%(mta)s-whois[name=%(__name__)s, dest="%(destemail)s", protocol="%(protocol)s", chain="%(chain)s", sendername="%(sendername)s"]
|
|
||||||
action_mwl = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
|
|
||||||
%(mta)s-whois-lines[name=%(__name__)s, dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s", sendername="%(sendername)s"]
|
|
||||||
action = %(action_)s
|
|
||||||
|
|
||||||
[ssh]
|
|
||||||
|
|
||||||
enabled = true
|
|
||||||
port = ssh
|
|
||||||
filter = sshd
|
|
||||||
logpath = /var/log/auth.log
|
|
||||||
maxretry = 3
|
|
||||||
|
|
||||||
[nginx-limits]
|
|
||||||
|
|
||||||
enabled = true
|
|
||||||
port = http,https
|
|
||||||
filter = nginx-limits
|
|
||||||
logpath = /hostdata/*/logs/error.log
|
|
||||||
maxretry = 3
|
|
||||||
|
|
||||||
[nginx-ban]
|
|
||||||
enabled = true
|
|
||||||
port = http,https
|
|
||||||
filter = nginx-ban
|
|
||||||
logpath = /hostdata/*/logs/access.log
|
|
||||||
maxretry = 3
|
|
||||||
|
|
||||||
[nginx-raw]
|
|
||||||
enabled = true
|
|
||||||
port = http,https
|
|
||||||
filter = nginx-raw
|
|
||||||
logpath = /hostdata/*/logs/access.log
|
|
||||||
maxretry = 3
|
|
||||||
|
|
||||||
[dropbear]
|
|
||||||
|
|
||||||
enabled = true
|
|
||||||
port = ssh
|
|
||||||
filter = dropbear
|
|
||||||
logpath = /var/log/auth.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[pam-generic]
|
|
||||||
|
|
||||||
enabled = true
|
|
||||||
filter = pam-generic
|
|
||||||
port = all
|
|
||||||
banaction = iptables-allports
|
|
||||||
#port = anyport
|
|
||||||
logpath = /var/log/auth.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[xinetd-fail]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = xinetd-fail
|
|
||||||
port = all
|
|
||||||
banaction = iptables-multiport-log
|
|
||||||
logpath = /var/log/daemon.log
|
|
||||||
maxretry = 2
|
|
||||||
|
|
||||||
|
|
||||||
[ssh-route]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = sshd
|
|
||||||
action = route
|
|
||||||
logpath = /var/log/sshd.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[ssh-iptables-ipset4]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ssh
|
|
||||||
filter = sshd
|
|
||||||
banaction = iptables-ipset-proto4
|
|
||||||
logpath = /var/log/sshd.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[ssh-iptables-ipset6]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ssh
|
|
||||||
filter = sshd
|
|
||||||
banaction = iptables-ipset-proto6
|
|
||||||
logpath = /var/log/sshd.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
|
|
||||||
[apache]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = apache-auth
|
|
||||||
logpath = /var/log/apache*/*error.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[apache-multiport]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = apache-auth
|
|
||||||
logpath = /var/log/apache*/*error.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[apache-noscript]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = apache-noscript
|
|
||||||
logpath = /var/log/apache*/*error.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
[apache-overflows]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = apache-overflows
|
|
||||||
logpath = /var/log/apache*/*error.log
|
|
||||||
maxretry = 2
|
|
||||||
|
|
||||||
[php-url-fopen]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = php-url-fopen
|
|
||||||
logpath = /var/www/*/logs/access_log
|
|
||||||
|
|
||||||
[lighttpd-fastcgi]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = lighttpd-fastcgi
|
|
||||||
logpath = /var/log/lighttpd/error.log
|
|
||||||
|
|
||||||
# Same as above for mod_auth
|
|
||||||
# It catches wrong authentifications
|
|
||||||
|
|
||||||
[lighttpd-auth]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = http,https
|
|
||||||
filter = suhosin
|
|
||||||
logpath = /var/log/lighttpd/error.log
|
|
||||||
|
|
||||||
[nginx-http-auth]
|
|
||||||
|
|
||||||
enabled = true
|
|
||||||
filter = nginx-http-auth
|
|
||||||
port = http,https
|
|
||||||
logpath = /var/log/nginx/error.log
|
|
||||||
|
|
||||||
[roundcube-auth]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = roundcube-auth
|
|
||||||
port = http,https
|
|
||||||
logpath = /var/log/roundcube/userlogins
|
|
||||||
|
|
||||||
|
|
||||||
[sogo-auth]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = sogo-auth
|
|
||||||
port = http, https
|
|
||||||
# without proxy this would be:
|
|
||||||
# port = 20000
|
|
||||||
logpath = /var/log/sogo/sogo.log
|
|
||||||
|
|
||||||
|
|
||||||
[vsftpd]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ftp,ftp-data,ftps,ftps-data
|
|
||||||
filter = vsftpd
|
|
||||||
logpath = /var/log/vsftpd.log
|
|
||||||
# or overwrite it in jails.local to be
|
|
||||||
# logpath = /var/log/auth.log
|
|
||||||
# if you want to rely on PAM failed login attempts
|
|
||||||
# vsftpd's failregex should match both of those formats
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
|
|
||||||
[proftpd]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ftp,ftp-data,ftps,ftps-data
|
|
||||||
filter = proftpd
|
|
||||||
logpath = /var/log/proftpd/proftpd.log
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
|
|
||||||
[pure-ftpd]
|
|
||||||
|
|
||||||
enabled = true
|
|
||||||
port = ftp,ftp-data,ftps,ftps-data
|
|
||||||
filter = pure-ftpd
|
|
||||||
logpath = /var/log/syslog
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
|
|
||||||
[wuftpd]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = ftp,ftp-data,ftps,ftps-data
|
|
||||||
filter = wuftpd
|
|
||||||
logpath = /var/log/syslog
|
|
||||||
maxretry = 6
|
|
||||||
|
|
||||||
|
|
||||||
[postfix]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = smtp,ssmtp,submission
|
|
||||||
filter = postfix
|
|
||||||
logpath = /var/log/mail.log
|
|
||||||
|
|
||||||
|
|
||||||
[couriersmtp]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = smtp,ssmtp,submission
|
|
||||||
filter = couriersmtp
|
|
||||||
logpath = /var/log/mail.log
|
|
||||||
|
|
||||||
[courierauth]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = smtp,ssmtp,submission,imap2,imap3,imaps,pop3,pop3s
|
|
||||||
filter = courierlogin
|
|
||||||
logpath = /var/log/mail.log
|
|
||||||
|
|
||||||
|
|
||||||
[sasl]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = smtp,ssmtp,submission,imap2,imap3,imaps,pop3,pop3s
|
|
||||||
filter = postfix-sasl
|
|
||||||
# You might consider monitoring /var/log/mail.warn instead if you are
|
|
||||||
# running postfix since it would provide the same log lines at the
|
|
||||||
# "warn" level but overall at the smaller filesize.
|
|
||||||
logpath = /var/log/mail.log
|
|
||||||
|
|
||||||
[dovecot]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = smtp,ssmtp,submission,imap2,imap3,imaps,pop3,pop3s
|
|
||||||
filter = dovecot
|
|
||||||
logpath = /var/log/mail.log
|
|
||||||
|
|
||||||
# To log wrong MySQL access attempts add to /etc/my.cnf:
|
|
||||||
# log-error=/var/log/mysqld.log
|
|
||||||
# log-warning = 2
|
|
||||||
[mysqld-auth]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = mysqld-auth
|
|
||||||
port = 3306
|
|
||||||
logpath = /var/log/mysqld.log
|
|
||||||
|
|
||||||
|
|
||||||
#[named-refused-udp]
|
|
||||||
#
|
|
||||||
#enabled = false
|
|
||||||
#port = domain,953
|
|
||||||
#protocol = udp
|
|
||||||
#filter = named-refused
|
|
||||||
#logpath = /var/log/named/security.log
|
|
||||||
|
|
||||||
[named-refused-tcp]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
port = domain,953
|
|
||||||
protocol = tcp
|
|
||||||
filter = named-refused
|
|
||||||
logpath = /var/log/named/security.log
|
|
||||||
|
|
||||||
# Multiple jails, 1 per protocol, are necessary ATM:
|
|
||||||
# see https://github.com/fail2ban/fail2ban/issues/37
|
|
||||||
[asterisk-tcp]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = asterisk
|
|
||||||
port = 5060,5061
|
|
||||||
protocol = tcp
|
|
||||||
logpath = /var/log/asterisk/messages
|
|
||||||
|
|
||||||
[asterisk-udp]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = asterisk
|
|
||||||
port = 5060,5061
|
|
||||||
protocol = udp
|
|
||||||
logpath = /var/log/asterisk/messages
|
|
||||||
|
|
||||||
|
|
||||||
# Jail for more extended banning of persistent abusers
|
|
||||||
# !!! WARNING !!!
|
|
||||||
# Make sure that your loglevel specified in fail2ban.conf/.local
|
|
||||||
# is not at DEBUG level -- which might then cause fail2ban to fall into
|
|
||||||
# an infinite loop constantly feeding itself with non-informative lines
|
|
||||||
[recidive]
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
filter = recidive
|
|
||||||
logpath = /var/log/fail2ban.log
|
|
||||||
action = iptables-allports[name=recidive]
|
|
||||||
sendmail-whois-lines[name=recidive, logpath=/var/log/fail2ban.log]
|
|
||||||
bantime = 604800 ; 1 week
|
|
||||||
findtime = 86400 ; 1 day
|
|
||||||
maxretry = 5
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y
|
|
||||||
sudo apt-get install iptables-persistent
|
|
||||||
sudo invoke-rc.d iptables-persistent save
|
|
||||||
clear
|
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
mkdir -p /firewall/iptables/bin
|
|
||||||
echo '#!/bin/bash' > /firewall/iptables/bin/fire.sh
|
|
||||||
echo 'sudo service fail2ban stop' >> /firewall/iptables/bin/fire.sh
|
|
||||||
echo 'nano /etc/iptables/rules.v4' >> /firewall/iptables/bin/fire.sh
|
|
||||||
echo 'iptables-restore < /etc/iptables/rules.v4' >> /firewall/iptables/bin/fire.sh
|
|
||||||
echo 'iptables-save > /etc/iptables/rules.v4' >> /firewall/iptables/bin/fire.sh
|
|
||||||
echo 'sudo service fail2ban start' >> /firewall/iptables/bin/fire.sh
|
|
||||||
ln -sf /firewall/iptables/bin/fire.sh /bin/fire
|
|
||||||
curl -s https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/iptables/rules > /etc/iptables/rules.v4
|
|
||||||
chmod +x /bin/fire
|
|
||||||
# ========================================================================
|
|
||||||
|
|
||||||
|
|
||||||
sudo apt-get install fail2ban -y
|
|
||||||
sudo service fail2ban stop
|
|
||||||
curl -s https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/iptables/jail.local > /etc/fail2ban/jail.local
|
|
||||||
touch /nginx/logs/error.log
|
|
||||||
sudo service fail2ban start
|
|
||||||
clear
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
# Generated by iptables-save v1.4.21 on Fri Feb 23 11:18:23 2018
|
|
||||||
*nat
|
|
||||||
:PREROUTING ACCEPT [2:100]
|
|
||||||
:INPUT ACCEPT [1:40]
|
|
||||||
:OUTPUT ACCEPT [0:0]
|
|
||||||
:POSTROUTING ACCEPT [0:0]
|
|
||||||
COMMIT
|
|
||||||
# Completed on Fri Feb 23 11:18:23 2018
|
|
||||||
# Generated by iptables-save v1.4.21 on Fri Feb 23 11:18:23 2018
|
|
||||||
*mangle
|
|
||||||
:PREROUTING ACCEPT [65:7186]
|
|
||||||
:INPUT ACCEPT [44:4420]
|
|
||||||
:FORWARD ACCEPT [22:2966]
|
|
||||||
:OUTPUT ACCEPT [36:8424]
|
|
||||||
:POSTROUTING ACCEPT [58:11390]
|
|
||||||
COMMIT
|
|
||||||
# Completed on Fri Feb 23 11:18:23 2018
|
|
||||||
# Generated by iptables-save v1.4.21 on Fri Feb 23 11:18:23 2018
|
|
||||||
*filter
|
|
||||||
:INPUT DROP [0:0]
|
|
||||||
:FORWARD ACCEPT [0:0]
|
|
||||||
:OUTPUT ACCEPT [36:8424]
|
|
||||||
-A INPUT -i lo -j ACCEPT
|
|
||||||
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
|
||||||
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
|
|
||||||
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
|
|
||||||
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
|
|
||||||
COMMIT
|
|
||||||
# Completed on Fri Feb 23 11:18:23 2018
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ "$1" == "install" ]; then
|
|
||||||
case "`grep DISTRIB_CODENAME /etc/*-release | awk -F '=' '{print $2}'`" in
|
|
||||||
bionic)
|
|
||||||
if [ "$(whoami)" != "root" ]
|
|
||||||
then
|
|
||||||
echo "You should Login as root to use this script!";
|
|
||||||
echo "sudo -i";
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "/nginx/" ]; then
|
|
||||||
echo "We've detect a folder '/nginx/'"
|
|
||||||
echo "Please to a fresh reinstallation of your server this is a whole new release you can't update!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "/etc/nginx" ]; then
|
|
||||||
echo "We've detect a folder '/etc/nginx' which means"
|
|
||||||
echo "Maybe you have installed nginx on your system!"
|
|
||||||
echo "Please remove everything related to nginx apache or any other web server using port 80/443"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "/opt/nginx/" ]; then
|
|
||||||
echo "We've detect a folder '/opt/nginx/' which means"
|
|
||||||
echo "Maybe you have use this script before!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y
|
|
||||||
apt-get install build-essential libssl-dev curl nano wget zip unzip git sudo iftop htop -y
|
|
||||||
|
|
||||||
sudo add-apt-repository ppa:maxmind/ppa -y
|
|
||||||
apt-get update; apt-get upgrade -y; apt-get autoremove -y
|
|
||||||
apt-get install libmaxminddb0 libmaxminddb-dev mmdb-bin -y
|
|
||||||
apt-get install libgd-dev -y
|
|
||||||
|
|
||||||
useradd nginx
|
|
||||||
mkdir -p /usr/local/nginx/
|
|
||||||
cd /; wget https://github.com/theraw/The-World-Is-Yours/raw/v2/OS/Ubuntu/18.04/source/nginx16.zip; unzip nginx16.zip; rm -Rf nginx16.zip
|
|
||||||
curl -s https://raw.githubusercontent.com/theraw/The-World-Is-Yours/v2/OS/Ubuntu/18.04/nginx.service > /etc/systemd/system/nginx.service
|
|
||||||
killall nginx
|
|
||||||
systemctl daemon-reload
|
|
||||||
sudo systemctl start nginx.service && sudo systemctl enable nginx.service
|
|
||||||
service nginx stop
|
|
||||||
|
|
||||||
# create dirs
|
|
||||||
mkdir /hostdata
|
|
||||||
mkdir -p /nginx/live
|
|
||||||
mkdir -p /nginx/conf.d
|
|
||||||
mkdir -p /nginx/db/
|
|
||||||
mkdir -p /nginx/modules
|
|
||||||
mkdir -p /hostdata/default/logs
|
|
||||||
mkdir -p /hostdata/default/public_html
|
|
||||||
curl -s https://raw.githubusercontent.com/theraw/The-World-Is-Yours/v2/static/html/index.html > /hostdata/default/public_html/index.html
|
|
||||||
mkdir -p /hostdata/default/public_html/L7
|
|
||||||
cd /hostdata/default/public_html/L7; wget https://github.com/theraw/The-World-Is-Yours/raw/v2/static/html/loading.gif
|
|
||||||
cd /hostdata/default/public_html/L7; wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/v2/static/html/aes.min.js
|
|
||||||
|
|
||||||
curl -s https://raw.githubusercontent.com/theraw/The-World-Is-Yours/v2/static/live/default > /nginx/live/default
|
|
||||||
curl -s https://raw.githubusercontent.com/theraw/The-World-Is-Yours/v2/static/nginx.conf > /nginx/nginx.conf
|
|
||||||
|
|
||||||
cd /nginx/db/; wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz; tar xf GeoLite2-City.tar.gz; rm -Rf GeoLite2-City.tar.gz
|
|
||||||
mv /nginx/db/GeoLite2-City_*/GeoLite2-City.mmdb /nginx/db/; rm -Rf /nginx/db/GeoLite2-City_*
|
|
||||||
cd /nginx/db/; wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz; tar xf GeoLite2-Country.tar.gz; rm -Rf GeoLite2-Country.tar.gz
|
|
||||||
mv /nginx/db/GeoLite2-Country_*/GeoLite2-Country.mmdb /nginx/db/; rm -Rf /nginx/db/GeoLite2-Country_*
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
if [ "$1" == 'clean' ]; then
|
|
||||||
service nginx stop
|
|
||||||
systemctl disable nginx.service
|
|
||||||
rm -Rf /nginx
|
|
||||||
rm -Rf /usr/local/nginx
|
|
||||||
rm -Rf /usr/sbin/nginx
|
|
||||||
rm -Rf /etc/init.d/nginx
|
|
||||||
rm -Rf /hostdata/
|
|
||||||
rm -Rf /opt/nginx
|
|
||||||
rm -Rf /etc/systemd/system/nginx.service
|
|
||||||
systemctl daemon-reload
|
|
||||||
clear
|
|
||||||
echo "We've just removed /nginx and /hostdata and /opt/nginx"
|
|
||||||
fi
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
nginx:
|
||||||
|
container_name: nginx
|
||||||
|
ports:
|
||||||
|
- "0.0.0.0:80-9000:80-9000"
|
||||||
|
image: ""
|
||||||
|
shm_size: '512MB'
|
||||||
|
privileged: true
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
nginx_net:
|
||||||
|
ipv4_address: 172.22.0.22
|
||||||
|
dns:
|
||||||
|
- "8.8.8.8"
|
||||||
|
- "8.8.4.4"
|
||||||
|
ulimits:
|
||||||
|
nproc: 65535
|
||||||
|
cap_add:
|
||||||
|
- "ALL"
|
||||||
|
volumes:
|
||||||
|
- /dopesrv/nginx:/nginx
|
||||||
|
- /dopesrv/etc:/etc
|
||||||
|
- /dopesrv/opt:/opt
|
||||||
|
- /dopesrv/home:/home
|
||||||
|
- /dopesrv/root:/root
|
||||||
|
- /dopesrv/var:/var
|
||||||
|
db:
|
||||||
|
container_name: db
|
||||||
|
image: 'mariadb:latest'
|
||||||
|
shm_size: '512MB'
|
||||||
|
privileged: true
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- '3306:3306'
|
||||||
|
networks:
|
||||||
|
nginx_net:
|
||||||
|
ipv4_address: 172.22.0.33
|
||||||
|
dns:
|
||||||
|
- "8.8.8.8"
|
||||||
|
- "8.8.4.4"
|
||||||
|
ulimits:
|
||||||
|
nproc: 65535
|
||||||
|
cap_add:
|
||||||
|
- "ALL"
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: '67WxFgoz1M'
|
||||||
|
MYSQL_DATABASE: 'nginx'
|
||||||
|
MYSQL_USER: 'dopeuser'
|
||||||
|
MYSQL_PASSWORD: '67WxFgoz1M'
|
||||||
|
volumes:
|
||||||
|
- /dopesrv/var/lib/mysql:/var/lib/mysql
|
||||||
|
networks:
|
||||||
|
nginx_net:
|
||||||
|
driver: bridge
|
||||||
|
driver_opts:
|
||||||
|
com.docker.network.enable_ipv6: "false"
|
||||||
|
ipam:
|
||||||
|
driver: default
|
||||||
|
config:
|
||||||
|
- subnet: 172.22.0.0/16
|
||||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
<html>
|
<html>
|
||||||
<center><h1>The World Is Yours Default Page</h1></center>
|
<center><h1>NGINX-AS-WEB-FIREWALL Default Page!?</h1></center>
|
||||||
<center><h2>If you can see this that means your installation was successful!</h2></center>
|
<center><h2>If you can see this that means your installation was successful!</h2></center>
|
||||||
<center><h2>Thanks Using This Project, For Issues or suggestion Post them on <a href="https://github.com/theraw/The-World-Is-Yours/issues" target="_blank">(Github)</a></h2></center>
|
<center><h2>Thank You For Using This Project, For Issues or suggestion Post them on <a href="https://github.com/theraw/The-World-Is-Yours" target="_blank">(Github)</a></h2></center>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 708 KiB |
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
mkdir /opt/xgeoip; cd /opt/xgeoip; wget https://sourceforge.net/projects/xtables-addons/files/Xtables-addons/xtables-addons-3.3.tar.xz/download; tar xf download; rm -rf download
|
|
||||||
mv /opt/xgeoip/xtables-addons-3.3 /opt/iptables-geoip-3.3
|
|
||||||
cd /opt/iptables-geoip-3.3; ./configure
|
|
||||||
make -j`nproc`
|
|
||||||
make install
|
|
||||||
clear
|
|
||||||
bash /opt/iptables-geoip-3.3/geoip/xt_geoip_dl
|
|
||||||
mv /opt/iptables-geoip-3.3/geoip/GeoLite2-Country-CSV_*/* /opt/iptables-geoip-3.3/geoip
|
|
||||||
|
|
||||||
bash /opt/iptables-geoip-3.3/geoip/xt_geoip_build
|
|
||||||
mkdir -p /usr/share/xt_geoip/
|
|
||||||
mv /opt/iptables-geoip-3.3/geoip/*.iv4 /usr/share/xt_geoip/
|
|
||||||
mv /opt/iptables-geoip-3.3/geoip/*.iv6 /usr/share/xt_geoip/
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80 default_server;
|
|
||||||
root /hostdata/default/public_html;
|
|
||||||
index index.html;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
# ================================================
|
|
||||||
add_header GEO_COUNTRY_CODE $geoip2_data_country_code;
|
|
||||||
add_header GEO_COUNTRY_NAME $geoip2_data_country_name;
|
|
||||||
add_header GEO_STATE $geoip2_data_state;
|
|
||||||
add_header GEO_CITY_NAME $geoip2_data_city_name;
|
|
||||||
add_header GEO_ZIP_CODE $geoip2_data_zip;
|
|
||||||
|
|
||||||
add_header X-Content-Type-Options 'nosniff' always;
|
|
||||||
add_header X-Xss-Protection '1; mode=block';
|
|
||||||
add_header Referrer-Policy 'no-referrer-when-downgrade';
|
|
||||||
# ================================================
|
|
||||||
|
|
||||||
# ================================================
|
|
||||||
access_log /hostdata/default/logs/access.log main;
|
|
||||||
error_log /hostdata/default/logs/error.log;
|
|
||||||
# ================================================
|
|
||||||
|
|
||||||
# ================================================
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ =404;
|
|
||||||
}
|
|
||||||
location ^~ /L7 {
|
|
||||||
testcookie off;
|
|
||||||
}
|
|
||||||
# ================================================
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -1,15 +1,12 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Please use this to build dynamic modules every single detail is strictly required!
|
|
||||||
./configure \
|
./configure \
|
||||||
--user=nginx \
|
--user=nginx \
|
||||||
--group=nginx \
|
--group=nginx \
|
||||||
--modules-path=/nginx/modules/ \
|
|
||||||
--sbin-path=/usr/sbin/nginx \
|
--sbin-path=/usr/sbin/nginx \
|
||||||
--conf-path=/nginx/nginx.conf \
|
--conf-path=/nginx/nginx.conf \
|
||||||
--pid-path=/run/nginx.pid \
|
--pid-path=/var/run/nginx.pid \
|
||||||
--lock-path=/run/nginx.lock \
|
--lock-path=/var/run/nginx.lock \
|
||||||
--error-log-path=/var/log/nginx/error.log \
|
--error-log-path=/nginx/logs/error.log \
|
||||||
--http-log-path=/var/log/nginx/access.log \
|
--http-log-path=/nginx/logs/access.log \
|
||||||
--with-pcre \
|
--with-pcre \
|
||||||
--with-threads \
|
--with-threads \
|
||||||
--with-file-aio \
|
--with-file-aio \
|
||||||
@@ -38,5 +35,16 @@
|
|||||||
--with-stream_realip_module \
|
--with-stream_realip_module \
|
||||||
--with-stream_geoip_module \
|
--with-stream_geoip_module \
|
||||||
--with-ld-opt="-Wl,-rpath,/usr/local/lib/" \
|
--with-ld-opt="-Wl,-rpath,/usr/local/lib/" \
|
||||||
--add-dynamic-module=/the path of /ngx_devel_kit \
|
--add-module=/opt/nginx/modules/ngx_devel_kit \
|
||||||
--add-dynamic-module=/your module path
|
--add-module=/opt/nginx/modules/ngx_pagespeed-1.13.35.2-stable \
|
||||||
|
--add-module=/opt/nginx/modules/testcookie-nginx-module \
|
||||||
|
--add-module=/opt/nginx/modules/set-misc-nginx-module \
|
||||||
|
--add-module=/opt/nginx/modules/headers-more-nginx-module \
|
||||||
|
--add-module=/opt/nginx/modules/echo-nginx-module \
|
||||||
|
--add-module=/opt/nginx/modules/ngx_cache_purge \
|
||||||
|
--add-module=/opt/nginx/modules/ngx_http_geoip2_module \
|
||||||
|
--add-module=/opt/nginx/modules/lua-nginx-module \
|
||||||
|
--add-module=/opt/nginx/modules/ModSecurity-nginx \
|
||||||
|
--add-module=/opt/nginx/modules/encrypted-session-nginx-module \
|
||||||
|
--add-module=/opt/nginx/modules/naxsi/naxsi_src/ \
|
||||||
|
--add-module=/opt/nginx/modules/nginx-http-rdns
|
||||||
+91
-145
@@ -1,175 +1,121 @@
|
|||||||
|
# Suggestions? => https://github.com/theraw/The-World-Is-Yours/issues
|
||||||
# Problems? => https://github.com/theraw/The-World-Is-Yours/issues
|
# Problems? => https://github.com/theraw/The-World-Is-Yours/issues
|
||||||
|
# Errors? => https://github.com/theraw/The-World-Is-Yours/issues
|
||||||
user nginx;
|
user nginx;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
worker_processes auto;
|
worker_processes auto;
|
||||||
worker_rlimit_nofile 65535;
|
worker_rlimit_nofile 65535;
|
||||||
# ====================================================================
|
|
||||||
error_log /var/log/nginx/error.log notice;
|
|
||||||
pid /run/nginx.pid;
|
|
||||||
# ====================================================================
|
|
||||||
|
|
||||||
# ====================================================================
|
|
||||||
# LOAD DYNAMIC MODS
|
|
||||||
# ====================================================================
|
|
||||||
load_module /nginx/modules/ndk_http_module.so;
|
|
||||||
load_module /nginx/modules/ngx_http_set_misc_module.so;
|
|
||||||
load_module /nginx/modules/ngx_http_geoip2_module.so;
|
|
||||||
load_module /nginx/modules/ngx_stream_geoip2_module.so;
|
|
||||||
load_module /nginx/modules/ngx_http_testcookie_access_module.so;
|
|
||||||
load_module /nginx/modules/ngx_http_cookie_flag_filter_module.so;
|
|
||||||
# load_module /nginx/modules/ngx_http_headers_more_filter_module.so
|
|
||||||
# load_module /nginx/modules/ngx_http_encrypted_session_module.so
|
|
||||||
# load_module /nginx/modules/ngx_http_brotli_filter_module.so
|
|
||||||
# load_module /nginx/modules/ngx_http_brotli_static_module.so
|
|
||||||
|
|
||||||
# This module is nginx rtmp module but a better one, has same features rtmp/vod/hls/dash etc.
|
|
||||||
# load_module /nginx/modules/ngx_http_flv_live_module.so
|
|
||||||
|
|
||||||
# Every module works but modSecurity doesn't work because you have to compile mod security library
|
|
||||||
#
|
|
||||||
# load_module /nginx/modules/ngx_http_modsecurity_module.so;
|
|
||||||
# ====================================================================
|
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections 65535;
|
|
||||||
multi_accept on;
|
multi_accept on;
|
||||||
use epoll;
|
use epoll;
|
||||||
|
worker_connections 65535;
|
||||||
}
|
}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
# ////////////////////////////////////////////////////// #
|
# ////////////////////////////////////////////////////// #
|
||||||
# ==================== GEOIP =========================== #
|
# =================== START L7 ========================= #
|
||||||
geoip2 /nginx/db/GeoLite2-Country.mmdb {
|
# turn this 'on' if you want to use L7 For every domain hosted in your server
|
||||||
$geoip2_data_country_code default=US source=$remote_addr country iso_code;
|
testcookie off;
|
||||||
$geoip2_data_country_name country names en;
|
testcookie_name DOPEHOSTING;
|
||||||
|
testcookie_secret random;
|
||||||
|
testcookie_session $remote_addr;
|
||||||
|
#testcookie_arg GO;
|
||||||
|
testcookie_httponly_flag on;
|
||||||
|
testcookie_max_attempts 3;
|
||||||
|
testcookie_secure_flag on;
|
||||||
|
testcookie_get_only on;
|
||||||
|
testcookie_p3p 'CP="CUR ADM OUR NOR STA NID", policyref="/w3c/p3p.xml"';
|
||||||
|
testcookie_fallback /cookies.html?backurl=$scheme://$host$request_uri;
|
||||||
|
|
||||||
|
# Those are some ip's whitelisted by me. mostly are search engines. But not everything!
|
||||||
|
testcookie_whitelist {
|
||||||
|
8.8.8.8/32;
|
||||||
|
127.0.0.1/32;
|
||||||
|
# I don't suggest using alot of IPs here as this whitelist can fail!.
|
||||||
}
|
}
|
||||||
|
testcookie_redirect_via_refresh on;
|
||||||
geoip2 /nginx/db/GeoLite2-City.mmdb {
|
testcookie_refresh_encrypt_cookie on;
|
||||||
$geoip2_data_city_name default=NA city names en;
|
testcookie_refresh_encrypt_cookie_key random;
|
||||||
$geoip2_data_zip default=NA postal code;
|
testcookie_refresh_encrypt_cookie_iv random;
|
||||||
$geoip2_data_state default=NA subdivisions 0 names en;
|
testcookie_refresh_template '<html><head><meta http-equiv="refresh" content="0; $testcookie_nexturl"><title>Just a moment please...</title></head><body> </script><script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script><script type=\"text/javascript\" src="//proxy2.dopehosting.net/aes.min.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("$testcookie_enc_key"),b=toNumbers("$testcookie_enc_iv"),c=toNumbers("$testcookie_enc_set");document.cookie="DOPEHOSTING="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/";</script></body></html>';
|
||||||
}
|
# ===================== END L7 ========================= #
|
||||||
|
|
||||||
# ================== END GEOIP ========================= #
|
|
||||||
# ////////////////////////////////////////////////////// #
|
|
||||||
|
|
||||||
# ////////////////////////////////////////////////////// #
|
|
||||||
include /nginx/mime.types;
|
|
||||||
# ////////////////////////////////////////////////////// #
|
# ////////////////////////////////////////////////////// #
|
||||||
|
|
||||||
# ////////////////////////////////////////////////////// #
|
# ////////////////////////////////////////////////////// #
|
||||||
# ===================== LOGS =========================== #
|
# ===================== LOGS =========================== #
|
||||||
log_format main '$remote_addr status: $status |==| $request |==| $time_local';
|
log_format main '$remote_addr |==| $status |==| $request |==| $time_local';
|
||||||
# -------------------------------------------------------#
|
# -------------------------------------------------------#
|
||||||
log_format agent '$time_local - client: $remote_addr $status |==| $request |==| $http_user_agent';
|
log_format agent '$remote_addr |==| $status |==| $request |==| $http_user_agent';
|
||||||
# -------------------------------------------------------#
|
# -------------------------------------------------------#
|
||||||
log_format full '$remote_addr |==| $remote_user |==| $time_local |==| $request |==| $status |==| $body_bytes_sent |==| $http_referer |==| $http_user_agent |==| $http_x_forwarded_for |==| $http_origin';
|
log_format full '$remote_addr |==| $remote_user |==| $time_local |==| $request |==| $status |==| $body_bytes_sent |==| $http_referer |==| $http_user_agent |==| $http_x_forwarded_for';
|
||||||
# -------------------------------------------------------#
|
# =================== END LOGS ========================= #
|
||||||
log_format json escape=json '[{'
|
|
||||||
'"body_bytes_sent":"$body_bytes_sent",'
|
|
||||||
'"bytes_sent":"$bytes_sent",'
|
|
||||||
'"http_host":"$http_host",'
|
|
||||||
'"msec":"$msec",'
|
|
||||||
'"time_local":"$time_local",'
|
|
||||||
'"connection":"$connection",'
|
|
||||||
'"connection_requests":"$connection_requests",'
|
|
||||||
'"remote_addr":"$remote_addr",'
|
|
||||||
'"request_length":"$request_length",'
|
|
||||||
'"request_method":"$request_method",'
|
|
||||||
'"request_uri":"$request_uri",'
|
|
||||||
'"http_user_agent":"$http_user_agent",'
|
|
||||||
'"http_x_forwarded_for":"$http_x_forwarded_for",'
|
|
||||||
'"country_code":"$geoip2_data_country_code",'
|
|
||||||
'"server_port":"$server_port",'
|
|
||||||
'"server_protocol":"$server_protocol",'
|
|
||||||
'"ssl_protocol":"$ssl_protocol",'
|
|
||||||
'"status":"$status",'
|
|
||||||
'"upstream_response_time":"$upstream_response_time",'
|
|
||||||
'"upstream_addr":"$upstream_addr",'
|
|
||||||
'"upstream_connect_time":"$upstream_connect_time"'
|
|
||||||
'}]';
|
|
||||||
# =================== END LOGS========================== #
|
|
||||||
# ////////////////////////////////////////////////////// #
|
# ////////////////////////////////////////////////////// #
|
||||||
default_type application/octet-stream;
|
|
||||||
|
# ////////////////////////////////////////////////////// #
|
||||||
|
# ===================== GEIP =========================== #
|
||||||
|
geoip2 /nginx/db/GeoLite2-Country.mmdb {
|
||||||
|
$geoip2_data_country_code default=US country iso_code;
|
||||||
|
$geoip2_data_country_name country names en;
|
||||||
|
}
|
||||||
|
|
||||||
|
# EX Ban China!
|
||||||
|
#map $geoip2_data_country_code $allowed_country {
|
||||||
|
# default yes;
|
||||||
|
# CN no;
|
||||||
|
#}
|
||||||
|
# =================== END GEIP ========================= #
|
||||||
|
# ////////////////////////////////////////////////////// #
|
||||||
|
|
||||||
|
# ////////////////////////////////////////////////////// #
|
||||||
|
# ===================== EXTRA ========================== #
|
||||||
|
# Don't Go with "Nginx Can Handle Everything" !
|
||||||
|
limit_conn_zone $server_name zone=max:1m;
|
||||||
|
limit_req_zone $binary_remote_addr zone=one:1m rate=1r/s;
|
||||||
|
# =================== END EXTRA ======================== #
|
||||||
|
# ////////////////////////////////////////////////////// #
|
||||||
|
|
||||||
|
# ////////////////////////////////////////////////////// #
|
||||||
|
# ==================== BACKENDS ======================== #
|
||||||
|
map $http_upgrade $connection_upgrade {
|
||||||
|
default upgrade;
|
||||||
|
'' close;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Example Of Backend
|
||||||
|
#upstream varnish {
|
||||||
|
# zone tcp_servers 64k;
|
||||||
|
# server 10.10.10.39:80;
|
||||||
|
#}
|
||||||
|
# =================== END BACKENDS ===================== #
|
||||||
|
# ////////////////////////////////////////////////////// #
|
||||||
|
|
||||||
|
# ////////////////////////////////////////////////////// #
|
||||||
|
# ==================== GENERAL ========================= #
|
||||||
|
client_body_buffer_size 1M;
|
||||||
|
client_header_buffer_size 1M;
|
||||||
|
client_body_timeout 90s;
|
||||||
|
client_header_timeout 90s;
|
||||||
|
client_max_body_size 2M;
|
||||||
|
keepalive_timeout 10s;
|
||||||
|
port_in_redirect off;
|
||||||
sendfile on;
|
sendfile on;
|
||||||
server_names_hash_bucket_size 6969;
|
server_names_hash_bucket_size 6969;
|
||||||
server_names_hash_max_size 6969;
|
|
||||||
resolver 8.8.8.8;
|
|
||||||
client_body_buffer_size 128k;
|
|
||||||
client_header_buffer_size 5M;
|
|
||||||
client_max_body_size 128M;
|
|
||||||
client_body_timeout 30s;
|
|
||||||
client_header_timeout 30s;
|
|
||||||
keepalive_timeout 30s;
|
|
||||||
open_file_cache max=200000 inactive=20s;
|
|
||||||
open_file_cache_errors on;
|
|
||||||
open_file_cache_min_uses 2;
|
|
||||||
open_file_cache_valid 30s;
|
|
||||||
reset_timedout_connection on;
|
|
||||||
send_timeout 30s;
|
|
||||||
port_in_redirect off;
|
|
||||||
server_name_in_redirect off;
|
server_name_in_redirect off;
|
||||||
server_tokens off;
|
server_tokens off;
|
||||||
tcp_nodelay on;
|
tcp_nodelay on;
|
||||||
tcp_nopush on;
|
tcp_nopush on;
|
||||||
types_hash_max_size 2048;
|
types_hash_max_size 2048;
|
||||||
# CloudFlare IPs
|
resolver 8.8.8.8 8.8.4.4;
|
||||||
# List: https://www.cloudflare.com/ips-v4
|
default_type application/octet-stream;
|
||||||
set_real_ip_from 173.245.48.0/20;
|
include /nginx/mime.types;
|
||||||
set_real_ip_from 103.21.244.0/22;
|
# =================== END GENERAL ====================== #
|
||||||
set_real_ip_from 103.22.200.0/22;
|
# ////////////////////////////////////////////////////// #
|
||||||
set_real_ip_from 103.31.4.0/22;
|
|
||||||
set_real_ip_from 141.101.64.0/18;
|
|
||||||
set_real_ip_from 108.162.192.0/18;
|
|
||||||
set_real_ip_from 190.93.240.0/20;
|
|
||||||
set_real_ip_from 188.114.96.0/20;
|
|
||||||
set_real_ip_from 197.234.240.0/22;
|
|
||||||
set_real_ip_from 198.41.128.0/17;
|
|
||||||
set_real_ip_from 162.158.0.0/15;
|
|
||||||
set_real_ip_from 104.16.0.0/12;
|
|
||||||
set_real_ip_from 172.64.0.0/13;
|
|
||||||
set_real_ip_from 131.0.72.0/22;
|
|
||||||
real_ip_header X-Forwarded-For;
|
|
||||||
real_ip_recursive on;
|
|
||||||
|
|
||||||
## Gzip Settings ##
|
|
||||||
gzip on;
|
|
||||||
gzip_buffers 16 8k;
|
|
||||||
gzip_comp_level 5;
|
|
||||||
gzip_disable "msie6";
|
|
||||||
gzip_min_length 256;
|
|
||||||
gzip_proxied any;
|
|
||||||
gzip_types
|
|
||||||
application/atom+xml
|
|
||||||
application/javascript
|
|
||||||
application/json
|
|
||||||
application/ld+json
|
|
||||||
application/manifest+json
|
|
||||||
application/rss+xml
|
|
||||||
application/vnd.geo+json
|
|
||||||
application/vnd.ms-fontobject
|
|
||||||
application/x-font-ttf
|
|
||||||
application/x-javascript
|
|
||||||
application/x-web-app-manifest+json
|
|
||||||
application/xhtml+xml
|
|
||||||
application/xml
|
|
||||||
font/opentype
|
|
||||||
image/bmp
|
|
||||||
image/svg+xml
|
|
||||||
image/x-icon
|
|
||||||
text/cache-manifest
|
|
||||||
text/css
|
|
||||||
text/javascript
|
|
||||||
text/plain
|
|
||||||
text/vcard
|
|
||||||
text/vnd.rim.location.xloc
|
|
||||||
text/vtt
|
|
||||||
text/x-component
|
|
||||||
text/x-cross-domain-policy
|
|
||||||
text/x-js
|
|
||||||
text/xml;
|
|
||||||
gzip_vary on;
|
|
||||||
|
|
||||||
|
# ////////////////////////////////////////////////////// #
|
||||||
|
# =================== LOAD CONFIGS ===================== #
|
||||||
include /nginx/live/*;
|
include /nginx/live/*;
|
||||||
include /nginx/conf.d/*.conf;
|
include /nginx/conf.d/*;
|
||||||
|
include /nginx/naxsi_core.rules;
|
||||||
|
# =================== END CONFIGS ====================== #
|
||||||
# ////////////////////////////////////////////////////// #
|
# ////////////////////////////////////////////////////// #
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
root /hostdata/raws.com/public_html;
|
||||||
|
index index.html index.php;
|
||||||
|
server_name raws.com www.raws.com;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
SecRulesEnabled;
|
||||||
|
LearningMode;
|
||||||
|
DeniedUrl "/denied/";
|
||||||
|
CheckRule "$SQL >= 8" BLOCK;
|
||||||
|
CheckRule "$RFI >= 8" BLOCK;
|
||||||
|
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||||
|
CheckRule "$EVADE >= 4" BLOCK;
|
||||||
|
CheckRule "$XSS >= 8" BLOCK;
|
||||||
|
access_log /hostdata/raws.com/logs/access.log main;
|
||||||
|
error_log /hostdata/raws.com/logs/error.log;
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /denied/ {
|
||||||
|
return 444;
|
||||||
|
}
|
||||||
|
# =========================================
|
||||||
|
# PHPMYADMIN.
|
||||||
|
# =========================================
|
||||||
|
location /phpmyadmin {
|
||||||
|
root /hostdata/default/;
|
||||||
|
location ~ ^/phpmyadmin/(.+\.php)$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
root /hostdata/default/;
|
||||||
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include /nginx/fastcgi_params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# =========================================
|
||||||
|
# END PHPMYADMIN.
|
||||||
|
# =========================================
|
||||||
|
|
||||||
|
# =========================================
|
||||||
|
# PHP.
|
||||||
|
# =========================================
|
||||||
|
location ~ \.php {
|
||||||
|
try_files $uri /index.php =404;
|
||||||
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include /nginx/fastcgi_params;
|
||||||
|
}
|
||||||
|
# =========================================
|
||||||
|
# END PHP.
|
||||||
|
# =========================================
|
||||||
|
}
|
||||||
+8
-3
@@ -1,13 +1,17 @@
|
|||||||
vm.nr_hugepages = 0
|
vm.nr_hugepages = 0
|
||||||
vm.vfs_cache_pressure = 100
|
vm.vfs_cache_pressure = 100
|
||||||
fs.file-max = 1000000
|
fs.file-max = 1000000
|
||||||
|
net.core.wmem_max = 16777216
|
||||||
|
net.core.rmem_max = 16777216
|
||||||
kernel.randomize_va_space = 2
|
kernel.randomize_va_space = 2
|
||||||
net.ipv4.ip_forward = 1
|
net.ipv4.ip_forward = 1
|
||||||
net.ipv4.tcp_syncookies = 1
|
net.ipv4.tcp_syncookies = 1
|
||||||
net.ipv4.ip_local_port_range = 12000 65535
|
net.ipv4.ip_local_port_range = 1024 64999
|
||||||
|
net.ipv4.tcp_wmem = 4096 65536 16777216
|
||||||
|
net.ipv4.tcp_rmem = 4096 87380 16777216
|
||||||
net.ipv4.tcp_window_scaling = 1
|
net.ipv4.tcp_window_scaling = 1
|
||||||
net.core.somaxconn = 65535
|
net.core.somaxconn = 32768
|
||||||
net.core.netdev_max_backlog = 2000
|
net.core.netdev_max_backlog = 30000
|
||||||
net.ipv4.tcp_max_syn_backlog = 2048
|
net.ipv4.tcp_max_syn_backlog = 2048
|
||||||
net.ipv4.tcp_fin_timeout = 90
|
net.ipv4.tcp_fin_timeout = 90
|
||||||
net.ipv4.tcp_tw_recycle = 1
|
net.ipv4.tcp_tw_recycle = 1
|
||||||
@@ -17,3 +21,4 @@ net.ipv4.tcp_congestion_control = bbr
|
|||||||
net.ipv4.tcp_synack_retries = 2
|
net.ipv4.tcp_synack_retries = 2
|
||||||
net.ipv4.tcp_syn_retries = 2
|
net.ipv4.tcp_syn_retries = 2
|
||||||
kernel.sched_autogroup_enabled = 0
|
kernel.sched_autogroup_enabled = 0
|
||||||
|
net.ipv4.tcp_max_orphans = 32768
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
root /hostdata/default/public_html;
|
||||||
|
index index.html;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
# ================================================
|
||||||
|
# LIMIT CONNECTION FOR IP / IPs WILL BE AUTO BANNED IF YOU HAVE INSTALL IPTABLES/FAIL2BAN
|
||||||
|
limit_conn max 800;
|
||||||
|
limit_req zone=one burst=300 nodelay;
|
||||||
|
# ================================================
|
||||||
|
|
||||||
|
# ================================================
|
||||||
|
# 1. Don't put log files into location / {..} it will not work as you think. Use like this.
|
||||||
|
# 2. If you change their name or location make sure you also change those https://github.com/theraw/The-World-Is-Yours/blob/master/iptables/jail.local#L105-L118
|
||||||
|
access_log /hostdata/default/logs/access.log main;
|
||||||
|
error_log /hostdata/default/logs/error.log;
|
||||||
|
# ================================================
|
||||||
|
|
||||||
|
# ================================================
|
||||||
|
location / {
|
||||||
|
SecRulesEnabled;
|
||||||
|
LearningMode;
|
||||||
|
DeniedUrl "/denied/";
|
||||||
|
CheckRule "$SQL >= 8" BLOCK;
|
||||||
|
CheckRule "$RFI >= 8" BLOCK;
|
||||||
|
CheckRule "$TRAVERSAL >= 4" BLOCK;
|
||||||
|
CheckRule "$EVADE >= 4" BLOCK;
|
||||||
|
CheckRule "$XSS >= 8" BLOCK;
|
||||||
|
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
# ================================================
|
||||||
|
|
||||||
|
location /denied/ {
|
||||||
|
return 444;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ================================================
|
||||||
|
location ~ \.php {
|
||||||
|
try_files $uri /index.php =404;
|
||||||
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
# ================================================
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user