Bug 2220890

Summary: healthcheck tool needs to be updated for new default password storage scheme
Product: Red Hat Enterprise Linux 8 Reporter: mreynolds
Component: 389-ds-baseAssignee: mreynolds
Status: CLOSED ERRATA QA Contact: LDAP QA Team <idm-ds-qe-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 8.9CC: bsmejkal, emartyny, gkimetto, idm-ds-dev-bugs, sumenon, vashirov
Target Milestone: rcKeywords: Regression, TestCaseProvided, Triaged
Target Release: 8.9Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sync-to-jira
Fixed In Version: 389-ds-1.4-820230816162424-17499975 Doc Type: Bug Fix
Doc Text:
.The `dsctl healthcheck` command now uses the password storage scheme `PBKDF2-SHA512` by default Previously, the `dsctl healthcheck` command used `SSHA512` password storage scheme by default. Consequently, the command reported a warning because it did not detect the new password storage scheme `PBKDF2-SHA512`. With this update, the `dsctl healthcheck` command now uses `PBKDF2-SHA512` password storage scheme by default and no warnings occur.
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-14 15:32:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2209172    
Deadline: 2023-07-17   

Description mreynolds 2023-07-06 12:50:50 UTC
Description of problem:

Healthcheck tool is reporting a warning because it does not recognize the new default password storage scheme in 1.4.3 (PBKDF2-SHA512).  

Upstream tickets:

https://github.com/389ds/389-ds-base/issues/2375
https://github.com/389ds/389-ds-base/issues/5825

Comment 1 mreynolds 2023-07-06 13:24:38 UTC
*** Bug 2220877 has been marked as a duplicate of this bug. ***

Comment 4 Viktor Ashirov 2023-07-17 11:23:29 UTC
Build tested:
389-ds-base-1.4.3.36-2.module+el8.9.0+19332+3ffa8e10.x86_64

Automated test passed (had to comment out instance.config.set('nsslapd-accesslog-logbuffering','off') in /usr/lib/python3.6/site-packages/lib389/topologies.py, otherwise healthcheck would also fail):

===================================================================================================================== test session starts =====================================================================================================================
platform linux -- Python 3.6.8, pytest-3.4.2, py-1.5.3, pluggy-0.6.0 -- /usr/libexec/platform-python
cachedir: ../../.pytest_cache
389-ds-base: 1.4.3.36-2.module+el8.9.0+19332+3ffa8e10
nss: 3.79.0-11.el8_7
nspr: 4.35.0-1.el8_8
openldap: 2.4.46-18.el8
cyrus-sasl: not installed
FIPS: disabled
rootdir: /root/ds/dirsrvtests, inifile: pytest.ini
plugins: flaky-3.7.0
collected 1 item

healthcheck/health_security_test.py::test_healthcheck_insecure_pwd_hash_configured PASSED                                                                                                                                                               [100%]

================================================================================================================== 1 passed in 35.73 seconds ==================================================================================================================



But when running in FIPS mode manually, healthcheck fails:
# dsctl slapd-localhost healthcheck --check config:passwordscheme
Beginning lint report, this could take a while ...
Checking config:passwordscheme ...
Healthcheck complete.
2 Issues found!  Generating report ...


[1] DS Lint Error: DSCLE0002
--------------------------------------------------------------------------------
Severity: HIGH
Check: config:passwordscheme
Affects:
 -- cn=config

Details:
-----------
Password storage schemes in Directory Server define how passwords are hashed via a
one-way mathematical function for storage. Knowing the hash it is difficult to gain
the input, but knowing the input you can easily compare the hash.

Many hashes are well known for cryptograhpic verification properties, but are
designed to be *fast* to validate. This is the opposite of what we desire for password
storage. In the unlikely event of a disclosure, you want hashes to be *difficult* to
verify, as this adds a cost of work to an attacker.

In Directory Server, we offer one hash suitable for this (PBKDF2-SHA512) and one hash
for "legacy" support (SSHA512).

Your configured scheme (SSHA512) for 'nsslapd-rootpwstoragescheme' is not secure


Resolution:
-----------
Perform a configuration reset of the values:

IE, stop Directory Server, and in dse.ldif delete this line (nsslapd-rootpwstoragescheme). When Directory Server
is started, they will use the server provided defaults that are secure.

You can also use 'dsconf' to replace these values.  Here is an example:

    # dsconf slapd-localhost config replace nsslapd-rootpwstoragescheme=PBKDF2-SHA512


[2] DS Lint Error: DSCLE0002
--------------------------------------------------------------------------------
Severity: HIGH
Check: config:passwordscheme
Affects:
 -- cn=config

Details:
-----------
Password storage schemes in Directory Server define how passwords are hashed via a
one-way mathematical function for storage. Knowing the hash it is difficult to gain
the input, but knowing the input you can easily compare the hash.

Many hashes are well known for cryptograhpic verification properties, but are
designed to be *fast* to validate. This is the opposite of what we desire for password
storage. In the unlikely event of a disclosure, you want hashes to be *difficult* to
verify, as this adds a cost of work to an attacker.

In Directory Server, we offer one hash suitable for this (PBKDF2-SHA512) and one hash
for "legacy" support (SSHA512).

Your configured scheme (SSHA512) for 'passwordStorageScheme' is not secure


Resolution:
-----------
Perform a configuration reset of the values:

IE, stop Directory Server, and in dse.ldif delete this line (passwordStorageScheme). When Directory Server
is started, they will use the server provided defaults that are secure.

You can also use 'dsconf' to replace these values.  Here is an example:

    # dsconf slapd-localhost config replace passwordStorageScheme=PBKDF2-SHA512


Since SSHA512 is considered "insecure" in a non-FIPS environment, but in FIPS mode this is the best pwd storage scheme that we can set, should the healthcheck tool take this into consideration?

Comment 5 mreynolds 2023-07-17 13:37:28 UTC
We now have Rust password hashers using openssl instead of NSS.  So we can now have PBKDF2 in Fips environment.

Comment 6 Viktor Ashirov 2023-07-17 13:41:58 UTC
Should it be enabled at the instance creation time by default? Or there some compatibility issues that prevent us to make it default in FIPS mode?

Comment 7 mreynolds 2023-07-17 13:52:21 UTC
(In reply to Viktor Ashirov from comment #6)
> Should it be enabled at the instance creation time by default? Or there some
> compatibility issues that prevent us to make it default in FIPS mode?

Oh wait.  Ok in RHEL 8 in fips we do use SSHA512 as default.  But we do support PBKDF2 (Rust version) in RHEL 8 now with fips.  In 2.x we always use PBKDF2-SHA512.

Comment 12 Viktor Ashirov 2023-08-21 13:04:02 UTC
Automated test passes in FIPS mode too:
=============================================================================================== test session starts ================================================================================================
platform linux -- Python 3.6.8, pytest-3.4.2, py-1.5.3, pluggy-0.6.0 -- /usr/libexec/platform-python
cachedir: dirsrvtests/.pytest_cache
389-ds-base: 1.4.3.37-1.module+el8.9.0+19689+7d653af8
nss: 3.90.0-3.el8_8
nspr: 4.35.0-1.el8_8
openldap: 2.4.46-18.el8
cyrus-sasl: not installed
FIPS: enabled
rootdir: /root/ds/dirsrvtests, inifile: pytest.ini
collected 1 item

dirsrvtests/tests/suites/healthcheck/health_security_test.py::test_healthcheck_insecure_pwd_hash_configured PASSED                                                                                           [100%]

============================================================================================ 1 passed in 40.61 seconds =============================================================================================

Marking as VERIFIED:Tested.

Comment 17 errata-xmlrpc 2023-11-14 15:32:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (389-ds:1.4 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6965