From 6939b54f18b5c95e4d7e41f569c86e8956c41c52 Mon Sep 17 00:00:00 2001 From: TommyTran732 <57488583+tommytran732@users.noreply.github.com> Date: Fri, 3 Jan 2020 03:38:37 -0500 Subject: [PATCH] Update cloudflare.sh --- cloudflare.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cloudflare.sh b/cloudflare.sh index b340f0b..64c823a 100644 --- a/cloudflare.sh +++ b/cloudflare.sh @@ -32,7 +32,17 @@ elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = yum -y install firewalld wget wget https://www.cloudflare.com/ips-v4 wget https://www.cloudflare.com/ips-v6 + for ips in `cat ips-v4`; + do + firewall-cmd --add-rich-rule='rule family="ipv4" source address="$ips" port port="80" protocol="tcp" accept' + firewall-cmd --add-rich-rule='rule family="ipv4" source address="$ips" port port="443" protocol="tcp" accept' + done + for ips in `cat ips-v6`; + do + firewall-cmd --add-rich-rule='rule family="ipv6" source address="$ips" port port="80" protocol="tcp" accept' + firewall-cmd --add-rich-rule='rule family="ipv6" source address="$ips" port port="443" protocol="tcp" accept' + done firewall-cmd --reload else output "Unsupported distribution. This script only supports Fedora, RHEL, CentOS, Ubuntu, and Debian."