Package: opencryptoki
Version: 3.27.0-1
Severity: normal

Package: opencryptoki
Version: 3.27.0-1
Severity: important

Subject: opencryptoki: pkcsslotd.service fails to start under systemd 263 
(ProtectSystem=strict makes /run/opencryptoki read-only)

Dear Maintainer,

After upgrading systemd from 262.2-1 to 263~rc1 (now 263~rc1-2), 
pkcsslotd.service
no longer starts:

  systemd[1]: Starting pkcsslotd.service - Daemon which manages cryptographic 
hardware tokens for the openCryptoki package...
  systemd[1]: pkcsslotd.service: Control process exited, code=exited, 
status=3/NOTIMPLEMENTED
  systemd[1]: pkcsslotd.service: Failed with result 'exit-code'.

pkcsslotd itself logs nothing. Started by hand as root, outside systemd, the
daemon starts and runs normally (it switches to the pkcsslotd user and creates
its PID file and sockets). With systemd 262.2-1 the unit started fine; the
first start under 263~rc1 is the first failure. Neither opencryptoki nor its
unit file changed (both dated 2026-06-29).

To find the cause I started the unit with a runtime drop-in that relaxed one
sandboxing option at a time:

  no change                              fails (status 3)
  MemoryDenyWriteExecute=no              fails
  SystemCallFilter= (reset)              fails
  PrivateDevices=no                      fails
  ProtectSystem=no                       STARTS
  ProtectHome=no                         fails
  PrivateTmp=no                          fails
  RestrictAddressFamilies= (reset)       fails
  IPAddressDeny= (reset)                 fails
  RestrictNamespaces=no                  fails
  NoNewPrivileges=no                     fails
  RemoveIPC=no                           fails
  ProtectProc/ProcSubset                 fails
  ProtectKernel*/ProtectClock/ProtectControlGroups=no   fails
  RestrictSUIDSGID/RestrictRealtime/LockPersonality=no  fails
  all of the above relaxed               STARTS

So the only relevant option is ProtectSystem=strict. The unit allows writes
only through ReadWritePaths=/var, but pkcsslotd needs to write to:

  /run/opencryptoki/pkcsslotd.pid
  /run/opencryptoki/pkcsslotd.socket
  /run/opencryptoki/pkcsslotd.admin.socket
  /var/lock/opencryptoki/   (/var/lock is a symlink to /run/lock)

Presumably systemd < 263 let these writes through (perhaps via the
/var/run -> /run and /var/lock -> /run/lock symlinks under the writable /var),
while 263 no longer does. Either way, the unit relies on paths under /run that
it does not declare.

This drop-in fixes it while keeping the rest of the sandbox:

  # /etc/systemd/system/pkcsslotd.service.d/run-writable.conf
  [Service]
  ReadWritePaths=/run/opencryptoki /run/lock/opencryptoki

With it, the service starts normally:

  pkcsslotd[...]: PID file (/run/opencryptoki/pkcsslotd.pid) created

Suggested fix: add the two /run paths to ReadWritePaths= in
pkcsslotd.service. RuntimeDirectory= would be an alternative, but it would
conflict with the ownership and mode that tmpfiles.d/opencryptoki.conf sets
for /run/opencryptoki (710 pkcsslotd:pkcs11) and /var/lock/opencryptoki
(0770 root:pkcs11).

The systemd maintainers may want to know about this as well, since the
behaviour change comes from the upgrade to 263~rc1, but the missing paths are
in this package's unit file.

Best regards
Giacomo Mulas


-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (401, 'unstable'), (10, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

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

Versions of packages opencryptoki depends on:
ii  adduser                     3.161
ii  libc6                       2.43-8
ii  libcap2                     1:2.78-1+b2
ii  libldap2                    2.6.14+dfsg-2+b1
ii  libopencryptoki0            3.27.0-1
ii  libssl3t64                  3.6.5-2
ii  systemd [systemd-tmpfiles]  263~rc1-2

opencryptoki recommends no packages.

opencryptoki suggests no packages.

-- Configuration Files:
/etc/opencryptoki/strength.conf [Errno 13] Permesso negato: 
'/etc/opencryptoki/strength.conf'

-- no debconf information

Reply via email to