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

mkeyes
29.59.2007 e880c8b7f01ace6d56371a24167aa282cc824e2a
Adding parameters, customKeyMgr and customTrustMgr, to the functions, configureSSL and unconfigureSSL. 
This allows the use of these functions to create and delete new key managers and trust managers.
1 files modified
105 ■■■■■ changed files
opends/tests/functional-tests/shared/functions/security.xml 105 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/functions/security.xml
@@ -466,6 +466,18 @@
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="customKeyMgr" type="optional" default="''">
        <function-arg-description>
          Name for a new key manager
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="customTrustMgr" type="optional" default="''">
        <function-arg-description>
          Name for a new trust manager
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
@@ -474,11 +486,28 @@
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!--- configure Key Manager Provider -->
      <message>
        'Configure Key Manager Provider'
      </message>
      
    <if expr="len(customKeyMgr.strip()) != 0">
      <call function="'dsconfig'">
        { 'location'       : location ,
          'dsPath'         : dsPath ,
          'dsInstanceHost' : dsInstanceHost ,
          'dsInstancePort' : dsInstancePort ,
          'dsInstanceDn'   : dsInstanceDn ,
          'dsInstancePswd' : dsInstancePswd ,
          'subcommand'     : 'create-key-manager' ,
          'objectType'     : 'manager-name' ,
          'objectName'     :  customKeyMgr ,
          'optionsString'  :  '--type file-based --set enabled:true --set key-store-file:config/keystore --set key-store-pin:%s --set key-store-type:JKS' % keystorePin,
          'expectedRC'     : 0
        }
      </call>
      <else>
      <call function="'dsconfig'">
        { 'location'       : location ,
          'dsPath'         : dsPath ,
@@ -493,12 +522,30 @@
          'expectedRC'     : 0 
        }
      </call>
      </else>
    </if>
      
      <!--- configure Trust Manager Provider -->
      <message>
         'Configure Trust Manager Provider'
      </message>
      
    <if expr="len(customTrustMgr.strip()) != 0">
      <call function="'dsconfig'">
        { 'location'       : location ,
          'dsPath'         : dsPath ,
          'dsInstanceHost' : dsInstanceHost ,
          'dsInstancePort' : dsInstancePort ,
          'dsInstanceDn'   : dsInstanceDn ,
          'dsInstancePswd' : dsInstancePswd ,
          'subcommand'     : 'create-trust-manager' ,
          'objectType'     : 'manager-name' ,
          'objectName'     :  customTrustMgr ,
          'optionsString'  :  '--type generic --set enabled:true --set java-implementation-class:org.opends.server.extensions.BlindTrustManagerProvider' ,
          'expectedRC'     : 0
        }
      </call>
      <else>
      <call function="'dsconfig'">
        { 'location'       : location ,
          'dsPath'         : dsPath ,
@@ -513,6 +560,9 @@
          'expectedRC'     : 0
        }
      </call>
      </else>
    </if>
      
      <!--- Enable LDAPS Connection Handler -->
      <message>
@@ -521,7 +571,13 @@
      
      <script>
        option1='--set ssl-cert-nickname:%s' % certAlias
        if customTrustMgr:
          option2='--set trust-manager-provider-dn:"cn=%s,cn=Trust Manager Providers,cn=config"' % (customTrustMgr)
        else:
        option2='--set trust-manager-provider-dn:"cn=Blind Trust,cn=Trust Manager Providers,cn=config"' 
        if customKeyMgr:
          option3='--set key-manager-provider-dn:"cn=%s,cn=Key Manager Providers,cn=config"' % (customKeyMgr)
        else:
        option3='--set key-manager-provider-dn:"cn=%s,cn=Key Manager Providers,cn=config"' % (keystoreType)
        option4='--set listen-port:%s' % DIRECTORY_INSTANCE_SSL_PORT
        option5='--set enabled:true' 
@@ -907,6 +963,18 @@
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="customKeyMgr" type="optional" default="''">
        <function-arg-description>
          Name for a new key manager
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="customTrustMgr" type="optional" default="''">
        <function-arg-description>
          Name for a new trust manager
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="extraParams" type="optional">
        <function-arg-description>
          Optional extra parameters for specific test cases
@@ -930,7 +998,7 @@
          'subcommand'     :  'set-connection-handler-prop' ,
          'objectType'     : 'handler-name' ,
          'objectName'     : 'LDAPS Connection Handler',
          'optionsString'  :  '--set enabled:false',
          'optionsString'  : '--set enabled:false --reset key-manager-provider-dn --reset trust-manager-provider-dn --reset ssl-cert-nickname',
          'expectedRC'     : 0 
        }
      </call>
@@ -939,6 +1007,21 @@
      <message>
        'Disabling SSL Trust Manager Provider'
      </message>
      <if expr="len(customTrustMgr.strip()) != 0">
        <call function="'dsconfig'">
        { 'location'       : location ,
          'dsPath'         : dsPath ,
          'dsInstanceHost' : dsInstanceHost ,
          'dsInstancePort' : dsInstancePort ,
          'dsInstanceDn'   : dsInstanceDn ,
          'dsInstancePswd' : dsInstancePswd ,
          'subcommand'     : 'delete-trust-manager' ,
          'objectType'     : 'manager-name' ,
          'objectName'     :  customTrustMgr ,
          'expectedRC'     : 0
        }
        </call>
        <else>
      <call function="'dsconfig'">
        { 'location'       : location,
          'dsPath'         : dsPath,
@@ -953,11 +1036,29 @@
          'expectedRC'     : 0
        }
      </call>
      </else>
    </if>
      <!--- Disable Key Manager Provider -->
      <message>
        'Disabling Key Manager Provider'
      </message>
      
      <if expr="len(customKeyMgr.strip()) != 0">
        <call function="'dsconfig'">
        { 'location'       : location ,
          'dsPath'         : dsPath ,
          'dsInstanceHost' : dsInstanceHost ,
          'dsInstancePort' : dsInstancePort ,
          'dsInstanceDn'   : dsInstanceDn ,
          'dsInstancePswd' : dsInstancePswd ,
          'subcommand'     : 'delete-key-manager' ,
          'objectType'     : 'manager-name' ,
          'objectName'     :  customKeyMgr ,
          'expectedRC'     : 0
        }
        </call>
        <else>
      <call function="'dsconfig'">
        { 'location'       : location,
          'dsPath'         : dsPath,
@@ -972,6 +1073,8 @@
          'expectedRC'     : 0 
        }
      </call>
        </else>
      </if>
    </sequence>
  </function>