Created
July 12, 2022 12:53
-
-
Save badwallass/f7f8ba1e22b8987cf8d790f4f00b2db7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
cf_ips() { | |
echo "# https://www.cloudflare.com/ips" | |
echo "geo \$realip_remote_addr \$cloudflare_ip {" | |
echo "default 0;" | |
for type in v4 v6; do | |
echo "# IP$type" | |
curl -sL "https://www.cloudflare.com/ips-$type/" | sed "s|\$| 1;|g" | |
echo | |
done | |
echo "}" | |
echo "# Generated at $(LC_ALL=C date)" | |
} | |
cf_ips > /path/to/allow-cloudflare.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment