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 1114864 - SELinux prevents asterisk logrotate script from doing its job
Summary: SELinux prevents asterisk logrotate script from doing its job
Keywords:
Status: CLOSED DUPLICATE of bug 1139001
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: abrt
Version: 7.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jakub Filak
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-01 07:41 UTC by Milos Malik
Modified: 2016-12-01 00:47 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-25 10:10:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Milos Malik 2014-07-01 07:41:38 UTC
Description of problem:
 * asterisk package contains a logrotate script which is regularly processed by logrotate cron job
 * SELinux prevents some of the actions written in the /etc/logrotate.d/asterisk file

Version-Release number of selected component (if applicable):
asterisk-11.10.2-2.fc19.x86_64
logrotate-3.8.6-4.el7.x86_64
selinux-policy-3.12.1-155.el7.noarch
selinux-policy-devel-3.12.1-155.el7.noarch
selinux-policy-doc-3.12.1-155.el7.noarch
selinux-policy-minimum-3.12.1-155.el7.noarch
selinux-policy-mls-3.12.1-155.el7.noarch
selinux-policy-sandbox-3.12.1-155.el7.noarch
selinux-policy-targeted-3.12.1-155.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. get a RHEL-7.0 machine with active targeted policy
2. install asterisk RPM
3. start and stop the asterisk service at least once (to have something in asterisk log files)
4. wait for logrotate cron job to finish or force its execution
5. search for AVCs

Actual results in enforcing mode:
----
type=USER_AVC msg=audit(06/30/2014 17:04:40.594:1372) : pid=515 uid=dbus auid=unset ses=unset subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  denied  { send_msg } for msgtype=method_call interface=org.freedesktop.login1.Manager member=CreateSession dest=org.freedesktop.login1 spid=20969 tpid=512 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:system_r:systemd_logind_t:s0 tclass=dbus  exe=/usr/bin/dbus-daemon sauid=dbus hostname=? addr=? terminal=?' 
----
type=PATH msg=audit(06/30/2014 17:04:40.617:1374) : item=1 name=.cache objtype=CREATE 
type=PATH msg=audit(06/30/2014 17:04:40.617:1374) : item=0 name=/var/lib/asterisk inode=18242495 dev=fd:03 mode=dir,750 ouid=asterisk ogid=asterisk rdev=00:00 obj=system_u:object_r:asterisk_var_lib_t:s0 objtype=PARENT 
type=CWD msg=audit(06/30/2014 17:04:40.617:1374) :  cwd=/var/lib/asterisk 
type=SYSCALL msg=audit(06/30/2014 17:04:40.617:1374) : arch=x86_64 syscall=mkdir success=no exit=-13(Permission denied) a0=0x7ffffda2cedf a1=0777 a2=0x7ffffda2b530 a3=0x7ffffda2afe0 items=2 ppid=20970 pid=20979 auid=root uid=asterisk gid=asterisk euid=asterisk suid=asterisk fsuid=asterisk egid=asterisk sgid=asterisk fsgid=asterisk tty=(none) ses=12 comm=mkdir exe=/usr/bin/mkdir subj=system_u:system_r:logrotate_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(06/30/2014 17:04:40.617:1374) : avc:  denied  { write } for  pid=20979 comm=mkdir name=asterisk dev="vda3" ino=18242495 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:asterisk_var_lib_t:s0 tclass=dir 
----
type=PATH msg=audit(06/30/2014 17:04:40.633:1375) : item=1 name=/var/lib/asterisk/.cache objtype=CREATE 
type=PATH msg=audit(06/30/2014 17:04:40.633:1375) : item=0 name=/var/lib/asterisk/ inode=18242495 dev=fd:03 mode=dir,750 ouid=asterisk ogid=asterisk rdev=00:00 obj=system_u:object_r:asterisk_var_lib_t:s0 objtype=PARENT 
type=CWD msg=audit(06/30/2014 17:04:40.633:1375) :  cwd=/var/lib/asterisk 
type=SYSCALL msg=audit(06/30/2014 17:04:40.633:1375) : arch=x86_64 syscall=mkdir success=no exit=-13(Permission denied) a0=0x7fd33b920100 a1=0777 a2=0x7fd33b920118 a3=0x7fff1ed079a0 items=2 ppid=20970 pid=20984 auid=root uid=asterisk gid=asterisk euid=asterisk suid=asterisk fsuid=asterisk egid=asterisk sgid=asterisk fsgid=asterisk tty=(none) ses=12 comm=abrt-cli exe=/usr/bin/abrt-cli subj=system_u:system_r:logrotate_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(06/30/2014 17:04:40.633:1375) : avc:  denied  { write } for  pid=20984 comm=abrt-cli name=asterisk dev="vda3" ino=18242495 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:asterisk_var_lib_t:s0 tclass=dir 
----
type=PATH msg=audit(06/30/2014 17:04:40.634:1376) : item=1 name=/var/lib/asterisk/.config objtype=CREATE 
type=PATH msg=audit(06/30/2014 17:04:40.634:1376) : item=0 name=/var/lib/asterisk/ inode=18242495 dev=fd:03 mode=dir,750 ouid=asterisk ogid=asterisk rdev=00:00 obj=system_u:object_r:asterisk_var_lib_t:s0 objtype=PARENT 
type=CWD msg=audit(06/30/2014 17:04:40.634:1376) :  cwd=/var/lib/asterisk 
type=SYSCALL msg=audit(06/30/2014 17:04:40.634:1376) : arch=x86_64 syscall=mkdir success=no exit=-13(Permission denied) a0=0x7fd33b920160 a1=0777 a2=0x7fd33b920179 a3=0x0 items=2 ppid=20970 pid=20984 auid=root uid=asterisk gid=asterisk euid=asterisk suid=asterisk fsuid=asterisk egid=asterisk sgid=asterisk fsgid=asterisk tty=(none) ses=12 comm=abrt-cli exe=/usr/bin/abrt-cli subj=system_u:system_r:logrotate_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(06/30/2014 17:04:40.634:1376) : avc:  denied  { write } for  pid=20984 comm=abrt-cli name=asterisk dev="vda3" ino=18242495 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:asterisk_var_lib_t:s0 tclass=dir 
----
type=PATH msg=audit(06/30/2014 17:04:40.636:1377) : item=0 name=/etc/abrt/abrt.conf inode=26612638 dev=fd:03 mode=file,644 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:abrt_etc_t:s0 objtype=NORMAL 
type=CWD msg=audit(06/30/2014 17:04:40.636:1377) :  cwd=/var/lib/asterisk 
type=SYSCALL msg=audit(06/30/2014 17:04:40.636:1377) : arch=x86_64 syscall=lstat success=no exit=-13(Permission denied) a0=0x7fff1ed06a00 a1=0x7fff1ed068a0 a2=0x7fff1ed068a0 a3=0x9 items=1 ppid=20970 pid=20984 auid=root uid=asterisk gid=asterisk euid=asterisk suid=asterisk fsuid=asterisk egid=asterisk sgid=asterisk fsgid=asterisk tty=(none) ses=12 comm=abrt-cli exe=/usr/bin/abrt-cli subj=system_u:system_r:logrotate_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(06/30/2014 17:04:40.636:1377) : avc:  denied  { getattr } for  pid=20984 comm=abrt-cli path=/etc/abrt/abrt.conf dev="vda3" ino=26612638 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:abrt_etc_t:s0 tclass=file 
----

Expected results:
 * no AVCs

Additional info:
# cat /etc/logrotate.d/asterisk 
/var/log/asterisk/messages /var/log/asterisk/event_log /var/log/asterisk/queue_log {
    missingok
    notifempty
    create 0640 asterisk asterisk
    sharedscripts
    postrotate
	/sbin/runuser --login --shell=/bin/bash --command="/usr/sbin/asterisk -rx 'logger reload'" asterisk >/dev/null 2>/dev/null || true
    endscript
}
#

Comment 1 Miroslav Grepl 2014-07-01 08:21:16 UTC
Any idea why abrt-cli is started?

Comment 2 Jakub Filak 2014-09-18 19:05:11 UTC
I presume something sources /etc/profile.d/abrt-console-notification.sh which runs "abrt-cli status --since=$last_login" to notify users about new crashes. I have pushed a patch to the upstream repository which disables this profile.d script if STDOUT is not connected to a terminal:
https://github.com/abrt/abrt/commit/592b7e19a20b38547c5b3c5d81add27ed79e05a9

Milosi, could you please replace your /etc/profile.d/abrt-console-notification.sh with https://github.com/abrt/abrt/blob/master/src/cli/abrt-console-notification.sh, retest and report the results here?

Comment 3 Jakub Filak 2014-09-25 10:10:30 UTC

*** This bug has been marked as a duplicate of bug 1139001 ***


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