Bug 1298478

Summary: NIS account passwords not disabled when nsAccountLock is TRUE
Product: Red Hat Enterprise Linux 6 Reporter: Martin Kosek <mkosek>
Component: slapi-nisAssignee: Alexander Bokovoy <abokovoy>
Status: CLOSED ERRATA QA Contact: Namita Soman <nsoman>
Severity: high Docs Contact:
Priority: high    
Version: 6.0CC: ksiddiqu, rcritten, sumenon
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1298481 (view as bug list) Environment:
Last Closed: 2016-05-11 01:21:17 UTC Type: ---
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: 1298481    

Description Martin Kosek 2016-01-14 08:53:53 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/freeipa/ticket/5480

When the password algorithm is defined as CRYPT and NIS is used to authenticate users on other systems, there is no way to disable or lock accounts.   Traditional convention has been to put two bang (exclamation) characters in front of the password, creating an impossible password hash.  This effectively locks the user account, preventing authentication.

On line 55 of defs-nis.c, line 55 can have the following added to add a pair of bang characters in front of the password hash:

{{{
%ifeq("nsAccountLock","TRUE","!!","")
}}}

There may be a better place within the format to put that, but the syntax escapes me.  Simply adding the above code in the password field before the %regsubi... would produce a !!* for locked accounts instead of just the * as it sits now.  This may cause problems.

Comment 1 Martin Kosek 2016-01-14 08:56:12 UTC
The bug needs to be fixed in slapi-nis, in the plugin itself. It is a security related fix, as account lock is not effective in NIS - thus increasing severity.

Comment 5 Alexander Bokovoy 2016-02-18 11:25:46 UTC
To test this you need:
 1. Configure IPA to serve NIS maps
 2. Configure NIS client
 3. Create an IPA user, let's say, 'user'
 4. On NIS client, run 'ypcat passwd', this will print the map in passwd format. Note that second field is '*' for enabled users.
 5. As IPA admin, disable 'user' with 'ipa user-disable user'
 6. On NIS client, run 'ypcat passwd' and notice that 'user' now has '!!*' in the second field.
 7. As IPA admin, enable 'user' with 'ipa user-enable user'
 8. On NIS client, run 'ypcat passwd' and notice that 'user' now has only '*' in the second field.

For example:

# ipa user-disable foobar
------------------------------
Disabled user account "foobar"
------------------------------
# ypcat passwd |grep foobar:
foobar:!!*:955000024:955000024:Foo Bar:/home/foobar:/bin/sh
# ipa user-enable foobar
-----------------------------
Enabled user account "foobar"
-----------------------------
# ypcat passwd |grep foobar:
foobar:*:955000024:955000024:Foo Bar:/home/foobar:/bin/sh

Comment 6 Sudhir Menon 2016-02-22 12:49:33 UTC
Verified using RHEL6.8 IPA-Server and IPA-Client

ipa-server-3.0.0-50.el6.x86_64
ipa-client-3.0.0-50.el6.x86_64
sssd-1.13.3-15.el6.x86_64

[root@r68client yp]# /etc/init.d/ypbind start
Starting NIS service:                                      [  OK  ]
Binding NIS service:                                       [  OK  ]

[root@r68client yp]# ypcat passwd
user:*:163400006:163400006:user test:/home/user:/bin/sh

[root@r68server ~]# ipa user-disable user
----------------------------
Disabled user account "user"
----------------------------

[root@r68client yp]# ypcat passwd
user:!!*:163400006:163400006:user test:/home/user:/bin/sh

[root@r68server ~]# ipa user-enable user
---------------------------
Enabled user account "user"
---------------------------

[root@r68client yp]# ypcat passwd
user:*:163400006:163400006:user test:/home/user:/bin/sh

Comment 8 errata-xmlrpc 2016-05-11 01:21:17 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://rhn.redhat.com/errata/RHBA-2016-0966.html