|
|
706194 |
From 434620ee342ac4767beccec647a318bfa7743dfa Mon Sep 17 00:00:00 2001
|
|
|
706194 |
From: Rob Crittenden <rcritten@redhat.com>
|
|
|
706194 |
Date: Thu, 18 Aug 2022 08:21:58 -0400
|
|
|
706194 |
Subject: [PATCH] doc: Update LDAP grace period design with default values
|
|
|
706194 |
|
|
|
706194 |
New group password policies will get -1 (unlimited) on creation
|
|
|
706194 |
by default.
|
|
|
706194 |
|
|
|
706194 |
Existing group password policies will remain untouched and
|
|
|
706194 |
those created prior will be treated as no BIND allowed.
|
|
|
706194 |
|
|
|
706194 |
Fixes: https://pagure.io/freeipa/issue/9212
|
|
|
706194 |
|
|
|
706194 |
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
|
|
|
706194 |
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
|
|
|
706194 |
---
|
|
|
706194 |
doc/designs/ldap_grace_period.md | 17 ++++++++++++++++-
|
|
|
706194 |
1 file changed, 16 insertions(+), 1 deletion(-)
|
|
|
706194 |
|
|
|
706194 |
diff --git a/doc/designs/ldap_grace_period.md b/doc/designs/ldap_grace_period.md
|
|
|
706194 |
index 4b9db3424..e26aedda9 100644
|
|
|
706194 |
--- a/doc/designs/ldap_grace_period.md
|
|
|
706194 |
+++ b/doc/designs/ldap_grace_period.md
|
|
|
706194 |
@@ -51,7 +51,22 @@ The basic flow is:
|
|
|
706194 |
|
|
|
706194 |
On successful password reset (by anyone) reset the user's passwordGraceUserTime to 0.
|
|
|
706194 |
|
|
|
706194 |
-The default value on install/upgrade will be -1 to retail existing behavior.
|
|
|
706194 |
+Range values for passwordgracelimit are:
|
|
|
706194 |
+
|
|
|
706194 |
+-1 : password grace checking is disabled
|
|
|
706194 |
+ 0 : no grace BIND are allowed at all post-expiration
|
|
|
706194 |
+ 1..MAXINT: the number of BIND allowed post-expiration
|
|
|
706194 |
+
|
|
|
706194 |
+The default value for the global policy on install/upgrade will be -1 to
|
|
|
706194 |
+retain existing behavior.
|
|
|
706194 |
+
|
|
|
706194 |
+New group password policies will default to -1 to retain previous
|
|
|
706194 |
+behavior.
|
|
|
706194 |
+
|
|
|
706194 |
+Existing group policies with no grace limit set are updated to use
|
|
|
706194 |
+the default unlimited value, -1. This is done because lack of value in
|
|
|
706194 |
+LDAP is treated as 0 so any existing group policies would not allow
|
|
|
706194 |
+post-expiration BIND so this will avoid confusion.
|
|
|
706194 |
|
|
|
706194 |
The per-user attempts will not be replicated.
|
|
|
706194 |
|
|
|
706194 |
--
|
|
|
706194 |
2.37.2
|
|
|
706194 |
|
|
|
706194 |
From 497a57e7a6872fa30d1855a1d91a455bfdbf9300 Mon Sep 17 00:00:00 2001
|
|
|
706194 |
From: Rob Crittenden <rcritten@redhat.com>
|
|
|
706194 |
Date: Thu, 4 Aug 2022 12:04:22 -0400
|
|
|
706194 |
Subject: [PATCH] Set default gracelimit on group password policies to -1
|
|
|
706194 |
|
|
|
706194 |
This will retain previous behavior of unlimited LDAP BIND
|
|
|
706194 |
post-expiration.
|
|
|
706194 |
|
|
|
706194 |
Fixes: https://pagure.io/freeipa/issue/9212
|
|
|
706194 |
|
|
|
706194 |
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
|
|
|
706194 |
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
|
|
|
706194 |
---
|
|
|
706194 |
API.txt | 2 +-
|
|
|
706194 |
ipaserver/plugins/pwpolicy.py | 2 ++
|
|
|
706194 |
ipatests/test_xmlrpc/test_pwpolicy_plugin.py | 2 ++
|
|
|
706194 |
3 files changed, 5 insertions(+), 1 deletion(-)
|
|
|
706194 |
|
|
|
706194 |
diff --git a/API.txt b/API.txt
|
|
|
706194 |
index 5ba9add13..d7ea74f08 100644
|
|
|
706194 |
--- a/API.txt
|
|
|
706194 |
+++ b/API.txt
|
|
|
706194 |
@@ -4075,7 +4075,7 @@ option: Int('krbpwdlockoutduration?', cli_name='lockouttime')
|
|
|
706194 |
option: Int('krbpwdmaxfailure?', cli_name='maxfail')
|
|
|
706194 |
option: Int('krbpwdmindiffchars?', cli_name='minclasses')
|
|
|
706194 |
option: Int('krbpwdminlength?', cli_name='minlength')
|
|
|
706194 |
-option: Int('passwordgracelimit?', cli_name='gracelimit', default=-1)
|
|
|
706194 |
+option: Int('passwordgracelimit?', autofill=True, cli_name='gracelimit', default=-1)
|
|
|
706194 |
option: Flag('raw', autofill=True, cli_name='raw', default=False)
|
|
|
706194 |
option: Str('setattr*', cli_name='setattr')
|
|
|
706194 |
option: Str('version?')
|
|
|
706194 |
diff --git a/ipaserver/plugins/pwpolicy.py b/ipaserver/plugins/pwpolicy.py
|
|
|
706194 |
index 4428aede2..f4ebffd5c 100644
|
|
|
706194 |
--- a/ipaserver/plugins/pwpolicy.py
|
|
|
706194 |
+++ b/ipaserver/plugins/pwpolicy.py
|
|
|
706194 |
@@ -408,6 +408,7 @@ class pwpolicy(LDAPObject):
|
|
|
706194 |
minvalue=-1,
|
|
|
706194 |
maxvalue=Int.MAX_UINT32,
|
|
|
706194 |
default=-1,
|
|
|
706194 |
+ autofill=True,
|
|
|
706194 |
),
|
|
|
706194 |
)
|
|
|
706194 |
|
|
|
706194 |
@@ -539,6 +540,7 @@ class pwpolicy_add(LDAPCreate):
|
|
|
706194 |
keys[-1], krbpwdpolicyreference=dn,
|
|
|
706194 |
cospriority=options.get('cospriority')
|
|
|
706194 |
)
|
|
|
706194 |
+
|
|
|
706194 |
return dn
|
|
|
706194 |
|
|
|
706194 |
def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
|
|
706194 |
diff --git a/ipatests/test_xmlrpc/test_pwpolicy_plugin.py b/ipatests/test_xmlrpc/test_pwpolicy_plugin.py
|
|
|
706194 |
index 8eee69c18..fc785223b 100644
|
|
|
706194 |
--- a/ipatests/test_xmlrpc/test_pwpolicy_plugin.py
|
|
|
706194 |
+++ b/ipatests/test_xmlrpc/test_pwpolicy_plugin.py
|
|
|
706194 |
@@ -387,6 +387,7 @@ class test_pwpolicy_mod_cospriority(Declarative):
|
|
|
706194 |
krbpwdhistorylength=[u'10'],
|
|
|
706194 |
krbpwdmindiffchars=[u'3'],
|
|
|
706194 |
krbpwdminlength=[u'8'],
|
|
|
706194 |
+ passwordgracelimit=[u'-1'],
|
|
|
706194 |
objectclass=objectclasses.pwpolicy,
|
|
|
706194 |
),
|
|
|
706194 |
summary=None,
|
|
|
706194 |
@@ -417,6 +418,7 @@ class test_pwpolicy_mod_cospriority(Declarative):
|
|
|
706194 |
krbpwdhistorylength=[u'10'],
|
|
|
706194 |
krbpwdmindiffchars=[u'3'],
|
|
|
706194 |
krbpwdminlength=[u'8'],
|
|
|
706194 |
+ passwordgracelimit=[u'-1'],
|
|
|
706194 |
),
|
|
|
706194 |
summary=None,
|
|
|
706194 |
value=u'ipausers',
|
|
|
706194 |
--
|
|
|
706194 |
2.37.2
|
|
|
706194 |
|
|
|
706194 |
From a4ddaaf3048c4e8d78a1807af7266ee40ab3a30b Mon Sep 17 00:00:00 2001
|
|
|
706194 |
From: Rob Crittenden <rcritten@redhat.com>
|
|
|
706194 |
Date: Thu, 4 Aug 2022 12:04:41 -0400
|
|
|
706194 |
Subject: [PATCH] Set default on group pwpolicy with no grace limit in upgrade
|
|
|
706194 |
|
|
|
706194 |
If an existing group policy lacks a password grace limit
|
|
|
706194 |
update it to -1 on upgrade.
|
|
|
706194 |
|
|
|
706194 |
Fixes: https://pagure.io/freeipa/issue/9212
|
|
|
706194 |
|
|
|
706194 |
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
|
|
|
706194 |
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
|
|
|
706194 |
---
|
|
|
706194 |
.../updates/90-post_upgrade_plugins.update | 1 +
|
|
|
706194 |
ipaserver/install/plugins/update_pwpolicy.py | 66 +++++++++++++++++++
|
|
|
706194 |
2 files changed, 67 insertions(+)
|
|
|
706194 |
|
|
|
706194 |
diff --git a/install/updates/90-post_upgrade_plugins.update b/install/updates/90-post_upgrade_plugins.update
|
|
|
706194 |
index c7ec71d49..6fe91aa6c 100644
|
|
|
706194 |
--- a/install/updates/90-post_upgrade_plugins.update
|
|
|
706194 |
+++ b/install/updates/90-post_upgrade_plugins.update
|
|
|
706194 |
@@ -26,6 +26,7 @@ plugin: update_ra_cert_store
|
|
|
706194 |
plugin: update_mapping_Guests_to_nobody
|
|
|
706194 |
plugin: fix_kra_people_entry
|
|
|
706194 |
plugin: update_pwpolicy
|
|
|
706194 |
+plugin: update_pwpolicy_grace
|
|
|
706194 |
|
|
|
706194 |
# last
|
|
|
706194 |
# DNS version 1
|
|
|
706194 |
diff --git a/ipaserver/install/plugins/update_pwpolicy.py b/ipaserver/install/plugins/update_pwpolicy.py
|
|
|
706194 |
index dca44ce43..4185f0343 100644
|
|
|
706194 |
--- a/ipaserver/install/plugins/update_pwpolicy.py
|
|
|
706194 |
+++ b/ipaserver/install/plugins/update_pwpolicy.py
|
|
|
706194 |
@@ -78,3 +78,69 @@ class update_pwpolicy(Updater):
|
|
|
706194 |
return False, []
|
|
|
706194 |
|
|
|
706194 |
return False, []
|
|
|
706194 |
+
|
|
|
706194 |
+
|
|
|
706194 |
+@register()
|
|
|
706194 |
+class update_pwpolicy_grace(Updater):
|
|
|
706194 |
+ """
|
|
|
706194 |
+ Ensure all group policies have a grace period set.
|
|
|
706194 |
+ """
|
|
|
706194 |
+
|
|
|
706194 |
+ def execute(self, **options):
|
|
|
706194 |
+ ldap = self.api.Backend.ldap2
|
|
|
706194 |
+
|
|
|
706194 |
+ base_dn = DN(('cn', self.api.env.realm), ('cn', 'kerberos'),
|
|
|
706194 |
+ self.api.env.basedn)
|
|
|
706194 |
+ search_filter = (
|
|
|
706194 |
+ "(&(objectClass=krbpwdpolicy)(!(passwordgracelimit=*)))"
|
|
|
706194 |
+ )
|
|
|
706194 |
+
|
|
|
706194 |
+ while True:
|
|
|
706194 |
+ # Run the search in loop to avoid issues when LDAP limits are hit
|
|
|
706194 |
+ # during update
|
|
|
706194 |
+
|
|
|
706194 |
+ try:
|
|
|
706194 |
+ (entries, truncated) = ldap.find_entries(
|
|
|
706194 |
+ search_filter, ['objectclass'], base_dn, time_limit=0,
|
|
|
706194 |
+ size_limit=0)
|
|
|
706194 |
+
|
|
|
706194 |
+ except errors.EmptyResult:
|
|
|
706194 |
+ logger.debug("update_pwpolicy: no policies without "
|
|
|
706194 |
+ "passwordgracelimit set")
|
|
|
706194 |
+ return False, []
|
|
|
706194 |
+
|
|
|
706194 |
+ except errors.ExecutionError as e:
|
|
|
706194 |
+ logger.error("update_pwpolicy: cannot retrieve list "
|
|
|
706194 |
+ "of policies missing passwordgracelimit: %s", e)
|
|
|
706194 |
+ return False, []
|
|
|
706194 |
+
|
|
|
706194 |
+ logger.debug("update_pwpolicy: found %d "
|
|
|
706194 |
+ "policies to update, truncated: %s",
|
|
|
706194 |
+ len(entries), truncated)
|
|
|
706194 |
+
|
|
|
706194 |
+ error = False
|
|
|
706194 |
+
|
|
|
706194 |
+ for entry in entries:
|
|
|
706194 |
+ # Set unlimited BIND by default
|
|
|
706194 |
+ entry['passwordgracelimit'] = -1
|
|
|
706194 |
+ try:
|
|
|
706194 |
+ ldap.update_entry(entry)
|
|
|
706194 |
+ except (errors.EmptyModlist, errors.NotFound):
|
|
|
706194 |
+ pass
|
|
|
706194 |
+ except errors.ExecutionError as e:
|
|
|
706194 |
+ logger.debug("update_pwpolicy: cannot "
|
|
|
706194 |
+ "update policy: %s", e)
|
|
|
706194 |
+ error = True
|
|
|
706194 |
+
|
|
|
706194 |
+ if error:
|
|
|
706194 |
+ # Exit loop to avoid infinite cycles
|
|
|
706194 |
+ logger.error("update_pwpolicy: error(s) "
|
|
|
706194 |
+ "detected during pwpolicy update")
|
|
|
706194 |
+ return False, []
|
|
|
706194 |
+
|
|
|
706194 |
+ elif not truncated:
|
|
|
706194 |
+ # All affected entries updated, exit the loop
|
|
|
706194 |
+ logger.debug("update_pwpolicy: all policies updated")
|
|
|
706194 |
+ return False, []
|
|
|
706194 |
+
|
|
|
706194 |
+ return False, []
|
|
|
706194 |
--
|
|
|
706194 |
2.37.2
|
|
|
706194 |
|