Bug 839608

Summary: Extra policy rule required for hplip3 fax support
Product: Red Hat Enterprise Linux 5 Reporter: Tim Waugh <twaugh>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.8CC: dwalsh, ksrot, mmalik
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-2.4.6-337.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-08 03:32:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 501834    
Attachments:
Description Flags
selinux-policy-hplip3.patch none

Description Tim Waugh 2012-07-12 12:34:18 UTC
Created attachment 597787 [details]
selinux-policy-hplip3.patch

Description of problem:
In order to make faxing work for the hplip3 package, the hp3fax CUPS backend needs to be able to send a D-Bus message to the system bus.

Version-Release number of selected component (if applicable):
selinux-policy-2.4.6-327.el5

How reproducible:
100%

Steps to Reproduce:
1.Try to use hplip3 (with fixes) for faxing
  
Actual results:
Audit messages, faxing doesn't work

Additional info:
This addition to cups.te has been tested locally and works for me.

Comment 1 Milos Malik 2012-07-12 12:56:07 UTC
Have you seen any AVCs or USER_AVCs when the faxing did not work?

Comment 2 Tim Waugh 2012-07-12 14:02:02 UTC
Yes, for example:

type=USER_AVC msg=audit(1342013211.753:130): user pid=2098 uid=81 auid=4294967295 subj=system_u:system_r:system_dbusd_t:s0 msg='avc:  denied  { send_msg } for msgtype=signal interface=com.hplip.StatusService member=Event dest=org.freedesktop.DBus spid=6177 tpid=6170 scontext=system_u:system_r:hplip_t:s0-s0:c0.c1023 tcontext=user_u:system_r:unconfined_t:s0 tclass=dbus : exe="/bin/dbus-daemon" (sauid=81, hostname=?, addr=?, terminal=?)'

Comment 3 Milos Malik 2012-07-12 14:52:13 UTC
The automated test by-the-way found following AVC in enforcing mode:
----
time->Thu Jul 12 10:47:54 2012
type=SYSCALL msg=audit(1342104474.495:238276): arch=40000003 syscall=102 success=no exit=-13 a0=3 a1=bf9cdf10 a2=649118 a3=9ed22c0 items=0 ppid=8843 pid=8928 auid=0 uid=4 gid=7 euid=4 suid=4 fsuid=4 egid=7 sgid=7 fsgid=7 tty=(none) ses=28074 comm="hpfax" exe="/usr/bin/python" subj=root:system_r:hplip_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1342104474.495:238276): avc:  denied  { name_connect } for  pid=8928 comm="hpfax" scontext=root:system_r:hplip_t:s0-s0:c0.c1023 tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket
----

Comment 4 RHEL Program Management 2012-07-12 14:59:20 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 5 Miroslav Grepl 2012-07-12 17:52:08 UTC
Milos,
could you add full part of AVC?

Comment 6 Milos Malik 2012-07-12 20:08:31 UTC
> could you add full part of AVC?
I don't know what you mean by "full part of AVC". Did you mean full auditing?

Here is the AVC from enforcing mode:
----
type=SOCKETCALL msg=audit(07/12/2012 16:05:21.564:240482) : nargs=3 a0=4 a1=92f62d8 a2=10 
type=SOCKADDR msg=audit(07/12/2012 16:05:21.564:240482) : saddr=inet host:127.0.0.1 serv:0 
type=SYSCALL msg=audit(07/12/2012 16:05:21.564:240482) : arch=i386 syscall=socketcall(connect) success=no exit=-13(Permission denied) a0=3 a1=bfbf0f50 a2=72b118 a3=92f62c0 items=0 ppid=1729 pid=1757 auid=root uid=lp gid=lp euid=lp suid=lp fsuid=lp egid=lp sgid=lp fsgid=lp tty=(none) ses=28345 comm=hpfax exe=/usr/bin/python subj=root:system_r:hplip_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(07/12/2012 16:05:21.564:240482) : avc:  denied  { name_connect } for  pid=1757 comm=hpfax scontext=root:system_r:hplip_t:s0-s0:c0.c1023 tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket 
----

Here is the AVC from permissive mode:
----
type=SOCKETCALL msg=audit(07/12/2012 16:03:28.977:240400) : nargs=3 a0=4 a1=b7b912d8 a2=10 
type=SOCKADDR msg=audit(07/12/2012 16:03:28.977:240400) : saddr=inet host:127.0.0.1 serv:0 
type=SYSCALL msg=audit(07/12/2012 16:03:28.977:240400) : arch=i386 syscall=socketcall(connect) success=no exit=-111(Connection refused) a0=3 a1=bf8f5980 a2=ff7118 a3=b7b912c0 items=0 ppid=32721 pid=32749 auid=root uid=lp gid=lp euid=lp suid=lp fsuid=lp egid=lp sgid=lp fsgid=lp tty=(none) ses=28345 comm=hpfax exe=/usr/bin/python subj=root:system_r:hplip_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(07/12/2012 16:03:28.977:240400) : avc:  denied  { name_connect } for  pid=32749 comm=hpfax scontext=root:system_r:hplip_t:s0-s0:c0.c1023 tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket 
----

Comment 7 Tim Waugh 2012-07-13 10:00:46 UTC
FWIW. The name_connect AVC messages are from hplip, not hplip3.  The attached patch fixes hplip3 fax operation for me, using the packages from a forthcoming update (bug #501834 comment #40).

Comment 8 Miroslav Grepl 2012-07-13 10:09:32 UTC
Milos,
to which port is trying to connect it?

Comment 10 Miroslav Grepl 2012-07-16 08:25:13 UTC
Added Tim's patch.

Comment 17 Miroslav Grepl 2012-10-05 11:58:04 UTC
type=AVC msg=audit(1342104474.495:238276): avc:  denied  { name_connect } for  pid=8928 comm="hpfax" scontext=root:system_r:hplip_t:s0-s0:c0.c1023 tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket

to which port does hpfax connect?

This rule was not added because it would allow hplip to connect to generic port.

Comment 21 Miroslav Grepl 2012-10-10 05:57:24 UTC
Fixed in selinux-policy-2.4.6-337.el5

Comment 24 errata-xmlrpc 2013-01-08 03:32:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0060.html