As a beginner, I would like to understand PF configuration behavior so that I can write rules that match my security policies. I intend to post later about what I'm learning. Right now, I'm banging on edge cases to suss out what's going on inside the evaluation engine without having to dig into the code. It's been very instructive. However, I stumbled upon a sequence that's confusing me. I'm having a hard time understanding how it's not a bug.
Although no one would ever write rules like this, my expectation is that packets should pass. Instead they are getting blocked. The set up is simple—two machines on two separate networks (10.10.100.1/24, 10.10.200.1/24) joined by a gateway. Here's the config:
ping from either machine to the other fails with this configuration!!!
If I comment out the first "pass in", pings go through. If I remove the second "pass in" (leaving the first), it fails as expected.
Pings in the second configuration go through.
Pinging the gateway's subnet address for each machine also fails with the first configuration. I'd expect that to be the case as it's consistent.
Replacing every "in" with "out" or "all" behaves the same way: fail with the first configuration, succeed with the second. I also tested the optimization switch (
If this is not a bug, what do I not understand? If this is a bug, I'm happy to file it.
Although no one would ever write rules like this, my expectation is that packets should pass. Instead they are getting blocked. The set up is simple—two machines on two separate networks (10.10.100.1/24, 10.10.200.1/24) joined by a gateway. Here's the config:
Code:
# First configuration
pass in # first pass
block in
pass in # second pass
ping from either machine to the other fails with this configuration!!!
Code:
ping -c1 -t2 10.10.200.1
PING 10.10.200.1 (10.10.200.1): 56 data bytes
--- 10.10.200.1 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
If I comment out the first "pass in", pings go through. If I remove the second "pass in" (leaving the first), it fails as expected.
Code:
# Second configuration
#pass in # first pass
block in
pass in # second pass
Pings in the second configuration go through.
Code:
ping -c1 -t2 10.10.200.1
PING 10.10.200.1 (10.10.200.1): 56 data bytes
64 bytes from 10.10.200.1: icmp_seq=0 ttl=63 time=0.154 ms
--- 10.10.200.1 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.154/0.154/0.000 ms
Pinging the gateway's subnet address for each machine also fails with the first configuration. I'd expect that to be the case as it's consistent.
Replacing every "in" with "out" or "all" behaves the same way: fail with the first configuration, succeed with the second. I also tested the optimization switch (
-o basic
vs -o none
) with no difference in odd behavior (again, first fails, second works).If this is not a bug, what do I not understand? If this is a bug, I'm happy to file it.