Create allow_cloudflare.sh

pull/8/head
qwertyforce 2021-07-17 22:16:01 +03:00
parent c475363564
commit 5e22ed5f73
1 changed files with 18 additions and 0 deletions

18
misc/allow_cloudflare.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
set -e
cf_ips() {
echo "# https://www.cloudflare.com/ips"
for type in v4 v6; do
echo "# IP$type"
curl -s "https://www.cloudflare.com/ips-$type" | sed "s|^|allow |g" | sed "s|\$|;|g"
echo
done
echo "# Generated at $(LC_ALL=C date)"
}
cf_ips > allow-cloudflare.conf
(cf_ips && echo "deny all; # deny all remaining ips") > allow-cloudflare-only.conf