Skip to content

Issue 6516 - Allow to configure the password scheme not updated on bind #6517

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

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

tbordaz
Copy link
Contributor

@tbordaz tbordaz commented Jan 20, 2025

Bug description:
The configuration option 'nsslapd-enable-upgrade-hash: on' allows
to update, during a user bind, the password storage hash of the
user password.
The update sets the password storage hash to the one defined in the
password policy (passwordStorageScheme)

If the current user password hash is 'CRYPT' or 'CLEAR' then the
password storage hash is not updated. This is hardcoded.

Fix description:
Introduce a new configuration parameter that list the hashes
that are not upgraded during a bind.
'nsslapd-scheme-list-no-upgrade-hash'

fixes: #6516

Reviewed by:

@@ -132,6 +146,159 @@ def test_password_modify_non_utf8(topology_st, pbkdf2_sha512_scheme):

log.info('test_password_modify_non_utf8: PASSED')

def test_pwd_scheme_not_upgraded_on_bind(topology_st, crypt_scheme, request):
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: since test_pwd_scheme_not_upgraded_on_bind and test_pwd_scheme_crypt_upgraded_on_bind are very similar, I think you should rather have a single parametrized test
each parameter values being a tuple (no_upgrade_hash_value, expected_hash_after_bind)

/* values are comma separated list. Add heading/ending commas
* to retrieve the exact current hash in that list
*/
no_upgrade_hashes = slapi_ch_smprintf(",%s,", slapdFrontendConfig->scheme_list_no_upgrade_hash);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice trick. FYI you could also keep the configuration parameter as is and use strtok_r to parse it:
char *saveptr = NULL;
no_upgrade_hashes = slapi_ch_strdup(slapdFrontendConfig->scheme_list_no_upgrade_hash);
for (char *hash = strtok_r(no_upgrade_hashes, ", \t\n", &saveptr);
hash;
hash = strtok_r(NULL, ", \t\n", &saveptr)) {
if strcasecmp(hash, curpwsp->pws_name) == )) {
ignore_upgrade = 1;
break;
}
}
slapi_ch_free_string(&no_upgrade_hashes);

Bug description:
	The configuration option 'nsslapd-enable-upgrade-hash: on' allows
	to update, during a user bind, the password storage hash of the
	user password.
	The update sets the password storage hash to the one defined in the
	password policy (passwordStorageScheme)

	If the current user password hash is 'CRYPT' or 'CLEAR' then the
	password storage hash is not updated. This is hardcoded.

Fix description:
	Introduce a new configuration parameter that list the hashes
	that are *not* upgraded during a bind.
	'nsslapd-scheme-list-no-upgrade-hash'

fixes: 389ds#6516

Reviewed by: Pierre Rogier
Copy link
Contributor

@progier389 progier389 left a comment

Choose a reason for hiding this comment

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

LGTM

@tbordaz tbordaz merged commit bd1152a into 389ds:main Jan 22, 2025
199 checks passed
tbordaz added a commit that referenced this pull request Jan 22, 2025
…nd (#6517)

Bug description:
	The configuration option 'nsslapd-enable-upgrade-hash: on' allows
	to update, during a user bind, the password storage hash of the
	user password.
	The update sets the password storage hash to the one defined in the
	password policy (passwordStorageScheme)

	If the current user password hash is 'CRYPT' or 'CLEAR' then the
	password storage hash is not updated. This is hardcoded.

Fix description:
	Introduce a new configuration parameter that list the hashes
	that are *not* upgraded during a bind.
	'nsslapd-scheme-list-no-upgrade-hash'

fixes: #6516

Reviewed by: Pierre Rogier
tbordaz added a commit that referenced this pull request Jan 22, 2025
…nd (#6517)

Bug description:
	The configuration option 'nsslapd-enable-upgrade-hash: on' allows
	to update, during a user bind, the password storage hash of the
	user password.
	The update sets the password storage hash to the one defined in the
	password policy (passwordStorageScheme)

	If the current user password hash is 'CRYPT' or 'CLEAR' then the
	password storage hash is not updated. This is hardcoded.

Fix description:
	Introduce a new configuration parameter that list the hashes
	that are *not* upgraded during a bind.
	'nsslapd-scheme-list-no-upgrade-hash'

fixes: #6516

Reviewed by: Pierre Rogier
@tbordaz
Copy link
Contributor Author

tbordaz commented Jan 22, 2025

654db44..bd1152a main
8773d9d..c949756 389-ds-base-3.0
541cd38..14070b4 389-ds-base-2.6

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.

Allow to configure the password scheme not updated on bind
2 participants