[SOLVED] Security group only works on one container

isaacntk

Member
Jul 13, 2020
19
2
23
29
I have weird and inconsistent behavior in using security groups. A few containers only have this security group applied, its working fine on one, traffic can get through on all the others.

Firewall is enabled on the datacenter, host, and container/VM level

/etc/pve/firewall/cluster.fw aliases and security groups:

Code:
[ALIASES]

apache-main 192.168.1.1 # DNS and Reverse Proxy
internal 192.168.2.0/24 # Internal CT/VM
lan 192.168.0.0/16 # Local network
physical 192.168.0.0/24 # Physical machines

[group reverse_proxy] # Services behind proxy - last rule

IN ACCEPT -source wireguard -p tcp -dport 22 -log nolog # SSH
IN ACCEPT -source physical -p tcp -dport 22 -log nolog # SSH
IN ACCEPT -source lan -p tcp -dport 80 -log nolog # HTTP
IN ACCEPT -source lan -p tcp -dport 443 -log nolog # HTTPS
IN ACCEPT -source internal -log nolog # Accept incoming internal
IN DROP -source lan -log nolog # Drop incoming LAN
OUT ACCEPT -dest apache-main -p tcp -dport 53 -log nolog # DNS
OUT ACCEPT -dest apache-main -p udp -dport 53 -log nolog # DNS
OUT ACCEPT -dest internal -log nolog # Accept outgoing internal
OUT DROP -dest lan -log nolog # Drop outgoing LAN

201.fw:

Code:
[OPTIONS]

enable: 1

[RULES]

GROUP reverse_proxy

203.fw:

Code:
[OPTIONS]

enable: 1

[RULES]

GROUP reverse_proxy

pinging from 201 (should be dropped):

Code:
# ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.039 ms
64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.048 ms
64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.049 ms
^C
--- 192.168.1.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2043ms
rtt min/avg/max/mdev = 0.039/0.045/0.049/0.004 ms

pinging from 203 (successfully dropped):

Code:
# ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
^C
--- 192.168.1.2 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2044ms

In fact I have 2 more containers using the same security group but none of them follow the rule except 203. I know the rules are working on 203 because disabling the firewall/SG on 203 allows pinging again.

I've tried rebooting the server, pve-firewall restart, turning firewall on/off on every level but the behavior is consistent. 203 (which is the first container I assigned the security group to) is the only one that respects the rules
 
Found the issue, I need to enable firewall on the virtual network interface as well as on the container itself
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!