pam: handle protected authentication path#8599
pam: handle protected authentication path#8599sumit-bose wants to merge 5 commits intoSSSD:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements support for PKCS#11 tokens that utilize a protected authentication path, such as an external keypad. The changes span the p11_child process, the PAM responder, and the PAM client, ensuring that a flag indicating the presence of a protected path is propagated through the system. This allows the PAM client to correctly prompt the user to use an external device and bypass standard PIN collection. Additionally, the PR refactors authentication token utility functions to handle keypad-based authentication more generically and updates the test suite to reflect the modified communication protocol. One review comment identifies a logic issue in the responder's response parsing where a prefix of the string "true" could be incorrectly interpreted as a match.
|
Review done using Claude Code / claude-opus-4-6 Functional Issues
Nits & Non-functional Issues
Confirmed Issues from Existing Review Comments
|
|
Note: Covscan is green. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for the CKF_PROTECTED_AUTHENTICATION_PATH flag, allowing SSSD to handle PKCS#11 tokens that use a protected authentication path (e.g., an external keypad). The changes span the p11_child helper, the PAM responder, and the SSS client to ensure the flag is correctly detected, transmitted, and acted upon by adjusting the PAM conversation style and prompts. Feedback indicates a potential memory leak in the do_pam_conversation function when it is called with the PAM_TEXT_INFO style, which is now utilized when a protected authentication path is detected.
| free(request); | ||
| } | ||
| free(response); | ||
| free(reply); |
There was a problem hiding this comment.
Does
response = GDM_PAM_EXTENSION_REPLY_TO_CUSTOM_JSON_RESPONSE(reply);
allocate a new memory or points to reply internals?
There was a problem hiding this comment.
Points to internals.
There was a problem hiding this comment.
Isn't it a double-free then?
There was a problem hiding this comment.
Hi,
imo not, there is reply as struct pam_response and then the char * resp member which is set to response. Both should be freed individually.
But I realized that the struct returned by GDM_PAM_EXTENSION_REPLY_TO_CUSTOM_JSON_RESPONSE() has a member which might be freed as well. I asked Joan about it and will update the patch when he replies.
bye,
Sumit
There was a problem hiding this comment.
Hi,
GDM upstream will add free macros in https://gitlab.gnome.org/GNOME/gdm/-/merge_requests/363 . In the latest version I added an SSSD version of them if they are not already present and use them.
bye,
Sumit
| talloc_free(prompt); | ||
| if (offset != msg_len) { | ||
| DEBUG(SSSDBG_OP_FAILURE, | ||
| "Expected [%zu] and copied [%zu] number of bytes to not match.\n", |
There was a problem hiding this comment.
Is it?
There is still "number of bytes to not match"...
Probably a wrong string was edited: "... We just need do notify that the"
|
Review round completed. Only few minor comments. |
70ef4b4 to
ea3bf52
Compare
If a Smartcard reader has a built-in keypad or keyboard the flag CKF_PROTECTED_AUTHENTICATION_PATH is set in the token info data. To properly tell the user that the pin must be given at the reader directly and not at the computer this information must be propagated to the pam_sss module. Resolves: SSSD#5371
sss_authtok_set_sc_keypad() does not set which token and certificate should be used for authentication, just using sss_authtok_set_sc() with SSS_AUTHTOK_TYPE_SC_KEYPAD as type is sufficient.
In case the conversation callback allocates memory for a reply we have to free it.
Use safealign_memcpy() instead of plain memcpy() and add a consistency check.
If a Smartcard reader has a built-in keypad or keyboard the flag
CKF_PROTECTED_AUTHENTICATION_PATH is set in the token info data. To
properly tell the user that the pin must be given at the reader directly
and not at the computer this information must be propagated to the
pam_sss module.
Resolves: #5371