Bug 1288255
| Summary: | staff_t and sysadm_t should be able to read Journald. | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | wibrown <wibrown> |
| Component: | selinux-policy | Assignee: | Lukas Vrabec <lvrabec> |
| Status: | CLOSED ERRATA | QA Contact: | Milos Malik <mmalik> |
| Severity: | low | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.2 | CC: | jzarsky, lvrabec, mgrepl, mmalik, plautrba, pvrabec, ssekidde, wibrown |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | selinux-policy-3.13.1-81.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-11-04 02:25:40 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
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). 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. 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
#
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; # 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 |
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