Skip to content

KRB5: read keytab copy in offline mode too#8671

Open
alexey-tikhonov wants to merge 1 commit intoSSSD:masterfrom
alexey-tikhonov:read-keytab-offline
Open

KRB5: read keytab copy in offline mode too#8671
alexey-tikhonov wants to merge 1 commit intoSSSD:masterfrom
alexey-tikhonov:read-keytab-offline

Conversation

@alexey-tikhonov
Copy link
Copy Markdown
Member

The process can transition from offline pre-auth to online auth within the same invocation.

The process can transition from offline pre-auth to online auth within
the same invocation.
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 modifies the privileged_krb5_setup function in krb5_child.c to allow keytab setup even when offline, while adding a guard to skip FAST configuration in offline mode. Feedback suggests that skipping FAST setup entirely when offline could lead to security issues or authentication failures if the process transitions to online mode later, as the FAST options would not be properly initialized.

}

if (kr->fast_val != K5C_FAST_NEVER) {
if (!offline && kr->fast_val != K5C_FAST_NEVER) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The addition of the !offline guard here prevents FAST from being configured if the krb5_child process starts in offline mode. While this avoids a failing network operation during initial setup, it creates a problem for the transition to online mode mentioned in the PR description. If the process transitions to online mode later (e.g., via k5c_send_and_recv), it will attempt authentication without FAST being configured in kr->options. This is particularly problematic if kr->fast_val == K5C_FAST_DEMAND, as the authentication might proceed insecurely (without FAST) if the KDC allows it, or fail unexpectedly. Consider performing a partial FAST setup (e.g., setting the FAST flags in kr->options) even when offline, or ensuring that FAST setup is re-evaluated during the transition to online mode in k5c_setup.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@sumit-bose, what would you say?

Patch is triggered by https://bugzilla.redhat.com/show_bug.cgi?id=2464782

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I mean, that's not introduced by this patch, but is it worth fixing?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi,

thank you for covering this use case. But I wonder if it wouldn't be better to just not keep krb5_child running when offline. The reason to keep krb5_child running is to keep the context/session to the KDC, especially for authentication types where this is required. Since there is no context/session if krb5_child is offline during SSS_PAM_PREAUTH I think krb5_child can just stop.

bye,
Sumit

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

if krb5_child is offline during SSS_PAM_PREAUTH I think krb5_child can just stop.

What krb5_child is expected to do in this case - SSS_PAM_PREAUTH & offline?

Copy link
Copy Markdown
Member Author

@alexey-tikhonov alexey-tikhonov May 4, 2026

Choose a reason for hiding this comment

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

I mean currently it tries tgt_req_child() without checking offline flag:

ret = tgt_req_child(kr);

In theory if SSSD is offline this doesn't make sense.

But practically in this specific case - https://bugzilla-attachments.redhat.com/attachment.cgi?id=2139368 - situation is different:

[unpack_buffer] (0x0100): [RID#632] cmd [249 (pre-auth)] uid [1367600004] gid [1367600004] validate [true] enterprise principal [false] offline [true] UPN [james@CB.ETTLE.ORG.UK]
[unpack_buffer] (0x0100): [RID#632] ccname: [KCM:] old_ccname: [KCM:] keytab: [/etc/krb5.keytab]
[k5c_ccache_check] (0x4000): [RID#632] Old ccache is [KCM:] and is  active and TGT is  valid.
[k5c_ccache_check] (0x4000): [RID#632] Reusing old ccache [KCM:]
[main] (0x0400): [RID#632] Will perform pre-auth
[tgt_req_child] (0x1000): [RID#632] Attempting to get a TGT
[get_and_save_tgt] (0x0400): [RID#632] Attempting kinit for realm [CB.ETTLE.ORG.UK]
[sss_krb5_auth_methods_request] (0x4000): [RID#632] Got request [password].

-- KDC is actually reachable.

@alexey-tikhonov alexey-tikhonov marked this pull request as ready for review May 6, 2026 09:52
@alexey-tikhonov
Copy link
Copy Markdown
Member Author

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants