🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.dist
2 messages
2 total messages Started by Heinz Pechtl Sun, 29 Nov 2026 16:20
Bug#1155790: pam_u2f second factor broken in polkit dialogs: sandboxed polkit-agent-helper@.service blocks /dev/hidraw* and u2f_...
#6742
Author: Heinz Pechtl
Date: Sun, 29 Nov 2026 16:20
128 lines
8604 bytes
Package: libpam-u2f
Version: 1.4.0-3+b2
Severity: important

Subject: pam_u2f second factor broken in polkit dialogs: sandboxed polkit-agent-helper@.service blocks /dev/hidraw* and u2f_keys

Description:
   Since polkit 127, polkit-agent-helper-1 is socket-activated and
   runs in a strict systemd sandbox (unit
   polkit-agent-helper@.service, shipped by polkitd 127+). The PAM
   stack of the polkit authentication dialog (e.g. /etc/pam.d/polkit-1,
   which includes common-auth) is executed inside this helper process.

   With pam_u2f enabled (pam-auth-update;
   'auth [success=1 default=ignore] pam_u2f.so' in
   /etc/pam.d/common-auth), U2F/YubiKey second-factor authentication
   fails in all polkit dialogs (pkexec, KDE System Settings, ...),
   while the exact same authentication works in sudo, getty/login and
   GDM, which do not run in this sandbox.

   Root cause: the shipped unit enables
       PrivateDevices=yes
       DevicePolicy=closed
       ProtectHome=yes
   which prevents pam_u2f from
       1) opening the YubiKey (a USB HID device, /dev/hidraw*), and
       2) reading the key mapping file ~/.config/Yubico/u2f_keys.

   The polkit-agent-helper(8) man page (SANDBOXING section) states
   that PAM module vendors should ship a systemd drop-in that relaxes
   only the specific directives their module requires. Arch and NixOS
   ship exactly such a drop-in for pam_u2f (see References); the
   Debian package libpam-u2f does not, so U2F authentication is
   broken out of the box with polkit >= 127.

Steps to reproduce:
   1. Install libpam-u2f and enroll a key:
        pam-auth-update  (enable libpam-u2f)
        u2f-prepare      (creates ~/.config/Yubico/u2f_keys)
      A YubiKey 4/5 (U2F) must be plugged in (/dev/hidraw*).
   2. Log into a graphical session that uses a polkit agent
      (Polkit-KDE agent / Plasma on this system).
   3. Trigger a polkit authorization, e.g.:
        run0
   4. When the authentication dialog appears, touch the YubiKey.

Expected result:
   The dialog authenticates via the U2F touch (as it does with sudo).

Actual result:
   The U2F touch is not accepted; authentication fails or silently
   falls back to the password module.

Workaround (confirmed in the upstream threads, referenced below):
   sudo systemctl edit polkit-agent-helper@.service  and add:

     [Service]
     ProtectHome=read-only
     PrivateDevices=no
     DeviceAllow=/dev/urandom r
     DeviceAllow=char-hidraw rw

   then: sudo systemctl daemon-reload
   (Trade-off: the root-running helper gets full /dev and read-only
   access to /home again; polkit maintainers call this the correct
   way to solve the issue.)

Suggested fix:
   Ship a vendor drop-in with the libpam-u2f package, e.g.
   /usr/lib/systemd/system/polkit-agent-helper@.service.d/pam-u2f.conf:

     [Service]
     ProtectHome=read-only
     PrivateDevices=no
     DeviceAllow=/dev/urandom r
     DeviceAllow=char-hidraw rw

   (This is what Arch ships for pam_u2f; see References. If pam_u2f
   can be made to work with the device sandbox kept active, a
   narrower override with only
   'DeviceAllow=char-hidraw rw', 'DeviceAllow=/dev/urandom r' and
   'ProtectHome=read-only' would be preferable.)

Journal excerpt (reproduced before applying the workaround):
Nov 29 10:05:17 earth systemd[1]: Starting polkit-agent-helper@0-4122-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000)...
Nov 29 10:05:17 earth polkit-agent-helper-1[8247]: PAM (polkit-1) /usr/lib/pam.d is not supported on this system; see /usr/share/doc/libpam0g/Debian-PAM-MiniPolicy.gz
Nov 29 10:05:17 earth polkit-agent-helper-1[8247]: polkit-agent-helper-1: pam_authenticate failed: Authentication failure
Nov 29 10:05:17 earth systemd[1]: Starting polkit-agent-helper@1-36881-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000)...
Nov 29 10:05:17 earth systemd[1]: polkit-agent-helper@0-4122-1601_41079-1000.service: Deactivated successfully.
Nov 29 10:05:17 earth systemd[1]: Finished polkit-agent-helper@0-4122-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000).
Nov 29 10:05:17 earth polkit-agent-helper-1[8268]: PAM (polkit-1) /usr/lib/pam.d is not supported on this system; see /usr/share/doc/libpam0g/Debian-PAM-MiniPolicy.gz
Nov 29 10:05:17 earth polkit-agent-helper-1[8268]: polkit-agent-helper-1: pam_authenticate failed: Authentication failure
Nov 29 10:05:17 earth systemd[1]: Starting polkit-agent-helper@2-24609-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000)...
Nov 29 10:05:18 earth polkit-agent-helper-1[8273]: PAM (polkit-1) /usr/lib/pam.d is not supported on this system; see /usr/share/doc/libpam0g/Debian-PAM-MiniPolicy.gz
Nov 29 10:05:18 earth polkit-agent-helper-1[8273]: polkit-agent-helper-1: pam_authenticate failed: Authentication failure
Nov 29 10:05:18 earth systemd[1]: polkit-agent-helper@1-36881-1601_41079-1000.service: Deactivated successfully.
Nov 29 10:05:18 earth systemd[1]: Finished polkit-agent-helper@1-36881-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000).
Nov 29 10:05:18 earth systemd[1]: polkit-agent-helper@2-24609-1601_41079-1000.service: Deactivated successfully.
Nov 29 10:05:18 earth systemd[1]: Finished polkit-agent-helper@2-24609-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000).

System information:
   Kernel:          7.3.6+deb14-amd64 (Debian 7.3.6-1, 2026-11-24), x86_64
   Distribution:    Debian GNU/Linux forky/sid (Debian 14)
   systemd:         262.2-1
   glibc:           2.43 (2.43-7)
   polkitd:         128-1
   libpam-u2f:      1.4.0-3+b2
   polkit-kde-agent-1: 4:6.7.4-1
   libpam-runtime:  1.7.0-8
   YubiKey:         Bus 001 Device 005: ID 1050:0407
                    Yubico.com Yubikey 4/5 OTP+U2F+CCID
                    (present as /dev/hidraw0..6)
   PAM config:      /etc/pam.d/common-auth, Primary block:
                    auth [success=1 default=ignore] pam_u2f.so
   No local drop-in for polkit-agent-helper@.service is present;
   the as-shipped unit contains (among others):
     PrivateDevices=yes, DevicePolicy=closed, ProtectHome=yes,
     ProtectSystem=strict, PrivateNetwork=yes, NoNewPrivileges=yes

References:
   - https://github.com/polkit-org/polkit/issues/622
     (polkit 127 sandbox breaks pam_u2f; polkit maintainer: the
     drop-in above is "the correct way to solve these issues")
   - https://github.com/Yubico/pam-u2f/issues/389
     (same breakage reported; Arch's shipped fix discussed)
   - Arch fix commit:
     https://gitlab.archlinux.org/archlinux/packaging/packages/pam-u2f/-/commit/888507cc6e4307e8acdfccec8718b7be559b08e9
   - man 8 polkit-agent-helper, section "SANDBOXING"
Bug#1155790: pam_u2f second factor broken in polkit dialogs: sandboxed polkit-agent-helper@.service blocks /dev/hidraw* and u2f_...
#7142
Author: Simon Josefsson
Date: Wed, 02 Dec 2026 11:20
168 lines
10642 bytes
--=-=-=
Content-Type: text/plain

Thanks for the detailed report with suggested fix -- I've uploaded
1.4.0-4 with your suggested fix, please test it if you are able to as
I've no easy way to test this in a live forky desktop environment.

/Simon

Heinz Pechtl <heinz.pechtl@asamnet.de> writes:

> Package: libpam-u2f
> Version: 1.4.0-3+b2
> Severity: important
>
> Subject: pam_u2f second factor broken in polkit dialogs: sandboxed polkit-agent-helper@.service blocks /dev/hidraw* and u2f_keys
>
> Description:
>   Since polkit 127, polkit-agent-helper-1 is socket-activated and
>   runs in a strict systemd sandbox (unit
>   polkit-agent-helper@.service, shipped by polkitd 127+). The PAM
>   stack of the polkit authentication dialog (e.g. /etc/pam.d/polkit-1,
>   which includes common-auth) is executed inside this helper process.
>
>   With pam_u2f enabled (pam-auth-update;
>   'auth [success=1 default=ignore] pam_u2f.so' in
>   /etc/pam.d/common-auth), U2F/YubiKey second-factor authentication
>   fails in all polkit dialogs (pkexec, KDE System Settings, ...),
>   while the exact same authentication works in sudo, getty/login and
>   GDM, which do not run in this sandbox.
>
>   Root cause: the shipped unit enables
>       PrivateDevices=yes
>       DevicePolicy=closed
>       ProtectHome=yes
>   which prevents pam_u2f from
>       1) opening the YubiKey (a USB HID device, /dev/hidraw*), and
>       2) reading the key mapping file ~/.config/Yubico/u2f_keys.
>
>   The polkit-agent-helper(8) man page (SANDBOXING section) states
>   that PAM module vendors should ship a systemd drop-in that relaxes
>   only the specific directives their module requires. Arch and NixOS
>   ship exactly such a drop-in for pam_u2f (see References); the
>   Debian package libpam-u2f does not, so U2F authentication is
>   broken out of the box with polkit >= 127.
>
> Steps to reproduce:
>   1. Install libpam-u2f and enroll a key:
>        pam-auth-update  (enable libpam-u2f)
>        u2f-prepare      (creates ~/.config/Yubico/u2f_keys)
>      A YubiKey 4/5 (U2F) must be plugged in (/dev/hidraw*).
>   2. Log into a graphical session that uses a polkit agent
>      (Polkit-KDE agent / Plasma on this system).
>   3. Trigger a polkit authorization, e.g.:
>        run0
>   4. When the authentication dialog appears, touch the YubiKey.
>
> Expected result:
>   The dialog authenticates via the U2F touch (as it does with sudo).
>
> Actual result:
>   The U2F touch is not accepted; authentication fails or silently
>   falls back to the password module.
>
> Workaround (confirmed in the upstream threads, referenced below):
>   sudo systemctl edit polkit-agent-helper@.service  and add:
>
>     [Service]
>     ProtectHome=read-only
>     PrivateDevices=no
>     DeviceAllow=/dev/urandom r
>     DeviceAllow=char-hidraw rw
>
>   then: sudo systemctl daemon-reload
>   (Trade-off: the root-running helper gets full /dev and read-only
>   access to /home again; polkit maintainers call this the correct
>   way to solve the issue.)
>
> Suggested fix:
>   Ship a vendor drop-in with the libpam-u2f package, e.g.
>   /usr/lib/systemd/system/polkit-agent-helper@.service.d/pam-u2f.conf:
>
>     [Service]
>     ProtectHome=read-only
>     PrivateDevices=no
>     DeviceAllow=/dev/urandom r
>     DeviceAllow=char-hidraw rw
>
>   (This is what Arch ships for pam_u2f; see References. If pam_u2f
>   can be made to work with the device sandbox kept active, a
>   narrower override with only
>   'DeviceAllow=char-hidraw rw', 'DeviceAllow=/dev/urandom r' and
>   'ProtectHome=read-only' would be preferable.)
>
> Journal excerpt (reproduced before applying the workaround):
> Nov 29 10:05:17 earth systemd[1]: Starting polkit-agent-helper@0-4122-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000)...
> Nov 29 10:05:17 earth polkit-agent-helper-1[8247]: PAM (polkit-1) /usr/lib/pam.d is not supported on this system; see /usr/share/doc/libpam0g/Debian-PAM-MiniPolicy.gz
> Nov 29 10:05:17 earth polkit-agent-helper-1[8247]: polkit-agent-helper-1: pam_authenticate failed: Authentication failure
> Nov 29 10:05:17 earth systemd[1]: Starting polkit-agent-helper@1-36881-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000)...
> Nov 29 10:05:17 earth systemd[1]: polkit-agent-helper@0-4122-1601_41079-1000.service: Deactivated successfully.
> Nov 29 10:05:17 earth systemd[1]: Finished polkit-agent-helper@0-4122-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000).
> Nov 29 10:05:17 earth polkit-agent-helper-1[8268]: PAM (polkit-1) /usr/lib/pam.d is not supported on this system; see /usr/share/doc/libpam0g/Debian-PAM-MiniPolicy.gz
> Nov 29 10:05:17 earth polkit-agent-helper-1[8268]: polkit-agent-helper-1: pam_authenticate failed: Authentication failure
> Nov 29 10:05:17 earth systemd[1]: Starting polkit-agent-helper@2-24609-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000)...
> Nov 29 10:05:18 earth polkit-agent-helper-1[8273]: PAM (polkit-1) /usr/lib/pam.d is not supported on this system; see /usr/share/doc/libpam0g/Debian-PAM-MiniPolicy.gz
> Nov 29 10:05:18 earth polkit-agent-helper-1[8273]: polkit-agent-helper-1: pam_authenticate failed: Authentication failure
> Nov 29 10:05:18 earth systemd[1]: polkit-agent-helper@1-36881-1601_41079-1000.service: Deactivated successfully.
> Nov 29 10:05:18 earth systemd[1]: Finished polkit-agent-helper@1-36881-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000).
> Nov 29 10:05:18 earth systemd[1]: polkit-agent-helper@2-24609-1601_41079-1000.service: Deactivated successfully.
> Nov 29 10:05:18 earth systemd[1]: Finished polkit-agent-helper@2-24609-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000).
>
> System information:
>   Kernel:          7.3.6+deb14-amd64 (Debian 7.3.6-1, 2026-11-24), x86_64
>   Distribution:    Debian GNU/Linux forky/sid (Debian 14)
>   systemd:         262.2-1
>   glibc:           2.43 (2.43-7)
>   polkitd:         128-1
>   libpam-u2f:      1.4.0-3+b2
>   polkit-kde-agent-1: 4:6.7.4-1
>   libpam-runtime:  1.7.0-8
>   YubiKey:         Bus 001 Device 005: ID 1050:0407
>                    Yubico.com Yubikey 4/5 OTP+U2F+CCID
>                    (present as /dev/hidraw0..6)
>   PAM config:      /etc/pam.d/common-auth, Primary block:
>                    auth [success=1 default=ignore] pam_u2f.so
>   No local drop-in for polkit-agent-helper@.service is present;
>   the as-shipped unit contains (among others):
>     PrivateDevices=yes, DevicePolicy=closed, ProtectHome=yes,
>     ProtectSystem=strict, PrivateNetwork=yes, NoNewPrivileges=yes
>
> References:
>   - https://github.com/polkit-org/polkit/issues/622
>     (polkit 127 sandbox breaks pam_u2f; polkit maintainer: the
>     drop-in above is "the correct way to solve these issues")
>   - https://github.com/Yubico/pam-u2f/issues/389
>     (same breakage reported; Arch's shipped fix discussed)
>   - Arch fix commit:
>     https://gitlab.archlinux.org/archlinux/packaging/packages/pam-u2f/-/commit/888507cc6e4307e8acdfccec8718b7be559b08e9
>   - man 8 polkit-agent-helper, section "SANDBOXING"
>

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQOEBAEWCgMsFiEEo8ychwudMQq61M8vUXIrCP5HRaIFAmsP/NIbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyFBxzaW1vbkBqb3NlZnNzb24ub3JnwhwmAJgzBFyS
zrQWCSsGAQQB2kcPAQEHQAiHK2SL4a8QwZCvX1fkJU5l8aNp2jmw7hrcOfGGsZTr
tCVTaW1vbiBKb3NlZnNzb24gPHNpbW9uQGpvc2Vmc3Nvbi5vcmc+iJYEExYIAD4C
GwMFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AWIQSx0r0Tdb7LeEz0+MTXPPY4xTwG
vgUCatfMtwUJD2HCAwAKCRDXPPY4xTwGvue9AP40ROc4bUzq1zxU43T76rWP+6jv
mKO/CaPer1S2fZMOtQEAuMKQ3X/qP75LtsbJG82TaaIkg2UM5Mw+pp0UOfPJ6Aq4
OARcks9qEgorBgEEAZdVAQUBAQdAMZUbpg1up2WOwPlQn3pPVaRMejyZnScmD7d5
TRzHehwDAQgHiH4EGBYIACYCGwwWIQSx0r0Tdb7LeEz0+MTXPPY4xTwGvgUCatfL
twUJD2HATQAKCRDXPPY4xTwGvocHAP9g1zG1w10/lhb7ksrN9T8xnHTOZNibd27d
k+X+leRCkQD+OWllYuM1N1ZA/a5Qjyv7pnq+hrxeqSg+cnm4ArlDQwa4MwRcks+B
FgkrBgEEAdpHDwEBB0DsUwiDmnlwMSNoSF+ByvW0E6TVXou9PKDa9SpZvKghioj1
BBgWCAAmAhsCFiEEsdK9E3W+y3hM9PjE1zz2OMU8Br4FAmrXy7oFCQ9hwDYAgXYg
BBkWCAAdFiEEo8ychwudMQq61M8vUXIrCP5HRaIFAlySz4EACgkQUXIrCP5HRaKn
TAEAoB+OWrHmYCK8Cjr1DgPUH7JnhPBmR2DbhR5jPRREEugA+gOMeWmL6GOpaPfK
YLcNhzw4ZnAlxSLY1wq1eANBpiQOCRDXPPY4xTwGvjf7AP9MpnBFLDHomavCkXzR
aJEaYqYigvHl7W7qWuswi2FgTQEAg7xKIF4THHLZj4f48rwFG7VW2ts8o/SaYpJM
ogWJlwYACgkQUXIrCP5HRaLUvAEAsBq6LW4csyOY3IpGpHeS2OT9F35XiRTpEjIP
Jx6nXHMA/iRHV6K5YMM1d0IEi8xTgtpYwi9esQHUFpPHZj5xIJoL
=oEl3
-----END PGP SIGNATURE-----
--=-=-=--
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads