Bug 590065

Summary: SELinux prevented restorecon from reading from the urandom device.
Product: Red Hat Enterprise Linux 6 Reporter: Tim Waugh <twaugh>
Component: system-config-printerAssignee: Tim Waugh <twaugh>
Status: CLOSED CURRENTRELEASE QA Contact: Yulia Kopkova <ykopkova>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: azelinka, jpopelka, pknirsch, twaugh, ykopkova
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:4c6368fb70ee361580dcbc143f07157fe7024e6e632fcfdbff0bb8368519cf77,Contest
Fixed In Version: system-config-printer-1.1.16-12.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 587830 Environment:
Last Closed: 2010-11-15 14:48:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 587830    
Bug Blocks:    

Description Tim Waugh 2010-05-07 16:01:07 UTC
This also affects Red Hat Enterprise Linux 6.

+++ This bug was initially created as a clone of Bug #587830 +++


SELinux prevented restorecon from reading from the urandom device.

Detailed Description:

[restorecon has a permissive type (setfiles_t). This access was not denied.]

SELinux prevented restorecon from reading from the urandom device. This access
should be allowed for individual applications, but there are situations where
all applications require the access (for example, when ProPolice/SSP stack
smashing protection is used). Allowing this access may allow malicious
applications to drain the kernel entropy pool. This can compromise the ability
of some software that is dependent on high quality random numbers (e.g.,
ssh-keygen) to operate effectively. The risk of this type of attack is
relatively low.

Allowing Access:

Changing the "global_ssp" boolean to true will allow this access: "setsebool -P

Fix Command:

setsebool -P global_ssp=1

Additional Information:

Source Context                unconfined_u:unconfined_r:setfiles_t:s0-s0:c0.c102
Target Context                system_u:object_r:urandom_device_t:s0
Target Objects                /dev/urandom [ chr_file ]
Source                        restorecon
Source Path                   /sbin/setfiles
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           policycoreutils-2.0.82-7.fc13
Target RPM Packages           
Policy RPM                    selinux-policy-3.7.19-6.fc13
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Plugin Name                   global_ssp
Host Name                     (removed)
Platform                      Linux sup35.ccdom.wi.mit.edu
                     #1 SMP Tue Apr 20 08:57:50
                              UTC 2010 x86_64 x86_64
Alert Count                   1
First Seen                    Fri 30 Apr 2010 09:01:49 PM EDT
Last Seen                     Fri 30 Apr 2010 09:01:49 PM EDT
Local ID                      9a4a320c-4c08-4ceb-8ef9-4b6bc7758b2e
Line Numbers                  

Raw Audit Messages            

node=sup35.ccdom.wi.mit.edu type=AVC msg=audit(1272675709.917:27220): avc:  denied  { read } for  pid=5722 comm="restorecon" path="/dev/urandom" dev=devtmpfs ino=4054 scontext=unconfined_u:unconfined_r:setfiles_t:s0-s0:c0.c1023 tcontext=system_u:object_r:urandom_device_t:s0 tclass=chr_file

node=sup35.ccdom.wi.mit.edu type=SYSCALL msg=audit(1272675709.917:27220): arch=c000003e syscall=59 success=yes exit=0 a0=1923db0 a1=1923fd0 a2=1924370 a3=30 items=0 ppid=5568 pid=5722 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=(none) ses=1 comm="restorecon" exe="/sbin/setfiles" subj=unconfined_u:unconfined_r:setfiles_t:s0-s0:c0.c1023 key=(null)

Hash String generated from  global_ssp,restorecon,setfiles_t,urandom_device_t,chr_file,read
audit2allow suggests:

#============= setfiles_t ==============
#!!!! This avc can be allowed using the boolean 'global_ssp'

allow setfiles_t urandom_device_t:chr_file read;

--- Additional comment from alexl@users.sourceforge.net on 2010-04-30 21:04:40 EDT ---

I think this happened while attempting to connect to remote printer with the printer troubleshooting.

--- Additional comment from dwalsh@redhat.com on 2010-05-03 14:25:27 EDT ---

This looks like something in cups is leaking an open file descriptor to /dev/urand.

--- Additional comment from twaugh@redhat.com on 2010-05-04 12:59:42 EDT ---

I don't think this is anything to do with cups, but instead with the system-config-printer troubleshooter -- that's entirely different.  Fixing component.

For reference: the troubleshooter runs as the logged in user with no special SELinux context, and runs:

 LC_ALL=C restorecon -nvR /etc/cups/ /usr/lib/cups/ /usr/share/cups/

However, it doesn't close all file descriptors before doing this.  It ought to use the close_fds parameter to subprocess.Popen.

--- Additional comment from updates@fedoraproject.org on 2010-05-07 11:54:51 EDT ---

system-config-printer-1.2.2-1.fc13 has been submitted as an update for Fedora 13.

Comment 1 RHEL Product and Program Management 2010-05-07 16:31:44 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for

Comment 2 Jiri Popelka 2010-06-07 17:30:17 UTC
Fixed in system-config-printer-1.1.16-12.el6

Comment 4 releng-rhel@redhat.com 2010-11-15 14:48:43 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.