My assumption is that CF used to send their IP list without a trailing
newline, and they've recently fixed that, causing riking's hack to emit an
*extra* newline, which caused the reported problem.
#!/bin/bash -e
# Download list of CloudFlare ips
wget https://www.cloudflare.com/ips-v4 -O - > /tmp/cloudflare-ips
- echo >> /tmp/cloudflare-ips
wget https://www.cloudflare.com/ips-v6 -O - >> /tmp/cloudflare-ips
# Make into nginx commands and escape for inclusion into sed append command
CONTENTS=$(</tmp/cloudflare-ips sed 's/^/set_real_ip_from /' | sed 's/$/;/' | tr '\n' '\\' | sed 's/\\/\\n/g')