diff --git a/Dockerfile b/Dockerfile index c7fb76d..609826d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ RUN cd /tmp \ && apt-get update -y && apt-get upgrade -y --no-install-recommends --no-install-suggests \ && apt-get install -y --no-install-recommends --no-install-suggests curl gpg-agent nano \ libgd3 gettext-base unzip rsync cron apt-transport-https software-properties-common \ - ca-certificates libmaxminddb0 libmaxminddb-dev mmdb-bin \ + ca-certificates libmaxminddb0 libmaxminddb-dev mmdb-bin python3-pip \ && dpkg --configure -a \ && touch /var/log/cron.log \ && curl -s https://nginx.org/keys/nginx_signing.key | apt-key add - \ @@ -34,6 +34,7 @@ RUN cd /tmp \ && ln -sf /dev/stdout /var/log/nginx/access.log \ && ln -sf /dev/stderr /var/log/nginx/error.log \ && service nginx stop && update-rc.d -f nginx disable \ + && pip3 install requests \ && apt-get clean -y && apt-get autoclean -y \ && apt-get autoremove --purge -y \ && rm -rf /var/lib/apt/lists/* /var/lib/log/* /tmp/* /var/tmp/* diff --git a/files/etc/nginx/cdn.conf b/files/etc/nginx/cdn-example.conf similarity index 100% rename from files/etc/nginx/cdn.conf rename to files/etc/nginx/cdn-example.conf diff --git a/files/etc/nginx/cdn-ips.conf b/files/etc/nginx/cdn-ips.conf index d7393f3..a1dc392 100644 --- a/files/etc/nginx/cdn-ips.conf +++ b/files/etc/nginx/cdn-ips.conf @@ -1,76 +1,7 @@ # Local cache/proxy +set_real_ip_from 0.0.0.0/0; +set_real_ip_from ::/0; set_real_ip_from 127.0.0.1/32; - -# Incapsula -set_real_ip_from 199.83.128.0/21; -set_real_ip_from 198.143.32.0/19; -set_real_ip_from 149.126.72.0/21; -set_real_ip_from 103.28.248.0/22; -set_real_ip_from 185.11.124.0/22; -set_real_ip_from 192.230.64.0/18; -set_real_ip_from 45.64.64.0/22; - -# Cloudflare -set_real_ip_from 103.21.244.0/22; -set_real_ip_from 103.22.200.0/22; -set_real_ip_from 103.31.4.0/22; -set_real_ip_from 104.16.0.0/12; -set_real_ip_from 108.162.192.0/18; -set_real_ip_from 141.101.64.0/18; -set_real_ip_from 162.158.0.0/15; -set_real_ip_from 172.64.0.0/13; -set_real_ip_from 173.245.48.0/20; -set_real_ip_from 188.114.96.0/20; -set_real_ip_from 190.93.240.0/20; -set_real_ip_from 197.234.240.0/22; -set_real_ip_from 198.41.128.0/17; -set_real_ip_from 199.27.128.0/21; - -# stackpath https://support.stackpath.com/hc/en-us/articles/224785167-IP-Blocks -set_real_ip_from 108.161.176.0/20; -set_real_ip_from 94.46.144.0/20; -set_real_ip_from 146.88.128.0/20; -set_real_ip_from 198.232.124.0/22; -set_real_ip_from 23.111.8.0/22; -set_real_ip_from 217.22.28.0/22; -set_real_ip_from 64.125.76.64/27; -set_real_ip_from 64.125.76.96/27; -set_real_ip_from 64.125.78.96/27; -set_real_ip_from 64.125.78.192/27; -set_real_ip_from 151.139.0.0/19; -set_real_ip_from 64.125.78.224/27; -set_real_ip_from 64.125.102.32/27; -set_real_ip_from 64.125.102.64/27; -set_real_ip_from 64.125.102.96/27; -set_real_ip_from 94.31.27.64/27; -set_real_ip_from 94.31.33.128/27; -set_real_ip_from 94.31.33.160/27; -set_real_ip_from 94.31.33.192/27; -set_real_ip_from 94.31.56.160/27; -set_real_ip_from 177.54.148.0/24; -set_real_ip_from 94.46.144.0/21; -set_real_ip_from 185.18.207.64/26; -set_real_ip_from 50.31.249.224/27; -set_real_ip_from 50.31.251.32/28; -set_real_ip_from 119.81.42.192/27; -set_real_ip_from 119.81.104.96/28; -set_real_ip_from 119.81.67.8/29; -set_real_ip_from 119.81.0.104/30; -set_real_ip_from 119.81.1.144/30; -set_real_ip_from 27.50.77.226/32; -set_real_ip_from 27.50.79.130/32; -set_real_ip_from 103.66.28.0/22; -set_real_ip_from 119.81.131.130/32; -set_real_ip_from 119.81.131.131/32; -set_real_ip_from 216.12.211.59/32; -set_real_ip_from 216.12.211.60/32; -set_real_ip_from 37.58.110.67/32; -set_real_ip_from 37.58.110.68/32; -set_real_ip_from 158.85.206.228/32; -set_real_ip_from 158.85.206.231/32; -set_real_ip_from 174.36.204.195/32; -set_real_ip_from 174.36.204.196/32; -set_real_ip_from 103.228.104.0/22; +set_real_ip_from 172.16.0.0/12; real_ip_header X-Forwarded-For; - diff --git a/files/etc/nginx/cdn/cdn-arvancloud.conf b/files/etc/nginx/cdn/cdn-arvancloud.conf new file mode 100644 index 0000000..6c4d066 --- /dev/null +++ b/files/etc/nginx/cdn/cdn-arvancloud.conf @@ -0,0 +1,48 @@ +set_real_ip_from 185.143.232.0/22; +set_real_ip_from 92.114.16.80/28; +set_real_ip_from 2.146.0.0/28; +set_real_ip_from 46.224.2.32/29; +set_real_ip_from 89.187.178.96/29; +set_real_ip_from 195.181.173.128/29; +set_real_ip_from 89.187.169.88/29; +set_real_ip_from 188.229.116.16/29; +set_real_ip_from 83.123.255.56/31; +set_real_ip_from 164.138.128.28/31; +set_real_ip_from 94.182.182.28/30; +set_real_ip_from 185.17.115.176/30; +set_real_ip_from 5.213.255.36/31; +set_real_ip_from 138.128.139.144/29; +set_real_ip_from 5.200.14.8/29; +set_real_ip_from 188.122.68.224/29; +set_real_ip_from 188.122.83.176/29; +set_real_ip_from 213.179.217.16/29; +set_real_ip_from 185.179.201.192/29; +set_real_ip_from 43.239.139.192/29; +set_real_ip_from 213.179.197.16/29; +set_real_ip_from 213.179.201.192/29; +set_real_ip_from 109.200.214.248/29; +set_real_ip_from 138.128.141.16/29; +set_real_ip_from 188.122.78.136/29; +set_real_ip_from 213.179.211.32/29; +set_real_ip_from 103.194.164.24/29; +set_real_ip_from 185.50.105.136/29; +set_real_ip_from 213.179.213.16/29; +set_real_ip_from 162.244.52.120/29; +set_real_ip_from 188.122.80.240/29; +set_real_ip_from 109.200.195.64/29; +set_real_ip_from 109.200.199.224/29; +set_real_ip_from 185.228.238.0/28; +set_real_ip_from 94.182.153.24/29; +set_real_ip_from 94.101.182.0/27; +set_real_ip_from 37.152.184.208/28; +set_real_ip_from 78.39.156.192/28; +set_real_ip_from 158.255.77.238/31; +set_real_ip_from 81.12.28.16/29; +set_real_ip_from 176.65.192.202/31; +set_real_ip_from 2.144.3.128/28; +set_real_ip_from 89.45.48.64/28; +set_real_ip_from 37.32.16.0/27; +set_real_ip_from 37.32.17.0/27; +set_real_ip_from 37.32.18.0/27; + +real_ip_header X-Real-IP; \ No newline at end of file diff --git a/files/etc/nginx/cdn/cdn-arvancloud.py b/files/etc/nginx/cdn/cdn-arvancloud.py new file mode 100755 index 0000000..5b6ce5c --- /dev/null +++ b/files/etc/nginx/cdn/cdn-arvancloud.py @@ -0,0 +1,21 @@ +#!/usr/local/bin/python3 +""" +Util to grab ArvanCloud Inbound addresses +""" +#!/usr/local/bin/python3 +# coding: utf-8 + +import requests + +ips = requests.get("https://www.arvancloud.com/fa/ips.txt").text +config = "" + +for item in ips.split(): + directive = f"set_real_ip_from {item};\n" + config += directive + +bottom = "real_ip_header X-Real-IP;" +config += "\n" + bottom + +with open("cdn-arvancloud.conf", "w")as f: + f.write(config) \ No newline at end of file diff --git a/files/etc/nginx/cdn/cdn-bunny.conf b/files/etc/nginx/cdn/cdn-bunny.conf new file mode 100644 index 0000000..15d5958 --- /dev/null +++ b/files/etc/nginx/cdn/cdn-bunny.conf @@ -0,0 +1,439 @@ +set_real_ip_from 185.93.1.242; +set_real_ip_from 185.152.67.139; +set_real_ip_from 91.189.179.2; +set_real_ip_from 185.152.67.22; +set_real_ip_from 185.152.67.152; +set_real_ip_from 54.38.195.201; +set_real_ip_from 217.182.201.147; +set_real_ip_from 89.187.185.87; +set_real_ip_from 212.102.50.49; +set_real_ip_from 84.17.46.50; +set_real_ip_from 89.187.185.163; +set_real_ip_from 84.17.37.209; +set_real_ip_from 89.187.185.162; +set_real_ip_from 89.187.188.223; +set_real_ip_from 89.187.188.227; +set_real_ip_from 89.187.188.228; +set_real_ip_from 185.59.220.196; +set_real_ip_from 212.102.50.50; +set_real_ip_from 185.93.2.242; +set_real_ip_from 185.180.14.250; +set_real_ip_from 185.59.220.193; +set_real_ip_from 185.93.2.241; +set_real_ip_from 95.217.37.33; +set_real_ip_from 84.17.63.177; +set_real_ip_from 185.93.1.241; +set_real_ip_from 195.181.163.193; +set_real_ip_from 89.187.169.15; +set_real_ip_from 84.17.44.181; +set_real_ip_from 51.79.176.84; +set_real_ip_from 51.79.176.85; +set_real_ip_from 89.187.162.244; +set_real_ip_from 212.102.46.113; +set_real_ip_from 139.180.134.196; +set_real_ip_from 45.32.177.93; +set_real_ip_from 51.83.238.53; +set_real_ip_from 89.38.96.158; +set_real_ip_from 195.181.163.194; +set_real_ip_from 217.138.193.34; +set_real_ip_from 102.129.144.45; +set_real_ip_from 185.243.214.143; +set_real_ip_from 185.243.214.145; +set_real_ip_from 92.223.87.36; +set_real_ip_from 5.188.95.16; +set_real_ip_from 185.59.220.194; +set_real_ip_from 89.187.162.249; +set_real_ip_from 89.187.162.242; +set_real_ip_from 185.243.214.239; +set_real_ip_from 185.102.217.65; +set_real_ip_from 185.93.1.243; +set_real_ip_from 185.243.214.244; +set_real_ip_from 156.146.40.49; +set_real_ip_from 185.59.220.199; +set_real_ip_from 185.59.220.198; +set_real_ip_from 195.181.166.158; +set_real_ip_from 185.180.12.68; +set_real_ip_from 185.31.158.210; +set_real_ip_from 139.99.63.197; +set_real_ip_from 138.199.57.151; +set_real_ip_from 138.199.24.209; +set_real_ip_from 89.187.162.251; +set_real_ip_from 138.199.24.211; +set_real_ip_from 89.187.169.3; +set_real_ip_from 89.187.185.164; +set_real_ip_from 89.187.169.39; +set_real_ip_from 89.187.169.47; +set_real_ip_from 37.19.206.70; +set_real_ip_from 5.189.202.54; +set_real_ip_from 5.188.120.15; +set_real_ip_from 200.25.62.76; +set_real_ip_from 156.146.53.225; +set_real_ip_from 200.25.38.139; +set_real_ip_from 138.199.24.218; +set_real_ip_from 138.199.24.219; +set_real_ip_from 138.199.46.65; +set_real_ip_from 185.40.106.117; +set_real_ip_from 143.244.38.129; +set_real_ip_from 200.25.45.4; +set_real_ip_from 200.25.57.5; +set_real_ip_from 200.25.22.6; +set_real_ip_from 200.25.11.8; +set_real_ip_from 200.25.53.5; +set_real_ip_from 122.10.147.2; +set_real_ip_from 200.25.13.98; +set_real_ip_from 128.1.121.170; +set_real_ip_from 209.177.87.194; +set_real_ip_from 107.155.21.186; +set_real_ip_from 107.155.6.130; +set_real_ip_from 107.155.27.226; +set_real_ip_from 84.17.44.161; +set_real_ip_from 185.180.13.248; +set_real_ip_from 143.244.60.109; +set_real_ip_from 41.242.2.18; +set_real_ip_from 92.38.138.8; +set_real_ip_from 200.25.62.5; +set_real_ip_from 200.25.38.69; +set_real_ip_from 200.25.42.70; +set_real_ip_from 200.25.36.166; +set_real_ip_from 195.206.229.106; +set_real_ip_from 138.199.9.99; +set_real_ip_from 138.199.9.98; +set_real_ip_from 138.199.37.225; +set_real_ip_from 92.223.88.123; +set_real_ip_from 84.17.46.52; +set_real_ip_from 92.223.80.170; +set_real_ip_from 185.93.2.243; +set_real_ip_from 194.242.11.186; +set_real_ip_from 37.19.203.80; +set_real_ip_from 138.199.37.226; +set_real_ip_from 65.108.101.60; +set_real_ip_from 185.164.35.8; +set_real_ip_from 193.39.14.167; +set_real_ip_from 185.173.226.42; +set_real_ip_from 195.69.143.190; +set_real_ip_from 94.20.154.22; +set_real_ip_from 37.19.216.129; +set_real_ip_from 185.93.1.244; +set_real_ip_from 89.38.224.138; +set_real_ip_from 213.170.143.68; +set_real_ip_from 138.199.9.107; +set_real_ip_from 156.59.145.154; +set_real_ip_from 143.244.49.177; +set_real_ip_from 102.129.144.44; +set_real_ip_from 141.94.200.27; +set_real_ip_from 23.248.177.58; +set_real_ip_from 138.199.46.66; +set_real_ip_from 138.199.37.227; +set_real_ip_from 138.199.37.231; +set_real_ip_from 138.199.37.230; +set_real_ip_from 138.199.37.229; +set_real_ip_from 103.216.222.103; +set_real_ip_from 138.199.46.69; +set_real_ip_from 138.199.46.68; +set_real_ip_from 138.199.46.67; +set_real_ip_from 185.93.1.246; +set_real_ip_from 103.216.222.105; +set_real_ip_from 103.216.222.107; +set_real_ip_from 138.199.37.232; +set_real_ip_from 103.216.222.109; +set_real_ip_from 195.181.163.196; +set_real_ip_from 107.182.163.162; +set_real_ip_from 195.181.163.195; +set_real_ip_from 84.17.46.53; +set_real_ip_from 212.102.40.114; +set_real_ip_from 185.234.52.150; +set_real_ip_from 84.17.46.54; +set_real_ip_from 138.199.40.58; +set_real_ip_from 143.244.38.134; +set_real_ip_from 185.152.64.17; +set_real_ip_from 84.17.59.115; +set_real_ip_from 89.187.165.194; +set_real_ip_from 103.216.222.111; +set_real_ip_from 138.199.15.193; +set_real_ip_from 89.35.237.170; +set_real_ip_from 37.19.216.130; +set_real_ip_from 185.93.1.247; +set_real_ip_from 185.93.3.244; +set_real_ip_from 180.149.231.39; +set_real_ip_from 209.160.96.178; +set_real_ip_from 143.244.49.179; +set_real_ip_from 143.244.49.180; +set_real_ip_from 195.181.164.178; +set_real_ip_from 143.244.49.187; +set_real_ip_from 143.244.51.67; +set_real_ip_from 143.244.51.65; +set_real_ip_from 143.244.51.66; +set_real_ip_from 138.199.9.104; +set_real_ip_from 122.10.251.138; +set_real_ip_from 212.102.50.52; +set_real_ip_from 185.152.66.243; +set_real_ip_from 143.244.49.178; +set_real_ip_from 156.146.53.227; +set_real_ip_from 146.59.68.188; +set_real_ip_from 200.25.18.73; +set_real_ip_from 84.17.63.178; +set_real_ip_from 200.25.32.131; +set_real_ip_from 143.244.38.139; +set_real_ip_from 169.150.215.113; +set_real_ip_from 37.19.207.34; +set_real_ip_from 204.16.244.131; +set_real_ip_from 208.83.234.216; +set_real_ip_from 87.249.137.50; +set_real_ip_from 185.93.2.248; +set_real_ip_from 134.195.197.175; +set_real_ip_from 128.1.104.170; +set_real_ip_from 192.189.65.146; +set_real_ip_from 143.244.45.177; +set_real_ip_from 176.123.9.72; +set_real_ip_from 185.93.1.249; +set_real_ip_from 185.93.1.250; +set_real_ip_from 169.150.215.115; +set_real_ip_from 209.177.87.197; +set_real_ip_from 156.146.56.162; +set_real_ip_from 156.146.56.161; +set_real_ip_from 185.93.2.246; +set_real_ip_from 185.93.2.245; +set_real_ip_from 212.102.50.58; +set_real_ip_from 212.102.40.113; +set_real_ip_from 185.93.2.244; +set_real_ip_from 158.69.123.215; +set_real_ip_from 143.244.50.82; +set_real_ip_from 143.244.50.83; +set_real_ip_from 156.146.56.163; +set_real_ip_from 156.59.181.10; +set_real_ip_from 185.135.85.154; +set_real_ip_from 104.218.233.175; +set_real_ip_from 185.165.170.74; +set_real_ip_from 92.223.103.16; +set_real_ip_from 129.227.217.178; +set_real_ip_from 200.25.69.72; +set_real_ip_from 139.99.68.6; +set_real_ip_from 128.1.52.179; +set_real_ip_from 200.25.16.103; +set_real_ip_from 15.235.54.226; +set_real_ip_from 102.67.138.155; +set_real_ip_from 156.59.126.78; +set_real_ip_from 192.34.87.166; +set_real_ip_from 102.219.177.93; +set_real_ip_from 146.70.80.218; +set_real_ip_from 156.146.43.65; +set_real_ip_from 195.181.163.203; +set_real_ip_from 195.181.163.202; +set_real_ip_from 156.146.56.169; +set_real_ip_from 156.146.56.170; +set_real_ip_from 156.146.56.166; +set_real_ip_from 156.146.56.171; +set_real_ip_from 169.150.207.210; +set_real_ip_from 156.146.56.167; +set_real_ip_from 185.81.165.6; +set_real_ip_from 143.244.50.84; +set_real_ip_from 143.244.50.85; +set_real_ip_from 143.244.50.86; +set_real_ip_from 143.244.50.87; +set_real_ip_from 156.146.56.168; +set_real_ip_from 169.150.207.211; +set_real_ip_from 207.246.64.80; +set_real_ip_from 116.202.155.146; +set_real_ip_from 108.61.127.143; +set_real_ip_from 116.202.193.178; +set_real_ip_from 116.202.236.170; +set_real_ip_from 46.4.116.17; +set_real_ip_from 104.194.8.93; +set_real_ip_from 139.99.150.49; +set_real_ip_from 116.202.224.168; +set_real_ip_from 188.40.126.227; +set_real_ip_from 88.99.26.189; +set_real_ip_from 168.119.39.238; +set_real_ip_from 88.99.26.97; +set_real_ip_from 168.119.12.188; +set_real_ip_from 199.247.1.226; +set_real_ip_from 157.245.99.163; +set_real_ip_from 51.195.190.71; +set_real_ip_from 169.197.143.85; +set_real_ip_from 169.197.143.195; +set_real_ip_from 104.238.220.175; +set_real_ip_from 176.9.139.55; +set_real_ip_from 176.9.139.94; +set_real_ip_from 172.96.160.206; +set_real_ip_from 38.75.137.102; +set_real_ip_from 38.75.137.10; +set_real_ip_from 38.75.136.40; +set_real_ip_from 38.75.137.65; +set_real_ip_from 38.75.136.153; +set_real_ip_from 38.75.136.111; +set_real_ip_from 5.161.66.71; +set_real_ip_from 142.132.223.79; +set_real_ip_from 142.132.223.80; +set_real_ip_from 142.132.223.81; +set_real_ip_from 5.161.88.97; +set_real_ip_from 5.161.90.228; +set_real_ip_from 5.161.85.161; +set_real_ip_from 5.161.78.181; +set_real_ip_from 5.161.84.169; +set_real_ip_from 5.161.92.86; +set_real_ip_from 5.161.92.85; +set_real_ip_from 5.161.92.84; +set_real_ip_from 5.161.72.83; +set_real_ip_from 5.161.70.244; +set_real_ip_from 5.161.71.198; +set_real_ip_from 5.161.49.93; +set_real_ip_from 5.161.72.89; +set_real_ip_from 5.161.72.135; +set_real_ip_from 5.161.72.194; +set_real_ip_from 5.161.72.200; +set_real_ip_from 5.161.70.230; +set_real_ip_from 5.161.60.80; +set_real_ip_from 38.75.137.193; +set_real_ip_from 38.75.136.208; +set_real_ip_from 64.140.160.18; +set_real_ip_from 104.237.58.186; +set_real_ip_from 64.140.162.66; +set_real_ip_from 169.150.207.55; +set_real_ip_from 143.244.50.81; +set_real_ip_from 143.244.51.75; +set_real_ip_from 169.150.207.56; +set_real_ip_from 109.248.43.116; +set_real_ip_from 109.248.43.117; +set_real_ip_from 109.248.43.162; +set_real_ip_from 109.248.43.163; +set_real_ip_from 109.248.43.164; +set_real_ip_from 109.248.43.165; +set_real_ip_from 49.12.71.27; +set_real_ip_from 49.12.0.158; +set_real_ip_from 78.47.94.156; +set_real_ip_from 109.248.43.159; +set_real_ip_from 109.248.43.160; +set_real_ip_from 109.248.43.208; +set_real_ip_from 109.248.43.179; +set_real_ip_from 109.248.43.232; +set_real_ip_from 109.248.43.231; +set_real_ip_from 109.248.43.241; +set_real_ip_from 109.248.43.236; +set_real_ip_from 109.248.43.240; +set_real_ip_from 116.202.118.194; +set_real_ip_from 116.202.80.29; +set_real_ip_from 159.69.57.80; +set_real_ip_from 139.180.129.216; +set_real_ip_from 139.99.174.7; +set_real_ip_from 89.187.169.18; +set_real_ip_from 89.187.162.166; +set_real_ip_from 89.187.162.245; +set_real_ip_from 185.180.13.241; +set_real_ip_from 185.180.13.242; +set_real_ip_from 185.180.13.243; +set_real_ip_from 185.59.220.203; +set_real_ip_from 185.59.220.200; +set_real_ip_from 185.59.220.202; +set_real_ip_from 185.59.220.201; +set_real_ip_from 89.187.169.26; +set_real_ip_from 212.102.56.49; +set_real_ip_from 212.102.56.48; +set_real_ip_from 212.102.56.54; +set_real_ip_from 212.102.56.57; +set_real_ip_from 185.180.13.246; +set_real_ip_from 143.244.63.120; +set_real_ip_from 138.199.9.97; +set_real_ip_from 138.199.40.49; +set_real_ip_from 138.199.40.50; +set_real_ip_from 138.199.40.51; +set_real_ip_from 138.199.9.105; +set_real_ip_from 143.244.38.132; +set_real_ip_from 143.244.38.133; +set_real_ip_from 37.19.222.241; +set_real_ip_from 143.244.49.181; +set_real_ip_from 89.187.179.7; +set_real_ip_from 84.17.35.196; +set_real_ip_from 84.17.35.195; +set_real_ip_from 143.244.62.213; +set_real_ip_from 185.93.3.246; +set_real_ip_from 195.181.163.198; +set_real_ip_from 185.152.64.19; +set_real_ip_from 84.17.37.211; +set_real_ip_from 212.102.50.54; +set_real_ip_from 138.199.4.133; +set_real_ip_from 138.199.4.132; +set_real_ip_from 212.102.46.115; + +set_real_ip_from 2a02:6ea0:c80f::6; +set_real_ip_from 2a02:6ea0:c80f::5; +set_real_ip_from 2001:41d0:602:1ac9::; +set_real_ip_from 2001:41d0:0602:0493::; +set_real_ip_from 2400:52e0:1e02::576:1; +set_real_ip_from 2400:52e0:1e00::601:1; +set_real_ip_from 2400:52e0:1e02::602:1; +set_real_ip_from 2a01:4f9:2b:2f5e::2; +set_real_ip_from 2400:52e0:1a02::625:1; +set_real_ip_from 2400:52e0:1500::641:1; +set_real_ip_from 2400:52e0:1a02::674:1; +set_real_ip_from 2400:52e0:1500::714:1; +set_real_ip_from 2400:52e0:1500::715:1; +set_real_ip_from 2400:52e0:1e00::723:1; +set_real_ip_from 2400:52e0:1500::747:1; +set_real_ip_from 2400:52e0:1500::749:1; +set_real_ip_from 2400:52e0:1500::782:1; +set_real_ip_from 2400:52e0:1500::783:1; +set_real_ip_from 2400:52e0:1500::784:1; +set_real_ip_from 2400:52e0:1e02::827:1; +set_real_ip_from 2400:52e0:1500::858:1; +set_real_ip_from 2400:52e0:1e00::860:1; +set_real_ip_from 2400:52e0:1e00::863:1; +set_real_ip_from 2400:52e0:1e00::864:1; +set_real_ip_from 2400:52e0:1e00::865:1; +set_real_ip_from 2400:52e0:1500::867:1; +set_real_ip_from 2400:52e0:1500::868:1; +set_real_ip_from 2400:52e0:1500::869:1; +set_real_ip_from 2400:52e0:1e00::874:1; +set_real_ip_from 2400:52e0:1a02::876:1; +set_real_ip_from 2400:52e0:1a02::878:1; +set_real_ip_from 2400:52e0:1e01::879:1; +set_real_ip_from 2400:52e0:1a03::881:1; +set_real_ip_from 2400:52e0:1e01::883:1; +set_real_ip_from 2400:52e0:1a01::912:1; +set_real_ip_from 2800:1e0:2410:1::9; +set_real_ip_from 2607:fdc0:1:a:bace:f6ff:fe01:e295; +set_real_ip_from 2400:52e0:1e02::932:1; +set_real_ip_from 2400:52e0:1a00::940:1; +set_real_ip_from 2400:52e0:1a00::941:1; +set_real_ip_from 2400:52e0:1500::944:1; +set_real_ip_from 2400:52e0:1500::945:1; +set_real_ip_from 2400:52e0:1e02::946:1; +set_real_ip_from 2400:52e0:1e02::947:1; +set_real_ip_from 2400:52e0:1a03::950:1; +set_real_ip_from 2400:52e0:1e02::951:1; +set_real_ip_from 2607:5300:60:9ad7::1; +set_real_ip_from 2400:52e0:1a01::953:1; +set_real_ip_from 2400:52e0:1a01::954:1; +set_real_ip_from 2400:52e0:1500::955:1; +set_real_ip_from 2800:1e0:2420:2::a; +set_real_ip_from 2402:1f00:8001:706::1; +set_real_ip_from 2607:5300:203:a1e2::1; +set_real_ip_from 2001:ac8:37:74::973:1; +set_real_ip_from 2400:52e0:1a02::974:1; +set_real_ip_from 2400:52e0:1a02::975:1; +set_real_ip_from 2400:52e0:1a02::976:1; +set_real_ip_from 2400:52e0:1500::977:1; +set_real_ip_from 2400:52e0:1500::978:1; +set_real_ip_from 2400:52e0:1500::979:1; +set_real_ip_from 2400:52e0:1500::980:1; +set_real_ip_from 2400:52e0:1500::981:1; +set_real_ip_from 2400:52e0:1500::982:1; +set_real_ip_from 2a02:7b40:b951:a506::1; +set_real_ip_from 2400:52e0:1a01::984:1; +set_real_ip_from 2400:52e0:1a01::985:1; +set_real_ip_from 2400:52e0:1a01::986:1; +set_real_ip_from 2400:52e0:1a01::987:1; +set_real_ip_from 2400:52e0:1500::988:1; +set_real_ip_from 2400:52e0:1500::989:1; +set_real_ip_from 2a04:ff07:d9:12::1; +set_real_ip_from 2a04:ff07:d9:13::1; +set_real_ip_from 2a04:ff07:d9:39::1; +set_real_ip_from 2a04:ff07:d9:3::1; +set_real_ip_from 2a04:ff07:d9:3a::1; +set_real_ip_from 2a04:ff07:d9:3b::1; +set_real_ip_from 2a04:ff07:d9:1::1; +set_real_ip_from 2a04:ff07:d9:1b::1; +set_real_ip_from 2a01:4f8:c17:aec0::1; +set_real_ip_from 2a01:4f8:c17:fc7::1; +set_real_ip_from 2a01:4f8:c17:20b2::1; + +real_ip_header X-Real-IP; \ No newline at end of file diff --git a/files/etc/nginx/cdn/cdn-bunny.py b/files/etc/nginx/cdn/cdn-bunny.py new file mode 100755 index 0000000..c28ed4c --- /dev/null +++ b/files/etc/nginx/cdn/cdn-bunny.py @@ -0,0 +1,26 @@ +#!/usr/local/bin/python3 +""" +Util to grab ArvanCloud Inbound addresses +""" +#!/usr/local/bin/python3 +# coding: utf-8 + +import requests + +v4 = requests.get("https://bunnycdn.com/api/system/edgeserverlist").json() +v6 = requests.get("https://bunnycdn.com/api/system/edgeserverlist/ipv6").json() +config = "" + +for item in v4: + directive = f"set_real_ip_from {item};\n" + config += directive +config += "\n" +for item in v6: + directive = f"set_real_ip_from {item};\n" + config += directive + +bottom = "real_ip_header X-Real-IP;" +config += "\n" + bottom + +with open("cdn-bunny.conf", "w")as f: + f.write(config) \ No newline at end of file diff --git a/files/etc/nginx/cdn/cdn-cloudflare.conf b/files/etc/nginx/cdn/cdn-cloudflare.conf new file mode 100644 index 0000000..862d89e --- /dev/null +++ b/files/etc/nginx/cdn/cdn-cloudflare.conf @@ -0,0 +1,25 @@ +set_real_ip_from 173.245.48.0/20; +set_real_ip_from 103.21.244.0/22; +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/13; +set_real_ip_from 104.24.0.0/14; +set_real_ip_from 172.64.0.0/13; +set_real_ip_from 131.0.72.0/22; + +set_real_ip_from 2400:cb00::/32; +set_real_ip_from 2606:4700::/32; +set_real_ip_from 2803:f800::/32; +set_real_ip_from 2405:b500::/32; +set_real_ip_from 2405:8100::/32; +set_real_ip_from 2a06:98c0::/29; +set_real_ip_from 2c0f:f248::/32; + +real_ip_header CF-Connecting-IP; \ No newline at end of file diff --git a/files/etc/nginx/cdn/cdn-cloudflare.py b/files/etc/nginx/cdn/cdn-cloudflare.py new file mode 100755 index 0000000..3727513 --- /dev/null +++ b/files/etc/nginx/cdn/cdn-cloudflare.py @@ -0,0 +1,22 @@ +#!/usr/local/bin/python3 +# coding: utf-8 + +import requests + +v4 = requests.get("https://www.cloudflare.com/ips-v4").text +v6 = requests.get("https://www.cloudflare.com/ips-v6").text +config = "" + +for item in v4.split(): + directive = f"set_real_ip_from {item};\n" + config += directive +config += "\n" +for item in v6.split(): + directive = f"set_real_ip_from {item};\n" + config += directive + +bottom = "real_ip_header CF-Connecting-IP;" +config += "\n" + bottom + +with open("cdn-cloudflare.conf", "w")as f: + f.write(config) \ No newline at end of file diff --git a/files/etc/nginx/cdn/cdn-fastly.conf b/files/etc/nginx/cdn/cdn-fastly.conf new file mode 100644 index 0000000..aec9d92 --- /dev/null +++ b/files/etc/nginx/cdn/cdn-fastly.conf @@ -0,0 +1,21 @@ +set_real_ip_from 23.235.32.0/20 +set_real_ip_from 43.249.72.0/22 +set_real_ip_from 103.244.50.0/24 +set_real_ip_from 103.245.222.0/23 +set_real_ip_from 103.245.224.0/24 +set_real_ip_from 104.156.80.0/20 +set_real_ip_from 140.248.64.0/18 +set_real_ip_from 140.248.128.0/17 +set_real_ip_from 146.75.0.0/17 +set_real_ip_from 151.101.0.0/16 +set_real_ip_from 157.52.64.0/18 +set_real_ip_from 167.82.0.0/17 +set_real_ip_from 167.82.128.0/20 +set_real_ip_from 167.82.160.0/20 +set_real_ip_from 167.82.224.0/20 +set_real_ip_from 172.111.64.0/18 +set_real_ip_from 185.31.16.0/22 +set_real_ip_from 199.27.72.0/21 +set_real_ip_from 199.232.0.0/16 + +real_ip_header Fastly-Client-IP; \ No newline at end of file diff --git a/files/etc/nginx/cdn/cdn-fastly.py b/files/etc/nginx/cdn/cdn-fastly.py new file mode 100755 index 0000000..e5cb876 --- /dev/null +++ b/files/etc/nginx/cdn/cdn-fastly.py @@ -0,0 +1,16 @@ +#!/usr/local/bin/python3 +""" +Util to grab Fastly Inbound addresses +""" +import requests + +url = 'https://api.fastly.com/public-ip-list' +json = requests.get(url).json() + +config = "set_real_ip_from " +config += "\nset_real_ip_from ".join(json["addresses"]) +bottom = "real_ip_header Fastly-Client-IP;" +config += "\n\n" + bottom + +with open("cdn-fastly.conf", "w")as f: + f.write(config) \ No newline at end of file