Skip to content

Commit

Permalink
Add: Cloudflare IPs whitelist task
Browse files Browse the repository at this point in the history
  • Loading branch information
fatk committed Jan 3, 2023
1 parent 1b693e3 commit 11e13a0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions nginx-proxy/tasks/cloudflare-whitelist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

CLOUDFLARE_FILE_PATH=/opt/apps/pixelcloud/nginx-proxy/volumes/nginx/conf.d/cloudflare.conf

echo "#Cloudflare" > $CLOUDFLARE_FILE_PATH;
echo "" >> $CLOUDFLARE_FILE_PATH;

echo "# - IPv4" >> $CLOUDFLARE_FILE_PATH;
for i in `curl -s -L https://www.cloudflare.com/ips-v4`; do
echo "set_real_ip_from $i;" >> $CLOUDFLARE_FILE_PATH;
done

echo "" >> $CLOUDFLARE_FILE_PATH;
echo "# - IPv6" >> $CLOUDFLARE_FILE_PATH;
for i in `curl -s -L https://www.cloudflare.com/ips-v6`; do
echo "set_real_ip_from $i;" >> $CLOUDFLARE_FILE_PATH;
done

echo "" >> $CLOUDFLARE_FILE_PATH;
echo "real_ip_header CF-Connecting-IP;" >> $CLOUDFLARE_FILE_PATH;

0 comments on commit 11e13a0

Please sign in to comment.