|
|
26521d |
From c3c7eabb2dae02977c0a7e1e659a0a928f8fa37d Mon Sep 17 00:00:00 2001
|
|
|
26521d |
From: =?UTF-8?q?Barbora=20Smejkalov=C3=A1?= <bsmejkal@redhat.com>
|
|
|
26521d |
Date: Fri, 4 Jan 2019 09:14:34 +0100
|
|
|
26521d |
Subject: [PATCH] Issue 50091 - shadowWarning is not generated if
|
|
|
26521d |
passwordWarning is lower than 86400 seconds (1 day).
|
|
|
26521d |
|
|
|
26521d |
Description:
|
|
|
26521d |
Added test case to check if shadowWarning attribute is generated when passwordWarning is set to lower value than 84600 seconds.
|
|
|
26521d |
|
|
|
26521d |
https://pagure.io/389-ds-base/issue/50091
|
|
|
26521d |
|
|
|
26521d |
Reviewed by: vashirov, amsharma, spichugi, firstyear (Thank you!)
|
|
|
26521d |
---
|
|
|
26521d |
.../suites/password/pwdPolicy_warning_test.py | 53 ++++++++++++++++++-
|
|
|
26521d |
1 file changed, 51 insertions(+), 2 deletions(-)
|
|
|
26521d |
|
|
|
26521d |
diff --git a/dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py b/dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py
|
|
|
26521d |
index 1b955c66e..90b712e9e 100644
|
|
|
26521d |
--- a/dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py
|
|
|
26521d |
+++ b/dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py
|
|
|
26521d |
@@ -12,14 +12,14 @@ from ldap.controls.ppolicy import PasswordPolicyControl
|
|
|
26521d |
from lib389.tasks import *
|
|
|
26521d |
from lib389.utils import *
|
|
|
26521d |
from lib389.topologies import topology_st
|
|
|
26521d |
-
|
|
|
26521d |
+from lib389.idm.user import UserAccounts
|
|
|
26521d |
from lib389._constants import (DEFAULT_SUFFIX, DN_CONFIG, PASSWORD, DN_DM,
|
|
|
26521d |
HOST_STANDALONE, PORT_STANDALONE, SERVERID_STANDALONE)
|
|
|
26521d |
from dateutil.parser import parse as dt_parse
|
|
|
26521d |
import datetime
|
|
|
26521d |
|
|
|
26521d |
CONFIG_ATTR = 'passwordSendExpiringTime'
|
|
|
26521d |
-USER_DN = 'uid=tuser,{:s}'.format(DEFAULT_SUFFIX)
|
|
|
26521d |
+USER_DN = 'uid=tuser,{}'.format(DEFAULT_SUFFIX)
|
|
|
26521d |
USER_PASSWD = 'secret123'
|
|
|
26521d |
|
|
|
26521d |
logging.getLogger(__name__).setLevel(logging.INFO)
|
|
|
26521d |
@@ -546,6 +546,55 @@ def test_with_local_policy(topology_st, global_policy, local_policy):
|
|
|
26521d |
topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
26521d |
|
|
|
26521d |
|
|
|
26521d |
+@pytest.mark.bz1589144
|
|
|
26521d |
+@pytest.mark.ds50091
|
|
|
26521d |
+def test_search_shadowWarning_when_passwordWarning_is_lower(topology_st, global_policy):
|
|
|
26521d |
+ """Test if value shadowWarning is present with global password policy
|
|
|
26521d |
+ when passwordWarning is set with lower value.
|
|
|
26521d |
+
|
|
|
26521d |
+ :id: c1e82de6-1aa3-42c3-844a-9720172158a3
|
|
|
26521d |
+ :setup: Standalone Instance
|
|
|
26521d |
+ :steps:
|
|
|
26521d |
+ 1. Bind as Directory Manager
|
|
|
26521d |
+ 2. Set global password policy
|
|
|
26521d |
+ 3. Add test user to instance.
|
|
|
26521d |
+ 4. Modify passwordWarning to have smaller value than 86400
|
|
|
26521d |
+ 5. Bind as the new user
|
|
|
26521d |
+ 6. Search for shadowWarning attribute
|
|
|
26521d |
+ 7. Rebind as Directory Manager
|
|
|
26521d |
+ :expectedresults:
|
|
|
26521d |
+ 1. Binding should be successful
|
|
|
26521d |
+ 2. Setting password policy should be successful
|
|
|
26521d |
+ 3. Adding test user should be successful
|
|
|
26521d |
+ 4. Modifying passwordWarning should be successful
|
|
|
26521d |
+ 5. Binding should be successful
|
|
|
26521d |
+ 6. Attribute shadowWarning should be found
|
|
|
26521d |
+ 7. Binding should be successful
|
|
|
26521d |
+ """
|
|
|
26521d |
+
|
|
|
26521d |
+ users = UserAccounts(topology_st.standalone, DEFAULT_SUFFIX)
|
|
|
26521d |
+
|
|
|
26521d |
+ log.info("Bind as %s" % DN_DM)
|
|
|
26521d |
+ assert topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
26521d |
+
|
|
|
26521d |
+ log.info("Creating test user")
|
|
|
26521d |
+ testuser = users.create_test_user(1004)
|
|
|
26521d |
+ testuser.add('objectclass', 'shadowAccount')
|
|
|
26521d |
+ testuser.set('userPassword', USER_PASSWD)
|
|
|
26521d |
+
|
|
|
26521d |
+ log.info("Setting passwordWarning to smaller value than 86400")
|
|
|
26521d |
+ assert topology_st.standalone.config.set('passwordWarning', '86399')
|
|
|
26521d |
+
|
|
|
26521d |
+ log.info("Bind as test user")
|
|
|
26521d |
+ assert topology_st.standalone.simple_bind_s(testuser.dn, USER_PASSWD)
|
|
|
26521d |
+
|
|
|
26521d |
+ log.info("Check if attribute shadowWarning is present")
|
|
|
26521d |
+ assert testuser.present('shadowWarning')
|
|
|
26521d |
+
|
|
|
26521d |
+ log.info("Rebinding as DM")
|
|
|
26521d |
+ topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
26521d |
+
|
|
|
26521d |
+
|
|
|
26521d |
if __name__ == '__main__':
|
|
|
26521d |
# Run isolated
|
|
|
26521d |
# -s for DEBUG mode
|
|
|
26521d |
--
|
|
|
26521d |
2.17.2
|
|
|
26521d |
|