Bug 1394899

Summary: RHDS should ignore passwordMinAge if "password must reset" is true
Product: Red Hat Enterprise Linux 7 Reporter: Ming Davies <minyu>
Component: 389-ds-baseAssignee: mreynolds
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: amsharma, gparente, mreynolds, mvarun, nhosoi, nkinder, pvoborni, rmeggins, tbordaz
Target Milestone: pre-dev-freeze   
Target Release: 7.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.6.1-7.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 21:12:24 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:

Description Ming Davies 2016-11-14 16:35:30 UTC
Description of problem:
Customer has specified the following password policy:

nsslapd-pwpolicy-local: on
passwordLockout: on
passwordUnlock: off
passwordLockoutDuration: 3600
passwordIsGlobalPolicy: on
passwordChange: on
passwordGraceLimit: 3
passwordExp: on
passwordMustChange: on
passwordMaxAge: 7776000
passwordWarning: 604800
passwordMinAge: 86400
passwordHistory: on
passwordInHistory: 6
passwordCheckSyntax: on
passwordMinLength: 8
passwordMinAlphas: 1
passwordMinDigits: 1
passwordMinSpecials: 1
passwordMinCategories: 3

Customer noticed that if an user's password is reset by "cn=directory manager", the user gets "Password change failed. Server message: Please make sure the password meets the complexity constraints" when ssh into a sssd client, even though the same password gets accepted happily via ldapmodify!

#ldapmodify -h ibm-x3755-1.gsslab.rdu2.redhat.com -p 389  -D "uid=ASmith,ou=People,dc=example,dc=com" -w T0_change_n0w
Sat 12 Nov 06:29:34 EST 2016
dn: uid=ASmith,ou=People,dc=example,dc=com
changetype: modify
replace: userpassword
userpassword: Ge9EiG#oh5Ee <<<<<<<

From a sssd client:
 ldappasswd -ZZ -h ibm-x3755-1.gsslab.rdu2.redhat.com -p 389 -D "uid=ASmith,ou=People,dc=example,dc=com" -w T0_change_n0w -s Ge9EiG#oh5Ee "uid=ASmith,ou=People,dc=example,dc=com"
Result: Constraint violation (19)
Additional info: Failed to update password

also via ssh:

[ming@snowflake ~]$ ssh asmith.pnq2.redhat.com
asmith.pnq2.redhat.com's password: 
Password expired. Change your password now.
Last login: Mon Nov 14 21:17:05 2016 from vpn1-5-81.ams2.redhat.com
...
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for user asmith.
Current Password: 
New password:   <<<<type in Ge9EiG#oh5Ee <<<<<<<
Retype new password:  <<<<type in Ge9EiG#oh5Ee <<<<<<<
Password change failed. Server message: Please make sure the password meets the complexity constraints.
passwd: Authentication token is no longer valid; new one required


Corresponding DS' access log shows:
[14/Nov/2016:08:10:26.499614367 -0500] conn=314 op=2 EXT oid="1.3.6.1.4.1.4203.1.11.1" name="passwd_modify_plugin"
[14/Nov/2016:08:10:26.500434883 -0500] conn=314 op=2 RESULT err=19 tag=120 nentries=0 etime=0


The reason of the failure is due to the following:
nscpentrywsi: passwordAllowChangeTime: 20161121112040Z
nscpentrywsi: passwordGraceUserTime: 0
nscpentrywsi: passwordExpirationTime: 19700101000000Z
nscpentrywsi: passwordExpWarned: 1


Resetting the password as "cn=directory manager" change passwordExpirationTime to 19700101000000Z, i.e. no password expiration date, but the passwordAllowChangeTime is still in the past!

Version-Release number of selected component (if applicable):
sssd-1.13.0-40.el7_2.12.x86_64
RHDS10


How reproducible:


Steps to Reproduce:
1. Setup a RHDS10 server, configure the password policy as above. 
2. Setup RHEL7.2 sssd client
3. Configure TLS on RHDS10 server
4. Create an user on RHDS10 and then reset the user's password as "cn=directory manager"
5. Attempt to update the user's password via ldapmodify as well as via ldappasswd on sssd client.

Actual results:


Expected results:
If password policy enforces "passwordMustChange: on" then we should not check passwordMinAge. This should be independent of whether update is done via ldapmodify or ldappasswd.


Additional info:

Comment 1 Noriko Hosoi 2016-11-14 16:47:50 UTC
Changing the Product to RHEL since the Password policy belongs to 389-ds-base.

Comment 2 thierry bordaz 2016-11-14 17:12:19 UTC
The RC of the ldappasswd failure is that it uses an internal operation to update the password. In op_shared_allow_pw_change there is this test:

	/* check if password is within password minimum age;
	   error result is sent directly from check_pw_minage */	
	if ((internal_op || !pb->pb_conn->c_needpw) && 
         check_pw_minage(pb, &sdn, mod->mod_bvalues) == 1)
	{

So minage is systematically tested when using EXTOP, while using direct MOD it is tested at the condition pw_must_change is not set (c_needpw is set if pw_must_change).

Comment 4 Noriko Hosoi 2016-11-14 19:47:42 UTC
Upstream ticket:
https://fedorahosted.org/389/ticket/49039

Comment 5 mreynolds 2017-03-29 00:03:26 UTC
Fixed upstream

Comment 7 mreynolds 2017-04-04 16:23:40 UTC
Regression - internal password updates cause crash

Comment 8 mreynolds 2017-04-06 15:24:43 UTC
Fixed upstream

Comment 9 mreynolds 2017-04-06 15:43:20 UTC
*** Bug 1438724 has been marked as a duplicate of this bug. ***

Comment 10 mreynolds 2017-04-11 15:40:17 UTC
*** Bug 1438724 has been marked as a duplicate of this bug. ***

Comment 13 Amita Sharma 2017-05-02 08:47:24 UTC
======================= test session starts ===================================================
platform linux2 -- Python 2.7.5, pytest-3.0.7, py-1.4.33, pluggy-0.4.0 -- /usr/bin/python
cachedir: .cache
metadata: {'Python': '2.7.5', 'Platform': 'Linux-3.10.0-657.el7.x86_64-x86_64-with-redhat-7.4-Maipo', 'Packages': {'py': '1.4.33', 'pytest': '3.0.7', 'pluggy': '0.4.0'}, 'Plugins': {'beakerlib': '0.7.1', 'html': '1.14.2', 'cov': '2.4.0', 'metadata': '1.3.0'}}
DS build: 1.3.6.1
389-ds-base: 1.3.6.1-9.el7
nss: 3.28.4-3.el7
nspr: 4.13.1-1.0.el7_3
openldap: 2.4.44-4.el7
svrcore: 4.1.3-2.el7

rootdir: /export/tests, inifile:
plugins: metadata-1.3.0, html-1.14.2, cov-2.4.0, beakerlib-0.7.1
collected 1 items 

tickets/ticket49039_test.py::test_ticket49039 PASSED

Comment 14 Viktor Ashirov 2017-05-20 13:51:49 UTC
*** Bug 1438724 has been marked as a duplicate of this bug. ***

Comment 15 errata-xmlrpc 2017-08-01 21:12:24 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, 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-2017:2086