apparmor cups samba problem no printing

Bug #1370930 reported by Roger Tri
46
This bug affects 8 people
Affects Status Importance Assigned to Milestone
cups (Ubuntu)
Fix Released
High
Jamie Strandboge

Bug Description

I configured a usb brother printer correctly (working) on ubuntu 14.04.1.
Then I installed a samba server to share this printer on a windows network
The samba printing from windows machines works correctly. The usb direct cups printing inform printing OK, jobs completed, but nothing prints. On syslog I see this apparmor DENIED messages:
Sep 18 08:51:57 gabi-K55A kernel: [ 844.181601] type=1400 audit(1411023117.729:74): apparmor="DENIED" operation="open" profile="/usr/sbin/cupsd
" name="/var/cache/samba/gencache.tdb" pid=3353 comm="smb" requested_mask="r" denied_mask="r" fsuid=7 ouid=0
Sep 18 08:51:57 gabi-K55A kernel: [ 844.181649] type=1400 audit(1411023117.729:75): apparmor="DENIED" operation="open" profile="/usr/sbin/cupsd
" name="/var/cache/samba/gencache.tdb" pid=3353 comm="smb" requested_mask="r" denied_mask="r" fsuid=7 ouid=0
Sep 18 08:51:57 gabi-K55A kernel: [ 844.182286] type=1400 audit(1411023117.729:76): apparmor="DENIED" operation="open" profile="/usr/sbin/cupsd
" name="/var/cache/samba/gencache.tdb" pid=3353 comm="smb" requested_mask="r" denied_mask="r" fsuid=7 ouid=0
Sep 18 08:54:04 gabi-K55A kernel: [ 971.394145] type=1400 audit(1411023244.943:77): apparmor="DENIED" operation="signal" profile="/usr/sbin/cup
sd" pid=2034 comm="cupsd" requested_mask="send" denied_mask="send" signal=term peer="unconfined"
Sep 18 08:54:04 gabi-K55A kernel: [ 971.394155] type=1400 audit(1411023244.943:78): apparmor="DENIED" operation="signal" profile="/usr/sbin/cup
sd" pid=2034 comm="cupsd" requested_mask="send" denied_mask="send" signal=term peer="unconfined"
Sep 18 08:54:04 gabi-K55A kernel: [ 971.394161] type=1400 audit(1411023244.943:79): apparmor="DENIED" operation="signal" profile="/usr/sbin/cup
sd" pid=2034 comm="cupsd" requested_mask="send" denied_mask="send" signal=term peer="unconfined"
Sep 18 08:54:04 gabi-K55A kernel: [ 971.394166] type=1400 audit(1411023244.943:80): apparmor="DENIED" operation="signal" profile="/usr/sbin/cup
sd" pid=2034 comm="cupsd" requested_mask="send" denied_mask="send" signal=term peer="unconfined"

I install with apt-get last apparmor profiles, but I get this messages yet, with the same result (no printing):
Sep 18 09:15:06 gabi-K55A kernel: [ 100.620853] usblp0: removed
Sep 18 09:15:06 gabi-K55A kernel: [ 100.878155] usblp 1-4:1.0: usblp0: USB Bidirectional printer dev 3 if 0 alt 0 proto 2 vid 0x04F9 pid 0x0037
Sep 18 09:16:39 gabi-K55A kernel: [ 193.894732] type=1400 audit(1411024599.437:117): apparmor="DENIED" operation="open" profile="/usr/sbin/cupsd" name="/var/cache/samba/gencache.tdb" pid=2384 comm="smb" requested_mask="r" denied_mask="r" fsuid=7 ouid=0

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

pitti, can you have a look what is missing here in the AppArmor profile? Thanks.

Revision history for this message
Martin Pitt (pitti) wrote :

The bits about gendache.tdb are covered by bug 1371097. I don't know what the denied_mask="send" signal=term bits are about, I suggest asking the apparmor developers (jdstrand and tyhicks).

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Since 14.04, apparmor has signal mediation. Cups is trying to kill some processes. To obtain 13.10 behavior, you could add this to usr.sbin.cupsd:
  signal,

However, this would obviously allow cups to send signals to anything. I'm guessing it is sending signals to third party backends. It would probably be best to change this rule:
  /usr/lib/cups/backend/* Ux,

to something like (untested):
  /usr/lib/cups/backend/* Cx -> cups_backends,
  signal (send) peer=cups_backends,
  profile cups_backends {
    file,
    capability,
    network,
    audit deny capability mac_admin,
    dbus,
    signal,
    ptrace,
    unix,
  }

In addition to fixing the above, this adds a modest improvement over what we have now: backends aren't allowed to change MAC policy, can't change_profile and can't use mount.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Actually, I see more Ux rules. Try this instead (also untested):
  /usr/bin/hpijs Cx -> third_party,
  /usr/Brother/** Cx -> third_party,
  /usr/lib/cups/backend/* Cx -> third_party,
  /usr/lib/cups/filter/** Cxr -> third_party,
  /usr/lib/cups/driver/* Cxr -> third_party,
  signal (send) peer=third_party,
  profile third_party {
    file,
    capability,
    network,
    audit deny capability mac_admin,
    dbus,
    signal,
    ptrace,
    unix,
  }

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in cups (Ubuntu):
status: New → Confirmed
Changed in cups (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Jamie Strandboge (jdstrand)
importance: Undecided → High
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

I'm preparing an update for this now that implements the above. Note, I do not have a third party printer so it is possible more fine tuning will need to be done. Also note, the 'unix' rule will not work on Debian-- it will need to be conditionally applied to Ubuntu until the unix mediation is upstreamed and included in Debian.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Sorry, I meant the 'signal' rule instead of 'unix'.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Sigh, that's what I get for typing too fast. Debian does not support dbus, signal, ptrace or unix rules -- all of these should be excluded in Debian and included in Ubuntu.

Changed in cups (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cups - 1.7.5-2ubuntu1

---------------
cups (1.7.5-2ubuntu1) utopic; urgency=medium

  * debian/local/apparmor-profile:
    - move Ux to Cx -> third_party and provie a third_party child profile. In
      this manner, we can add some modest confinement (can't change MAC
      policy, change_profile or mount) but more importantly it allows us to
      specify peer=third_party to restrict where the strictly confined cups
      process can send signals (LP: #1370930)
    - allow r of /var/cache/samba/*.tdb (LP: #1371097)
    - allow r of /var/{cache,lib}/samba/printing/printers.tdb
 -- Jamie Strandboge <email address hidden> Wed, 24 Sep 2014 11:24:03 -0500

Changed in cups (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Gustavo A. Díaz (gdiaz) wrote :

And what about for those who use 14.04.2 LTS?

Revision history for this message
jose (o1485726) wrote :

Any news on this?

Revision history for this message
TEN (launchpad-20-ten) wrote :

Probably triggered by some recent package update,
Ubuntu 14.04.3 LTS 3.13.0-61-generic #100-Ubuntu SMP Wed Jul 29 11:21:34 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
reports in /var/log/kern.log:

type=1400 audit(1439324668.029:103): apparmor="DENIED" operation="open" profile="/usr/sbin/cupsd" name="/var/cache/samba/gencache.tdb" pid=1019 comm="smb" requested_mask="r" denied_mask="r" fsuid=7 ouid=0

The above message can be prevented by this addition to /etc/apparmor.d/usr.sbin.cupsd from bug 1371097 after the following comment:

  # Site-specific additions and overrides. See local/README for details.
  #include <local/usr.sbin.cupsd>

  /var/cache/samba/*.tdb r,

However, another error follows, also repeatedly:

type=1400 audit(1439325510.504:68): apparmor="DENIED" operation="signal" profile="/usr/sbin/cupsd" pid=952 comm="cupsd" requested_mask="send" denied_mask="send" signal=term peer="unconfined"

For this one, suggestions not directly applicable to LTS seem to be made in bug 1370930 with a fix for other versions.
How can this best be applied to also fix Ubuntu 14.04.3 ?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.