Skip to content

Re-hash sha512 hashed passwords with current hashing algorithm#42

Merged
stanislav-zaprudskiy merged 2 commits intostable/2025.1-m3from
revert_sha512_crypt_removal
Dec 5, 2025
Merged

Re-hash sha512 hashed passwords with current hashing algorithm#42
stanislav-zaprudskiy merged 2 commits intostable/2025.1-m3from
revert_sha512_crypt_removal

Conversation

@stanislav-zaprudskiy
Copy link
Copy Markdown
Collaborator

@stanislav-zaprudskiy stanislav-zaprudskiy commented Dec 2, 2025

SHA512 hashing was dropped from Keystone upstream in the following changes:

However, the last available implementation of SHA512 - https://review.opendev.org/c/openstack/keystone/+/930223/2/keystone/common/password_hashers/sha512_crypt.py - never worked and is not correct, which could be confirmed by executing the respective test. So it's not enough to just revert https://review.opendev.org/c/openstack/keystone/+/939778 - a proper implementation of the algorithm is needed.

For that reason, the PR brings back passlib - to use its implementation of SHA512 hashing. However, it is worth noting that passlib was dropped from the upstream as well, which we shall also do with the next Keystone upgrade, along with the respective cherry-picked https://review.opendev.org/c/openstack/keystone/+/959279 - which brings re-hashing functionality.

With this PR In the meantime, until the next upgrade, the respective impacted users will get their password hash updated in database to the current hashing mechanism upon executing login/password authentication. There could be some users that won't log in until then, and thus won't get their hash updated - in which case it would be safe to assume that those users are no longer relevant (as they didn't log in within e.g. 6mo). Such users would have to be identified, reviewed and followed up as needed.

Upstream issue - https://bugs.launchpad.net/keystone/+bug/2133706.

rajivmucheli
rajivmucheli previously approved these changes Dec 2, 2025
BerndKue
BerndKue previously approved these changes Dec 2, 2025
@stanislav-zaprudskiy stanislav-zaprudskiy marked this pull request as draft December 4, 2025 07:48
adrianjarvis and others added 2 commits December 4, 2025 15:12
With Epoxy release the support for the sha512_crypt hash is dropped.
This change adds a check of the password hash when the user authenticates.
If the hash of the users password is deprecated then the password will be
re-hashed using the default hasher and updated in the database.

Change-Id: I4a16401b914c92fd7db9d626cb1642570b36d600
Signed-off-by: Adrian Jarvis <adrian.jarvis@catalystcloud.nz>
@stanislav-zaprudskiy stanislav-zaprudskiy force-pushed the revert_sha512_crypt_removal branch from ba22b9b to 766c1a6 Compare December 4, 2025 14:27
@stanislav-zaprudskiy stanislav-zaprudskiy changed the title Revert "Drop the sha512_crypt module" Re-hash sha512 hashed passwords with current hashing algorithm Dec 4, 2025
@stanislav-zaprudskiy stanislav-zaprudskiy marked this pull request as ready for review December 4, 2025 14:48
@stanislav-zaprudskiy stanislav-zaprudskiy merged commit 81abd56 into stable/2025.1-m3 Dec 5, 2025
3 checks passed
@stanislav-zaprudskiy stanislav-zaprudskiy deleted the revert_sha512_crypt_removal branch December 5, 2025 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants