Bug 1056309 - AVC denial when systemd-journald set to write to separate btrfs subvolume
Summary: AVC denial when systemd-journald set to write to separate btrfs subvolume
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-21 23:29 UTC by Chris Murphy
Modified: 2015-06-29 14:38 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-29 14:38:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Chris Murphy 2014-01-21 23:29:32 UTC
Description of problem:
A Btrfs subvolume "systemd-journal" is set to mount at /var/log/journal, and SElinux produces AVC denials in this configuration.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. btrfs subvolume create systemd-journal
2. Change fstab so that subvol=systemd-journal mounts at /var/log/journal.
3. cp -a contents of /var/log/journal to systemd-journal
4. Confirm original and new have the same permissions and SElinux contexts.
5. Reboot

Actual results:

Jan 21 15:45:06 f20s.localdomain systemd[1]: Mounted /var/log/journal
...
Jan 21 15:45:07 f20s.localdomain systemd[1]: Starting Tell Plymouth To Write Out Runtime Data...
Jan 21 15:45:07 f20s.localdomain systemd[1]: Starting Trigger Flushing of Journal to Persistent Storage...
Jan 21 15:45:07 f20s.localdomain systemd[1]: Starting Create Volatile Files and Directories...
Jan 21 15:45:07 f20s.localdomain systemd-journal[209]: Runtime journal is using 8.0M (max allowed 197.4M, trying to leave 296.2M free of 1.9
Jan 21 15:45:07 f20s.localdomain systemd[1]: Started Trigger Flushing of Journal to Persistent Storage.
Jan 21 15:45:07 f20s.localdomain kernel: type=1400 audit(1390344307.291:5): avc:  denied  { net_admin } for  pid=367 comm="systemd-tmpfile" 
Jan 21 15:45:07 f20s.localdomain systemd[1]: Started Tell Plymouth To Write Out Runtime Data.
Jan 21 15:45:07 f20s.localdomain kernel: type=1400 audit(1390344307.405:6): avc:  denied  { setattr } for  pid=367 comm="systemd-tmpfile" na
Jan 21 15:45:07 f20s.localdomain systemd-tmpfiles[367]: chmod(/var/log/journal) failed: Permission denied

Since it's denied, the log isn't being written to.


Expected results:

To change permissions of /var/log/journal if needed, and to permit writing to the log found on a different mount point than rootfs. This doesn't seem altogether different than /var as separate partition.


Additional info:

1. Upon creation, the btrfs subvolume has the following permission and context:

drwxr-xr-x. root root system_u:object_r:file_t:s0   systemd-journal

2. Somehow it later becomes:

drwxr-xr-x. root root system_u:object_r:var_log_t:s0   systemd-journal

This was not altered by the user so maybe when it was mounted at /var/log/journal the subvolume was given this label by the mount point which had that same label?

3. The original directory:
drwxr-sr-x+ root   systemd-journal system_u:object_r:var_log_t:s0   journal

4. The directory once the subvolume is mounted
drwxr-xr-x. root   root   system_u:object_r:var_log_t:s0   journal

So it seems clear systemd-journald wants to change the permissions and group ownership, but SELinux is denying it even though the labeling seems correct.


# ausearch -m AVC

time->Tue Jan 21 11:28:40 2014
type=SYSCALL msg=audit(1390328920.473:357): arch=c000003e syscall=54 success=no exit=-1 a0=3 a1=1 a2=20 a3=7fff41e39030 items=0 ppid=1 pid=1020 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm="systemd-tmpfile" exe="/usr/bin/systemd-tmpfiles" subj=system_u:system_r:systemd_tmpfiles_t:s0 key=(null)
type=AVC msg=audit(1390328920.473:357): avc:  denied  { net_admin } for  pid=1020 comm="systemd-tmpfile" capability=12  scontext=system_u:system_r:systemd_tmpfiles_t:s0 tcontext=system_u:system_r:systemd_tmpfiles_t:s0 tclass=capability
----
time->Tue Jan 21 11:28:47 2014
type=SYSCALL msg=audit(1390328927.482:360): arch=c000003e syscall=54 success=no exit=-1 a0=9 a1=1 a2=20 a3=7f67ec568ca0 items=0 ppid=1 pid=1028 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm="setroubleshootd" exe="/usr/bin/python2.7" subj=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1390328927.482:360): avc:  denied  { net_admin } for  pid=1028 comm="setroubleshootd" capability=12  scontext=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 tclass=capability
----
time->Tue Jan 21 15:59:52 2014
type=SYSCALL msg=audit(1390345192.467:436): arch=c000003e syscall=54 success=no exit=-1 a0=3 a1=1 a2=20 a3=7fff72a2c510 items=0 ppid=1 pid=1458 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm="systemd-tmpfile" exe="/usr/bin/systemd-tmpfiles" subj=system_u:system_r:systemd_tmpfiles_t:s0 key=(null)
type=AVC msg=audit(1390345192.467:436): avc:  denied  { net_admin } for  pid=1458 comm="systemd-tmpfile" capability=12  scontext=system_u:system_r:systemd_tmpfiles_t:s0 tcontext=system_u:system_r:systemd_tmpfiles_t:s0 tclass=capability
----
time->Tue Jan 21 15:59:58 2014
type=SYSCALL msg=audit(1390345198.732:439): arch=c000003e syscall=54 success=no exit=-1 a0=9 a1=1 a2=20 a3=7f7189f1cca0 items=0 ppid=1 pid=1468 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm="setroubleshootd" exe="/usr/bin/python2.7" subj=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1390345198.732:439): avc:  denied  { net_admin } for  pid=1468 comm="setroubleshootd" capability=12  scontext=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 tclass=capability




The use case here may be flawed or obscure, but the idea is that maybe we want to have a single journal location to write to, no matter what Btrfs snapshot we boot from (e.g. whether we boot current or a rollback, write to the same journal, rather than to a snapshot specific journal)

Comment 1 Chris Murphy 2014-01-21 23:32:02 UTC
Sorry. This is F20 except for the kernel, which is a rawhide kernel.

selinux-policy-3.12.1-117.fc20.noarch
3.13.0-1.fc21.x86_64

Comment 2 Chris Murphy 2014-01-21 23:44:23 UTC
I wonder if the AVC denial is not the chmod on /var/log/journal the directory, but if this is passing through to the subvolume itself and that's what's being denied? And then the question is whether this should succeed or not. Discussion started on systemd devel@

http://lists.freedesktop.org/archives/systemd-devel/2014-January/016371.html

Comment 3 Miroslav Grepl 2014-01-23 12:04:22 UTC
This AVC relates with

https://bugzilla.redhat.com/show_bug.cgi?id=1054337

Comment 4 Fedora End Of Life 2015-05-29 10:36:47 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2015-06-29 14:38:48 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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