Package: cups-browsed
Version: 1.28.17-7+b3
Severity: important
Tags: upstream
X-Debbugs-Cc: [email protected]
Control: forwarded -1 https://github.com/OpenPrinting/cups-browsed/issues/53

Dear Maintainer,

Printing through queues auto-created by cups-browsed (DEVICE_URI
implicitclass://...) fails every time for jobs submitted by an ordinary
local user. The printer is a Kyocera ECOSYS P2235dn (driverless IPP,
reachable over the network and over USB via ipp-usb).

Versions:
  cups          2.4.20-1
  cups-browsed  1.28.17-7+b3
  cups-filters  1.28.17-7+b3
  cupsd and /usr/lib/cups/backend/ipp are linked against libgssapi_krb5
  (Kerberos is not configured; cupsd.conf has DefaultAuthType Basic)

What happens (from /var/log/cups/error_log, LogLevel debug):

  [Job 7] envp[..]="AUTH_UID=****"      <- AUTH_UID is set for the job
  [Job 7] Started backend /usr/lib/cups/backend/implicitclass
  [Job 7] Debug: implicitclass - copying to temp print file "/tmp/1264a6b046f1d"
  [Job 7] The filtered output of pdftoippprinter is written to file 
/tmp/1264a6b047529
  [Job 7] Started IPP Backend (/usr/lib/cups/backend/ipp) with pid: 75344
  [Job 7] Resolved as "ipp://<printer>.local:631/ipp/print"...
  [Job 7] job-uri uri ipp://<printer>:631/jobs/1000
  E [Job 7] Unable to open print file: Permission denied
  [Job 7] The IPP Backend exited with the status 1

implicitclass is mode 0700 so it runs as root and creates its temp file
in /tmp as root, mode 0600. It then execs the ipp backend, which, because
AUTH_UID is set (CUPS built with GSSAPI), switches to the submitting
user's UID and can no longer read the file.

Consequences, all of which make this very hard to diagnose:

 * The ipp backend has already sent Create-Job, so the printer keeps a
   job in "job-incoming" with no document. It then reports
   printer-state=processing indefinitely, while its state message still
   says "Ready".
 * Later jobs are rejected by the busy printer ("Print job was not
   accepted"), yet the implicitclass/ipp backend exits 0 and CUPS marks
   the job "completed". The user sees nothing printed and nothing
   indicates an error.
 * A second auto-created queue for the same device (USB via ipp-usb)
   loops forever on "ALL_DESTS_BUSY".

Expected: implicitclass should create its temp file so the ipp backend
can read it after dropping privileges (e.g. chown it to AUTH_UID, or
create it with seteuid as suggested in upstream #53), or pass the data
over a pipe/stdin instead of a file in /tmp.

Workaround: create a permanent queue directly against the printer
  lpadmin -p NAME -E -v ipp://<printer>.local:631/ipp/print -m everywhere
and set "CreateIPPPrinterQueues No" in /etc/cups/cups-browsed.conf.
Printing then works immediately.

Upstream report with the same analysis (Debian 12, 1.28.17-3+deb12u1):
https://github.com/OpenPrinting/cups-browsed/issues/53
There the maintainer noted the privilege drop only happens when AUTH_UID
is set; this report confirms AUTH_UID is set for ordinary local jobs on
a GSSAPI-enabled build without Kerberos configured.


-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 7.3.4+deb14-amd64 (SMP w/128 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages cups-browsed depends on:
ii  cups-daemon                2.4.20-1
ii  libavahi-client3           0.8-18
ii  libavahi-common3           0.8-18
ii  libavahi-glib1             0.8-18
ii  libc6                      2.43-7
ii  libcups2t64                2.4.20-1
ii  libcupsfilters1t64         1.28.17-7+b3
ii  libglib2.0-0t64            2.90.1-2
ii  libldap2                   2.6.14+dfsg-2+b1
ii  sysvinit-utils [lsb-base]  3.18-2

Versions of packages cups-browsed recommends:
ii  avahi-daemon  0.8-18

cups-browsed suggests no packages.

-- Configuration Files:
/etc/cups/cups-browsed.conf changed:
BrowseRemoteProtocols dnssd
CreateIPPPrinterQueues No


-- no debconf information

Reply via email to