Bug 678103 - SELinux is preventing /usr/sbin/dnsmasq from 'search' accesses on the dossier /var/lib/tftpboot.
Summary: SELinux is preventing /usr/sbin/dnsmasq from 'search' accesses on the dossier...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 14
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: setroubleshoot_trace_hash:3ca1a441a78...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-02-16 18:10 UTC by Michael S.
Modified: 2011-02-24 20:54 UTC (History)
2 users (show)

Fixed In Version: selinux-policy-3.9.7-31.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-02-24 20:54:03 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Michael S. 2011-02-16 18:10:33 UTC
SELinux is preventing /usr/sbin/dnsmasq from 'search' accesses on the dossier /var/lib/tftpboot.

*****  Plugin catchall (100. confidence) suggests  ***************************

If you believe that dnsmasq should be allowed search access on the tftpboot directory 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 dnsmasq /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:dnsmasq_t:s0-s0:c0.c1023
Target Context                system_u:object_r:tftpdir_rw_t:s0
Target Objects                /var/lib/tftpboot [ dir ]
Source                        dnsmasq
Source Path                   /usr/sbin/dnsmasq
Port                          <Inconnu>
Host                          (removed)
Source RPM Packages           dnsmasq-2.52-1.fc13
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.7-29.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed)
                              2.6.35.10-74.fc14.i686.PAE #1 SMP Thu Dec 23
                              16:10:47 UTC 2010 i686 i686
Alert Count                   2
First Seen                    mer. 16 févr. 2011 18:59:13 CET
Last Seen                     mer. 16 févr. 2011 19:09:17 CET
Local ID                      5cab97e3-c543-419b-a41c-d12224f2f8f2

Raw Audit Messages
type=AVC msg=audit(1297879757.622:1696): avc:  denied  { search } for  pid=1636 comm="dnsmasq" name="tftpboot" dev=dm-1 ino=237976 scontext=system_u:system_r:dnsmasq_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tftpdir_rw_t:s0 tclass=dir


type=SYSCALL msg=audit(1297879757.622:1696): arch=i386 syscall=open success=no exit=EACCES a0=8e3d008 a1=8000 a2=0 a3=63 items=0 ppid=1 pid=1636 auid=4294967295 uid=99 gid=40 euid=99 suid=99 fsuid=99 egid=40 sgid=40 fsgid=40 tty=(none) ses=4294967295 comm=dnsmasq exe=/usr/sbin/dnsmasq subj=system_u:system_r:dnsmasq_t:s0-s0:c0.c1023 key=(null)

Hash: dnsmasq,dnsmasq_t,tftpdir_rw_t,dir,search

audit2allow

#============= dnsmasq_t ==============
allow dnsmasq_t tftpdir_rw_t:dir search;

audit2allow -R

#============= dnsmasq_t ==============
allow dnsmasq_t tftpdir_rw_t:dir search;

Comment 1 Michael S. 2011-02-16 18:23:00 UTC
Dnsmasq can be used as a tftp server, and I use it with virt-manager to do pxe installation 

 $ ls -lZd /var/lib/tftpboot
drwxr-xr-x. root root system_u:object_r:tftpdir_rw_t:s0 /var/lib/tftpboot


Dnsmasq is runing with :

 1636 ?        S      0:07 /usr/sbin/dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/libvirt/network/default.pid --conf-file=  --listen-address 192.168.122.1 --except-interface lo --dhcp-range 192.168.122.2,192.168.122.254 --dhcp-lease-max=253 --enable-tftp --tftp-root /var/lib/tftpboot --dhcp-boot pxelinux.0

And I have added     <tftp root='/var/lib/tftpboot' />  to/etc/libvirt/qemu/networks/default.xml :

<network>
  <name>default</name>
  <uuid>xxx</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <tftp root='/var/lib/tftpboot' />
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
      <bootp file='pxelinux.0' />
    </dhcp>
  </ip>
</network>

Comment 2 Daniel Walsh 2011-02-16 19:38:00 UTC
Miroslav can you change 

interface(`tftp_read_content',`
	gen_require(`
		type tftpdir_t;
		type tftpdir_rw_t;
	')

	read_files_pattern($1, tftpdir_t, tftpdir_t)
	read_lnk_files_pattern($1, tftpdir_t, tftpdir_t)

	read_files_pattern($1, tftpdir_rw_t, tftpdir_rw_t)
	read_lnk_files_pattern($1, tftpdir_rw_t, tftpdir_rw_t)
')

Comment 3 Miroslav Grepl 2011-02-17 08:41:10 UTC
Fixed in selinux-policy-3.9.7-31.fc14

Comment 4 Fedora Update System 2011-02-21 20:28:26 UTC
selinux-policy-3.9.7-31.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/selinux-policy-3.9.7-31.fc14

Comment 5 Fedora Update System 2011-02-22 04:54:01 UTC
selinux-policy-3.9.7-31.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update selinux-policy'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/selinux-policy-3.9.7-31.fc14

Comment 6 Fedora Update System 2011-02-24 20:53:25 UTC
selinux-policy-3.9.7-31.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.


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