Bug 988814 - wrong SYSLOG_FACILITY reported for authpriv messages, sshd logs in /var/log/messages, not /var/log/secure
Summary: wrong SYSLOG_FACILITY reported for authpriv messages, sshd logs in /var/log/m...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 988163 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-26 13:22 UTC by Tomas Heinrich
Modified: 2016-09-20 04:51 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-13 11:45:36 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
should fix the problem (3.42 KB, patch)
2013-07-26 16:59 UTC, Zbigniew Jędrzejewski-Szmek
no flags Details | Diff

Description Tomas Heinrich 2013-07-26 13:22:33 UTC
Description of problem:
Messages that should have SYSLOG_FACILITY 10 (authpriv) are logged by journald as if they have have SYSLOG_FACILITY 11 (ftp). This results in those message not appearing in /var/log/secure but in /var/log/messages.

Version-Release number of selected component (if applicable):
systemd-205-1.fc20.x86_64

How reproducible:
100%

Steps to Reproduce:
$ journalctl -o verbose -f
$ tail -f /var/log/{messages,secure}
$ logger -p authpriv.notice authpriv-msg

Inspect the outputs of the commands above.


Actual results:
Wrong facility is assigned to authpriv messages, i.e. SYSLOG_FACILITY=11 in journalctl's output.

Expected results:
SYSLOG_FACILITY=10

Additional info:
If normal users are allowed access to logs with the 'ftp' facility, they can unintentionally get access to sshd logs.

Comment 1 Michal Schmidt 2013-07-26 14:06:05 UTC
void server_process_syslog_message(
        ...
        int priority = LOG_USER | LOG_INFO;
        ...
        syslog_parse_priority((char**) &buf, &priority);
...

Then:
void syslog_parse_priority(char **p, int *priority) {
        ...
        *priority = (*priority & LOG_FACMASK) | (a*100 + b*10 + c);
...

LOG_USER is (1<<3), in binary 1000.
authpriv.notice is <87>, in binary 1010111.
Thus in the end, in binary:
*priority = 1000 | 1010111 = 1011111, that is facility 11, level debug.

The priority calculation line was changed by:
http://cgit.freedesktop.org/systemd/systemd/commit/?id=49998b3

Zbigniew, would you recheck this?

Comment 2 Michal Schmidt 2013-07-26 14:08:34 UTC
(In reply to Michal Schmidt from comment #1)
> authpriv.notice is <87>, in binary 1010111.

Sorry, this should say "authpriv.debug", which is what I actually used in my test.

Comment 3 Jason Tibbitts 2013-07-26 14:20:01 UTC
*** Bug 988163 has been marked as a duplicate of this bug. ***

Comment 4 Zbigniew Jędrzejewski-Szmek 2013-07-26 16:58:36 UTC
Yeah, looks like I messed up. Does the following patch (and the analysis in the commit message) make sense to you?

Comment 5 Zbigniew Jędrzejewski-Szmek 2013-07-26 16:59:35 UTC
Created attachment 778846 [details]
should fix the problem

Comment 6 Zbigniew Jędrzejewski-Szmek 2013-08-21 15:48:26 UTC
Committed upstream in http://cgit.freedesktop.org/systemd/systemd/commit/?id=ac50788b0.

Comment 7 Petr Lautrbach 2013-09-09 11:47:36 UTC
It seems to be already fixed in systemd-206-11.fc21.x86_64

Comment 8 Harald Hoyer 2013-09-13 11:45:36 UTC
systemd-207

Comment 9 Fedora Update System 2013-09-15 02:15:17 UTC
systemd-204-13.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/systemd-204-13.fc19

Comment 10 Fedora Update System 2013-09-17 18:52:44 UTC
systemd-204-14.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/systemd-204-14.fc19


Note You need to log in before you can comment on or make changes to this bug.