From ae5a223074388795e4ea073a162cbf1dc174d392 Mon Sep 17 00:00:00 2001 From: Paul Buonopane Date: Thu, 12 Aug 2021 13:05:45 -0400 Subject: [PATCH] Fix line break handling in Cloudflare template Cloudflare's IP list has gone back and forth between including a trailing line break and omitting it. When a trailing line break was first added in 2015, it resulted in a bug: https://meta.discourse.org/t/issue-with-cloudflare-template/35113 The trailing line break was removed again in 2021: https://meta.discourse.org/t/cloudflare-template-broken-again/200219 This fixes the template so that it will work regardless of extra line breaks. It will also safely ignore any empty lines that may appear in the files. --- templates/cloudflare.template.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/cloudflare.template.yml b/templates/cloudflare.template.yml index 45f29e2..2f5a089 100644 --- a/templates/cloudflare.template.yml +++ b/templates/cloudflare.template.yml @@ -6,9 +6,10 @@ run: #!/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=$(