Bug 714000

Summary: SELinux is preventing /bin/mount from 'mounton' accesses on the arquivo /var/named/chroot/etc/rndc.key.
Product: [Fedora] Fedora Reporter: Cesar Eduardo Barros <cesarb>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: atkac, dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:a893d3ba5482db09e87f420b693570a8d8703edd61f137ec71bdb5f6e33ab9cf
Fixed In Version: selinux-policy-3.9.16-32.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-08 18:10:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Cesar Eduardo Barros 2011-06-17 02:44:13 UTC
SELinux is preventing /bin/mount from 'mounton' accesses on the arquivo /var/named/chroot/etc/rndc.key.

*****  Plugin mounton (91.4 confidence) suggests  ****************************

If you want to allow mount to mount on rndc.key.
Then you must change the labeling on /var/named/chroot/etc/rndc.key.
Do
# semanage fcontext -a -t mnt_t '/var/named/chroot/etc/rndc.key'
# restorecon -v /var/named/chroot/etc/rndc.key

*****  Plugin catchall (9.59 confidence) suggests  ***************************

If you believe that mount should be allowed mounton access on the rndc.key file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep mount /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:mount_t:s0
Target Context                system_u:object_r:dnssec_t:s0
Target Objects                /var/named/chroot/etc/rndc.key [ file ]
Source                        mount
Source Path                   /bin/mount
Port                          <Desconhecido>
Host                          (removed)
Source RPM Packages           util-linux-2.19.1-1.fc15
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.16-26.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed)
                              2.6.38.7-30.fc15.x86_64 #1 SMP Fri May 27 05:15:53
                              UTC 2011 x86_64 x86_64
Alert Count                   4
First Seen                    Qua 15 Jun 2011 19:46:28 BRT
Last Seen                     Qui 16 Jun 2011 21:01:25 BRT
Local ID                      be61e7e0-aa30-4bf9-a6ac-855794cf8329

Raw Audit Messages
type=AVC msg=audit(1308268885.471:205): avc:  denied  { mounton } for  pid=8055 comm="mount" path="/var/named/chroot/etc/rndc.key" dev=dm-2 ino=233370 scontext=system_u:system_r:mount_t:s0 tcontext=system_u:object_r:dnssec_t:s0 tclass=file


type=SYSCALL msg=audit(1308268885.471:205): arch=x86_64 syscall=mount success=no exit=EACCES a0=7f8094538630 a1=7f8094545910 a2=7f8093183eef a3=ffffffffc0ed1001 items=0 ppid=8035 pid=8055 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=mount exe=/bin/mount subj=system_u:system_r:mount_t:s0 key=(null)

Hash: mount,mount_t,dnssec_t,file,mounton

audit2allow

#============= mount_t ==============
allow mount_t dnssec_t:file mounton;

audit2allow -R

#============= mount_t ==============
allow mount_t dnssec_t:file mounton;

Comment 1 Cesar Eduardo Barros 2011-06-17 02:53:11 UTC
The relevant packages would be:

bind-9.8.0-5.P2.fc15.x86_64
bind-chroot-9.8.0-5.P2.fc15.x86_64

The relevant mount call is probably from /etc/init.d/named

Comment 2 Daniel Walsh 2011-06-17 17:56:23 UTC
Is this bind mounting from the real rndc.key?

Comment 3 Daniel Walsh 2011-06-17 18:10:27 UTC
Fixed in selinux-policy-3.9.16-30.fc15

Comment 4 Cesar Eduardo Barros 2011-06-18 18:08:47 UTC
(In reply to comment #2)
> Is this bind mounting from the real rndc.key?

Should be.

$ ls -l /etc/rndc.key 
-rw-r-----. 1 root named 77 Jun 12 15:32 /etc/rndc.key
$ ls -lZ /etc/rndc.key 
-rw-r-----. root named system_u:object_r:dnssec_t:s0    /etc/rndc.key

The code seems to be this one (from /etc/init.d/named):

ROOTDIR_MOUNT='[...] /etc/rndc.key [...]'

mount_chroot_conf()
{
  if [ -n "$ROOTDIR" ]; then
    for all in $ROOTDIR_MOUNT; do
      [...]

      # If mount source is a file
      if ! [ -d "$all" ]; then
        # mount it only if it is not present in chroot or it is empty
        if ! [ -e "$ROOTDIR$all" ] || [ `stat -c'%s' "$ROOTDIR$all"` -eq 0 ]; then
          touch "$ROOTDIR$all"
          mount --bind "$all" "$ROOTDIR$all"
        fi
      else
        [...]

Comment 5 Fedora Update System 2011-06-30 15:59:03 UTC
selinux-policy-3.9.16-31.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/selinux-policy-3.9.16-31.fc15

Comment 6 Fedora Update System 2011-07-01 18:55:31 UTC
Package selinux-policy-3.9.16-32.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.9.16-32.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/selinux-policy-3.9.16-32.fc15
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2011-07-08 18:09:46 UTC
selinux-policy-3.9.16-32.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.