Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 291259 - app-admin-syslog-ng-3.0.4 configuration file format update
Summary: app-admin-syslog-ng-3.0.4 configuration file format update
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-31 06:51 UTC by Aurélien Requiem
Modified: 2010-06-24 02:13 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch to update the configuration for 3.0.x branch (syslog-ng-conf.patch,814 bytes, patch)
2009-10-31 06:52 UTC, Aurélien Requiem
Details | Diff
This patch fix bug #232874 and #291259 (syslog-ng-3.patch,1.02 KB, patch)
2009-11-05 18:03 UTC, Magnus Granberg
Details | Diff
really fix bug #232847, simpler fix for #291259 (syslog-ng.conf-3.x-232847-291259-fix.patch,995 bytes, patch)
2009-11-13 12:55 UTC, Oliver Sucker
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aurélien Requiem 2009-10-31 06:51:22 UTC
Hi,

After installing syslog-ng 3.0.x, the daemon complained about the configuration file.

Starting with syslog-ng 3.0.x the configuration file format for syslog-ng has changed. With hardened gentoo, the "match() filters based on regex should be upadted accordingly.

Please see patch attached to this bug.


Reproducible: Always

Steps to Reproduce:
1. install syslog-ng 3.0.x
2. start the server
3. observe the warning

Actual Results:  
The displayed warning is as follow :

WARNING: the match() filter without the use of the value() option is deprecated and hinders performance, please update your configuration;


Expected Results:  
no warnings

I filled this bug in hardened section has this is only related to the syslog-ng configuration with hardened profile.
Comment 1 Aurélien Requiem 2009-10-31 06:52:43 UTC
Created attachment 208833 [details, diff]
patch to update the configuration for 3.0.x branch
Comment 2 Boney McCracker 2009-10-31 15:27:31 UTC
I wonder if any of these could be changed to header-based matches, instead of applying a regex to the entire header + message, which is quite inefficient.

For example (not tested):

filter f_avc { program("avc"); };
filter f_audit { not program("avc") and match("regex" value("^audit.*")); };
filter f_pax { program("PAX"); };
filter f_grsec { program("grsec"); };
Comment 3 Boney McCracker 2009-10-31 16:15:51 UTC
In fact, I think it should actually be:

 filter f_avc { program("avc"); };
 filter f_audit { not program("avc") and message("^audit.*"); };
 filter f_pax { program("PAX"); };
 filter f_grsec { program("grsec"); };
 
Based on their documentation at:
http://www.balabit.com/dl/html/syslog-ng-v3.0-guide-admin-en.html/ch08s04.html
Comment 4 Boney McCracker 2009-10-31 19:35:11 UTC
Or maybe they should all be message() filters (depending on whether that text shows up in the headers or the message body).

At any rate, the format of the match filter is (according to the documentation):

match("<some regexp>" value("<a macro name>"))

 Not

match(regexp value("<some regexp>")
Comment 5 Renan Manola 2009-11-01 12:24:10 UTC
(In reply to comment #0)
> Hi,
> 
> After installing syslog-ng 3.0.x, the daemon complained about the configuration
> file.
> 
> Starting with syslog-ng 3.0.x the configuration file format for syslog-ng has
> changed. With hardened gentoo, the "match() filters based on regex should be
> upadted accordingly.
> 
> Please see patch attached to this bug.
> 
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> 1. install syslog-ng 3.0.x
> 2. start the server
> 3. observe the warning
> 
> Actual Results:  
> The displayed warning is as follow :
> 
> WARNING: the match() filter without the use of the value() option is deprecated
> and hinders performance, please update your configuration;
> 
> 
> Expected Results:  
> no warnings
> 
> I filled this bug in hardened section has this is only related to the syslog-ng
> configuration with hardened profile.
> 

Someone who is familiar with the configs could also update the sample configuration exibited here:
http://www.gentoo-wiki.info/Syslog-ng
Comment 6 Oliver Sucker 2009-11-02 11:44:23 UTC
Read the documentation thoroughly, as posted before:

>http://www.balabit.com/dl/html/syslog-ng-v3.0-guide-admin-en.html/ch08s04.html

Important is what it says concerning match() and message().

In syslog-ng 2.1, match() was applied to the message only, not to the header.
In syslog-ng 3.x, match() is applied to the message AND the header.
To get the old 2.1 match() behaviour in 3.x, there is the message() filter.

So it should be (just translating old file, not doing any optimizations):
filter f_avc { message(".*avc: .*"); };
filter f_audit { message("^audit.*") and not message(".*avc: .*"); };
filter f_pax { message("^PAX:.*"); };
filter f_grsec { message("^grsec:.*"); };

>filter f_pax { program("PAX"); };# njet
Filtering match with program() won't work, since there are no programs called
"avc", "PAX", or "grsec" (these messages are sent by the kernel, not by some
program). There is also no real need for optimization here, cause this filter
is only applied to kernel messages, not all messages:

log { source(kernsrc); filter(f_pax); destination(pax); };
log { source(kernsrc); filter(f_grsec); destination(grsec); };
log { source(kernsrc); filter(f_audit); destination(audit); };
log { source(kernsrc); filter(f_avc); destination(avc); };

>filter f_pax { match("regex" value("^PAX:.*")); };# njet
The method as posted in the patch won't work either.

HTH,
Oliver
Comment 7 Oliver Sucker 2009-11-02 20:08:25 UTC
Please also note bug #232847 with another configuration problem with syslog-ng which could be fixed together with this one (files/syslog-ng.conf.gentoo.hardened and files/syslog-ng.conf.gentoo.hardened.3.0).

Considering #232847, my above statements should be changed to:

# <H4xX0Rz1sT@eyeq.de> newer kernels have kernel time prefix with CONFIG_PRINTK_TIME set, see #232847
# <H4xX0Rz1sT@eyeq.de> syslog-ng 3.x deprecates old match() syntax, use message() as equivalent, see #291259                    
filter f_avc { message(".*avc: .*"); };
filter f_audit { message("^(\\[.*\\] )?audit.*") and not message(".*avc: .*"); };
filter f_pax { message("^(\\[.*\\] )?PAX:.*"); };
filter f_test { message("^(\\[.*\\] )?grsec:.*"); };

HTH,
Oliver
Comment 8 Boney McCracker 2009-11-02 20:23:46 UTC
Yes, I concur with Oliver.  Those match() filter functions should simply be replaced with message() filter functions.
Comment 9 cilly 2009-11-05 17:08:15 UTC
It works using:

# grsec & pax
filter f_avc { match("^\\[.*\] .*avc: .*" value("MESSAGE")); };
filter f_audit { match("^\\[.*\] audit.*" value("MESSAGE")) and not match(".*avc: .*" value("MESSAGE")); };
filter f_pax { match("^\\[.*\] PAX:.*" value("MESSAGE")); };
filter f_grsec { match("^\\[.*\] grsec:.*" value("MESSAGE")); };

fixes also:

https://bugs.gentoo.org/232847
Comment 10 Magnus Granberg gentoo-dev 2009-11-05 18:03:58 UTC
Created attachment 209354 [details, diff]
This patch fix bug #232874 and #291259

Thanks for the help cilly
Comment 11 Boney McCracker 2009-11-05 18:18:53 UTC
(In reply to comment #9)

Yes, that will work, but it's unnecessary added complexity.  The "message()" filter is an abbreviated syntax of the same function.

message(<some_regexp>);

- is equivalent to - 

match(<some_regexp> value("MESSAGE"));
Comment 12 Olliver Schinagl 2009-11-08 14:13:12 UTC
filter f_test { message("^(\\[.*\\] )?grsec:.*"); };

should be no?

filter f_grsec { message("^(\\[.*\\] )?grsec:.*"); };
Comment 13 Marvin Vek 2009-11-08 14:23:06 UTC
> (In reply to comment #9)
> 
> Yes, that will work, but it's unnecessary added complexity.  The "message()"
> filter is an abbreviated syntax of the same function.
> 
> message(<some_regexp>);
> 
> - is equivalent to - 
> 
> match(<some_regexp> value("MESSAGE"));

/votes against using unnecessary added complexity. Replacing the current match with message, works flawlessly. Lets not go crazy on regexp when it's not needed.
Comment 14 Doron Fediuck 2009-11-10 12:23:44 UTC
Here's a snip:

match("IN-*" value("MESSAGE"))
not match("OUT-*" value("MESSAGE"))
match("^PASS-*" value("MESSAGE"))
program("kernel")

Works like a charm. No warnings and life is good :)
Comment 15 Oliver Sucker 2009-11-13 12:54:11 UTC
(In reply to comment #12)
> filter f_test { message("^(\\[.*\\] )?grsec:.*"); };
> 
> should be no?
> 
> filter f_grsec { message("^(\\[.*\\] )?grsec:.*"); };
> 

of course, you're right, filter should be named f_grsec, my mistake. Thanks.

The patch as proposed by cilly and posted by Magnus Granberg is not backwards compatible with older kernels. It also won't work on newer ones with CONFIG_PRINTK_TIME disabled. The regex will fail in these two situations.

Moreover, as also pointed out by John Brendler and Marvin Vek, it adds unnecessary complexity.

Will post a patch.

HTH,
Oliver
Comment 16 Oliver Sucker 2009-11-13 12:55:23 UTC
Created attachment 210124 [details, diff]
really fix bug #232847, simpler fix for #291259
Comment 17 Enchant 2009-11-18 10:35:30 UTC
May be drop stable flag for version 3x before resolve this bug?
Comment 18 Enchant 2009-12-07 10:31:57 UTC
What about fix this bug? I think this is critical.
Comment 19 Jared Hancock 2010-02-04 14:01:09 UTC
Was there some kind of pandemic and the hardened guys are all gone now? Are you guys needing some more manpower?
Comment 20 Enchant 2010-02-24 08:31:58 UTC
and silence... :-\
Comment 22 Boney McCracker 2010-02-24 14:57:23 UTC
Typo in URL above:  it's "commons" not "common".

Also, explanation for those of you too young to get it...

Before cable television, TV channels used to stop broadcasting programming (i.e. content) at night (typically around midnight).  When they ended their "broadcast day", most of them would throw up a "test pattern" on the screen, rather than broadcast completely dead air (static).

This "indian head" test pattern was the standard until color television came along, at which time most stations started using a pattern of color bars.  Today, stations will at least throw up an "infomercial" rather than a test pattern.

But since a test pattern is preferable to completely dead air, I thought I'd provide one. ;)

Comment 23 Marvin Vek 2010-02-24 15:23:38 UTC
(In reply to comment #22)
> Also, explanation for those of you too young to get it...
> [CUT]
> Before cable television, TV channels used to stop broadcasting programming
> But since a test pattern is preferable to completely dead air, I thought I'd
> provide one. ;)

That sir, is off-topic awesomeness, and i love it!

Back on-topic, i keep referring to https://bugs.gentoo.org/show_bug.cgi?id=291259#c15 and https://bugs.gentoo.org/show_bug.cgi?id=291259#c16 containing the patch. Don't see why this hasn't been implemented yet.

*pokes $(grep email /usr/portage/app-admin/syslog-ng/metadata.xml)
Comment 24 Boney McCracker 2010-02-24 17:02:00 UTC
(In reply to comment #23)
I think it's just that this item is of comparatively low priority, relative to many other tasks the hardened project is tackling to get caught up.
Comment 25 Magnus Granberg gentoo-dev 2010-04-05 22:44:27 UTC
Fixed in syslog-ng-3.0.5-r1
Thank you all