Bug 1403017

Summary: rpc.mountd needs open & read access for fixed_disk_device_t
Product: [Fedora] Fedora Reporter: Scott Mayhew <smayhew>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: urgent    
Version: 25CC: dominick.grift, dwalsh, edgar.hoch, james, lvrabec, mgrepl, olchansk, plautrba, pmoore, ssekidde, swhiteho
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-225.11.fc25 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-28 08:50:12 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:

Description Scott Mayhew 2016-12-08 21:50:33 UTC
Description of problem:

rpc.mountd needs open & read access for fixed_disk_device_t.  Back in 2007 a change was made to rpc.mountd to make it use functionality provided by libblkid (nfs-utils commit e91ff017, "Use UUIDs to identify filesystems if kernel supports it.").  This commit first appeared in tag nfs-utils-1-0-11 upstream.

The first Fedora release to include that change was Fedora 7, released in May 2007.  

There were couple related bugs filed later in 2007:

426581 - SELinux nfs and rpc.mountd denials
426823 - SELinux generates blizzards of messages after upgrade

Unfortunately it doesn't look like anyone connected the dots... and since rpc.mountd soldiers on, generating device-number based FSIDs when it's unable to get the device UUIDs, the bug reporters indicated that it looked like everything was working properly.

As a result, a dontaudit rule was created to hide these errors.  Unfortunately, that can lead to stale filehandles, which is the very scenario that nfs-utils commit e91ff017 was intended to fix.


Version-Release number of selected component (if applicable):

selinux-policy-3.13.1-224.fc25.noarch


How reproducible:

Easy.


Steps to Reproduce:

See https://bugzilla.redhat.com/show_bug.cgi?id=1326406#c0


Actual results:

rpc.mountd cannot call the blkid_* functions from libblkid due to the AVC violations and cannot generate UUID-based FSIDs as a result.


Expected results:

rpc.mountd should have read & open access for fixed_disk_device_t so it can call the blkid_* functions from libblkid.


Additional info:

This policy file generated by audit2allow fixes the problem for me.

# cat mountdlibblkid.te

module mountdlibblkid 1.0;

require {
	type nfsd_t;
	type fixed_disk_device_t;
	class blk_file { open read };
}

#============= nfsd_t ==============
allow nfsd_t fixed_disk_device_t:blk_file { open read };

Comment 1 Scott Mayhew 2016-12-08 22:11:57 UTC
I see a lot of the files in the selinux-policy git repo have 'storage_raw_read_fixed_disk(domain)'.

http://oss.tresys.com/docs/refpolicy/api/kernel_storage.html says:

Allow the caller to directly read from a fixed disk. This is extremly dangerous as it can bypass the SELinux protections for filesystem objects, and should only be used by trusted domains. 

That sounds like what we need though.

Comment 2 Fedora Update System 2017-02-27 11:30:00 UTC
selinux-policy-3.13.1-225.11.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-e06f91350b

Comment 3 Fedora Update System 2017-02-27 23:52:18 UTC
selinux-policy-3.13.1-225.11.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-e06f91350b

Comment 4 Fedora Update System 2017-02-28 08:50:12 UTC
selinux-policy-3.13.1-225.11.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 5 Steve Dickson 2017-04-20 15:10:29 UTC
*** Bug 1326406 has been marked as a duplicate of this bug. ***