1963N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1963N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
1963N/A<!--
1963N/A ! CDDL HEADER START
1963N/A !
1963N/A ! The contents of this file are subject to the terms of the
1963N/A ! Common Development and Distribution License, Version 1.0 only
1963N/A ! (the "License"). You may not use this file except in compliance
1963N/A ! with the License.
1963N/A !
1963N/A ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
1963N/A ! or http://forgerock.org/license/CDDLv1.0.html.
1963N/A ! See the License for the specific language governing permissions
1963N/A ! and limitations under the License.
1963N/A !
1963N/A ! When distributing Covered Code, include this CDDL HEADER in each
1963N/A ! file and include the License file at legal-notices/CDDLv1_0.txt.
1963N/A ! If applicable, add the following below this CDDL HEADER, with the
1963N/A ! fields enclosed by brackets "[]" replaced with your own identifying
1963N/A ! information:
1963N/A ! Portions Copyright [yyyy] [name of copyright owner]
1963N/A !
1963N/A ! CDDL HEADER END
1963N/A !
3215N/A ! Copyright 2008-2009 Sun Microsystems, Inc.
1963N/A ! Portions Copyright 2013 ForgeRock AS
1963N/A ! -->
2086N/A<stax>
1963N/A
1963N/A <defaultcall function="security"/>
1963N/A
1963N/A <function name="security">
1963N/A
1963N/A <sequence>
1963N/A
1963N/A <!--- Test Suite information
1963N/A #@TestSuiteName Setup-Uninstall security Tests
1963N/A #@TestSuitePurpose Test all secuirty related options of the
1963N/A setup and uninstall commands
1963N/A #@TestSuiteGroup security
2086N/A #@TestSuiteID security Tests
2086N/A #@TestGroup Setup-Uninstall
2086N/A #@TestScript security.xml
1963N/A #@TestHTMLLink http://opends.dev.java.net/
1963N/A -->
1963N/A
1963N/A <script>
1963N/A if not CurrentTestPath.has_key('group'):
3209N/A CurrentTestPath['group'] = 'setup'
1963N/A CurrentTestPath['suite'] = 'security'
1963N/A </script>
1963N/A
1963N/A <call function="'testSuite_Preamble'"/>
1963N/A
1963N/A
1963N/A <call function="'getFreePort'">
1963N/A {
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A 'port' : 8500,
1963N/A }
1963N/A </call>
1963N/A <script>SEC_I1_PORT = STAXResult</script>
1963N/A
1963N/A <call function="'getFreePort'">
1963N/A {
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A 'port' : 8520,
1963N/A }
1963N/A </call>
1963N/A <script>SEC_I1_SPORT = STAXResult</script>
1963N/A
1963N/A <call function="'getFreePort'">
1963N/A {
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A 'port' : 8554,
1963N/A }
1963N/A </call>
1963N/A <script>SEC_I1_ADMIN_PORT = STAXResult</script>
1963N/A
1963N/A <call function="'getFreePort'">
1963N/A {
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A 'port' : 8540,
1963N/A }
1963N/A </call>
1963N/A <script>SEC_I1_REPL_PORT = STAXResult</script>
1963N/A
2086N/A <call function="'getFreePort'">
1963N/A {
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A 'port' : 8600,
1963N/A }
1963N/A </call>
1963N/A <script>SEC_I2_PORT = STAXResult</script>
1963N/A
1963N/A <call function="'getFreePort'">
1963N/A {
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A 'port' : 8620,
1963N/A }
1963N/A </call>
3642N/A <script>SEC_I2_SPORT = STAXResult</script>
1963N/A
3642N/A <call function="'getFreePort'">
1963N/A {
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A 'port' : 8654,
1963N/A }
1963N/A </call>
1963N/A <script>SEC_I2_ADMIN_PORT = STAXResult</script>
1963N/A
1963N/A <call function="'getFreePort'">
1963N/A {
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A 'port' : 8640,
1963N/A }
1963N/A </call>
1963N/A <script>SEC_I2_REPL_PORT = STAXResult</script>
1963N/A
1963N/A <message>
1963N/A 'Got these free ports for I1: %s, %s, %s, %s' \
1963N/A % (SEC_I1_PORT, SEC_I1_SPORT, SEC_I1_ADMIN_PORT, SEC_I1_REPL_PORT)
1963N/A </message>
2086N/A <message>
1963N/A 'Got these free ports for I2: %s, %s, %s, %s' \
1963N/A % (SEC_I2_PORT, SEC_I2_SPORT, SEC_I2_ADMIN_PORT, SEC_I2_REPL_PORT)
1963N/A </message>
1963N/A
1963N/A <!--- Test Case information
1963N/A #@TestMarker Setup-Uninstall Security tests
1963N/A #@TestName Setup-Uninstall: Security:
1963N/A security_starttls_ssl
2086N/A #@TestID security_starttls_ssl
2086N/A #@TestPurpose Test security related options of setup/uninstall
2086N/A #@TestPreamble
2086N/A #@TestStep Setup I1, with SSL
2086N/A Setup I2, with StartTLS
1963N/A Create o=o1 on I1 and I2, and import data on I1
1963N/A Setup replication I1 - I2
1963N/A Check SSL works OK on I1 and I2
1963N/A Check StartTLS not-OK on I1
1963N/A Check StartTLS OK on I2
1963N/A Export server certs I1 and I2
1963N/A Create new JKS keystore and import I1 and I2 certs
1963N/A Uninstall I1, using new keystore
1963N/A Uninstall I2
1963N/A #@TestPostamble
1963N/A #@TestResult PASS if all steps ran without errors
1963N/A -->
1963N/A <testcase name="getTestCaseName('security_starttls_ssl')">
1963N/A <sequence>
1963N/A
1963N/A <script>
1963N/A DM_DN = 'cn=DM'
1963N/A DM_PW = 'secret12'
1963N/A DM_PW_FILE = '%s/setup/pwd-security.ldif' % remote.data
1963N/A
1963N/A if is_windows_platform(STAF_REMOTE_HOSTNAME):
1963N/A KEYTOOL = '%s/bin/keytool.exe' % (JAVA_HOME)
2086N/A else:
2086N/A KEYTOOL = '%s/bin/keytool' % (JAVA_HOME)
2086N/A
1963N/A SEC_I1_BASE = '%s/sec_i1' % (OUT_GROUP)
1963N/A SEC_I1_ROOT = '%s/%s' % (SEC_I1_BASE, OPENDSNAME)
1963N/A SEC_I2_BASE = '%s/sec_i2' % (OUT_GROUP)
1963N/A SEC_I2_ROOT = '%s/%s' % (SEC_I2_BASE, OPENDSNAME)
1963N/A MY_KEYSTORE = '%s/ks' % OUT_GROUP
1963N/A SEC_O1_LDIF = '%s/setup/sec-o1.ldif' % remote.data
1963N/A </script>
1963N/A
1963N/A <call function="'checkFileExists'">
1963N/A {
1963N/A 'location' : STAF_REMOTE_HOSTNAME,
1963N/A 'file' : KEYTOOL
1963N/A }
1963N/A </call>
1963N/A
1963N/A <!-- 1.1. Setup I1 -->
1963N/A <message>'++ Setup of I1'</message>
1963N/A <call function="'runSTAFCommand'">
1963N/A { 'name' : 'Create directory to contain I1',
2086N/A 'location' : STAF_REMOTE_HOSTNAME,
1963N/A 'service' : 'FS',
1963N/A 'request' : 'CREATE',
1963N/A 'arguments' : 'DIRECTORY %s FAILIFEXISTS' % SEC_I1_BASE
1963N/A }
1963N/A </call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to create directory',
}
</call>
<call function="'runSTAFCommand'">
{ 'name' : 'Extract OpenDS ZIP file',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'ZIP',
'request' : 'UNZIP',
'arguments' : 'ZIPFILE %s/%s TODIRECTORY %s RESTOREPERMISSION' \
% (DIRECTORY_INSTANCE_DIR, ZIPNAME, SEC_I1_BASE)
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to unzip OpenDS ZIP file',
}
</call>
<script>
c = '%s/setup%s' % (SEC_I1_ROOT, fileExt)
p = []
p.append('--cli --hostname %s' % (STAF_REMOTE_HOSTNAME))
p.append('--no-prompt --ldapPort %s' % (SEC_I1_PORT))
p.append('--ldapsPort %s' % SEC_I1_SPORT)
p.append('--adminConnectorPort %s' % SEC_I1_ADMIN_PORT)
p.append('--rootUserDN "%s"' % DM_DN)
p.append('--rootUserPassword "%s"' % DM_PW)
p.append('--generateSelfSignedCertificate %s' % licenseOption)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch setup command for I1',
'command' : c,
'arguments' : p,
'path' : SEC_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-setup-i1.txt' % OUT_GROUP,
}
</call>
<!-- 1.2. Check I1 -->
<message>'++ Check status of I1'</message>
<script>
c = '%s/%s/status%s' % (SEC_I1_ROOT, fileFolder, fileExt)
p = []
p.append('--no-prompt --trustAll')
p.append('--bindDN "%s" --bindPassword "%s"' % (DM_DN, DM_PW))
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch status command for I1',
'command' : c,
'arguments' : p,
'path' : SEC_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-status-i1.txt' % OUT_GROUP,
}
</call>
<script>
grepFile = '%s/sec-status-i1.txt' % OUT_GROUP
</script>
<call function="'grep'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'filename' : grepFile,
'testString': 'Server Run Status: Started',
'expectedRC': 0,
}
</call>
<!-- 1.3. Check config/admin-keystore -->
<message>'++ Check file config/admin-keystore exists'</message>
<script>
ks = '%s/config/admin-keystore' % SEC_I1_ROOT
</script>
<call function="'checkFileExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
'file' : ks
}
</call>
<!-- 1.4. Check StartTLS non-enablement -->
<message>'++ Check StartTLS is disabled'</message>
<script>
ent = 'cn=LDAP Connection Handler,cn=Connection Handlers,cn=config'
</script>
<call function="'ldapSearchWithScript'">
{ 'dsInstancePort' : SEC_I1_PORT,
'dsInstanceDn' : DM_DN,
'dsInstancePswd' : DM_PW,
'dsBaseDN' : ent,
'dsFilter' : 'objectclass=*',
'dsAttributes' : 'ds-cfg-allow-start-tls',
'expectedRC' : 0,
'outputPath' : OUT_GROUP,
'outputFile' : 'sec-ldapsearch-i1.txt',
}
</call>
<script>
grepFile = '%s/sec-ldapsearch-i1.txt' % OUT_GROUP
</script>
<call function="'grep'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'filename' : grepFile,
'testString': 'ds-cfg-allow-start-tls: false',
'expectedRC': 0,
}
</call>
<!-- 2.1. Setup I2 -->
<message>'++ Setup I2'</message>
<call function="'runSTAFCommand'">
{ 'name' : 'Create directory to contain I2',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'CREATE',
'arguments' : 'DIRECTORY %s FAILIFEXISTS' % SEC_I2_BASE
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to create directory',
}
</call>
<call function="'runSTAFCommand'">
{ 'name' : 'Extract OpenDS ZIP file',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'ZIP',
'request' : 'UNZIP',
'arguments' : 'ZIPFILE %s/%s TODIRECTORY %s RESTOREPERMISSION' \
% (DIRECTORY_INSTANCE_DIR, ZIPNAME, SEC_I2_BASE)
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to unzip OpenDS ZIP file',
}
</call>
<script>
c = '%s/setup%s' % (SEC_I2_ROOT, fileExt)
p = []
p.append('--cli --hostname %s' % (STAF_REMOTE_HOSTNAME))
p.append('--no-prompt --ldapPort %s' % (SEC_I2_PORT))
p.append('--ldapsPort %s' % SEC_I2_SPORT)
p.append('--adminConnectorPort %s' % SEC_I2_ADMIN_PORT)
p.append('--rootUserDN "%s"' % DM_DN)
p.append('--rootUserPassword "%s"' % DM_PW)
p.append('--generateSelfSignedCertificate --enableStartTLS %s' \
% licenseOption)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch setup command for I2',
'command' : c,
'arguments' : p,
'path' : SEC_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-setup-i2.txt' % OUT_GROUP,
}
</call>
<!-- 2.2. Check I2 -->
<message>'++ Check status of I2'</message>
<script>
c = '%s/%s/status%s' % (SEC_I2_ROOT, fileFolder, fileExt)
p = []
p.append('--no-prompt --trustAll')
p.append('--bindDN "%s" --bindPassword "%s"' % (DM_DN, DM_PW))
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch status command for I2',
'command' : c,
'arguments' : p,
'path' : SEC_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-status-i2.txt' % OUT_GROUP,
}
</call>
<script>
grepFile = '%s/sec-status-i2.txt' % OUT_GROUP
</script>
<call function="'grep'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'filename' : grepFile,
'testString': 'Server Run Status: Started',
'expectedRC': 0,
}
</call>
<!-- 2.3. Check config/admin-keystore -->
<message>'++ Check file config/admin-keystore exists'</message>
<script>
ks = '%s/config/admin-keystore' % SEC_I2_ROOT
</script>
<call function="'checkFileExists'">
{
'location' : STAF_REMOTE_HOSTNAME,
'file' : ks
}
</call>
<!-- 2.4. Check StartTLS enablement -->
<message>'++ Check StartTLS is enabled on I2'</message>
<script>
ent = 'cn=LDAP Connection Handler,cn=Connection Handlers,cn=config'
</script>
<call function="'ldapSearchWithScript'">
{ 'dsInstancePort' : SEC_I2_PORT,
'dsInstanceDn' : DM_DN,
'dsInstancePswd' : DM_PW,
'dsBaseDN' : ent,
'dsFilter' : 'objectclass=*',
'dsAttributes' : 'ds-cfg-allow-start-tls',
'expectedRC' : 0,
'outputPath' : OUT_GROUP,
'outputFile' : 'sec-ldapsearch-i2.txt',
}
</call>
<script>
grepFile = '%s/sec-ldapsearch-i2.txt' % OUT_GROUP
</script>
<call function="'grep'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'filename' : grepFile,
'testString': 'ds-cfg-allow-start-tls: true',
'expectedRC': 0,
}
</call>
<!-- 3.1. Config: create backend I1 -->
<message>'++ create backend on I1'</message>
<script>
c = '%s/%s/dsconfig%s' % (SEC_I1_ROOT, fileFolder, fileExt)
p = []
p.append('create-backend --bindDN "%s"' % DM_DN)
p.append('--bindPassword "%s"' % DM_PW)
p.append('--trustAll --port %s' % SEC_I1_ADMIN_PORT)
p.append('--backend-name o1 --type local-db --no-prompt')
p.append('--set enabled:true --set writability-mode:enabled')
p.append('--set base-dn:"o=o1"')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Create backend on I1',
'command' : c,
'arguments' : p,
'path' : SEC_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-create-backend-i1.txt' % OUT_GROUP,
}
</call>
<!-- 3.2. Config: create backend I2 -->
<message>'++ create backend on I2'</message>
<script>
c = '%s/%s/dsconfig%s' % (SEC_I2_ROOT, fileFolder, fileExt)
p = []
p.append('create-backend --bindDN "%s"' % DM_DN)
p.append('--bindPassword "%s"' % DM_PW)
p.append('--trustAll --port %s' % SEC_I2_ADMIN_PORT)
p.append('--backend-name o1 --type local-db --no-prompt')
p.append('--set enabled:true --set writability-mode:enabled')
p.append('--set base-dn:"o=o1"')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Create backend on I2',
'command' : c,
'arguments' : p,
'path' : SEC_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-create-backend-i2.txt' % OUT_GROUP,
}
</call>
<!-- 3.3. Import data I1 -->
<message>'++ Import data on I1'</message>
<script>
c = '%s/%s/import-ldif%s' % (SEC_I1_ROOT, fileFolder, fileExt)
p = []
p.append('--bindDN "%s" --bindPassword "%s"' % (DM_DN, DM_PW))
p.append('--trustAll --port %s --backendID o1' % SEC_I1_ADMIN_PORT)
p.append('--ldifFile %s' % SEC_O1_LDIF)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Import data on I1',
'command' : c,
'arguments' : p,
'path' : SEC_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-import-ldif-i1.txt' % OUT_GROUP,
}
</call>
<!-- 3.4. Enable replication I1-I2 -->
<message>'++ Enable replication I1-I2'</message>
<script>
c = '%s/%s/dsreplication%s' % (SEC_I1_ROOT, fileFolder, fileExt)
p = []
p.append('enable --trustAll --host1 %s' % STAF_REMOTE_HOSTNAME)
p.append('--bindDN1 "%s"' % DM_DN)
p.append('--bindPassword1 "%s"' % DM_PW)
p.append('--port1 %s' % SEC_I1_ADMIN_PORT)
p.append('--replicationPort1 %s' % SEC_I1_REPL_PORT)
p.append('--host2 %s --bindDN2 "%s"' % (STAF_REMOTE_HOSTNAME, DM_DN))
p.append('--bindPassword2 "%s"' % DM_PW)
p.append('--port2 %s' % SEC_I2_ADMIN_PORT)
p.append('--replicationPort2 %s' % SEC_I2_REPL_PORT)
p.append('-I admin -w secret12')
p.append('--baseDN "o=o1" --no-prompt')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Enable I1 - I2 replication',
'command' : c,
'arguments' : p,
'path' : SEC_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-enable-repl.txt' % OUT_GROUP,
}
</call>
<!-- 3.5. Initialize replication -->
<message>'++ Initialize replication I1-I2'</message>
<script>
c = '%s/%s/dsreplication%s' % (SEC_I1_ROOT, fileFolder, fileExt)
p = []
p.append('initialize --trustAll')
p.append('-I admin -w secret12 --baseDN "o=o1"')
p.append('--hostSource %s' % STAF_REMOTE_HOSTNAME)
p.append('--portSource %s' % SEC_I1_ADMIN_PORT)
p.append('--hostDestination %s' % STAF_REMOTE_HOSTNAME)
p.append('--portDestination %s' % SEC_I2_ADMIN_PORT)
p.append('--no-prompt')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Initialize I1 - I2 replication',
'command' : c,
'arguments' : p,
'path' : SEC_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-initialize-repl.txt' % OUT_GROUP,
}
</call>
<!-- 4.1. Check SSL I1 -->
<message>'++ Check SSL I1'</message>
<script>
c = '%s/%s/ldapsearch%s' % (SEC_I1_ROOT, fileFolder, fileExt)
p = []
p.append('--hostname %s' % STAF_REMOTE_HOSTNAME)
p.append('--port %s' % SEC_I1_SPORT)
p.append('--trustAll --useSSL')
p.append('--baseDN "cn=user_2,o=o1"')
p.append('--searchScope base "(objectClass=*)"')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'SSL Search on I1',
'command' : c,
'arguments' : p,
'path' : SEC_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-ldapsearch-ssl-i1.txt' % OUT_GROUP,
}
</call>
<script>
grepFile = '%s/sec-ldapsearch-ssl-i1.txt' % OUT_GROUP
</script>
<call function="'grep'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'filename' : grepFile,
'testString': 'dn: cn=user_2,o=o1',
'expectedRC': 0,
}
</call>
<!-- 4.2. Check SSL I2 -->
<message>'++ Check SSL I2'</message>
<script>
c = '%s/%s/ldapsearch%s' % (SEC_I2_ROOT, fileFolder, fileExt)
p = []
p.append('--hostname %s' % STAF_REMOTE_HOSTNAME)
p.append('--port %s' % SEC_I2_SPORT)
p.append('--trustAll --useSSL')
p.append('--baseDN "cn=user_2,o=o1"')
p.append('--searchScope base "(objectClass=*)"')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'SSL Search on I2',
'command' : c,
'arguments' : p,
'path' : SEC_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-ldapsearch-ssl-i2.txt' % OUT_GROUP,
}
</call>
<script>
grepFile = '%s/sec-ldapsearch-ssl-i2.txt' % OUT_GROUP
</script>
<call function="'grep'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'filename' : grepFile,
'testString': 'dn: cn=user_2,o=o1',
'expectedRC': 0,
}
</call>
<!-- 4.3. Check not-StartTLS I1 -->
<message>'++ Check not-StartTLS I1'</message>
<script>
c = '%s/%s/ldapsearch%s' % (SEC_I1_ROOT, fileFolder, fileExt)
p = []
p.append('--hostname %s' % STAF_REMOTE_HOSTNAME)
p.append('--port %s' % SEC_I1_PORT)
p.append('--trustAll --useStartTLS')
p.append('--baseDN "cn=user_2,o=o1"')
p.append('--searchScope base "(objectClass=*)"')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'StartTLS Search on I1',
'command' : c,
'arguments' : p,
'path' : SEC_I1_ROOT,
'expectedRC': 52,
'outputFile': '%s/sec-ldapsearch-starttls-i1.txt' % OUT_GROUP,
}
</call>
<!-- 4.4. Check StartTLS I2 -->
<message>'++ Check StartTLS OK on I2'</message>
<script>
c = '%s/%s/ldapsearch%s' % (SEC_I2_ROOT, fileFolder, fileExt)
p = []
p.append('--hostname %s' % STAF_REMOTE_HOSTNAME)
p.append('--port %s' % SEC_I2_PORT)
p.append('--trustAll --useStartTLS')
p.append('--baseDN "cn=user_2,o=o1"')
p.append('--searchScope base "(objectClass=*)"')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'StartTLS Search on I2',
'command' : c,
'arguments' : p,
'path' : SEC_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-ldapsearch-starttls-i2.txt' % OUT_GROUP,
}
</call>
<script>
grepFile = '%s/sec-ldapsearch-starttls-i2.txt' % OUT_GROUP
</script>
<call function="'grep'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'filename' : grepFile,
'testString': 'dn: cn=user_2,o=o1',
'expectedRC': 0,
}
</call>
<!-- 5.1. Export server cert I1 -->
<message>'++ Export server cert I1'</message>
<script>
CERT1_FILE = '%s/cert1' % OUT_GROUP
KEYSTORE1_FILE = '%s/config/admin-keystore' % SEC_I1_ROOT
KEYSTORE1_PIN_FILE = '%s/config/admin-keystore.pin' % SEC_I1_ROOT
</script>
<call function="'runSTAFCommand'">
{ 'name' : 'Get content of keystore.pin file for I1',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'GET',
'arguments' : 'FILE %s TEXT' % KEYSTORE1_PIN_FILE
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to get content of keystore.pin file',
}
</call>
<script>
KEYSTORE1_PIN = STAFResult[:-1]
</script>
<script>
c = '%s' % KEYTOOL
p = []
p.append('-export -keystore %s' % KEYSTORE1_FILE)
p.append('-storepass "%s"' % KEYSTORE1_PIN)
p.append('-alias admin-cert -file %s' % CERT1_FILE)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Export I1 server cert',
'command' : KEYTOOL,
'arguments' : p,
'path' : SEC_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-export-cert-i1.txt' % OUT_GROUP,
}
</call>
<!-- 5.2. Export server cert I2 -->
<message>'++ Export server cert I2'</message>
<script>
CERT2_FILE = '%s/cert2' % OUT_GROUP
KEYSTORE2_FILE = '%s/config/admin-keystore' % SEC_I2_ROOT
KEYSTORE2_PIN_FILE = '%s/config/admin-keystore.pin' % SEC_I2_ROOT
</script>
<call function="'runSTAFCommand'">
{ 'name' : 'Get content of keystore.pin file for I2',
'location' : STAF_REMOTE_HOSTNAME,
'service' : 'FS',
'request' : 'GET',
'arguments' : 'FILE %s TEXT' % KEYSTORE2_PIN_FILE
}
</call>
<call function="'checktestRC'">
{ 'returncode' : RC,
'expected' : 0,
'result' : 'FAIL to get content of keystore.pin file',
}
</call>
<script>
KEYSTORE2_PIN = STAFResult[:-1]
</script>
<script>
c = '%s' % KEYTOOL
p = []
p.append('-export -keystore %s' % KEYSTORE2_FILE)
p.append('-storepass "%s"' % KEYSTORE2_PIN)
p.append('-alias admin-cert -file %s' % CERT2_FILE)
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Export I2 server cert',
'command' : KEYTOOL,
'arguments' : p,
'path' : SEC_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-export-cert-i2.txt' % OUT_GROUP,
}
</call>
<!-- 5.3. Create new JKS keystore with I1 cert -->
<message>'++ Create new JKS keystore with I1 cert'</message>
<script>
c = '%s' % KEYTOOL
p = []
p.append('-import -storetype JKS -keystore %s' % MY_KEYSTORE)
p.append('-file %s' % CERT1_FILE)
p.append('-storepass secret12 -alias admin-cert1')
p.append('-noprompt')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Import I1 cert in new JKS keystore',
'command' : KEYTOOL,
'arguments' : p,
'path' : SEC_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-import-cert-i1.txt' % OUT_GROUP,
}
</call>
<!-- 5.4. Import cert I2 -->
<message>'++ Import cert on I2'</message>
<script>
c = '%s' % KEYTOOL
p = []
p.append('-import -storetype JKS -keystore %s' % MY_KEYSTORE)
p.append('-file %s' % CERT2_FILE)
p.append('-storepass secret12 -alias admin-cert2')
p.append('-noprompt')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Import I2 cert in new JKS keystore',
'command' : KEYTOOL,
'arguments' : p,
'path' : SEC_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-import-cert-i2.txt' % OUT_GROUP,
}
</call>
<!-- 6.1. Uninstall I1 -->
<message>'++ Uninstall I1'</message>
<script>
c = '%s/uninstall%s' % (SEC_I1_ROOT, fileExt)
p = []
p.append('--cli --referencedHostName %s' % STAF_REMOTE_HOSTNAME)
p.append('--adminUID admin --bindPassword %s' % DM_PW)
p.append('--remove-all --no-prompt')
p.append('--trustStorePath %s' % MY_KEYSTORE)
p.append('--trustStorePassword secret12')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Uninstall I1',
'command' : c,
'arguments' : p,
'path' : SEC_I1_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-uninstall2-i1.txt' % OUT_GROUP,
}
</call>
<!-- 6.2. Uninstall I2 -->
<message>'++ Uninstall I2'</message>
<script>
c = '%s/uninstall%s' % (SEC_I2_ROOT, fileExt)
p = []
p.append('--cli --no-prompt --trustAll')
p.append('--adminUID admin --bindPasswordFile %s' % DM_PW_FILE)
p.append('--remove-all')
p = ' '.join(p)
</script>
<message>'%s %s' % (c, p)</message>
<call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Uninstall I2',
'command' : c,
'arguments' : p,
'path' : SEC_I2_ROOT,
'expectedRC': 0,
'outputFile': '%s/sec-uninstall-i2.txt' % OUT_GROUP,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<call function="'testSuite_Postamble'"/>
</sequence>
</function>
</stax>