Page MenuHomeFreeBSD

syslog.conf.5: Fix ipfw deny example
Needs ReviewPublic

Authored by jpb_jimby.name on Mar 23 2025, 6:01 PM.
Tags
None
Referenced Files
F137893252: D49461.diff
Wed, Nov 26, 11:17 PM
Unknown Object (File)
Tue, Nov 25, 10:19 PM
Unknown Object (File)
Mon, Nov 3, 9:51 PM
Unknown Object (File)
Thu, Oct 30, 8:52 PM
Unknown Object (File)
Thu, Oct 30, 10:53 AM
Unknown Object (File)
Thu, Oct 30, 4:00 AM
Unknown Object (File)
Oct 24 2025, 10:57 AM
Unknown Object (File)
Oct 24 2025, 8:32 AM
Subscribers

Details

Summary

In this example, the comparison operator is "contains" which does a substring match, not a regular expression match.

PR: 285385

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 63066
Build 59950: arc lint + arc unit

Event Timeline

ziaee retitled this revision from Fix ipfw example in syslog.conf.5 to syslog.conf.5: Fix ipfw deny example.Apr 13 2025, 6:38 AM
ziaee edited the summary of this revision. (Show Details)
ziaee added a reviewer: firewall.

Hey Jim, following our discussion today, what's holding up this one is:

  1. The commit body needs an explanation why
  2. Then I need someone else who is familiar with ipfw to verify the syntax
  3. Then I need mhorne or carlavilla to approve it

Then I would be able to commit it.

This issue concerns "Property Based Filters" as described in syslog.conf(5).

The errant entry is:

\# Log ipfw messages with "Deny" in the message body.
:msg, contains, ".*Deny.*"
*.* /var/log/ipfw.deny

In this example, the comparison operator is "contains" which does a substring match, not a regular expression match.
As shown, syslogd will not match an entry from ipfw with a rule such as:

02000 deny log tcp from 172.16.1.20 to me

because the log entry for this rule is:

Apr 13 11:58:06 external1 kernel: ipfw: 2000 Deny TCP 172.16.1.20:19569 172.16.1.10:23 in via em0

and the substring ".*Deny.*" does not appear.

However, by changing the Property Based Filter in syslog.conf to:

:msg, contains, "Deny"
*.* /var/log/ipfw.deny

and restarting syslog, subsequent denied TCP packets from 172.16.1.20 are logged as shown above.

Note that sysctl net.inet.ip.fw.verbose=1 must be set for ipfw to log to syslog.

That makes sense! If you "Edit Revision" from top right corner of the webapp, you could put:

In this example, the comparison operator is "contains" which does a substring match, not a regular expression match.

Where I put the angle brackets, and then that becomes the commit message body. After, you can verify with (in a new branch) git arc patch -c D49461 && git show.

This is just waiting on another IPFW SME to confirm.