Firewalld Cloudflare Proxy Whitelisting

But again, my suspicion it would be the order of priority that makes it all fall apart.
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv4" priority=1 source ipset="Cloudflarev4" service name="https" accept'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv6" priority=1 source ipset="Cloudflarev6" service name="https" accept'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv4" priority=1 source ipset="Cloudflarev4" service name="http" accept'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv6" priority=1 source ipset="Cloudflarev6" service name="http" accept'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv4" priority=32767 source address="0.0.0.0/0" service name="http" drop'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv4" priority=32767 source address="0.0.0.0/0" service name="https" drop'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv4" priority=1 source ipset="Cloudflarev4" service name="https" accept'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv6" priority=1 source ipset="Cloudflarev6" service name="https" accept'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv4" priority=1 source ipset="Cloudflarev4" service name="http" accept'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv6" priority=1 source ipset="Cloudflarev6" service name="http" accept'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv4" priority=32767 source address="0.0.0.0/0" service name="http" drop'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv4" priority=32767 source address="0.0.0.0/0" service name="https" drop'
MIGHT be able to fix that, if you insist on the two drop rules.
47 Replies
DarkDeviL
DarkDeviLOP•2y ago
You can literally do whatever you prefer in that regards. E.g.: - Add logging to the two drop rules - Remove the drop rules (and hope the default LogDenied=all catches them) Whatever you prefer that way, is up to you.
Kasumi (Deactivated Account)
So I've to remove these:
rule family="ipv6" source ipset="Cloudflarev6" service name="https" accept
rule family="ipv4" source ipset="Cloudflarev4" service name="http" accept
rule family="ipv6" source ipset="Cloudflarev6" service name="http" accept
rule family="ipv4" source ipset="Cloudflarev4" service name="https" accept
rule family="ipv4" source address="0.0.0.0/0" service name="http" log prefix="HTTP-/080-DROP: " drop
rule family="ipv4" source address="0.0.0.0/0" service name="https" log prefix="HTTPS/443-DROP: " drop
rule family="ipv6" source ipset="Cloudflarev6" service name="https" accept
rule family="ipv4" source ipset="Cloudflarev4" service name="http" accept
rule family="ipv6" source ipset="Cloudflarev6" service name="http" accept
rule family="ipv4" source ipset="Cloudflarev4" service name="https" accept
rule family="ipv4" source address="0.0.0.0/0" service name="http" log prefix="HTTP-/080-DROP: " drop
rule family="ipv4" source address="0.0.0.0/0" service name="https" log prefix="HTTPS/443-DROP: " drop
and add yours
DarkDeviL
DarkDeviLOP•2y ago
Those should be fine, for logging what it drops there.
DarkDeviL
DarkDeviLOP•2y ago
But if that doesn't help you, e.g. that it is still not logging anything, I'd suggest adding the priorities like above.
DarkDeviL
DarkDeviLOP•2y ago
Normally, I'm not running with that firewall-cmd thing though. But AFAIK, priority=1 should win over e.g. priority=32767 in the example above. E.g. lowest number comes first and wins, - just like e.g. MX records.
Kasumi (Deactivated Account)
yes Yes thanks I like firewalld more because its the only one that really works and also looks very good but the syntax is a bit yea. Its packed with features x3
DarkDeviL
DarkDeviLOP•2y ago
Well I would probably hold back with your continuous mention of "the only one that really works" and such stuff. It only just shouting PEBKAC.
Kasumi (Deactivated Account)
It looks like that it works
DarkDeviL
DarkDeviLOP•2y ago
drop log, or priority?
Kasumi (Deactivated Account)
Yes uhhh both Just Cloudflare Proxy is getting through and everything else is blocked :loveHeartHug: thanks I'll also menation everything of that and yea also Document it so I can understand it more thank you nvmd nmap still says that 80 and 443 is open
DarkDeviL
DarkDeviLOP•2y ago
From where are you nmap'ing?
Kasumi (Deactivated Account)
From my Laptop Local Device and Network
DarkDeviL
DarkDeviLOP•2y ago
Sitting at the same LAN?
DarkDeviL
DarkDeviLOP•2y ago
Hm, wait a minute...
Kasumi (Deactivated Account)
Okay :0047k3lly_think:
DarkDeviL
DarkDeviLOP•2y ago
Are you nmap'ing through IPv4 or IPv6?
Kasumi (Deactivated Account)
uhh both but I guess more IPv4 And I also added IPv6 dropping
DarkDeviL
DarkDeviLOP•2y ago
Seems like failed to copy your IPv6 drop rules above (And adjusting etc. in my examples)
Kasumi (Deactivated Account)
I jsut did that:
[root@v6108 ssl]# sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv6" priority=32767 source address="::/0" service name="https" drop'
success
[root@v6108 ssl]# sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv6" priority=32767 source address="::/0" service name="http" drop'
[root@v6108 ssl]# sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv6" priority=32767 source address="::/0" service name="https" drop'
success
[root@v6108 ssl]# sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule family="ipv6" priority=32767 source address="::/0" service name="http" drop'
DarkDeviL
DarkDeviLOP•2y ago
Do you still have:
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule source ipset="Systemadministration" service name="http" accept'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule source ipset="Systemadministration" service name="https" accept'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule source ipset="Systemadministration" service name="http" accept'
sudo firewall-cmd --permanent --zone=dmz --add-rich-rule='rule source ipset="Systemadministration" service name="https" accept'
?
Kasumi (Deactivated Account)
Nop I never added that Because that was just for the Local Servers I've
DarkDeviL
DarkDeviLOP•2y ago
It was in the originally posted .txt in #general-discussions though. (But yeah, only holding RFC1918 addresses there)
Kasumi (Deactivated Account)
Yes this txt file is idk 1-2 Years old and it still has the same typos :BL_TanaLaugh:
Kasumi (Deactivated Account)
Its currently looking like that
No description
Kasumi (Deactivated Account)
COuld it be because I added the ports? like firewall-cmd --permanent --add-port=80
DarkDeviL
DarkDeviLOP•2y ago
They are not in your list there?
Kasumi (Deactivated Account)
Its there:
No description
DarkDeviL
DarkDeviLOP•2y ago
I would somehow suppose these ports override everything, yeah.
Kasumi (Deactivated Account)
Hm still saying open
DarkDeviL
DarkDeviLOP•2y ago
Still appearing under ports: with that --info-zone command?
Kasumi (Deactivated Account)
Strange yes oh nvmd forgot to add permanent :Facepalm: hm but still I also removed the services Ahhhh looks like its droping now
DarkDeviL
DarkDeviLOP•2y ago
So it seems fine? Cloudflare allowed in, but everything else dropped?
DarkDeviL
DarkDeviLOP•2y ago
Great. 🙂
Kasumi (Deactivated Account)
Thank you :loveHeartHug:
DarkDeviL
DarkDeviLOP•2y ago
Should you want something that logs the HTTP(S) attempts to the above, you can simply add a logging directive with a priority that is lower than 32767, but greater than 1. 🙂
Kasumi (Deactivated Account)
Okay thank you ^^
DarkDeviL
DarkDeviLOP•2y ago
You're welcome. Glad I could help.
Kasumi (Deactivated Account)
Do you know some good courses for firewalld or just the docuentation?
DarkDeviL
DarkDeviLOP•2y ago
I don't know about any courses, no. Normally I would just stick to the official documentations for things (not specific to firewalld, or any other kind of firewall). And if that somehow fails with the official documentation, I would move on with e.g. Googling the issue, to see if something similar / close enough is popping up.
Kasumi (Deactivated Account)
Okay o.o

Did you find this page helpful?