Skip to content

Conversation

@ikerexxe
Copy link
Contributor

@ikerexxe ikerexxe commented Nov 19, 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 patches were reviewed at ikerexxe#9 and ikerexxe#12 by Justin and Sumit. I've had done some minor modifications to those patches:

  • Adapt the code to avoid merge/rebase conflicts.
  • Simplified the prompt tuning commits. Previously there were 4 commits: one introducing prompt tuning for EIdP, one adding prompt tuning for smartcard, another commit for passkey and a final one removing all prompt tuning and hardcoding the values. Currently, only the hardcoded values remain.
  • Add an additional commit, the last one, which fixes CI failures related to password change on expiration for samba (and probably AD).

As a reminder you can use https://copr.fedorainfracloud.org/coprs/ipedrosa/passwordles-gdm/ for testing and update sssd, authselect, mutter, gdm and gnome-shell packages.

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.

@alexey-tikhonov
Copy link
Member

@ikerexxe , how does it play together with #8185?

@ikerexxe
Copy link
Contributor Author

@ikerexxe , how does it play together with #8185?

@alexey-tikhonov we discovered that passkey with no PIN and LDAP server wasn't working at all (not even in master branch) while developing this feature. The first commit from that PR is also present in this branch, so once one of them is merged the other PR will remove it. That's all the relation there is between one and the other.

@ikerexxe ikerexxe added passwordless-gdm PRs related to the Passwordless GDM feature backport-to-sssd-2-9 labels Nov 21, 2025
@ikerexxe ikerexxe marked this pull request as ready for review November 21, 2025 10:15
@ikerexxe
Copy link
Contributor Author

/gemini review

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, enabling a more modern authentication experience. The changes are substantial, involving significant refactoring of the Kerberos authentication flow to better separate pre-authentication and authentication steps. A new JSON-based protocol is implemented for communication with GDM, handled by the new pamsrv_json.c file. While the refactoring improves code structure, I've identified a couple of critical security vulnerabilities related to buffer over-reads when parsing data from other SSSD components. These must be addressed. I've also noted an issue with error handling in the new JSON parsing logic that could mask problems and make debugging difficult.

@alexey-tikhonov
Copy link
Member

@ikerexxe , if SSSD is updated to a version that includes those patches, but GDM and authselect aren't, does old functionality works seamlessly?

@alexey-tikhonov
Copy link
Member

Is there a patch that contains RNs?

@ikerexxe
Copy link
Contributor Author

ikerexxe commented Nov 21, 2025

@ikerexxe , if SSSD is updated to a version that includes those patches, but GDM and authselect aren't, does old functionality works seamlessly?

I was testing this the other day. If any package with this functionality is missing then the old functionality works without any user interaction.

Is there a patch that contains RNs?

Responder: new option pam_json_services contains a new configuration option RN and man: clarify and fix pam_json_services compilation contains the feature RN.

As a side note, except for four checks that were in red, CI was in green until I submitted the latest changes. I checked the failing checks and they were not related to these changes.

@alexey-tikhonov
Copy link
Member

alexey-tikhonov commented Nov 21, 2025

Responder: new option pam_json_services contains a new configuration option RN and man: clarify and fix pam_json_services compilation contains the feature RN.

Try to imagine how it will read in an automatically generated notes.

I would re-phrase

Add pam_json_services option to enable JSON protocol ...

to something like

A new option `pam_json_services` is now available to configure ...

re:

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

As a nitpick: it should start with a capital letter.

I guess option is described in the man page, so I would reference in the style "please see <this> man page description for additional information and examples".

Also please add :packaging: RN - this is a note for maintainers:

  • what are dependencies; what versions of those dependencies will be required
  • what happens if reqs aren't met
  • is there any new ./configure options

etc

@ikerexxe
Copy link
Contributor Author

Rebased on top of master once #8176 has been merged.

I would re-phrase

Add pam_json_services option to enable JSON protocol ...

to something like

A new option `pam_json_services` is now available to configure ...

Done

Also please add :packaging: RN - this is a note for maintainers:

Added a new RN for :packaging: in commit man: clarify and fix pam_json_services compilation

@justin-stephenson
Copy link
Contributor

system tests in PRCI seemed to be stuck, so I am re-running CI jobs

@alexey-tikhonov
Copy link
Member

system tests in PRCI seemed to be stuck, so I am re-running CI jobs

It won't help until CI is fixed.

@alexey-tikhonov
Copy link
Member

I'm removing 'backport-to' label as automation will add a little value here.
Please open backport PR manually for discussion after this PR is merged.
But I personally think it is not a good fit for sssd-2-9 LTM branch.

@alexey-tikhonov alexey-tikhonov added no-backport This should go to target branch only. and removed backport-to-sssd-2-9 labels Nov 25, 2025
@justin-stephenson
Copy link
Contributor

I am ready to approve but first would like to see full PRCI runs for fedora-43 and fedora-44. Based on Slack discussion there is out of disk space events occurring on f43 + f44 as a result of a GDM bug. If I understand correctly SSSD/sssd-ci-containers#155 will workaround this

@alexey-tikhonov
Copy link
Member

Added a new RN for :packaging: in commit man: clarify and fix pam_json_services compilation

Thank you. Please don't forget to replace link to SSSD/sssd.io#79 with a link to actual page once doc PR is merged.

@alexey-tikhonov
Copy link
Member

@ikerexxe, please rebase.

@ikerexxe
Copy link
Contributor Author

I am ready to approve but first would like to see full PRCI runs for fedora-43 and fedora-44. Based on Slack discussion there is out of disk space events occurring on f43 + f44 as a result of a GDM bug. If I understand correctly SSSD/sssd-ci-containers#155 will workaround this

Rerun and everything is green except for system/centos-10 test, which has a known issue in the test_feature__presence test case.

@ikerexxe, please rebase.

Why? If you are asking this because #8150 was merged, those tests don't run in PRCI (at least not now): @pytest.mark.builtwith(client=["gdm", "passkey", "vfido"])

@alexey-tikhonov
Copy link
Member

alexey-tikhonov commented Nov 26, 2025

@ikerexxe, please rebase.

Why? If you are asking this because #8150 was merged,

That was my idea.

those tests don't run in PRCI (at least not now): @pytest.mark.builtwith(client=["gdm", "passkey", "vfido"])

:(

@alexey-tikhonov alexey-tikhonov added the coverity Trigger a coverity scan label Nov 26, 2025
Copy link
Contributor

@justin-stephenson justin-stephenson left a comment

Choose a reason for hiding this comment

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

Thank you for your large effort on this feature.

@alexey-tikhonov
Copy link
Member

alexey-tikhonov commented Nov 26, 2025

Covscan reported issues:

krb5_child.c:
707done:
708    talloc_free(token);
709    talloc_free(pin);
     
CID 639182: (#1 of 1): Uninitialized pointer read (UNINIT)
5. uninit_use_in_call: Using uninitialized value chl when calling krb5_responder_otp_challenge_free.
710    krb5_responder_otp_challenge_free(ctx, rctx, chl);
711    return ret;

pamsrv_json.c:
255    oauth2_link_prompt = talloc_strdup(tmp_ctx, OAUTH2_LINK_PROMPT);
      notnull: At condition oauth2_init_prompt == NULL, the value of oauth2_init_prompt cannot be NULL.
      dead_error_condition: The condition oauth2_init_prompt == NULL cannot be true.
256    if (oauth2_init_prompt == NULL) {
     
CID 639181: (#1 of 1): Logically dead code (DEADCODE)
dead_error_begin: Execution cannot reach this statement: ret = 12;.
257        ret = ENOMEM;
258        goto done;
259    }

@alexey-tikhonov alexey-tikhonov added Changes requested and removed coverity Trigger a coverity scan labels Nov 26, 2025
Call JSON message generation function and fill the data structure
containing the response_data linked list.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Parse GUI reply and set the appropriate data in `sss_auth_token`
structure.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Include JSON message where applies.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
This is needed by `pamsrv_json.c`, so let's make it public.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
When authenticating with a passkey, different PAM code paths within SSSD
can result in the `authtok` containing data even when the user did not
enter a PIN. Depending on the flow (e.g., triggered by `gdm` vs. `su`),
this data might be an empty string or non-printable characters like `^L`
(form feed).

The previous code had two issues:
1.  It only checked if the `authtok` was non-empty
    (`sss_authtok_get_type(...) != SSS_AUTHTOK_TYPE_EMPTY`). If user
    verification was disabled, this check would incorrectly pass for
    these 'junk' `authtok` values. This caused SSSD to prepare and send
    an erroneous PIN to the passkey helper.

2.  In the case where the `authtok` *was* correctly empty, the check
    would fail, `write_buf_len` would remain 0, and the `if
    (write_buf_len != 0)` block containing the `write_pipe_send` call
    would be skipped. This stalled the authentication flow, as the
    callback to continue the process was never set.

This patch fixes both issues:
1.  The `user_verification` setting is now stored in the state struct.
    The logic is updated to only prepare the PIN buffer if the `authtok`
    is non-empty *and* user verification is required
    (`state->user_verification != PAM_PASSKEY_VERIFICATION_OFF`).

2.  The `write_pipe_send` call is moved outside the conditional block so
    it always runs. This ensures that the asynchronous child
    communication (via `passkey_child_write_done`) is always triggered,
    even if the write buffer is empty (0-length).

This resolves both failure modes: junk PINs are no longer sent when
verification is off, and the auth flow no longer stalls when no PIN is
present.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
Use `pam_get_auth_types()` to detect the available mechanisms for a
user.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@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>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
@sssd-bot
Copy link

sssd-bot commented Dec 4, 2025

The pull request was accepted by @ikerexxe with the following PR CI status:


🟢 CodeFactor (success)
🟢 CodeQL (success)
🟢 osh-diff-scan:fedora-rawhide-x86_64:upstream (success)
🟢 rpm-build:centos-stream-10-x86_64:upstream (success)
🟢 rpm-build:fedora-41-x86_64:upstream (success)
🟢 rpm-build:fedora-42-x86_64:upstream (success)
🟢 rpm-build:fedora-43-x86_64:upstream (success)
🟢 rpm-build:fedora-rawhide-x86_64:upstream (success)
🟢 Analyze (target) / cppcheck (success)
🟢 Build / freebsd (success)
🟢 Build / make-distcheck (success)
🟢 ci / intgcheck (centos-10) (success)
🟢 ci / intgcheck (fedora-41) (success)
🟢 ci / intgcheck (fedora-42) (success)
🟢 ci / intgcheck (fedora-43) (success)
🟢 ci / intgcheck (fedora-44) (success)
🟢 ci / prepare (success)
🟢 ci / system (centos-10) (success)
🟢 ci / system (fedora-41) (success)
🟢 ci / system (fedora-42) (success)
🟢 ci / system (fedora-43) (success)
🟢 ci / system (fedora-44) (success)
➖ Coverity scan / coverity (skipped)
🟢 Static code analysis / codeql (success)
🟢 Static code analysis / pre-commit (success)
🟢 Static code analysis / python-system-tests (success)


There are unsuccessful or unfinished checks. Make sure that the failures are not related to this pull request before merging.

@ikerexxe ikerexxe merged commit cc1b9e0 into SSSD:master Dec 4, 2025
17 of 18 checks passed
@alexey-tikhonov alexey-tikhonov removed the coverity Trigger a coverity scan label Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accepted no-backport This should go to target branch only. passwordless-gdm PRs related to the Passwordless GDM feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants