Created
August 1, 2015 22:43
-
-
Save RaeesBhatti/e336ab920ab523335937 to your computer and use it in GitHub Desktop.
Allow HTTP and HTTPS from CloudFlare only (Ubuntu)
This file contains hidden or 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 | |
for i in `curl https://www.cloudflare.com/ips-v4`; do ufw allow from $i to any port 80; done | |
for i in `curl https://www.cloudflare.com/ips-v6`; do ufw allow from $i to any port 80; done | |
## If you have setup Full or Strict SSL settings with CloudFlare, use this one also | |
for i in `curl https://www.cloudflare.com/ips-v4`; do ufw allow from $i to any port 443; done | |
for i in `curl https://www.cloudflare.com/ips-v6`; do ufw allow from $i to any port 433; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment