Blame SOURCES/slapi-nis-extmem-0010-nis-lock-out-accounts-if-nsAccountLock-is-TRUE.patch

6b9042
From 5eaad9c4c218d9a59f6930a29f5bee54235c4fab Mon Sep 17 00:00:00 2001
6b9042
From: Alexander Bokovoy <abokovoy@redhat.com>
6b9042
Date: Tue, 19 Jan 2016 07:37:46 +0200
6b9042
Subject: [PATCH 10/12] nis: lock out accounts if nsAccountLock is TRUE
6b9042
6b9042
Add a rule that adds two bang characters in front of the password.
6b9042
6b9042
When the password algorithm is defined as CRYPT and NIS is used to
6b9042
authenticate users on other systems, there is no way to disable or lock
6b9042
accounts. Traditional convention has been to put two bang (exclamation)
6b9042
characters in front of the password, creating an impossible password
6b9042
hash. This effectively locks the user account, preventing
6b9042
authentication.
6b9042
6b9042
All UNIX systems agree that for encrypted passwords presence of a
6b9042
character which cannot be part of CRYPT password scheme renders
6b9042
impossible to login to system with such password. However, not all
6b9042
systems have meaning of locked accounts and even how these locked
6b9042
accounts express themselves.
6b9042
6b9042
There is certain controversy in what could be used to indicate locked
6b9042
accounts:
6b9042
 - GNU/Linux systems expect '!' as first character of the password field
6b9042
 - FreeBSD expects '*LOCKED*' string at start of the password field
6b9042
 - Various Solaris versions expect '*LOCK*' string at start of the
6b9042
   password field
6b9042
 - NetBSD has no meaning of locked passwords via content of password field
6b9042
6b9042
Given that it is impossible to serve NIS maps with encrypted passwords
6b9042
in a different way to different clients, standardize on '!!' scheme as
6b9042
traditional among UNIX administrators.
6b9042
6b9042
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1298478
6b9042
---
6b9042
 src/defs-nis.c | 10 +++++-----
6b9042
 1 file changed, 5 insertions(+), 5 deletions(-)
6b9042
6b9042
diff --git a/src/defs-nis.c b/src/defs-nis.c
6b9042
index 3d2b9e9..ad0e7dc 100644
6b9042
--- a/src/defs-nis.c
6b9042
+++ b/src/defs-nis.c
6b9042
@@ -52,17 +52,17 @@ static struct configuration {
6b9042
 	{"passwd.byname", config_exact, FALSE, NULL,
6b9042
 	 "(objectClass=posixAccount)",
6b9042
 	 "%{uid}", NULL,
6b9042
-	 "%{uid}:%ifeq(\"objectClass\",\"shadowAccount\",\"x\",\"%regsubi(\\\"%{userPassword}\\\",\\\"^\\\\\\\\{CRYPT\\\\\\\\}(..*)\\\",\\\"%1\\\",\\\"*\\\")\"):%regmatch(\"%{uidNumber}\",\"[0-9]+\"):%regmatch(\"%{gidNumber}\",\"[0-9]+\"):%{gecos:-%{cn:-}}:%{homeDirectory:-/}:%{loginShell:-" _PATH_BSHELL "}", NULL,
6b9042
+	 "%{uid}:%ifeq(\"nsAccountLock\",\"TRUE\",\"!!\",\"\")%ifeq(\"objectClass\",\"shadowAccount\",\"x\",\"%regsubi(\\\"%{userPassword}\\\",\\\"^\\\\\\\\{CRYPT\\\\\\\\}(..*)\\\",\\\"%1\\\",\\\"*\\\")\"):%regmatch(\"%{uidNumber}\",\"[0-9]+\"):%regmatch(\"%{gidNumber}\",\"[0-9]+\"):%{gecos:-%{cn:-}}:%{homeDirectory:-/}:%{loginShell:-" _PATH_BSHELL "}", NULL,
6b9042
 	 ":\r\n"},
6b9042
 	{"passwd.byuid", config_exact, FALSE, NULL,
6b9042
 	 "(objectClass=posixAccount)",
6b9042
 	 "%{uidNumber}", NULL,
6b9042
-	 "%{uid}:%ifeq(\"objectClass\",\"shadowAccount\",\"x\",\"%regsubi(\\\"%{userPassword}\\\",\\\"^\\\\\\\\{CRYPT\\\\\\\\}(..*)\\\",\\\"%1\\\",\\\"*\\\")\"):%regmatch(\"%{uidNumber}\",\"[0-9]+\"):%regmatch(\"%{gidNumber}\",\"[0-9]+\"):%{gecos:-%{cn:-}}:%{homeDirectory:-/}:%{loginShell:-" _PATH_BSHELL "}", NULL,
6b9042
+	 "%{uid}:%ifeq(\"nsAccountLock\",\"TRUE\",\"!!\",\"\")%ifeq(\"objectClass\",\"shadowAccount\",\"x\",\"%regsubi(\\\"%{userPassword}\\\",\\\"^\\\\\\\\{CRYPT\\\\\\\\}(..*)\\\",\\\"%1\\\",\\\"*\\\")\"):%regmatch(\"%{uidNumber}\",\"[0-9]+\"):%regmatch(\"%{gidNumber}\",\"[0-9]+\"):%{gecos:-%{cn:-}}:%{homeDirectory:-/}:%{loginShell:-" _PATH_BSHELL "}", NULL,
6b9042
 	 ":\r\n"},
6b9042
 	{"shadow.byname", config_exact, TRUE, NULL,
6b9042
 	 "(objectClass=shadowAccount)",
6b9042
 	 "%{uid}", NULL,
6b9042
-	 "%{uid}:%regsubi(\"%{userPassword}\",\"^\\\\{CRYPT\\\\}(..*)\",\"%1\",\"*\"):%{shadowLastChange:-}:%{shadowMin:-}:%{shadowMax:-}:%{shadowWarning:-}:%{shadowInactive:-}:%{shadowExpire:-}:%{shadowFlag:-}", NULL,
6b9042
+	 "%{uid}:%ifeq(\"nsAccountLock\",\"TRUE\",\"!!\",\"\")%regsubi(\"%{userPassword}\",\"^\\\\{CRYPT\\\\}(..*)\",\"%1\",\"*\"):%{shadowLastChange:-}:%{shadowMin:-}:%{shadowMax:-}:%{shadowWarning:-}:%{shadowInactive:-}:%{shadowExpire:-}:%{shadowFlag:-}", NULL,
6b9042
 	 ":\r\n"},
6b9042
 	{"passwd.adjunct.byname", config_exact, TRUE, NULL,
6b9042
 	 "(objectClass=shadowAccount)",
6b9042
@@ -72,12 +72,12 @@ static struct configuration {
6b9042
 	{"group.byname", config_exact, FALSE, NULL,
6b9042
 	 "(objectClass=posixGroup)",
6b9042
 	 "%{cn}", NULL,
6b9042
-	 "%{cn}:%regsubi(\"%{userPassword}\",\"^\\\\{CRYPT\\\\}(..*)\",\"%1\",\"*\"):%regmatch(\"%{gidNumber}\",\"[0-9]+\"):%merge(\",\",\"%{memberUid}\",\"%deref_r(\\\"member\\\",\\\"uid\\\")\",\"%deref_r(\\\"uniqueMember\\\",\\\"uid\\\")\")", NULL,
6b9042
+	 "%{cn}:%ifeq(\"nsAccountLock\",\"TRUE\",\"!!\",\"\")%regsubi(\"%{userPassword}\",\"^\\\\{CRYPT\\\\}(..*)\",\"%1\",\"*\"):%regmatch(\"%{gidNumber}\",\"[0-9]+\"):%merge(\",\",\"%{memberUid}\",\"%deref_r(\\\"member\\\",\\\"uid\\\")\",\"%deref_r(\\\"uniqueMember\\\",\\\"uid\\\")\")", NULL,
6b9042
 	 ":,\r\n"},
6b9042
 	{"group.bygid", config_exact, FALSE, NULL,
6b9042
 	 "(objectClass=posixGroup)",
6b9042
 	 "%{gidNumber}", NULL,
6b9042
-	 "%{cn}:%regsubi(\"%{userPassword}\",\"^\\\\{CRYPT\\\\}(..*)\",\"%1\",\"*\"):%{gidNumber}:%merge(\",\",\"%{memberUid}\",\"%deref_r(\\\"member\\\",\\\"uid\\\")\",\"%deref_r(\\\"uniqueMember\\\",\\\"uid\\\")\")", NULL,
6b9042
+	 "%{cn}:%ifeq(\"nsAccountLock\",\"TRUE\",\"!!\",\"\")%regsubi(\"%{userPassword}\",\"^\\\\{CRYPT\\\\}(..*)\",\"%1\",\"*\"):%{gidNumber}:%merge(\",\",\"%{memberUid}\",\"%deref_r(\\\"member\\\",\\\"uid\\\")\",\"%deref_r(\\\"uniqueMember\\\",\\\"uid\\\")\")", NULL,
6b9042
 	 ":,\r\n"},
6b9042
 	{"netgroup", config_exact, FALSE, NULL,
6b9042
 	 "(objectClass=nisNetgroup)",
6b9042
-- 
6b9042
2.5.0
6b9042