Skip to content

Conversation

@ikerexxe
Copy link
Contributor

@ikerexxe ikerexxe commented Dec 4, 2025

This is the implementation for the so called passwordless-gdm feature. The design page for this feature is available at SSSD/sssd.io#79.

The original patch set was reviewed at #8212 by Justin and Sumit. I've had done some minor modifications to those patches:

  • Adapt the code to avoid merge/rebase conflicts.

As a reminder you can use https://copr.fedorainfracloud.org/coprs/ipedrosa/passwordles-gdm/ for testing and update authselect, mutter, gdm and gnome-shell packages. As for sssd, I'd use the build provided in this PR since it will contain the exact bits that will be shipped in RHEL.

authselect brings a new feature called with-switchable-auth that you should enable to use this feature. In addition, you should add the following configuration to sssd.conf:

[pam]
pam_json_services = gdm-switchable-auth

Known limitations:

  • If EIdP and passkey are enabled at the same time for a given user, from the two of them only EIdP will be advertised (other methods aren't affected). Changing it will affect performance, so it's been decided to leave it as it is.
  • Since PAM: Add passkey preflight operation #7983 isn't merged, SSSD is unable to propagate the PIN request and PIN attempts left information to GDM. This is temporary and once this PR or the other one are merged, I'll update the PR to make these functionality available.

@ikerexxe ikerexxe added the no-backport This should go to target branch only. label Dec 4, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the passwordless-gdm feature, which is a significant enhancement. The changes involve a major refactoring of the authentication handling in krb5_child.c to better support multiple authentication methods, and the introduction of a new JSON-based protocol for authentication selection with GDM. The refactoring is well-structured and improves maintainability by separating the request and answer phases of authentication. The new JSON handling logic is implemented in pamsrv_json.c.

My review found a couple of critical issues in the new code that could lead to crashes. One is a classic C bug with a shadowed loop variable, and the other is a potential NULL pointer dereference when handling JSON data. I've provided specific comments and suggestions for fixes.

Overall, this is a great feature addition. Once the identified issues are addressed, this PR should be in good shape.

@alexey-tikhonov
Copy link
Member

JFTR: I think so massive change and big RFE isn't a best fit for LTM branch...

@alexey-tikhonov
Copy link
Member

This needs to incorporate #8296

@ikerexxe
Copy link
Contributor Author

I rebased on top of sssd-2-9 and included the changes from #8296 in this PR

@sumit-bose
Copy link
Contributor

Hi,

so far my tests went well, I opened freeipa/freeipa#8075 to get some broader testing.

bye,
Sumit

@sumit-bose
Copy link
Contributor

Hi,

so far my tests went well, I opened freeipa/freeipa#8075 to get some broader testing.

bye, Sumit

Ah, looks like I have to create a Fedora-43 build as well.

This API gets the selected response type data from the response_data
linked list. Includes unit tests.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Ray Strode <halfline@redhat.com>
Integration with GDM requests two prompts for EIdP so adding them to
prompt_config structure. In addition, implement all the functions needed
to manipulate the structure for these new prompts. Finally, add
unit-tests for the new functions.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Return `prompt_config` structure  in `pam_eval_prompting_config` to tune
the prompts from the SSSD config in the GUI.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Implement a set of functions to check the available authentication
mechanisms and their associated data, and generate a JSON message with
it. This JSON formatted message will be consumed by apps that provide
GUI login (i.e. GDM). Currently, the implementation only takes into
account password and OAUTH2 mechanisms.

Include unit tests to check the implemented functions.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Implement a set of functions to unpack the JSON reply from the GUI.
Include unit tests to check the implemented functions.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Implement a function to check whether the PAM service file in use is
enabled for the JSON procotol. This helps us filter which applications
are compatible with this protocol.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
This new option is used to enable the JSON protocol in the PAM responder
based on the PAM service file in use.

:config: A new option `pam_json_services` is now available to enable
         JSON protocol to communicate the available authentication
         mechanisms.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Call JSON message generation function and fill the data structure
containing the response_data linked list.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Forward the available authentication mechanisms and their associated
data message to the GUI login using a PAM conversation. Then, obtain the
reply and forward it to the responder, so that it can parse it.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Ray Strode <halfline@redhat.com>
Parse GUI reply and set the appropriate data in `sss_auth_token`
structure.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Include JSON message where applies.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
It returns NULL on error, but this wasn't checked.

Fixes: ceeffa9 ("Responder: generate JSON message for GUI")

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Integration with GDM requests two prompts for smartcard so modifying the
prompt_config structure. In addition, implement all the functions needed
to manipulate the structure for these new prompts. Finally, add
unit-tests for the new functions.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
ikerexxe and others added 18 commits December 24, 2025 09:11
This API gets all the elements with the selected response type data from
the response_data linked list. Includes unit tests.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Implement a set of functions to retrieve the smartcard data and generate
the JSON message with it.

Implement new unit test and adapt the existing ones to take into account
the new data.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Parse GUI reply for smartcard and set the appropriate data in
`sss_auth_token` structure.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Several of the functions in `pamsrv_json` had lots of arguments and I'm
about to add more for the passkey authentication mechanism. Reduce these
arguments by creating a structure that will contain all these data.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Include the certificate data in the JSON messages to set it in the
authtok structure more easily.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Include the certificate data in the JSON message to set it in the
authtok structure more easily.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
This is needed by `pamsrv_json.c`, so let's make it public.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Implement a set of functions to retrieve the passkey data and generate
the JSON message with it.

Implement new unit test and adapt the existing ones to take into account
the new data.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
`sss_authtok_set_local_passkey_pin` provides a way to set the passkey
PIN in the authtok structure for local passkey authentication.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Parse GUI reply for passkey and set the appropriate data in
`sss_auth_token` structure.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
During the `preauthentication` phase krb5_child checks for the available
authentication methods for the given user, advertises them and the
process is kept alive. Once the state is change to `authentication` the
same krb5_child process processes the credentials and proceeds with the
authentication itself.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
defaults

The `pam_p11_allowed_services` option now includes `gdm-switchable-auth`
as one of the default allowed PAM services for smartcard authentication.
The service was added alongside the other GDM-related services
(gdm-smartcard and gdm-password) for logical grouping.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
When a user's password expires after successful JSON authentication, the
fallback to traditional password change fails. Add
PAM_CLI_FLAGS_CHAUTHTOK_PREAUTH flag to distinguish password change
preauth from normal authentication preauth. When this flag is set, the
PAM responder skips JSON message generation and returns traditional
preauth data instead.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Use `pam_get_auth_types()` to detect the available mechanisms for a
user.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Add a note to clarify that 2FA isn't supported in JSON protocol and fix
man page compilation for `pam_json_services` option.

:feature: Unified passwordless login in the GUI. SSSD now supports a
          rich authentication selection interface. Users can login with
          smartcards, passkey, External IdPs and passwords directly
          within the graphical user interface.
:packaging: SSSD now supports authentication mechanism selection through
            PAM using a JSON-based protocol. This feature enables
            passwordless authentication mechanisms in GUI login
            environments that support the protocol.
            Feature will be supported by GNOME Display Manager (GDM)
            starting with GNOME 50. While currently optimized for GNOME,
            the JSON protocol design allows for future support in other
            display managers.
            authselect is the recommended approach and will handle the
            necessary PAM stack modifications  automatically starting
            with version 1.7 through the new option `with-switch-auth`
            which provides a new PAM service called `switchable-auth`.
            Manual PAM configuration is also possible.
            For more technical details and implementation specifications,
            see the design documentation:
            SSSD/sssd.io#79

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Port the pre-authentication retry logic from the IPA provider to the
krb5 provider, making it available to all krb5-based authentication
flows.

Relates: 6c1272e ("krb5: Add fallback password change support")
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Resolves: SSSD#8292
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
(cherry picked from commit 60ba493)
The `tokeninfo_matches()` function already handles PAM stacked tokens
correctly by processing them through the 2FA single path, so the
`answer_otp()` function should allow this token type to proceed.

Add SSS_AUTHTOK_TYPE_PAM_STACKED to the allowed authentication token
types in `answer_otp()` to restore previous functionality.

Fixes: 4cb99a2 ("krb5_child: advertise authentication methods").
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
(cherry picked from commit df15165)
@ikerexxe ikerexxe force-pushed the passwordless-gdm-2-9 branch from befff69 to 9c8d54f Compare December 24, 2025 08:12
@ikerexxe
Copy link
Contributor Author

Rebased on top of sssd-2-9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-backport This should go to target branch only. Waiting for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants