Skip to content

Passwordless-gdm for sssd-2-9#8267

Merged
alexey-tikhonov merged 36 commits intoSSSD:sssd-2-9from
ikerexxe:passwordless-gdm-2-9
Apr 30, 2026
Merged

Passwordless-gdm for sssd-2-9#8267
alexey-tikhonov merged 36 commits intoSSSD:sssd-2-9from
ikerexxe:passwordless-gdm-2-9

Conversation

@ikerexxe
Copy link
Copy Markdown
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
Copy Markdown

@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.

Comment thread src/responder/pam/pamsrv_json.c
Comment thread src/util/authtok.c
@alexey-tikhonov
Copy link
Copy Markdown
Member

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

@alexey-tikhonov
Copy link
Copy Markdown
Member

This needs to incorporate #8296

@ikerexxe
Copy link
Copy Markdown
Contributor Author

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

@sumit-bose
Copy link
Copy Markdown
Contributor

Hi,

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

bye,
Sumit

@sumit-bose
Copy link
Copy Markdown
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.

@ikerexxe ikerexxe force-pushed the passwordless-gdm-2-9 branch from befff69 to 9c8d54f Compare December 24, 2025 08:12
@ikerexxe
Copy link
Copy Markdown
Contributor Author

Rebased on top of sssd-2-9

Comment thread src/providers/krb5/krb5_ccache.c
Comment thread src/providers/krb5/krb5_child.c Outdated
Comment thread src/providers/krb5/krb5_child.c
@ikerexxe ikerexxe force-pushed the passwordless-gdm-2-9 branch 2 times, most recently from 88d8093 to c7fc0d5 Compare February 27, 2026 15:01
Comment thread src/providers/krb5/krb5_child.c Outdated
@ikerexxe ikerexxe force-pushed the passwordless-gdm-2-9 branch from c7fc0d5 to 2d9d41d Compare March 16, 2026 14:35
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>
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>
@ikerexxe ikerexxe force-pushed the passwordless-gdm-2-9 branch from 8df6cd5 to f54496c Compare April 24, 2026 10:52
ikerexxe and others added 21 commits April 24, 2026 14:48
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)
This should cover a case when a single execution of 'krb5_child'
handles both PREAUTH and AUTH

Resolves: SSSD#8331
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
(cherry picked from commit e2273e0)
When keep-alive sessions transition between command types (e.g., from
SSS_PAM_PREAUTH to SSS_PAM_AUTHENTICATE), enterprise principal settings
were not being updated, causing parsing inconsistencies in complex AD
environments.

This change ensures that when the backend sends updated enterprise
principal settings for different command types, the principals are
correctly re-parsed with the appropriate flags, fixing UPN handling in
multi-domain AD environments.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Alejandro López <allopez@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
(cherry picked from commit dd3cd95)
In contrast to other authentication methods for PKINIT some information
about the used Smartcard and certificate are already needed for the
pre-authentication step to trigger the MIT Kerberos PKINIT module to get
back the information if PKINIT is possible or not and if the Smartcard
can be used for authentication. If krb5_child is kept running between
the pre-authentication and the authentication step the information given
during pre-authentication is used if Smartcard authentication was
selected.

As long as only a single certificate is available there is no issue. But
if there are multiple certificates which all apply to the given mapping
and matching rules for the user trying to log in and the user can choose
a certificate for authentication the authentication might fail if the
certificate use during pre-authentication and the one selected by the
user differ. Before the change to keep krb5_child running for all
authentication methods this was not an issue since the fresh instance
started during the authentication step was using the certificate
selected by the user.

With this patch krb5_child is restart during the authentication step is
Smartcard authentication was selected.

Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
(cherry picked from commit f3a36be)
Commit 1f680ed added ad_pac_common.c and
$(NDR_KRB5PAC_LIBS) to sssd_pam unconditionally. So when building --without-samba, sssd_pam fails to link with undefined references to ndr_pull_init_blob and ndr_pull_PAC_DATA.

This change qualifies those additions with `BUILD_SAMBA` so the PAC
indicator feature is compiled in only when samba support is enabled.

Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Tomáš Halman <thalman@redhat.com>
(cherry picked from commit d0becea)
@ikerexxe ikerexxe force-pushed the passwordless-gdm-2-9 branch from adcf277 to 9e62f39 Compare April 24, 2026 12:51
@ikerexxe
Copy link
Copy Markdown
Contributor Author

Latest changes contain a rebase to sssd-2-9, f3a36be and partial d0becea

@alexey-tikhonov alexey-tikhonov merged commit 8b96046 into SSSD:sssd-2-9 Apr 30, 2026
9 of 10 checks passed
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants