63fe67
From 1a192048a49fcdfa8bcfe79e2fa86153b339fac1 Mon Sep 17 00:00:00 2001
63fe67
From: Mark Reynolds <mreynolds@redhat.com>
63fe67
Date: Tue, 13 Dec 2022 17:00:28 -0500
63fe67
Subject: [PATCH 2/2] Issue 5565 - Change default password storage scheme
63fe67
63fe67
Descriptrion:  Becuase of replication we need to use a default storage scheme
63fe67
that works on 389-ds-base-1.3.10
63fe67
63fe67
relates: https://github.com/389ds/389-ds-base/issues/5565
63fe67
63fe67
Reviewed by: spichugi & firstyear(thanks!!)
63fe67
---
63fe67
 .../tests/suites/healthcheck/health_security_test.py      | 8 ++++----
63fe67
 dirsrvtests/tests/suites/password/pwp_test.py             | 2 +-
63fe67
 ldap/servers/slapd/pw.c                                   | 3 ++-
63fe67
 src/lib389/lib389/config.py                               | 2 +-
63fe67
 4 files changed, 8 insertions(+), 7 deletions(-)
63fe67
63fe67
diff --git a/dirsrvtests/tests/suites/healthcheck/health_security_test.py b/dirsrvtests/tests/suites/healthcheck/health_security_test.py
63fe67
index 519107365..d14b52c7a 100644
63fe67
--- a/dirsrvtests/tests/suites/healthcheck/health_security_test.py
63fe67
+++ b/dirsrvtests/tests/suites/healthcheck/health_security_test.py
63fe67
@@ -1,5 +1,5 @@
63fe67
 # --- BEGIN COPYRIGHT BLOCK ---
63fe67
-# Copyright (C) 2020 Red Hat, Inc.
63fe67
+# Copyright (C) 2022 Red Hat, Inc.
63fe67
 # All rights reserved.
63fe67
 #
63fe67
 # License: GPL (version 3 or any later version).
63fe67
@@ -113,9 +113,9 @@ def test_healthcheck_insecure_pwd_hash_configured(topology_st):
63fe67
         standalone.config.set('passwordStorageScheme', 'SSHA512')
63fe67
         standalone.config.set('nsslapd-rootpwstoragescheme', 'SSHA512')
63fe67
     else:
63fe67
-        log.info('Set passwordStorageScheme and nsslapd-rootpwstoragescheme to PBKDF2-SHA512')
63fe67
-        standalone.config.set('passwordStorageScheme', 'PBKDF2-SHA512')
63fe67
-        standalone.config.set('nsslapd-rootpwstoragescheme', 'PBKDF2-SHA512')
63fe67
+        log.info('Set passwordStorageScheme and nsslapd-rootpwstoragescheme to PBKDF2_SHA256')
63fe67
+        standalone.config.set('passwordStorageScheme', 'PBKDF2_SHA256')
63fe67
+        standalone.config.set('nsslapd-rootpwstoragescheme', 'PBKDF2_SHA256')
63fe67
 
63fe67
     run_healthcheck_and_flush_log(topology_st, standalone, json=False, searched_code=CMD_OUTPUT)
63fe67
     run_healthcheck_and_flush_log(topology_st, standalone, json=True, searched_code=JSON_OUTPUT)
63fe67
diff --git a/dirsrvtests/tests/suites/password/pwp_test.py b/dirsrvtests/tests/suites/password/pwp_test.py
63fe67
index ce45bc364..190881222 100644
63fe67
--- a/dirsrvtests/tests/suites/password/pwp_test.py
63fe67
+++ b/dirsrvtests/tests/suites/password/pwp_test.py
63fe67
@@ -27,7 +27,7 @@ else:
63fe67
     if is_fips():
63fe67
         DEFAULT_PASSWORD_STORAGE_SCHEME = 'SSHA512'
63fe67
     else:
63fe67
-        DEFAULT_PASSWORD_STORAGE_SCHEME = 'PBKDF2-SHA512'
63fe67
+        DEFAULT_PASSWORD_STORAGE_SCHEME = 'PBKDF2_SHA256'
63fe67
 
63fe67
 
63fe67
 def _create_user(topo, uid, cn, uidNumber, userpassword):
63fe67
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
63fe67
index 825498858..566ba87dd 100644
63fe67
--- a/ldap/servers/slapd/pw.c
63fe67
+++ b/ldap/servers/slapd/pw.c
63fe67
@@ -280,7 +280,8 @@ pw_name2scheme(char *name)
63fe67
         } else {
63fe67
             /* if not, let's setup pbkdf2 */
63fe67
 #ifdef RUST_ENABLE
63fe67
-            char *pbkdf = "PBKDF2-SHA512";
63fe67
+            /* until 1.3.10 supports Rust hashers we can't use PBKDF2-SHA512 by default */
63fe67
+            char *pbkdf = "PBKDF2_SHA256";
63fe67
 #else
63fe67
             char *pbkdf = "PBKDF2_SHA256";
63fe67
 #endif
63fe67
diff --git a/src/lib389/lib389/config.py b/src/lib389/lib389/config.py
63fe67
index c7abdf778..c178eb02f 100644
63fe67
--- a/src/lib389/lib389/config.py
63fe67
+++ b/src/lib389/lib389/config.py
63fe67
@@ -209,7 +209,7 @@ class Config(DSLdapObject):
63fe67
             yield report
63fe67
 
63fe67
     def _lint_passwordscheme(self):
63fe67
-        allowed_schemes = ['SSHA512', 'PBKDF2-SHA512', 'GOST_YESCRYPT']
63fe67
+        allowed_schemes = ['SSHA512', 'PBKDF2_SHA256', 'GOST_YESCRYPT']
63fe67
         u_password_scheme = self.get_attr_val_utf8('passwordStorageScheme')
63fe67
         u_root_scheme = self.get_attr_val_utf8('nsslapd-rootpwstoragescheme')
63fe67
         if u_root_scheme not in allowed_schemes or u_password_scheme not in allowed_schemes:
63fe67
-- 
63fe67
2.38.1
63fe67