Hi
I try to figure out how firewalld works. I’ve read a lot all over the internet but it doesn’t get in my head how firewalld really works. I need a bit advice/help from you guys. It’s my first time to use firewalld.
I have actually mainly 4 zones active:
public:
public (active)
target: default
icmp-block-inversion: no
interfaces: ens3
sources:
services: ssh http https wireguard
ports:
protocols:
forward: yes
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
docker:
docker (active)
target: ACCEPT
icmp-block-inversion: no
interfaces: docker0
sources:
services:
ports:
protocols:
forward: yes
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
wireguard:
wireguard (active)
target: default
icmp-block-inversion: no
interfaces: wg0
sources:
services:
ports:
protocols:
forward: no
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
drop:
drop (active)
target: DROP
icmp-block-inversion: no
interfaces:
sources: IP
services:
ports:
protocols:
forward: yes
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
DOCKER
So let’s start with docker first.
I would like to ban an ip for the docker zone. I tried already firewall-cmd --add-rich-rule='rule family=ipv4 source address=IP reject' --zone=public --permanent
also for the docker zone. Both of them doesn’t work so I give the drop zone a shot at the moment firewall-cmd --zone=drop --add-source=IP --permanent
. I always reload firewalld after that firewall-cmd --reload
.
WIREGUARD
Currently I’m setting up wireguard and created the wireguard zone for that. The access to the server works but the peers doesn’t have any internet connections. Might be forwarding IP and masquerade doesn’t really work. So I enabled on both zones (public & wireguard) masquerade but this doesn’t seem to effect anything. I run sysctl -w net.ipv4.ip_forward=1
which has also no effect. I’m a bit stuck here as well.
fail2ban
banaction = firewallcmd-rich-rules[actiontype=]
banaction_allports = firewallcmd-rich-rules[actiontype=]
Ban works but nothing is listed under zones.
Drop everything first
I’m also thinking about to drop everything first and allow certain ports (ssh, http, …) only also for the docker zone. What needs to be done for that with all the zones? Default zone wouldn’t be public anymore and I would change it to drop zone?
I hope you guys can enlighten my brain a little