Repository navigation
pam: offer local Smartcard authentication to GDM switchable authentication - #9368
Conversation
e229383 to
911ec3d
Compare
Are there PRs/MRs you could link for the sake of posterity? |
|
Hi, thank you very much for the fix. So far I only tested it by checking the reply of the PAM responder in different configurations but it is working as expected. I'm just wondering if My suggestion would be to call something like bye, |
911ec3d to
8ac2766
Compare
|
Thanks for the review. I implemented your suggestions but I am going to do some more testing alongside the gdm patches. |
Hi, thank you for the updates, please let me know when you are done with your testing. bye, |
|
Added a commit so password is still offered next to local Smartcard auth (it was dropped because SSS_CERT_AUTH_PROMPTING disabled the password fallback), except with local_auth_policy = only. Tested with GNOME 51 + gdm!405 + gnome-shell!4459 and a PIV. |
|
Tested with GDM. I confirm that when authenticating a local user, it lists smartcard authentication and password authentication via JSON messages. Smartcard authentication works fine. However, password authentication doesn't work. Probably due to sssd not having enough permissions to read /etc/shadow for this local user. |
|
Password auth of local users should be handled by |
Hi, I think it would be better let the backends return this information. The password fallback was really meant as a falback if nothing else is available. Since we do not know if password authentication will really work, e.g. bye, |
11ec33a to
8ac2766
Compare
|
Removed the additional commit. The others are good to go from testing with the current gnome patches. |
8ac2766 to
f1978b9
Compare
|
Hi @divinehawk, I'm trying to test your fix here on a Fedora 45 system but, I'm running into some issues. By any chance did you create a custom pam (gdm-switchable-auth) config to use? Could you post what your /etc/pam.d/gdm-switchable-auth file contains? Thanks, |
|
I lost my Fedora VM but here's the one from Ubuntu I'm using: Note the pam_sss.so with allow_missing_name runs first in the auth stack. And my sssd.conf, with a proxy domain for the local users: |
spoore1
left a comment
There was a problem hiding this comment.
Thanks for the testing into.
Testing looks good.
When the smart card is inserted, I do see the expected generated JSON message:
(2026-10-28 8:31:05): [pam] [pam_get_auth_types] (0x4000): [CID#11] Authentication types for user [localuser1@local] and service [gdm-switchable-auth]: smartcard
(2026-10-28 8:31:05): [pam] [generate_json_auth_message] (0x0400): [CID#11] Generated JSON message: {"authSelection": {"mechanisms": {"smartcard": {"name": "Smartcard", "role": "smartcard", "certificates": [{"tokenName": "localuser1", "certInstruction": "CAC ID Certificate\nCN=localuser1", "pinPrompt": "PIN", "moduleName": "/usr/lib64/pkcs11/opensc-pkcs11.so", "keyId": "0001", "label": "CAC ID Certificate"}]}}, "priority": ["smartcard"]}}.
When I remove the card, I see GDM switch to Password prompt and this message:
"""
(2026-10-28 8:31:16): [pam] [pam_get_auth_types] (0x4000): [CID#12] Authentication types for user [localuser1@local] and service [gdm-switchable-auth]: password
(2026-10-28 8:31:16): [pam] [generate_json_auth_message] (0x0020): [CID#12] Failed to initialize authentication data.
(2026-10-28 8:31:16): [pam] [pam_reply] (0x0020): [CID#12] failed to generate JSON message.
"""
At this point in GDM, I am able to see the option to change authentication type. If I select Smartcard, I see the message to "insert card" in the prompt. And I see this message:
"""
(2026-10-28 8:31:36): [pam] [get_client_cred] (0x4000): Client [0x561cd3529e00][18] creds: euid[0] egid[0] pid[27102] cmd_line['gdm-session-worker [pam/gdm-smartcard]'].
(2026-10-28 8:31:36): [pam] [accept_fd_handler] (0x0400): [CID#13] Client [cmd gdm-session-worker [pam/gdm-smartcard]][uid 0][0x561cd3529e00][18] connected!
(2026-10-28 8:31:36): [pam] [pam_print_data] (0x0100): [CID#13] service: gdm-smartcard
(2026-10-28 8:31:36): [pam] [pam_reply] (0x0400): [CID#13] Local auth policy allowed: smartcard [True], passkey [False]
"""
sumit-bose
left a comment
There was a problem hiding this comment.
Hi,
thank you for the fix, ACK.
bye,
Sumit
Responses added with pam_add_response_no_send() are only used inside of the PAM responder, e.g. to evaluate the available authentication types, and are not sent to the client. Reviewed-by: Scott Poore <spoore@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com>
The smartcard mechanism of the JSON message is only enabled if the response list contains SSS_CERT_AUTH_PROMPTING, which is only added by krb5_child when the KDC offers PKINIT. Local Smartcard authentication, e.g. with the proxy provider and certificate mapping, was never offered to GDM's switchable authentication, even if local_auth_policy allows it and p11_child found a matching certificate. If local Smartcard authentication is allowed and certificates were found, add SSS_CERT_AUTH_PROMPTING in evalute_sending_cert_info() with pam_add_response_no_send(), pam_sss does not need it. Resolves: SSSD#9367 Reviewed-by: Scott Poore <spoore@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Scott Poore <spoore@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com>
f1978b9 to
a40af28
Compare
Resolves: #9367
With
pam_json_services = gdm-switchable-auth, local Smartcard authentication (e.g. the proxy provider with certificate mapping andlocal_auth_policy = enable:smartcard) is never offered to GDM, even though p11_child found a matching certificate and the local auth policy allows Smartcard authentication.Changes
evalute_sending_cert_info()now runs for every request. If local Smartcard authentication is allowed and certificates were found withoutSSS_CERT_AUTH_PROMPTING, it addsSSS_CERT_AUTH_PROMPTINGwithpam_add_response_no_send(), so the JSON message offers Smartcard and pam_sss gets the same reply as before. If it is not allowed, the certificate info is hidden as before.test_pam_preauth_cert_match_jsonintest_pam_srv.The authentication step needed no change: the proxy backend returns
PAM_BAD_ITEMfor the PIN, andpam_reply()falls back to local Smartcard authentication. Password-only users are not affected: they still get no JSON message and GDM falls back to its legacy services.Testing
test_pam_srv: all 92 tests pass; the new test fails without the fix. With plainpam_add_response()instead of the no-send helper, 16 existing Smartcard tests fail.make checkpasses.enable-switchable-authenticationon Ubuntu 26.10, proxy provider for local users, certificate mapping, PIV smartcard: Smartcard is offered and the PIN logs the user in;allow_missing_nameworks; password users still log in throughgdm-password.