Skip to content

Commit

Permalink
add various cdn ips sync
Browse files Browse the repository at this point in the history
  • Loading branch information
noogen committed Sep 19, 2022
1 parent 852421f commit cbfd69b
Show file tree
Hide file tree
Showing 11 changed files with 623 additions and 73 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 - \
Expand All @@ -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/*
Expand Down
File renamed without changes.
75 changes: 3 additions & 72 deletions files/etc/nginx/cdn-ips.conf
Original file line number Diff line number Diff line change
@@ -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;

48 changes: 48 additions & 0 deletions files/etc/nginx/cdn/cdn-arvancloud.conf
Original file line number Diff line number Diff line change
@@ -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;
21 changes: 21 additions & 0 deletions files/etc/nginx/cdn/cdn-arvancloud.py
Original file line number Diff line number Diff line change
@@ -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)
Loading

0 comments on commit cbfd69b

Please sign in to comment.