Bug 906283

Summary: Selinux prevents ircd-ratbox installing
Product: [Fedora] Fedora Reporter: Danny Staple <dastaple>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 17CC: dominick.grift, dwalsh, mgrepl, mmahut
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-12 05:09:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Danny Staple 2013-01-31 11:19:59 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0
Build Identifier: 

The package ircd-ratbox, in the Yum repos, will fail to be installed because it attempts to do soemthign with useradd that selinux prevents. Either ths ratbox installer or selinux are wrong here.

Reproducible: Always

Steps to Reproduce:
1.Fc 17 clean install
2.sudo yum install ircd-ratbox

Actual Results:  
In ratbox installation output:
Running Transaction
Error in PREIN scriptlet in rpm package ircd-ratbox-2.2.8-8.fc17.x86_64
useradd: cannot create directory /var/run/ircd-ratbox
error: %pre(ircd-ratbox-2.2.8-8.fc17.x86_64) scriptlet failed, exit status 12
  Verifying  : ircd-ratbox-2.2.8-8.fc17.x86_64                              1/1 

Failed:
  ircd-ratbox.x86_64 0:2.2.8-8.fc17                                             

Complete!

Package not actually installed, and "SELinux detected a problem". I've put the full output from the setroubleshoot in the additional information box.



Expected Results:  
Package installs, IRC server runs.

SELinux is preventing /usr/sbin/useradd from write access on the directory /run.

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

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

Additional Information:
Source Context                unconfined_u:system_r:useradd_t:s0-s0:c0.c1023
Target Context                system_u:object_r:var_run_t:s0
Target Objects                /run [ dir ]
Source                        useradd
Source Path                   /usr/sbin/useradd
Port                          <Unknown>
Host                          ukdtikv.uk.nds.com
Source RPM Packages           shadow-utils-4.1.5-4.fc17.x86_64
Target RPM Packages           filesystem-3-2.fc17.x86_64
Policy RPM                    selinux-policy-3.10.0-166.fc17.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     ukdtikv.uk.nds.com
Platform                      Linux ukdtikv.uk.nds.com 3.6.11-1.fc17.x86_64 #1
                              SMP Mon Dec 17 22:16:35 UTC 2012 x86_64 x86_64
Alert Count                   1
First Seen                    2013-01-31 11:15:05 GMT
Last Seen                     2013-01-31 11:15:05 GMT
Local ID                      a66415ba-a398-461a-b507-1ead77ea213f

Raw Audit Messages
type=AVC msg=audit(1359630905.231:1074): avc:  denied  { write } for  pid=21205 comm="useradd" name="/" dev="tmpfs" ino=7388 scontext=unconfined_u:system_r:useradd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:var_run_t:s0 tclass=dir


type=SYSCALL msg=audit(1359630905.231:1074): arch=x86_64 syscall=mkdir success=no exit=EACCES a0=7fff3e3a77a6 a1=0 a2=7f258185a730 a3=65726373662f7274 items=0 ppid=21202 pid=21205 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=2 comm=useradd exe=/usr/sbin/useradd subj=unconfined_u:system_r:useradd_t:s0-s0:c0.c1023 key=(null)

Hash: useradd,useradd_t,var_run_t,dir,write

audit2allow

#============= useradd_t ==============
#!!!! The source type 'useradd_t' can write to a 'dir' of the following types:
# httpd_user_script_exec_type, semanage_tmp_t, user_home_type, pcscd_var_run_t, file_context_t, home_root_t, selinux_config_t, user_home_dir_t, default_context_t, httpd_user_content_type, mail_spool_t, etc_t, config_home_t, tmp_t, var_t, semanage_store_t, selinux_login_config_t

allow useradd_t var_run_t:dir write;

audit2allow -R

#============= useradd_t ==============
#!!!! The source type 'useradd_t' can write to a 'dir' of the following types:
# httpd_user_script_exec_type, semanage_tmp_t, user_home_type, pcscd_var_run_t, file_context_t, home_root_t, selinux_config_t, user_home_dir_t, default_context_t, httpd_user_content_type, mail_spool_t, etc_t, config_home_t, tmp_t, var_t, semanage_store_t, selinux_login_config_t

allow useradd_t var_run_t:dir write;

Comment 1 Daniel Walsh 2013-01-31 15:59:08 UTC
Does ircd-ratbox create a user with its homedir in /run?

Comment 2 Daniel Walsh 2013-01-31 16:09:49 UTC
7ecc88cb3975cc12d55e3d09e16fef78f5dc338e allows this in git,  strange, i have never seen this before, not crazy about it but Not sure there is a better solution.

Comment 3 Danny Staple 2013-01-31 16:20:43 UTC
Marek Mahut <mmahut> is the ircd ratbox maintainer - should this be assigned to them, or at least in the cc list?

Comment 4 Miroslav Grepl 2013-02-01 10:07:47 UTC
Backported.

Comment 5 Fedora Update System 2013-02-04 22:04:56 UTC
selinux-policy-3.10.0-167.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-167.fc17

Comment 6 Fedora Update System 2013-02-05 17:02:49 UTC
Package selinux-policy-3.10.0-167.fc17:
* should fix your issue,
* was pushed to the Fedora 17 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.10.0-167.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-1971/selinux-policy-3.10.0-167.fc17
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2013-02-12 05:09:27 UTC
selinux-policy-3.10.0-167.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.