Better update the subject line too!
Others may be discouraged to update reading the subject alone.
Others may be discouraged to update reading the subject alone.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: senseOPN on June 23, 2025, 08:57:14 PMI implemented a new test case:
1) The Pass rule, non-logging
2) The logging Block rule, with Source "! FRITZ net"
3) Then again the same rule, with Source "any"
4) And just to check if that plays a role, a copy of this last rule - to check how it will be logged
I disabled logging for the default rule now.
Here is the screenshot:
Quote from: Patrick M. Hausen on June 23, 2025, 07:20:58 PMWhy do you need a block rule before the default block in the first place?
Quote from: meyergru on June 22, 2025, 11:06:17 PMQuote from: senseOPN on June 22, 2025, 10:55:03 PMLet's try again:Here is where you go wrong: Source "any" catches everything, which includes FRITZ net. And why shouldn't it? It is a catch-all rule that is always being applied before the default block rule, just because it matches anything. You could have noticed this long ago by the fact that the log entry tells you it is because of this very rule matching (and blocking): Look at the log entries, the label says "Block Fritz all other", which is exactly your second rule.
I have a Pass rule that allows Source "FRITZ net" to any destination for the FRITZ interface.
This Pass rules did not apply because of state, as it seems - from the information seen with the "i" button. I see only "PA" or "A" TCP flags set.
The "Default deny / State violation" rule comes first, but it has "Quick" not set, so that other rules are applied as well.
My Block rule was meant to catch IPs that are not from FRITZ net, as it has Source "any", not Source "FRITZ net" like the Pass rules - to any destination.
So it should normally only apply when a spoofed IP tries to reach anything!
If you wanted it to match only traffic that is not from FRITZ net, you would need to change the source to "!FRITZ net", not "any" (including FRITZ net). If you do that, then the default block rule would be applied.
Quote from: keeka on June 22, 2025, 07:00:44 PMQuote from: senseOPN on June 22, 2025, 05:16:54 PMWhatever, regular default-deny /state-violation packages should be logged for this rule and not with some other, user-added rule!No, that's not how it works. If some rule you define has already matched a packet and acted upon it, that packet will not reach the default block, whether logging is enabled or not. I vaguely recall there being match type rules which allowed you to act on a packet but it still traverse the rest of the interface rules. But don't see that in current opnsense.
That should be clear.
Quote from: meyergru on June 22, 2025, 06:21:27 PMSo then, the only misunderstanding is that you seem to know why your allow rule does not fire (namely because of state violations - if you search this forum for that you will find many examples of people having created split routing, as I said). And yes, you have shown the log entries, but not the rule details, AFAICS.
Apart from that, the logs you showed last are clearly from the second, blocking rule, for which you have explicitely enabled logging as shown in your first post, so what is the problem?
I can see still just one: Your packets are not being allowed for whatever cause (could be split routes, as indicated by invalid states), thus, this rule does not match and your second rule fires and gets logged, which is to be expected.
You seem to imply a problem with OpnSense or its logging and I do not see this, please explain how you come to your conclusion?
Quote from: meyergru on June 22, 2025, 05:55:30 PMIDK what you expect to see in your logs:
- You have a rule that does not fire (for whatever reason, you did not show the rule details and the list view does not give any hint as to why).
- You have a rule that seems general enough to fit anything else with logging enabled.
- You see packets logged for that second rule.
You can change the default block logging any way you want. Because this default rule would only be applied after all other rules, it is never being touched in this situation.
On the surface, I can see nothing that does not work as designed or configured by you. The only open question is why your first allow rule does not fire. And as said multiple times, we cannot tell because you did not show it in full.
The reason can be anything. The most probable cause is split routing, such that the TCP state matching does not work. This could happen if you WiFi AP on the Fritzbox is active or if you otherwise created a network loop.
Quote from: keeka on June 22, 2025, 03:47:58 PMQuote from: senseOPN on June 22, 2025, 11:52:52 AMThe question is, why those packages are logged with the wrong rule!
I disabled the rule and enabled logging of default blocks - and bamm, those packages are logged as "default deny / state violation", which is right!
But when I instead have my last rule logging, it will be logged with this!
So, with default drop logging enabled and your own rule disabled, you see dropped packets logged under the default rule description.
Then, with default logging disabled and your drop rule above enabled, you see packets dropped and logged under your rule's description (however only for the interface concerned).
Quote from: keeka on June 22, 2025, 03:47:58 PMWhat's more, if you have both your rule, and the default logging enabled, dropped packets (on that interface) will be dropped and logged by your rule alone. Those same packets will not encounter the default drop rule.
If that's what you're seeing, and its not totally clear TBH, that is what I would expect.
Regarding packets logged under the wrong rule, I believe this can appear to happen and I may have misunderstood your question.
Quote from: Bob.Dig on June 22, 2025, 01:40:13 PMWe have seen no evidence that you have understood how those rules work. What ip-range is fritz-net.
Quote from: keeka on June 21, 2025, 08:30:23 PMQuote from: senseOPN on June 21, 2025, 11:00:12 AMI found this, which is a bit similar:
https://forum.opnsense.org/index.php?topic=20219.0
When those are out-of-sync packages, the question remains why they get logged under this rule, which seems to be wrong.
Post 4 explains how packet filter and states work and gives a likely cause for what you are seeing. In your example above, I imagine you will NOT find any blocked packets with `tcpflags==S`.