Skip to content

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

Merged
tbordaz merged 1 commit into
389ds:mainfrom
tbordaz:issue_6516
Jan 22, 2025
Merged

Issue 6516 - Allow to configure the password scheme not updated on bind#6517
tbordaz merged 1 commit into
389ds:mainfrom
tbordaz:issue_6516

Conversation

@tbordaz
Copy link
Copy Markdown
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:


log.info('test_password_modify_non_utf8: PASSED')

def test_pwd_scheme_not_upgraded_on_bind(topology_st, crypt_scheme, request):
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.

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)

Comment thread ldap/servers/slapd/pw.c Outdated
/* 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
Copy Markdown
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
Copy Markdown
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
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
Copy Markdown
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