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 1274988 - Selinux avc denial for systemd-hostnamed
Summary: Selinux avc denial for systemd-hostnamed
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks: 1400961 1472751
TreeView+ depends on / blocked
 
Reported: 2015-10-24 15:29 UTC by Steeve Goveas
Modified: 2020-12-15 07:38 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-12-15 07:38:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Steeve Goveas 2015-10-24 15:29:51 UTC
Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-23.ael7b.noarch

Actual results:

Info: Searching AVC errors produced since 1445602913.79 (Fri Oct 23 08:21:53 2015)
Searching logs...
Running '/usr/bin/env LC_ALL=en_US.UTF-8 /sbin/ausearch -m AVC -m USER_AVC -m SELINUX_ERR -ts 10/23/2015 08:21:53 < /dev/null >/mnt/testarea/tmp.rhts-db-submit-result.CRjznt 2>&1'
----
time->Fri Oct 23 08:22:06 2015
type=SYSCALL msg=audit(1445602926.012:78): arch=c0000015 syscall=38 success=no exit=-13 a0=1000a99d190 a1=375ef1d0 a2=21 a3=6d items=0 ppid=1 pid=17823 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="systemd-hostnam" exe="/usr/lib/systemd/systemd-hostnamed" subj=system_u:system_r:systemd_hostnamed_t:s0 key=(null)
type=AVC msg=audit(1445602926.012:78): avc:  denied  { unlink } for  pid=17823 comm="systemd-hostnam" name="hostname" dev="dm-0" ino=135968053 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=file
Fail: AVC messages found.
Checking for errors...
Using stronger AVC checks.
	Define empty RHTS_OPTION_STRONGER_AVC parameter if this causes any problems.
Running 'cat /mnt/testarea/tmp.rhts-db-submit-result.CRjznt | /sbin/ausearch -m AVC -m SELINUX_ERR'
Fail: AVC messages found.
Running 'cat %s | /sbin/ausearch -m USER_AVC >/mnt/testarea/tmp.rhts-db-submit-result.FYAEUb 2>&1'
Info: No AVC messages found.
/bin/grep 'avc: ' /mnt/testarea/dmesg.log | /bin/grep --invert-match TESTOUT.log
No AVC messages found in dmesg
Running '/usr/sbin/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
Running 'rpm -q selinux-policy || true'
selinux-policy-3.13.1-23.ael7b.noarch

Comment 2 Miroslav Grepl 2015-10-26 06:58:44 UTC
I believe we have fixes for this in Fedora.

Comment 3 Giovanni Tirloni 2017-02-11 01:55:00 UTC
Experiencing a similar issue on a fresh install of CentOS 7.3

/var/log/audit/audit.log:

type=SERVICE_START msg=audit(1486777537.759:107): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
type=AVC msg=audit(1486777537.760:108): avc:  denied  { read } for  pid=1911 comm="systemd-hostnam" name="machine-info" dev="vda1" ino=513 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file
type=SYSCALL msg=audit(1486777537.760:108): arch=c000003e syscall=2 success=no exit=-13 a0=7f3edaa17f54 a1=80000 a2=1b6 a3=24 items=0 ppid=1 pid=1911 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="systemd-hostnam" exe="/usr/lib/systemd/systemd-hostnamed" subj=system_u:system_r:systemd_hostnamed_t:s0 key=(null)
type=SERVICE_STOP msg=audit(1486777537.764:109): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'

audit2allow output:

#============= systemd_hostnamed_t ==============

#!!!! WARNING: 'unlabeled_t' is a base type.
allow systemd_hostnamed_t unlabeled_t:file read;

 ls -lZ /etc/machine-info  /usr/lib/systemd/systemd /usr/lib/systemd/systemd-hostnamed
-rw-r--r--. root root system_u:object_r:unlabeled_t:s0 /etc/machine-info
-rwxr-xr-x. root root system_u:object_r:init_exec_t:s0 /usr/lib/systemd/systemd
-rwxr-xr-x. root root system_u:object_r:systemd_hostnamed_exec_t:s0 /usr/lib/systemd/systemd-hostnamed

Files:

$ ls -lZ /etc/machine-info  /usr/lib/systemd/systemd /usr/lib/systemd/systemd-hostnamed
-rw-r--r--. root root system_u:object_r:unlabeled_t:s0 /etc/machine-info
-rwxr-xr-x. root root system_u:object_r:init_exec_t:s0 /usr/lib/systemd/systemd
-rwxr-xr-x. root root system_u:object_r:systemd_hostnamed_exec_t:s0 /usr/lib/systemd/systemd-hostnamed


Workaround:

# fixfiles -f relabel
Cleaning out /tmp
Warning: Skipping the following R/O filesystems:
/sys/fs/cgroup
Warning: Skipping the following R/O filesystems:
/sys/fs/cgroup
Relabeling / /dev /dev/hugepages /dev/mqueue /dev/pts /dev/shm /run /run/user/0 /sys
100.0%
Cleaning up labels on /tmp

$ ls -lZ /etc/machine-info  /usr/lib/systemd/systemd /usr/lib/systemd/systemd-hostnamed
-rw-r--r--. root root system_u:object_r:hostname_etc_t:s0 /etc/machine-info
-rwxr-xr-x. root root system_u:object_r:init_exec_t:s0 /usr/lib/systemd/systemd
-rwxr-xr-x. root root system_u:object_r:systemd_hostnamed_exec_t:s0 /usr/lib/systemd/systemd-hostnamed


VM was installed by virt-builder / virt-install on a KVM hypervisor.

Comment 7 RHEL Program Management 2020-12-15 07:38:07 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.


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