Bug 401411 - SELinux is preventing /usr/bin/hpijs (cupsd_t) "getattr" to /usr/share/snmp/mibs/.index (snmpd_var_lib_t).
SELinux is preventing /usr/bin/hpijs (cupsd_t) "getattr" to /usr/share/snmp/m...
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted (Show other bugs)
8
x86_64 Linux
low Severity low
: ---
: ---
Assigned To: Daniel Walsh
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-11-27 12:07 EST by Andrig Miller
Modified: 2008-01-30 14:06 EST (History)
1 user (show)

See Also:
Fixed In Version: Current
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-01-30 14:06:51 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Andrig Miller 2007-11-27 12:07:36 EST
Description of problem:

Getting an AVC Denied when printing to my HP printer.

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

3.0.8-56.fc8

How reproducible:

Everytime I print.

Steps to Reproduce:
1. Print any document.
2.
3.
  
Actual results:

Document prints, but I get this access violation.

Expected results:

Shouldn't be getting this violation.



Additional info:

An interesting note here, is that this printer is attached to the network, but
not directly to any client machine that can print to it.  Also, here is the
entire alert from SE TroubleShoot:

Summary
    SELinux is preventing /usr/bin/hpijs (cupsd_t) "getattr" to
    /usr/share/snmp/mibs/.index (snmpd_var_lib_t).

Detailed Description
    SELinux denied access requested by /usr/bin/hpijs. It is not expected that
    this access is required by /usr/bin/hpijs and this access may signal an
    intrusion attempt. It is also possible that the specific version or
    configuration of the application is causing it to require additional access.

Allowing Access
    Sometimes labeling problems can cause SELinux denials.  You could try to
    restore the default system file context for /usr/share/snmp/mibs/.index,
    restorecon -v /usr/share/snmp/mibs/.index If this does not work, there is
    currently no automatic way to allow this access. Instead,  you can generate
    a local policy module to allow this access - see
    http://fedora.redhat.com/docs/selinux-faq-fc5/#id2961385 Or you can disable
    SELinux protection altogether. Disabling SELinux protection is not
    recommended. Please file a http://bugzilla.redhat.com/bugzilla/enter_bug.cgi
    against this package.

Additional Information        

Source Context                system_u:system_r:cupsd_t:SystemLow-SystemHigh
Target Context                system_u:object_r:snmpd_var_lib_t
Target Objects                /usr/share/snmp/mibs/.index [ file ]
Affected RPM Packages         hpijs-2.7.7-6.fc8 [application]
Policy RPM                    selinux-policy-3.0.8-56.fc8
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   plugins.catchall_file
Host Name                     localhost.localdomain
Platform                      Linux localhost.localdomain 2.6.23.1-49.fc8 #1 SMP
                              Thu Nov 8 22:14:09 EST 2007 x86_64 x86_64
Alert Count                   1
First Seen                    Tue 27 Nov 2007 09:59:31 AM MST
Last Seen                     Tue 27 Nov 2007 10:00:15 AM MST
Local ID                      f2b120cc-1d8d-4ae9-a03b-6e407caa817a
Line Numbers                  

Raw Audit Messages            

avc: denied { getattr } for comm=hpijs dev=dm-0 egid=7 euid=4 exe=/usr/bin/hpijs
exit=-13 fsgid=7 fsuid=4 gid=7 items=0 path=/usr/share/snmp/mibs/.index
pid=26840 scontext=system_u:system_r:cupsd_t:s0-s0:c0.c1023 sgid=7
subj=system_u:system_r:cupsd_t:s0-s0:c0.c1023 suid=4 tclass=file
tcontext=system_u:object_r:snmpd_var_lib_t:s0 tty=(none) uid=4
Comment 1 Daniel Walsh 2007-11-28 07:17:19 EST
Tim, should /usr/bin/hpijs be labeled hplip_exec_t?

Comment 2 Tim Waugh 2007-11-28 07:40:15 EST
Dan: Ah, yes, that's it.  Thanks for figuring it out.
Comment 3 Daniel Walsh 2007-11-28 08:27:49 EST
chcon -t hplip_exec_t /usr/bin/hpijs

Will fix it until the next update.

Fixed in selinux-policy-3.0.8-63.fc8
Comment 4 Andrig Miller 2007-11-28 12:47:54 EST
After applying that change via the chcon command, I no longer get the original
problem, but I get the following new problem:

Summary
    SELinux is preventing /usr/bin/hpijs (hplip_t) "write" to
    /var/spool/cups/tmp/gs_2V4krd (print_spool_t).

Detailed Description
    SELinux denied access requested by /usr/bin/hpijs. It is not expected that
    this access is required by /usr/bin/hpijs and this access may signal an
    intrusion attempt. It is also possible that the specific version or
    configuration of the application is causing it to require additional access.

Allowing Access
    Sometimes labeling problems can cause SELinux denials.  You could try to
    restore the default system file context for /var/spool/cups/tmp/gs_2V4krd,
    restorecon -v /var/spool/cups/tmp/gs_2V4krd If this does not work, there is
    currently no automatic way to allow this access. Instead,  you can generate
    a local policy module to allow this access - see
    http://fedora.redhat.com/docs/selinux-faq-fc5/#id2961385 Or you can disable
    SELinux protection altogether. Disabling SELinux protection is not
    recommended. Please file a http://bugzilla.redhat.com/bugzilla/enter_bug.cgi
    against this package.

Additional Information        

Source Context                system_u:system_r:hplip_t:SystemLow-SystemHigh
Target Context                system_u:object_r:print_spool_t
Target Objects                /var/spool/cups/tmp/gs_2V4krd [ file ]
Affected RPM Packages         hpijs-2.7.7-6.fc8 [application]
Policy RPM                    selinux-policy-3.0.8-56.fc8
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   plugins.catchall_file
Host Name                     localhost.localdomain
Platform                      Linux localhost.localdomain 2.6.23.1-49.fc8 #1 SMP
                              Thu Nov 8 22:14:09 EST 2007 x86_64 x86_64
Alert Count                   1
First Seen                    Wed 28 Nov 2007 10:46:32 AM MST
Last Seen                     Wed 28 Nov 2007 10:46:32 AM MST
Local ID                      ca29c1c3-0bb3-4d9b-be1c-55b600502d34
Line Numbers                  

Raw Audit Messages            

avc: denied { write } for comm=hpijs dev=dm-0 egid=7 euid=4 exe=/usr/bin/hpijs
exit=0 fsgid=7 fsuid=4 gid=7 items=0 path=/var/spool/cups/tmp/gs_2V4krd
pid=13034 scontext=system_u:system_r:hplip_t:s0-s0:c0.c1023 sgid=7
subj=system_u:system_r:hplip_t:s0-s0:c0.c1023 suid=4 tclass=file
tcontext=system_u:object_r:print_spool_t:s0 tty=(none) uid=4

Comment 5 Tim Waugh 2007-11-29 07:18:06 EST
I just tested this patch:

--- serefpolicy-3.0.8/policy/modules/services/cups.te.hplip-print-spool
2007-11-29 11:32:39.000000000 +0000
+++ serefpolicy-3.0.8/policy/modules/services/cups.te   2007-11-29
11:37:56.000000000 +0000
@@ -586,7 +586,9 @@ dev_read_rand(hplip_t)
 dev_rw_generic_usb_dev(hplip_t)
 dev_rw_usbfs(hplip_t)
 
-lpd_read_spool(hplip_t)
+# hpijs needs to read spool files, and puts
+# temporary files in /var/spool/cups/tmp/
+lpd_manage_spool(hplip_t)
 
 fs_getattr_all_fs(hplip_t)
 fs_search_auto_mountpoints(hplip_t)

and now printing generates no AVC messages when /usr/bin/hpijs is set to
hplip_exec_t.

Technically it's a little too much privilege: hpijs just needs to use
/var/spool/cups/tmp as temporary space.

I wonder if /var/spool/cups/tmp ought to be labelled as tmp_t instead?  What's
the difference between that and unconfined_tmp_t?
Comment 6 Daniel Walsh 2007-12-01 08:57:41 EST
Fixed in selinux-policy-3.0.8-63.fc8
Comment 7 Joe Buck 2007-12-12 00:49:13 EST
It's broken in Fedora 7 as well, with a slightly different failure.

SELinux is preventing sh (cupsd_t) "getattr" to /usr/bin/hpijs (hplip_exec_t).

Your suggestion in comment #3 won't work, since it's already hplip_exec_t.
Comment 8 Joe Buck 2007-12-12 01:00:23 EST
The issue I mentioned in #7 looks like a distinct bug, so I opened #420971.
Comment 9 Tim Waugh 2007-12-13 07:27:05 EST
(In reply to comment #7)
> It's broken in Fedora 7 as well, with a slightly different failure.
> 
> SELinux is preventing sh (cupsd_t) "getattr" to /usr/bin/hpijs (hplip_exec_t).

This is bug #422761.
Comment 10 Daniel Walsh 2007-12-13 15:23:15 EST
There is a fix for F7 in selinux-policy-2.6.4-63
Comment 11 Daniel Walsh 2008-01-30 14:06:51 EST
Bulk closing a old selinux policy bugs that were in the modified state.  If the
bug is still not fixed.  Please reopen.

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