Bug 684611

Summary: SELinux prevents httpd from mounting autofs
Product: Red Hat Enterprise Linux 6 Reporter: Brian Dudek <brian.dudek>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: dwalsh, ksrot, mgrepl
Target Milestone: rc   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.7.19-79.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 12:24:24 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 Brian Dudek 2011-03-13 19:55:09 UTC
Description of problem:  SELinux is preventing httpd from autofs mounting files system.  Without SELinux enabled the httpd mount of NFS resources work as expected and works as expected if mount is done manually (with 'cd' into /net/server...)  Home dir NFS resources from same server works with and without SELinux enabled.

# getsebool use_nfs_home_dirs
use_nfs_home_dirs --> on
 
# getsebool httpd_use_nfs
httpd_use_nfs --> on

# grep DocumentRoot /etc/httpd/conf/httpd.conf
DocumentRoot /net/shadow/export/iraid/website/client-site

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


How reproducible:
Always with SELINUX=enforcing

Apache/autofs configuration works and has been tested with SELINUX=permissive with no issues and as expected.


Steps to Reproduce:
1. disable selinux, reboot

2. config apache and autofs for /net/shadow/... resources then verify OK

3. enable selinux, reboot

2. mount | grep website
  ...nothing mounted as it should be

2.  service httpd start
Starting httpd: Syntax error on line 295 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory
                                                           [FAILED]
3.  cd /net/shadow/export/iraid/website/

4. mount | grep website
shadow:/export/iraid/website on /net/shadow/export/iraid/website type nfs (rw,nosuid,nodev,intr,sloppy,vers=4,addr=XXX.XXX.XXX.XXX,clientaddr=XXX.XX.XXX.XXX)

5. service httpd start
Starting httpd: 

6. service httpd status
httpd (pid  3474) is running...

Actual results:


Expected results:


Additional info:

audio.log report generated then httpd is started then fails:

type=AVC msg=audit(1300043363.272:71): avc:  denied  { read } for  pid=3165 comm="httpd" name="/" dev=autofs ino=20368 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:autofs_t:s0 tclass=dir

type=SYSCALL msg=audit(1300043363.272:71): arch=c000003e syscall=4 success=no exit=-13 a0=7f20c9133760 a1=7fff7e2f94f0 a2=7fff7e2f94f0 a3=7fff7e2f93d0 items=0 ppid=3163 pid=3165 auid=5076 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=3 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)

Comment 2 Daniel Walsh 2011-03-14 19:05:16 UTC
        fs_list_auto_mountpoints(httpd_*_t) 

Should be added to all nfs boolean blocks.

Comment 3 Miroslav Grepl 2011-03-14 19:45:54 UTC
yes, will add it.

Comment 4 Miroslav Grepl 2011-03-17 10:28:24 UTC
Fixed in selinux-policy-3.7.19-79.el6

Comment 7 errata-xmlrpc 2011-05-19 12:24:24 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0526.html