mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

el_kaboing
12.05.2006 597b3754efba08cf99f30419b7cf3f9d4bf74b31
Added functional tests for Issue 323.
5 files added
2 files modified
445 ■■■■■ changed files
opends/tests/functional-tests/shared/data/security/pwd_storage/admin_add_many_schemes.ldif 36 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/data/security/pwd_storage/admin_delete_MD5.ldif 29 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/data/security/pwd_storage/admin_depr_MD5.ldif 29 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/data/security/pwd_storage/user_change_pwd_depr_schemes.ldif 29 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/functions/utils.xml 42 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/security/pwd_storage/security_deprecated_schemes.xml 276 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_storage.xml 4 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/data/security/pwd_storage/admin_add_many_schemes.ldif
New file
@@ -0,0 +1,36 @@
# 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
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# 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
#
#      Portions Copyright 2006 Sun Microsystems, Inc.
#
dn: cn=Default Password Policy,cn=Password Policies,cn=config
changetype: modify
add: ds-cfg-default-password-storage-scheme
ds-cfg-default-password-storage-scheme: MD5
-
add: ds-cfg-default-password-storage-scheme
ds-cfg-default-password-storage-scheme: BASE64
-
add: ds-cfg-default-password-storage-scheme
ds-cfg-default-password-storage-scheme: SSHA256
opends/tests/functional-tests/shared/data/security/pwd_storage/admin_delete_MD5.ldif
New file
@@ -0,0 +1,29 @@
# 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
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# 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
#
#      Portions Copyright 2006 Sun Microsystems, Inc.
#
dn: cn=Default Password Policy,cn=Password Policies,cn=config
changetype: modify
delete: ds-cfg-default-password-storage-scheme
ds-cfg-default-password-storage-scheme: MD5
opends/tests/functional-tests/shared/data/security/pwd_storage/admin_depr_MD5.ldif
New file
@@ -0,0 +1,29 @@
# 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
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# 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
#
#      Portions Copyright 2006 Sun Microsystems, Inc.
#
dn: cn=Default Password Policy,cn=Password Policies,cn=config
changetype: modify
replace: ds-cfg-deprecated-password-storage-scheme
ds-cfg-deprecated-password-storage-scheme: MD5
opends/tests/functional-tests/shared/data/security/pwd_storage/user_change_pwd_depr_schemes.ldif
New file
@@ -0,0 +1,29 @@
# 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
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# 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
#
#      Portions Copyright 2006 Sun Microsystems, Inc.
#
dn: uid=tmason,ou=People,ou=password tests,o=Pwd Storage Tests,dc=example,dc=com
changetype: modify
replace: userpassword
userpassword: squinted
opends/tests/functional-tests/shared/functions/utils.xml
@@ -161,6 +161,48 @@
      
  </function>
  <function name="checktestStringNotPresent">
    <function-prolog>
        This function checks the return string against an expected return substring that should not be present for a testcase
    </function-prolog>
    <function-map-args>
        <function-required-arg name="testString">
            the substring being tested from the command
        </function-required-arg>
        <function-required-arg name="returnString">
            the return string received from command
        </function-required-arg>
    </function-map-args>
      <sequence>
         <script>
              import re
              searchre = re.compile('%s' % testString)
            </script>
            <if expr='re.search(searchre, returnString) == None'>
              <sequence>
              <tcstatus result="'pass'"/>
              <message log="1">
                'Success: Did Not Find substring, %s, in the return string' % (testString)
              </message>
              </sequence>
            <else>
              <sequence>
              <tcstatus result="'fail'"/>
              <message log="1" level="'Error'">
                'Error: Found substring, %s, in the return string, %s' % (testString, returnString)
              </message>
              </sequence>
            </else>
            </if>
      </sequence>
  </function>
  <function name="isAlive">
    <function-prolog>
opends/tests/functional-tests/testcases/security/pwd_storage/security_deprecated_schemes.xml
New file
@@ -0,0 +1,276 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<!---
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 *
 *
 *      Portions Copyright 2006 Sun Microsystems, Inc.
 -->
<stax>
  <defaultcall function="deprecated_schemes"/>
  <function name="deprecated_schemes">
      <sequence>
        <!--- Test case: Admin Add Three Additional Pwd Storage Schemes -->
        <testcase name="'Security: Depr Pwd Schemes: Preamble'">
          <sequence>
            <message>
               'Security: Deprecated Pwd Schemes: Preamble Step 1. Admin Adding 3 Pwd Storage Schemes'
            </message>
            <call function="'modifyEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'entryToBeModified'   : '%s/security/pwd_storage/admin_add_many_schemes.ldif' % STAGED_DATA_DIR }
            </call>
            <if expr="RC != 0">
                <tcstatus result="'fail'"/>
            </if>
            <message>
               'Security: Deprecated Pwd Schemes: Preamble Step 2. User Change Password'
            </message>
            <call function="'modifyEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=tmason,ou=people,ou=password tests,o=Pwd Storage Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'squatted' ,
                'entryToBeModified'   : '%s/security/pwd_storage/user_change_pwd_depr_schemes.ldif' % STAGED_DATA_DIR }
            </call>
            <if expr="RC != 0">
                <tcstatus result="'fail'"/>
            </if>
             <message>
               'Security: Deprecating Pwd Schemes: Preamble Step 3. Checking for MD5 Scheme Before Deprecating'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'         : 'uid=tmason,ou=people,ou=password tests,o=Pwd Storage Tests,dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'attributes'      : 'userpassword' }
            </call>
            <script>
             returnString = STAXResult[0][1]
            </script>
            <call function="'checktestString'">
                { 'returnString'       : returnString ,
                  'expectedString'     : 'MD5' }
            </call>
          </sequence>
        </testcase>
        <!--- Test Case : Admin Deprecate MD5 Scheme-->
        <testcase name="'Security: Depr Pwd Schemes: Admin Deprecate MD5'">
          <sequence>
            <message>
               'Security: Deprecated Pwd Schemes: Admin Deprecating MD5 Scheme'
            </message>
            <call function="'modifyEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'entryToBeModified'   : '%s/security/pwd_storage/admin_depr_MD5.ldif' % STAGED_DATA_DIR }
            </call>
            <if expr="RC != 0">
                <tcstatus result="'fail'"/>
            </if>
            <message>
               'Security: Deprecated Pwd Schemes: Admin Removing MD5 Scheme From Default'
            </message>
            <call function="'modifyEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'entryToBeModified'   : '%s/security/pwd_storage/admin_delete_MD5.ldif' % STAGED_DATA_DIR }
            </call>
            <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult }
            </call>
          </sequence>
        </testcase>
        <!--- Test Case : User Bind -->
        <testcase name="'Security: Depr Pwd Schemes: User Bind'">
          <sequence>
            <message>
               'Security: Deprecated Pwd Schemes: User Binding'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=tmason,ou=people,ou=password tests,o=Pwd Storage Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'squinted' ,
                'dsBaseDN'         : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base' }
            </call>
            <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult }
            </call>
          </sequence>
        </testcase>
        <!--- Test Case : Check that MD5 hashed password was deleted from from user's entry-->
        <testcase name="'Security: Depr Pwd Schemes: Check For Deletion'">
          <sequence>
             <message>
               'Security: Deprecating Pwd Schemes: Checking for MD5 Hashed Pwd After Deprecating'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'         : 'uid=tmason,ou=people,ou=password tests,o=Pwd Storage Tests,dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'attributes'      : 'userpassword' }
            </call>
            <script>
             returnString = STAXResult[0][1]
            </script>
            <call function="'checktestStringNotPresent'">
                { 'returnString'       : returnString ,
                  'testString'         : 'MD5' }
            </call>
          </sequence>
        </testcase>
        <!--- Test Case : Check that other schemes were not deleted from from user's entry-->
        <testcase name="'Security: Depr Pwd Schemes: Check For Non-Deletions - SSHA'">
          <sequence>
             <message>
               'Security: Deprecating Pwd Schemes: Checking for SSHA256 Hashed Pwd After Deprecating'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'         : 'uid=tmason,ou=people,ou=password tests,o=Pwd Storage Tests,dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'attributes'      : 'userpassword' }
            </call>
            <script>
             returnString = STAXResult[0][1]
            </script>
            <call function="'checktestString'">
                { 'returnString'       : returnString ,
                  'expectedString'     : 'SSHA256' }
            </call>
          </sequence>
        </testcase>
        <testcase name="'Security: Depr Pwd Schemes: Check For Non-Deletions - BASE64'">
          <sequence>
             <message>
               'Security: Deprecating Pwd Schemes: Checking for BASE64 Hashed Pwd After Deprecating'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'         : 'uid=tmason,ou=people,ou=password tests,o=Pwd Storage Tests,dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'attributes'      : 'userpassword' }
            </call>
            <script>
             returnString = STAXResult[0][1]
            </script>
            <call function="'checktestString'">
                { 'returnString'       : returnString ,
                  'expectedString'     : 'BASE64' }
            </call>
          </sequence>
        </testcase>
        <!--- Test case: Admin Reset To SSHA Storage Scheme -->
        <testcase name="'Security: Depr Pwd Schemes: Postamble'">
          <sequence>
            <message>
               'Security: Deprecating Pwd Schemes: Postamble - Admin Resetting to SSHA Storage Scheme'
            </message>
            <call function="'modifyEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'entryToBeModified'   : '%s/security/pwd_storage/admin_reset_SSHA.ldif' % STAGED_DATA_DIR }
            </call>
            <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult }
            </call>
          </sequence>
        </testcase>
        <return>RC</return>
     </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_storage.xml
@@ -113,6 +113,10 @@
        <call function="'multiple_schemes'" />
        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
          file="'%s/testcases/security/pwd_storage/security_deprecated_schemes.xml' % (TESTS_DIR)"/>
        <call function="'deprecated_schemes'" />
        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
          file="'%s/testcases/security/pwd_storage/security_teardown_pwd_storage.xml' % (TESTS_DIR)"/>
        <call function="'teardown_pwd_storage'" />