Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing password with ldap_password_policy = shadow does not take effect immediately #6477

Closed
pbrezina opened this issue Dec 8, 2022 · 1 comment
Assignees
Labels
Bugzilla Closed: Fixed Issue was closed as fixed.

Comments

@pbrezina
Copy link
Member

pbrezina commented Dec 8, 2022

This is a bug in new feature implemented in https://bugzilla.redhat.com/show_bug.cgi?id=1507035

It does not show itself during manual testing, only during automation when there are two consecutive ssh login attempts.

First ssh login says the password is expired, the password is correctly changed.

The seconds login attempt however does not refresh the user record because it happened sooner then pam_id_timeout (default 5 seconds) and therefore sssd thinks that the user's password is still expired.

The successful password change should also update shadowLastUpdate in cache.

The bug can be reproduced with the new test framework: https://github.com/pbrezina/sssd-tests-poc
The test is:

@pytest.mark.topology(KnownTopology.LDAP)
def test_shadow(client: Client, ldap: LDAP):
ldap.aci.add('(targetattr="userpassword")(version 3.0; acl "pwp test"; allow (all) userdn="ldap:///self";)')
ldap.user('shadowuser1').add(
shadowMin=0, shadowMax=99999, shadowWarning=7, shadowLastChange=0,
password='Secret123'
)

# Disabling pam_id_timeout makes the test pass
# client.sssd.pam['pam_id_timeout'] = '0'
client.sssd.domain['ldap_pwd_policy'] = 'shadow'
client.sssd.domain['ldap_chpass_update_last_change'] = 'True'
client.sssd.start()

assert client.auth.ssh.password_expired('shadowuser1', 'Secret123', 'Redhat@321')
assert client.auth.ssh.password('shadowuser1', 'Redhat@321')

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2144893

@pbrezina pbrezina self-assigned this Dec 8, 2022
pbrezina added a commit to pbrezina/sssd that referenced this issue Dec 8, 2022
Otherwise pam can use the changed information whe id chaching is
enabled, so next authentication that fits into the id timeout
(5 seconds by default) will still sees the password as expired.

Resolves: SSSD#6477
alexey-tikhonov pushed a commit that referenced this issue Dec 16, 2022
Otherwise pam can use the changed information whe id chaching is
enabled, so next authentication that fits into the id timeout
(5 seconds by default) will still sees the password as expired.

Resolves: #6477

Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Tomáš Halman <thalman@redhat.com>
(cherry picked from commit 7e8b97c)
@alexey-tikhonov
Copy link
Member

Pushed PR: #6478

  • master
    • 7e8b97c - ldap: update shadow last change in sysdb as well
  • sssd-2-8
    • d7da296 - ldap: update shadow last change in sysdb as well

@alexey-tikhonov alexey-tikhonov added the Closed: Fixed Issue was closed as fixed. label Dec 16, 2022
etrunko pushed a commit to etrunko/sssd that referenced this issue Oct 11, 2023
Otherwise pam can use the changed information whe id chaching is
enabled, so next authentication that fits into the id timeout
(5 seconds by default) will still sees the password as expired.

Resolves: SSSD#6477

Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Tomáš Halman <thalman@redhat.com>
(cherry picked from commit 7e8b97c)
etrunko pushed a commit to etrunko/sssd that referenced this issue Oct 11, 2023
Otherwise pam can use the changed information whe id chaching is
enabled, so next authentication that fits into the id timeout
(5 seconds by default) will still sees the password as expired.

Resolves: SSSD#6477

Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Tomáš Halman <thalman@redhat.com>
(cherry picked from commit 7e8b97c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugzilla Closed: Fixed Issue was closed as fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants