Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1409115

Summary: Incorrect permissons in the RPM package and boomaga requires the SELinux security policy
Product: [Fedora] Fedora Reporter: Alexander Sokolov <sokoloff.a>
Component: boomagaAssignee: MartinKG <mgansser>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: go.wigust, lvrabec, mgansser, mgansser
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: boomaga-0.8.0-6.git97f52c1.fc24 boomaga-0.8.0-8.gitb495615.fc25 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-06 07:49:46 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:

Description Alexander Sokolov 2016-12-29 16:16:54 UTC
Description of problem:
We have 2 problems.

1. The file /usr/lib/cups/backend/boomaga in the RPM package has the wrong permissions. It should have  have 700(rwx------) permissions. Here is a quote from the CUPS man backend:
> Permissions
> Backends without world read and execute permissions are run as the root user.
> Otherwise, the backend is run using an unprivileged user account, typically "lp".
> https://www.cups.org/doc/man-backend.html

2. The /usr/lib64/boomaga/boomagabackend requires SELinux policy. It requires
Write to ~/.cache directory
Send DBus messages

How reproducible:
always

Steps to Reproduce:
The first problem.
1. sudo dnf install boomaga
2. Print to virtual printer (tried Firefox and Chrome)
3. lpr /usr/share/doc/boomaga/README.md

Actual results:
System-config-printer GUI gives printer state error. In the cups logs we can found 'Can't change GID to 1000: Operation not permitted' line.


The second problem.
1. chmod chmod 700 /usr/lib/cups/backend/boomaga
2. cupsenable boomaga
3. lpr /usr/share/doc/boomaga/README.md

Actual results:
- if SELinux is set to Enforcing, nothing is printed and the boomaga virtual printer is immediately disabled. Error conditions are logged by SELinux.
- if SELinux is set to Permissive, the document is correctly printed but error conditions are still logged.


Additional info:
Issue on github https://github.com/Boomaga/boomaga/issues/43
I am the author of the program, and willing to answer questions.

Comment 1 MartinKG 2017-01-10 17:58:58 UTC
I've started creating a selinux package for boomage, unfortunately without success: https://martinkg.fedorapeople.org/Review/test/boomaga/

Comment 2 Alexander Sokolov 2017-01-10 18:53:20 UTC
@MartinKG
 
Maybe following information will help for you. Package cups-pdf has similar requirements and has correct SELinux policy. The difference is that cups-pdf writes files to the user desktop instead of ~/.cache.

Comment 3 Fedora Update System 2017-01-15 10:35:38 UTC
boomaga-0.8.0-6.git97f52c1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-da50adf63e

Comment 4 Fedora Update System 2017-01-15 16:31:42 UTC
boomaga-0.8.0-6.git97f52c1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-5d0871e3fd

Comment 5 Fedora Update System 2017-01-16 22:22:18 UTC
boomaga-0.8.0-6.git97f52c1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-5d0871e3fd

Comment 6 Fedora Update System 2017-01-16 22:22:38 UTC
boomaga-0.8.0-6.git97f52c1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-da50adf63e

Comment 7 Fedora Update System 2017-01-25 00:20:46 UTC
boomaga-0.8.0-6.git97f52c1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2017-02-15 10:39:42 UTC
boomaga-0.8.0-8.gitb495615.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-5bd6a83c49

Comment 9 Fedora Update System 2017-02-17 15:25:42 UTC
boomaga-0.8.0-8.gitb495615.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-5bd6a83c49

Comment 10 Fedora Update System 2017-02-26 01:36:27 UTC
boomaga-0.8.0-8.gitb495615.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Oleg Pykhalov 2017-03-24 21:39:33 UTC
I can print to boomaga printer, but with a delay about 30 seconds per task. SELinux Troubleshooter reports an error.

SELinux is preventing boomagabackend from 'sys_ptrace' accesses on the cap_userns Unknown.

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

If you believe that boomagabackend should be allowed sys_ptrace access on the Unknown cap_userns 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:
# ausearch -c 'boomagabackend' --raw | audit2allow -M my-boomagabackend
# semodule -X 300 -i my-boomagabackend.pp

Additional Information:
Source Context                system_u:system_r:boomaga_cups_t:s0-s0:c0.c1023
Target Context                system_u:system_r:boomaga_cups_t:s0-s0:c0.c1023
Target Objects                Unknown [ cap_userns ]
Source                        boomagabackend
Source Path                   boomagabackend
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-225.11.fc25.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.9.14-200.fc25.x86_64 #1 SMP Mon
                              Mar 13 19:26:40 UTC 2017 x86_64 x86_64
Alert Count                   3
First Seen                    2017-03-25 00:29:09 MSK
Last Seen                     2017-03-25 00:32:12 MSK
Local ID                      531f80ea-deab-40c6-9bd0-c7375eef6639

Raw Audit Messages
type=AVC msg=audit(1490391132.808:798): avc:  denied  { sys_ptrace } for  pid=12332 comm="boomagabackend" capability=19  scontext=system_u:system_r:boomaga_cups_t:s0-s0:c0.c1023 tcontext=system_u:system_r:boomaga_cups_t:s0-s0:c0.c1023 tclass=cap_userns permissive=1


Hash: boomagabackend,boomaga_cups_t,boomaga_cups_t,cap_userns,sys_ptrace

Comment 12 MartinKG 2017-03-30 12:45:01 UTC
i post a comment from Lukas Vrabec on the Fedora selinux forum:
https://lists.fedoraproject.org/archives/list/selinux@lists.fedoraproject.org/thread/VUOKKV77ETH45QIFED2XZWHEIAUJARND/

boomaga SELinux module is not part of selinux-policy package, which
means it's not maintained by Fedora SELinux team. I cloned boomaga repo
and boomaga policy is part of permissivedomains, which means that
boomaga rules won't be enforced by kernel, even if your system is in
enforcing state. If you would like to fix this issue you can create
local module:

$ cat boomaga_local.cil
(allow boomaga_cups_t boomaga_cups_t(cap_userns (sys_ptrace)))

# semodule -i boomaga_local.cil
#

Comment 13 MartinKG 2017-04-04 10:46:56 UTC
new comment form Lukas Vrabec on the Fedora selinux forum:

Update your boomaga_local.cil file:
$ cat boomaga_local.cil
(allow boomaga_cups_t boomaga_cups_t(cap_userns (sys_ptrace)))
(allow systemd_logind_t boomaga_cups_t(dbus (send_msg)))

and load it again:
# semodule -i boomaga_local.cil

Comment 14 Oleg Pykhalov 2017-04-04 18:07:47 UTC
Thank you for supporting this issue. I got another bunch of errors, but
I tried to solve it myself.

$ journalctl -b
Apr 04 19:17:47 magnolia.home.lan audit[938]: USER_AVC pid=938 uid=81
auid=4294967295 ses=4294967295
subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc: denied
{send_msg } for msgtype=method_call
interface=org.freedesktop.DBus.Introspectable member=Introspect
dest=org.freedesktop.login1 spid=5692 tpid=952
scontext=system_u:system_r:boomaga_cups_t:s0-s0:c0.c1023
tcontext=system_u:system_r:systemd_logind_t:s0 tclass=dbus
exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'

$ cat boomaga_local.cil
(allow boomaga_cups_t boomaga_cups_t(cap_userns (sys_ptrace)))
(allow systemd_logind_t boomaga_cups_t(dbus (send_msg)))
(allow boomaga_cups_t systemd_logind_t(dbus (send_msg)))

$ sudo semodule -i boomaga_local.cil

$ journalctl -b
Apr 04 19:30:48 magnolia.home.lan dbus-daemon[1597]: avc: denied {
send_msg } for msgtype=method_call interface=org.boomaga member=add
dest=org.boomaga spid=6894 tpid=6852
scontext=system_u:system_r:boomaga_cups_t:s0-s0:c0.c1023
tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
tclass=dbus

$ cat boomaga_local.cil
(allow boomaga_cups_t boomaga_cups_t(cap_userns (sys_ptrace)))
(allow systemd_logind_t boomaga_cups_t(dbus (send_msg)))
(allow boomaga_cups_t systemd_logind_t(dbus (send_msg)))
(allow boomaga_cups_t unconfined_t(dbus (send_msg)))

$ sudo semodule -i boomaga_local.cil

Printing to boomaga is working without errors and delays now.

Comment 15 Jan Kurik 2017-08-15 07:34:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.