security_grace_login.xml revision 26e986688547e11d631bcd0bceae96398824e6b3
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
! CDDL HEADER START
!
! The contents of this file are subject to the terms of the
! Common Development and Distribution License, Version 1.0 only
! (the "License"). You may not use this file except in compliance
! with the License.
!
! You can obtain a copy of the license at
! See the License for the specific language governing permissions
! and limitations under the License.
!
! When distributing Covered Code, include this CDDL HEADER in each
! file and include the License file at
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
! add the following below this CDDL HEADER, with the fields enclosed
! by brackets "[]" replaced with your own identifying information:
! Portions Copyright [yyyy] [name of copyright owner]
!
! CDDL HEADER END
!
! Copyright 2007-2008 Sun Microsystems, Inc.
! Portions Copyright 2012 ForgeRock AS
! -->
<stax>
<defaultcall function="grace_login"/>
<function name="grace_login">
<sequence>
<!--- Test Suite information
#@TestSuiteName Grace Login
#@TestSuitePurpose Test the Password Policy Grace Login
#@TestSuiteGroup Grace Login
#@TestScript security_grace_login.xml
-->
<!--- Define default values for test -->
<script>
basedn1 = 'ou=people,ou=password tests,'
basedn = '%s o=Pwd Policy Tests,dc=example,dc=com' % basedn1
basepwp ='cn=Default Password Policy,cn=Password Policies,cn=config'
msg = 'Security: Grace Login:'
msg1 = 'Password Policy DN: %s' % basepwp
msg2 = 'Account Is Disabled: false'
msg3 = 'Password History:'
grace_login_count = 3
</script>
<!--- Test Case information
#@TestMarker Grace Login
#@TestName Admin Changing Pwd Policy Settings
#@TestIssue none
#@TestPurpose Admin Changing Pwd Policy Settings
#@TestPreamble none
#@TestStep set ds-cfg-expire-passwords-without-warning true
ds-cfg-min-password-age 1 seconds
ds-cfg-max-password-age 3 seconds
ds-cfg-password-expiration-warning-interval 1 s
ds-cfg-grace-login-count 3
#@TestPostamble none
#@TestResult Success if modifyAnAttribute returns 0
-->
<testcase name="getTestCaseName('Preamble, Admin Change Pwd Policy Settings')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
listAttrs=[]
listAttrs.append("ds-cfg-expire-passwords-without-warning:true")
listAttrs.append("ds-cfg-allow-expired-password-changes:true")
listAttrs.append("ds-cfg-min-password-age:1 seconds")
listAttrs.append("ds-cfg-max-password-age:3 seconds")
listAttrs.append("ds-cfg-password-expiration-warning-interval:1 seconds")
listAttrs.append("ds-cfg-grace-login-count:%s" % grace_login_count)
</script>
<call function="'testStep'">
{ 'stepMessage' : '%s Admin modifying password policy setting.' % msg }
</call>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToModify' : basepwp ,
'listAttributes' : listAttrs ,
'changetype' : 'replace' }
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Get Default Password Policy.' % msg }
</call>
<script>
options=[]
options.append('--policy-name "Default Password Policy"')
dsconfigOptions=' '.join(options)
</script>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'subcommand' : 'get-password-policy-prop',
'optionsString' : dsconfigOptions
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Grace Login
#@TestName Admin Changing min password age beyond limit
#@TestIssue 2032
#@TestPurpose Testing issue 2032
#@TestPreamble none
#@TestStep Change Pwd Policy min password age beyond limit
set ds-cfg-min-password-age 10 seconds
ds-cfg-max-password-age 3 seconds
ds-cfg-password-expiration-warning-interval 1 s
#@TestPostamble none
#@TestResult Success if modifyAnAttribute returns 53
-->
<testcase name="getTestCaseName
('Preamble, Admin Change min pwd age beyond limit')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
listAttrs=[]
listAttrs.append("ds-cfg-min-password-age:10 seconds")
listAttrs.append("ds-cfg-max-password-age:3 seconds")
listAttrs.append("ds-cfg-password-expiration-warning-interval:1 seconds")
</script>
<call function="'testStep'">
{ 'stepMessage' : '%s Admin modifying password policy settings.' % msg }
</call>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToModify' : basepwp ,
'listAttributes' : listAttrs ,
'changetype' : 'replace' ,
'expectedRC' : 53 }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Grace Login
#@TestName Admin Changing min password age to limit
#@TestIssue 2032
#@TestPurpose Testing issue 2032
#@TestPreamble none
#@TestStep Change Pwd Policy min password age to limit
set ds-cfg-min-password-age 2 seconds
ds-cfg-max-password-age 3 seconds
ds-cfg-password-expiration-warning-interval 1 s
#@TestPostamble none
#@TestResult Success if modifyAnAttribute returns 53
-->
<testcase name="getTestCaseName('Preamble, Admin Change min pwd age to limit')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
listAttrs=[]
listAttrs.append("ds-cfg-min-password-age:2 seconds")
listAttrs.append("ds-cfg-max-password-age:3 seconds")
listAttrs.append("ds-cfg-password-expiration-warning-interval:1 seconds")
</script>
<call function="'testStep'">
{ 'stepMessage' : '%s Admin modifying password policy settings.' % msg }
</call>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToModify' : basepwp ,
'listAttributes' : listAttrs ,
'changetype' : 'replace' ,
'expectedRC' : 53 }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Grace Login
#@TestName Admin Changing expire warning interval beyond limit
#@TestIssue 2032
#@TestPurpose Testing issue 2032
#@TestPreamble none
#@TestStep Change Pwd Pol expire warning interval beyond limit
set ds-cfg-min-password-age 1 seconds
ds-cfg-max-password-age 3 seconds
ds-cfg-password-expiration-warning-interval 10 s
#@TestPostamble none
#@TestResult Success if modifyAnAttribute returns 53
-->
<testcase name="getTestCaseName
('Preamble, Admin Change expire warning interval beyond limit')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
listAttrs=[]
listAttrs.append("ds-cfg-min-password-age:1 seconds")
listAttrs.append("ds-cfg-max-password-age:3 seconds")
listAttrs.append("ds-cfg-password-expiration-warning-interval:10 seconds")
</script>
<call function="'testStep'">
{ 'stepMessage' : '%s Admin modifying password policy settings.' % msg }
</call>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToModify' : basepwp ,
'listAttributes' : listAttrs ,
'changetype' : 'replace' ,
'expectedRC' : 53 }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Grace Login
#@TestName Search Bad Pwd 4x
#@TestIssue none
#@TestPurpose Search Bad Pwd 4x
#@TestPreamble none
#@TestStep Pause 2 seconds
#@TestStep Verify grace login use times with manage-account
#@TestStep Search Bind 1 SearchObject returns 19
#@TestStep Verify remaining grace login with manage-account
#@TestStep Verify grace login use times with manage-account
#@TestStep Search Bind 2 SearchObject returns 19
#@TestStep Verify remaining grace login with manage-account
#@TestStep Search Bind 3 SearchObject returns 49
#@TestStep Verify remaining grace login with manage-account
#@TestStep Search Bind 4 SearchObject returns 49
#@TestStep Verify remaining grace login with manage-account
#@TestStep Verify manage-account get-all
#@TestPostamble none
#@TestResult Success if all the steps are PASS
-->
<testcase name="getTestCaseName('Search Bad Pwd 4x')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : '%s Get Default Password Policy.' % msg }
</call>
<script>
options=[]
options.append('--policy-name "Default Password Policy"')
dsconfigOptions=' '.join(options)
</script>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'subcommand' : 'get-password-policy-prop',
'optionsString' : dsconfigOptions
}
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Pause 2 seconds.' % msg }
</call>
<call function="'Sleep'">
{ 'sleepForMilliSeconds' : '2000' }
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Verify remaining grace login count with manage-account ' % msg }
</call>
<call function="'manageAccountWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-remaining-grace-login-count' ,
'targetDn' : 'uid=btalbot,%s' % basedn }
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Verify grace login use times with manage-account ' % msg }
</call>
<call function="'manageAccountWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-grace-login-use-times' ,
'targetDn' : 'uid=btalbot,%s' % basedn }
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{ 'returnString' : returnString ,
'expectedString' : 'Grace Login Use Times:' }
</call>
<!-- The password has expired, entering grace login period -->
<script>
remaining_grace_login_count = 2
</script>
<loop from="1" to="grace_login_count" var="loop">
<sequence>
<call function="'testStep'">
{ 'stepMessage' : '%s Search Bind %s' % (msg,loop) }
</call>
<call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'uid=btalbot,%s' % basedn ,
'dsInstancePswd' : 'trident',
'dsBaseDN' : 'dc=example,dc=com' ,
'dsFilter' : 'objectclass=*' ,
'extraParams' : '-s base' ,
'expectedRC' : 19 }
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Verify remaining grace login count.' % msg }
</call>
<call function="'manageAccountWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-remaining-grace-login-count' ,
'targetDn' : 'uid=btalbot,%s' % basedn }
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{ 'returnString' : returnString ,
'expectedString' : 'Remaining Grace Login Count: %s' % remaining_grace_login_count }
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Verify grace login use times.' % msg }
</call>
<call function="'manageAccountWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-grace-login-use-times' ,
'targetDn' : 'uid=btalbot,%s' % basedn }
</call>
<script>
returnString = STAXResult[0][1]
</script>
<!-- TODO: WTF -->
<call function="'checktestString'">
{ 'returnString' : returnString ,
'expectedString' : 'Grace Login Use Times: 20' }
</call>
<script>
remaining_grace_login_count -= 1
</script>
</sequence>
</loop>
<!-- The password has expired, no grace logins remaining -->
<call function="'testStep'">
{ 'stepMessage' : '%s Search Bind 4' % msg }
</call>
<call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'uid=btalbot,%s' % basedn ,
'dsInstancePswd' : 'trident',
'dsBaseDN' : 'dc=example,dc=com' ,
'dsFilter' : 'objectclass=*' ,
'extraParams' : '-s base' ,
'expectedRC' : 49 }
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Verify remaining grace login with manage-account' % msg }
</call>
<call function="'manageAccountWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-remaining-grace-login-count' ,
'targetDn' : 'uid=btalbot,%s' % basedn }
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{ 'returnString' : returnString ,
'expectedString' : 'Remaining Grace Login Count: 0' }
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Verify manage-account get-all' % msg }
</call>
<call function="'manageAccountWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-all' ,
'targetDn' : 'uid=btalbot,%s' % basedn }
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{ 'returnString' : returnString ,
'expectedString' : msg1 ,
'expectedString' : msg2 ,
'expectedString' : msg3 }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Grace Login
#@TestName Reset Pwd
#@TestIssue none
#@TestPurpose Reset Pwd
#@TestPreamble none
#@TestStep Search Bind 1 SearchObject returns 19
#@TestStep User resetting password
#@TestStep Admin reset max password age set
max-password-age to 24 h
#@TestStep Search Bind 2 SearchObject returns 0
#@TestStep Search Bind 2 SearchObject returns 0
#@TestPostamble none
#@TestResult Success if the 5 steps are PASS
-->
<testcase name="getTestCaseName('Reset Pwd')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : '%s Reset Pwd, Search Bind 1' % msg }
</call>
<call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'uid=kwinters,%s' % basedn ,
'dsInstancePswd' : 'forsook',
'dsBaseDN' : 'dc=example,dc=com' ,
'dsFilter' : 'objectclass=*' ,
'extraParams' : '-s base' ,
'expectedRC' : 19 }
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Reset Pwd, User resetting password' % msg }
</call>
<call function="'ldapPasswordModifyWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'uid=kwinters,%s' % basedn ,
'dsInstancePswd' : 'forsook' ,
'dsAuthzID' : 'dn:uid=kwinters,%s' % basedn ,
'dsNewPassword' : 'newforsook' ,
'knownIssue' : '3249' }
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Reset Pwd, Admin reset max password age' % msg }
</call>
<call function="'modifyPwdPolicy'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'propertyName' : 'Default Password Policy' ,
'attributeName' : 'max-password-age' ,
'attributeValue' : '24 h' }
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Reset Pwd, Search Bind 2' % msg }
</call>
<call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'uid=kwinters,%s' % basedn ,
'dsInstancePswd' : 'newforsook',
'dsBaseDN' : 'dc=example,dc=com' ,
'dsFilter' : 'objectclass=*' ,
'extraParams' : '-s base' }
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Reset Pwd, Search Bind 3' % msg }
</call>
<call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'uid=kwinters,%s' % basedn ,
'dsInstancePswd' : 'newforsook',
'dsBaseDN' : 'dc=example,dc=com' ,
'dsFilter' : 'objectclass=*' ,
'extraParams' : '-s base' }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Grace Login
#@TestName Admin Resetting Pwd Policy Settings
#@TestIssue none
#@TestPurpose Admin Resetting Pwd Policy Settings
#@TestPreamble none
#@TestStep set ds-cfg-expire-passwords-without-warning to
false ds-cfg-max-password-age 0 seconds
ds-cfg-min-password-age 0 seconds
ds-cfg-password-expiration-warning-interval 5 d
ds-cfg-grace-login-count 0
#@TestPostamble none
#@TestResult Success if modifyAnAttribute returns 0
-->
<testcase name="getTestCaseName('Postamble, Admin Reset Pwd Policy Settings')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
listAttrs=[]
listAttrs.append("ds-cfg-expire-passwords-without-warning:false")
listAttrs.append("ds-cfg-allow-expired-password-changes:false")
listAttrs.append("ds-cfg-max-password-age:0 seconds")
listAttrs.append("ds-cfg-min-password-age:0 seconds")
listAttrs.append("ds-cfg-password-expiration-warning-interval:5 d")
listAttrs.append("ds-cfg-grace-login-count:0")
</script>
<call function="'testStep'">
{ 'stepMessage' : '%s Admin resetting password policy settings.' % msg }
</call>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToModify' : basepwp ,
'listAttributes' : listAttrs ,
'changetype' : 'replace' }
</call>
<call function="'testStep'">
{ 'stepMessage' : '%s Get Default Password Policy.' % msg }
</call>
<script>
options=[]
options.append('--policy-name "Default Password Policy"')
dsconfigOptions=' '.join(options)
</script>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'subcommand' : 'get-password-policy-prop',
'optionsString' : dsconfigOptions
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
</sequence>
</function>
</stax>