Create allow_cloudflare.sh
parent
c475363564
commit
5e22ed5f73
|
@ -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
|
Loading…
Reference in New Issue