Skip to content

Tests: LDAP+KRB5 krb_misc tests#8655

Open
madhuriupadhye wants to merge 1 commit intoSSSD:sssd-2-13from
madhuriupadhye:bp_ldap_krb
Open

Tests: LDAP+KRB5 krb_misc tests#8655
madhuriupadhye wants to merge 1 commit intoSSSD:sssd-2-13from
madhuriupadhye:bp_ldap_krb

Conversation

@madhuriupadhye
Copy link
Copy Markdown
Contributor

Ported following test case:

  • kpasswd: BZ 847039: login works when krb5_kpasswd is unresolvable (kpasswd not needed for auth).
  • high UID: BZ 798655: auth and logs stay clean with a setuid(-1) helper process running.
  • password change: GH 677: SSH passwd with chpass_provider=krb5 logs initial auth in krb5_child.log.

Backporting of #8612

@madhuriupadhye madhuriupadhye requested review from aplopez, danlavu and spoore1 and removed request for danlavu April 28, 2026 11:00
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 adds three new system tests to the SSSD test suite, covering authentication scenarios with unresolvable kpasswd, handling of setuid(-1) helper processes, and password changes via SSH. The review feedback highlights the need to explicitly set the SSSD debug level to ensure logs are captured correctly for assertions, suggests reordering log checks to ensure they run even if authentication fails, and recommends adding a sleep delay to avoid race conditions when reading log files.

Comment thread src/tests/system/tests/test_ldap_krb5.py
Comment thread src/tests/system/tests/test_ldap_krb5.py Outdated
Comment thread src/tests/system/tests/test_ldap_krb5.py
Comment thread src/tests/system/tests/test_ldap_krb5.py
Copy link
Copy Markdown
Contributor

@spoore1 spoore1 left a comment

Choose a reason for hiding this comment

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

While I think some of the gemini review comments are worth at least taking note of, this backport to sssd-2-13 looks good to me.

@alexey-tikhonov alexey-tikhonov added the no-backport This should go to target branch only. label Apr 28, 2026
@alexey-tikhonov alexey-tikhonov removed the request for review from aplopez April 28, 2026 14:50
@sssd-bot
Copy link
Copy Markdown
Contributor

The pull request was accepted by @alexey-tikhonov with the following PR CI status:


🟢 rpm-build:centos-stream-10-x86_64:upstream (success)
🟢 rpm-build:fedora-42-x86_64:upstream (success)
🟢 rpm-build:fedora-43-x86_64:upstream (success)
🟢 rpm-build:fedora-44-x86_64:upstream (success)
🟢 rpm-build:fedora-rawhide-x86_64:upstream (success)


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



@pytest.mark.importance("high")
@pytest.mark.authentication
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Don't use the marker; we should get rid of them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated.

@pytest.mark.authentication
@pytest.mark.ticket(bz=847039)
@pytest.mark.topology(KnownTopology.LDAP_KRB5)
def test_ldap_krb5__auth_succeeds_when_kpasswd_unresolvable(client: Client, provider: GenericProvider, kdc: KDC):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Let us use similar language to the other authentication test cases.

test_ldap_krb5__user_can_login_when_kpasswd_cannot_be_resolved()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated.


BZ 847039: login works when krb5_kpasswd is unresolvable (kpasswd not needed for auth)

:setup:
Copy link
Copy Markdown

@danlavu danlavu Apr 29, 2026

Choose a reason for hiding this comment

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

We can assume that all the ldap_krb5 bits. Let's generalize the language.

  1. Add user
  2. Configure SSSD with an invalid value for 'krb5_passwd' and start SSSD

Is the change in the parameter value important? I'm not sure because it hasn't cached the user yet. I would find out if steps 3 and 4 are important.

3. Set krb5_kpasswd to an unresolvable hostname
4. Restart SSSD and clear cache
:steps:
1. Run id for puser1 so NSS resolution goes through SSSD before SSH login
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Are you sure this is correct? And not to populate the cache? I'd double-check, but also simply the language.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated, please check.

2. Authenticate puser1 with SSH password
:expectedresults:
1. id succeeds for puser1
2. SSH password authentication succeeds despite unresolvable kpasswd
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Login successful

"""
:title: Auth succeeds when krb5_kpasswd is unresolvable

BZ 847039: login works when krb5_kpasswd is unresolvable (kpasswd not needed for auth)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We don't need the bz in the title, it's a marker already!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated.

2. SSH password authentication succeeds despite unresolvable kpasswd
:customerscenario: True
"""
provider.user("puser1").add(uid=50001, gid=50001, password="12345678")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the uid and gid should automatically generate, and the password should default to 'Secret123'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated.

kdc.principal("puser1").add(password="12345678")

client.sssd.common.krb5_auth(kdc)
client.sssd.domain["krb5_realm"] = kdc.realm
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The default krb5_provider code configures krb5_realm and krb5_server, so these parameters can be dropped.

    def krb_provider(self, backend: KDC | GenericProvider) -> None:
        """
        Set auth_provider to krb5 and populate krb5 options.

        This method sets ``auth_provider=krb5`` and configures
        ``krb5_realm``, ``krb5_server``, and ``krb5_kpasswd`` based on
        the provided backend (KDC, IPA, or AD).

        :param backend: Backend role object (KDC, IPA, or AD).
        :type backend: KDC | GenericProvider
        """
        host = backend.host 
        if not isinstance(host, BaseDomainHost):
            raise TypeError(f"Expected BaseDomainHost, got {type(host)}")

        host.client.setdefault("auth_provider", "krb5")
        host.client.setdefault("krb5_realm", host.realm)
        host.client.setdefault("krb5_server", host.hostname)
        host.client.setdefault("krb5_kpasswd", host.hostname)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated.


assert client.auth.ssh.password("puser1", "12345678"), "Auth failed when krb5_kpasswd is unresolvable!"


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Go ahead and apply everything above to the following two test cases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated.

Ported following test case:

- kpasswd: BZ 847039: login works when krb5_kpasswd is
  unresolvable (kpasswd not needed for auth).
- high UID: BZ 798655: auth and logs stay clean with a
  setuid(-2) helper process running.
- password change: GH 677: SSH passwd with
  chpass_provider=krb5 logs initial auth in krb5_child.log.

Backporting of SSSD#8612

Signed-off-by: Madhuri Upadhye <mupadhye@redhat.com>
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. Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants