RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1288255 - staff_t and sysadm_t should be able to read Journald.
Summary: staff_t and sysadm_t should be able to read Journald.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.2
Hardware: All
OS: Linux
medium
low
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-12-03 23:44 UTC by wibrown@redhat.com
Modified: 2019-03-05 19:16 UTC (History)
8 users (show)

Fixed In Version: selinux-policy-3.13.1-81.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-04 02:25:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2283 0 normal SHIPPED_LIVE selinux-policy bug fix and enhancement update 2016-11-03 13:36:25 UTC

Description wibrown@redhat.com 2015-12-03 23:44:05 UTC
Description of problem:

staff_t and sysadm_t should be able to read journald entries. 

time->Fri Dec  4 09:35:19 2015
type=AVC msg=audit(1449185719.185:3528): avc:  denied  { read } for  pid=7276 comm="ds-journal-test" name="system" dev="dm-9" ino=523 scontext=staff_u:staff_r:staff_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file permissive=1
----
time->Fri Dec  4 09:35:19 2015
type=AVC msg=audit(1449185719.185:3529): avc:  denied  { open } for  pid=7276 comm="ds-journal-test" path="/var/log/journal/aec8dd14e0a14baca3031ea126c3b4a5/system" dev="dm-9" ino=523 scontext=staff_u:staff_r:staff_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file permissive=1
----


How reproducible:
Always

Comment 6 Jan Zarsky 2016-10-03 13:37:20 UTC
Could you please provide the 'ds-journal-test'? If your program uses journalctl then it will work. But the reported AVCs indicates that journal records are not in default path (/var/log/journal instead of /run/log/journal).

Comment 7 wibrown@redhat.com 2016-10-04 00:58:42 UTC
ds-journal-test just reads from the journal api interface. Just like journalctl, which also triggers this exact issue.

/var/log/journal is a valid path .... I'm not sure what the issue there is.

Comment 8 Jan Zarsky 2016-10-05 07:40:02 UTC
This bug is fixed only for journalctl - it has its own context journalctl_t which is allowed to read journal files.

# sesearch -s journalctl_t -t var_log_t -A
Found 5 semantic av rules:
   allow domain var_log_t : dir { getattr search open } ; 
   allow journalctl_t file_type : filesystem getattr ; 
   allow application_domain_type logfile : file { ioctl getattr lock append } ; 
   allow journalctl_t var_log_t : file { ioctl read getattr lock open } ; 
   allow journalctl_t var_log_t : dir { ioctl read getattr lock search open } ;

If your program runs in another context it can't read journal files even if you use journal api (it doesn't matter if journal files are in /var/log/journal or /run/log/journal). It would require allow rule for any process running under staff_t to read journal, which might not be safe.

# sesearch -s staff_t -t var_log_t -c file -p read -A

# sesearch -s staff_t -t syslogd_var_run_t -c file -p read -A

#

Comment 9 Milos Malik 2016-10-26 10:46:45 UTC
When a staff_u user runs "journalctl --help" then the transition happens as expected:

# sestatus 
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28
# ps -efZ | grep journalctl
staff_u:staff_r:journalctl_t:s0-s0:c0.c1023 staff-u+ 29448 29425  0 06:38 pts/1 00:00:00 journalctl --help
staff_u:staff_r:journalctl_t:s0-s0:c0.c1023 staff-u+ 29449 29448  0 06:38 pts/1 00:00:00 less
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 root 29451 1500  0 06:38 pts/2 00:00:00 grep --color=auto journalctl
# 

But it cannot find any journal, even though there is a system journal:

$ id
uid=1000(staff-user) gid=1000(staff-user) groups=1000(staff-user) context=staff_u:staff_r:staff_t:s0-s0:c0.c1023
$ journalctl --user
No journal files were found.
-- No entries --
$ journalctl --system
No journal files were found.
-- No entries --
$ 

# rpm -qa selinux\*
selinux-policy-mls-3.13.1-102.el7.noarch
selinux-policy-3.13.1-102.el7.noarch
selinux-policy-targeted-3.13.1-102.el7.noarch
# sesearch -s staff_t -t journalctl_exec_t -T
Found 1 semantic te rules:
   type_transition staff_t journalctl_exec_t : process journalctl_t; 


# sesearch -s sysadm_t -t journalctl_exec_t -T
Found 1 semantic te rules:
   type_transition sysadm_t journalctl_exec_t : process journalctl_t; 

#

Comment 11 errata-xmlrpc 2016-11-04 02:25:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2283.html


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