c8cd81
From 45e6d49b94da78cd82eb016b3266a17a1359a087 Mon Sep 17 00:00:00 2001
c8cd81
From: Rob Crittenden <rcritten@redhat.com>
c8cd81
Date: Thu, 4 Aug 2022 12:04:22 -0400
c8cd81
Subject: [PATCH] Set default gracelimit on group password policies to -1
c8cd81
c8cd81
This will retain previous behavior of unlimited LDAP BIND
c8cd81
post-expiration.
c8cd81
c8cd81
Fixes: https://pagure.io/freeipa/issue/9212
c8cd81
c8cd81
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
c8cd81
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
c8cd81
---
c8cd81
 API.txt                                      | 2 +-
c8cd81
 ipaserver/plugins/pwpolicy.py                | 2 ++
c8cd81
 ipatests/test_xmlrpc/test_pwpolicy_plugin.py | 2 ++
c8cd81
 3 files changed, 5 insertions(+), 1 deletion(-)
c8cd81
c8cd81
diff --git a/API.txt b/API.txt
c8cd81
index 66929b921b197e27ede847fb6b10bf1e44c3464a..210bfc4950e6a7346dbdd6e29d1096b2f8750b1e 100644
c8cd81
--- a/API.txt
c8cd81
+++ b/API.txt
c8cd81
@@ -4076,7 +4076,7 @@ option: Int('krbpwdlockoutduration?', cli_name='lockouttime')
c8cd81
 option: Int('krbpwdmaxfailure?', cli_name='maxfail')
c8cd81
 option: Int('krbpwdmindiffchars?', cli_name='minclasses')
c8cd81
 option: Int('krbpwdminlength?', cli_name='minlength')
c8cd81
-option: Int('passwordgracelimit?', cli_name='gracelimit', default=-1)
c8cd81
+option: Int('passwordgracelimit?', autofill=True, cli_name='gracelimit', default=-1)
c8cd81
 option: Flag('raw', autofill=True, cli_name='raw', default=False)
c8cd81
 option: Str('setattr*', cli_name='setattr')
c8cd81
 option: Str('version?')
c8cd81
diff --git a/ipaserver/plugins/pwpolicy.py b/ipaserver/plugins/pwpolicy.py
c8cd81
index 4428aede2dcc7a2a0b6128bf7f58eb47e4a8e07d..f4ebffd5c8f06a53b6c4d5e48ff6eeafa240e3a4 100644
c8cd81
--- a/ipaserver/plugins/pwpolicy.py
c8cd81
+++ b/ipaserver/plugins/pwpolicy.py
c8cd81
@@ -408,6 +408,7 @@ class pwpolicy(LDAPObject):
c8cd81
             minvalue=-1,
c8cd81
             maxvalue=Int.MAX_UINT32,
c8cd81
             default=-1,
c8cd81
+            autofill=True,
c8cd81
         ),
c8cd81
     )
c8cd81
 
c8cd81
@@ -539,6 +540,7 @@ class pwpolicy_add(LDAPCreate):
c8cd81
             keys[-1], krbpwdpolicyreference=dn,
c8cd81
             cospriority=options.get('cospriority')
c8cd81
         )
c8cd81
+
c8cd81
         return dn
c8cd81
 
c8cd81
     def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
c8cd81
diff --git a/ipatests/test_xmlrpc/test_pwpolicy_plugin.py b/ipatests/test_xmlrpc/test_pwpolicy_plugin.py
c8cd81
index 8eee69c185b15be72870050ed247f252c72d1c66..fc785223bfe56269ad8b211e8f1c3ac9f4064c3c 100644
c8cd81
--- a/ipatests/test_xmlrpc/test_pwpolicy_plugin.py
c8cd81
+++ b/ipatests/test_xmlrpc/test_pwpolicy_plugin.py
c8cd81
@@ -387,6 +387,7 @@ class test_pwpolicy_mod_cospriority(Declarative):
c8cd81
                     krbpwdhistorylength=[u'10'],
c8cd81
                     krbpwdmindiffchars=[u'3'],
c8cd81
                     krbpwdminlength=[u'8'],
c8cd81
+                    passwordgracelimit=[u'-1'],
c8cd81
                     objectclass=objectclasses.pwpolicy,
c8cd81
                 ),
c8cd81
                 summary=None,
c8cd81
@@ -417,6 +418,7 @@ class test_pwpolicy_mod_cospriority(Declarative):
c8cd81
                     krbpwdhistorylength=[u'10'],
c8cd81
                     krbpwdmindiffchars=[u'3'],
c8cd81
                     krbpwdminlength=[u'8'],
c8cd81
+                    passwordgracelimit=[u'-1'],
c8cd81
                 ),
c8cd81
                 summary=None,
c8cd81
                 value=u'ipausers',
c8cd81
-- 
c8cd81
2.37.2
c8cd81