1963N/A<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
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 ! See the License for the specific language governing permissions 1963N/A ! and limitations under the License. 1963N/A ! When distributing Covered Code, include this CDDL HEADER in each 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 ! Portions Copyright [yyyy] [name of copyright owner] 3215N/A ! Copyright 2008-2009 Sun Microsystems, Inc. 1963N/A ! Portions Copyright 2013 ForgeRock AS 1963N/A <
defaultcall function="security"/>
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 2086N/A #@TestSuiteID security Tests 2086N/A #@TestGroup Setup-Uninstall 3209N/A CurrentTestPath['group'] = 'setup'
1963N/A CurrentTestPath['suite'] = 'security'
1963N/A <
call function="'testSuite_Preamble'"/>
1963N/A <
call function="'getFreePort'">
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A <
script>SEC_I1_PORT = STAXResult</
script>
1963N/A <
call function="'getFreePort'">
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A <
script>SEC_I1_SPORT = STAXResult</
script>
1963N/A <
call function="'getFreePort'">
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A <
script>SEC_I1_ADMIN_PORT = STAXResult</
script>
1963N/A <
call function="'getFreePort'">
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A <
script>SEC_I1_REPL_PORT = STAXResult</
script>
2086N/A <
call function="'getFreePort'">
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A <
script>SEC_I2_PORT = STAXResult</
script>
1963N/A <
call function="'getFreePort'">
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
3642N/A <
script>SEC_I2_SPORT = STAXResult</
script>
3642N/A <
call function="'getFreePort'">
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A <
script>SEC_I2_ADMIN_PORT = STAXResult</
script>
1963N/A <
call function="'getFreePort'">
1963N/A 'host' : STAF_REMOTE_HOSTNAME,
1963N/A <
script>SEC_I2_REPL_PORT = STAXResult</
script>
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 '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 <!--- Test Case information 1963N/A #@TestMarker Setup-Uninstall Security tests 1963N/A #@TestName Setup-Uninstall: Security: 2086N/A #@TestID security_starttls_ssl 2086N/A #@TestStep Setup I1, with SSL 1963N/A Create o=o1 on I1 and I2, and import data on I1 1963N/A Check SSL works OK on I1 and I2 1963N/A Check StartTLS not-OK on I1 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 #@TestResult PASS if all steps ran without errors 1963N/A <
testcase name="getTestCaseName('security_starttls_ssl')">
1963N/A if is_windows_platform(STAF_REMOTE_HOSTNAME):
1963N/A SEC_I1_ROOT = '%s/%s' % (SEC_I1_BASE, OPENDSNAME)
1963N/A SEC_I2_ROOT = '%s/%s' % (SEC_I2_BASE, OPENDSNAME)
1963N/A <
call function="'checkFileExists'">
1963N/A 'location' : STAF_REMOTE_HOSTNAME,
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 'arguments' : 'DIRECTORY %s FAILIFEXISTS' % SEC_I1_BASE
<
call function="'checktestRC'">
'result' : 'FAIL to create directory',
<
call function="'runSTAFCommand'">
{ 'name' : 'Extract OpenDS ZIP file',
'location' : STAF_REMOTE_HOSTNAME,
'arguments' : 'ZIPFILE %s/%s TODIRECTORY %s RESTOREPERMISSION' \
% (DIRECTORY_INSTANCE_DIR, ZIPNAME, SEC_I1_BASE)
<
call function="'checktestRC'">
'result' : 'FAIL to unzip OpenDS ZIP file',
c = '%
s/
setup%s' % (SEC_I1_ROOT, fileExt)
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('--rootUserPassword "%s"' % DM_PW)
p.append('--generateSelfSignedCertificate %s' % licenseOption)
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch setup command for I1',
<
message>'++ Check status of I1'</
message>
c = '%s/%
s/
status%s' % (SEC_I1_ROOT, fileFolder, fileExt)
p.append('--bindDN "%s" --bindPassword "%s"' % (DM_DN, DM_PW))
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch status command for I1',
{ 'location' : STAF_REMOTE_HOSTNAME,
'testString': 'Server Run Status: Started',
<
call function="'checkFileExists'">
'location' : STAF_REMOTE_HOSTNAME,
<!-- 1.4. Check StartTLS non-enablement --> <
message>'++ Check StartTLS is disabled'</
message>
ent = 'cn=LDAP Connection Handler,cn=Connection Handlers,cn=config'
<
call function="'ldapSearchWithScript'">
{ 'dsInstancePort' : SEC_I1_PORT,
'dsInstancePswd' : DM_PW,
'dsFilter' : 'objectclass=*',
'dsAttributes' : 'ds-cfg-allow-start-tls',
'outputPath' : OUT_GROUP,
{ 'location' : STAF_REMOTE_HOSTNAME,
'testString': 'ds-cfg-allow-start-tls: false',
<
message>'++ Setup I2'</
message>
<
call function="'runSTAFCommand'">
{ 'name' : 'Create directory to contain I2',
'location' : STAF_REMOTE_HOSTNAME,
'arguments' : 'DIRECTORY %s FAILIFEXISTS' % SEC_I2_BASE
<
call function="'checktestRC'">
'result' : 'FAIL to create directory',
<
call function="'runSTAFCommand'">
{ 'name' : 'Extract OpenDS ZIP file',
'location' : STAF_REMOTE_HOSTNAME,
'arguments' : 'ZIPFILE %s/%s TODIRECTORY %s RESTOREPERMISSION' \
% (DIRECTORY_INSTANCE_DIR, ZIPNAME, SEC_I2_BASE)
<
call function="'checktestRC'">
'result' : 'FAIL to unzip OpenDS ZIP file',
c = '%
s/
setup%s' % (SEC_I2_ROOT, fileExt)
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('--rootUserPassword "%s"' % DM_PW)
p.append('--generateSelfSignedCertificate --enableStartTLS %s' \
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch setup command for I2',
<
message>'++ Check status of I2'</
message>
c = '%s/%
s/
status%s' % (SEC_I2_ROOT, fileFolder, fileExt)
p.append('--bindDN "%s" --bindPassword "%s"' % (DM_DN, DM_PW))
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Launch status command for I2',
{ 'location' : STAF_REMOTE_HOSTNAME,
'testString': 'Server Run Status: Started',
<
call function="'checkFileExists'">
'location' : STAF_REMOTE_HOSTNAME,
<!-- 2.4. Check StartTLS enablement --> <
message>'++ Check StartTLS is enabled on I2'</
message>
ent = 'cn=LDAP Connection Handler,cn=Connection Handlers,cn=config'
<
call function="'ldapSearchWithScript'">
{ 'dsInstancePort' : SEC_I2_PORT,
'dsInstancePswd' : DM_PW,
'dsFilter' : 'objectclass=*',
'dsAttributes' : 'ds-cfg-allow-start-tls',
'outputPath' : OUT_GROUP,
{ 'location' : STAF_REMOTE_HOSTNAME,
'testString': 'ds-cfg-allow-start-tls: true',
<!-- 3.1. Config: create backend I1 --> <
message>'++ create backend on I1'</
message>
c = '%s/%
s/
dsconfig%s' % (SEC_I1_ROOT, fileFolder, fileExt)
p.append('create-backend --bindDN "%s"' % DM_DN)
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')
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Create backend on I1',
<!-- 3.2. Config: create backend I2 --> <
message>'++ create backend on I2'</
message>
c = '%s/%
s/
dsconfig%s' % (SEC_I2_ROOT, fileFolder, fileExt)
p.append('create-backend --bindDN "%s"' % DM_DN)
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')
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Create backend on I2',
<!-- 3.3. Import data I1 --> <
message>'++ Import data on I1'</
message>
c = '%s/%
s/
import-ldif%s' % (SEC_I1_ROOT, fileFolder, fileExt)
p.append('--bindDN "%s" --bindPassword "%s"' % (DM_DN, DM_PW))
p.append('--trustAll --port %s --backendID o1' % SEC_I1_ADMIN_PORT)
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Import data on I1',
<!-- 3.4. Enable replication I1-I2 --> <
message>'++ Enable replication I1-I2'</
message>
p.append('enable --trustAll --host1 %s' % STAF_REMOTE_HOSTNAME)
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)
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Enable I1 - I2 replication',
<!-- 3.5. Initialize replication --> <
message>'++ Initialize replication I1-I2'</
message>
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)
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Initialize I1 - I2 replication',
<!-- 4.1. Check SSL I1 --> <
message>'++ Check SSL I1'</
message>
c = '%s/%
s/
ldapsearch%s' % (SEC_I1_ROOT, fileFolder, fileExt)
p.append('--hostname %s' % STAF_REMOTE_HOSTNAME)
p.append('--searchScope base "(objectClass=*)"')
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'SSL Search on I1',
{ 'location' : STAF_REMOTE_HOSTNAME,
'testString': 'dn: cn=user_2,o=o1',
<!-- 4.2. Check SSL I2 --> <
message>'++ Check SSL I2'</
message>
c = '%s/%
s/
ldapsearch%s' % (SEC_I2_ROOT, fileFolder, fileExt)
p.append('--hostname %s' % STAF_REMOTE_HOSTNAME)
p.append('--searchScope base "(objectClass=*)"')
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'SSL Search on I2',
{ 'location' : STAF_REMOTE_HOSTNAME,
'testString': 'dn: cn=user_2,o=o1',
<!-- 4.3. Check not-StartTLS I1 --> <
message>'++ Check not-StartTLS I1'</
message>
c = '%s/%
s/
ldapsearch%s' % (SEC_I1_ROOT, fileFolder, fileExt)
p.append('--hostname %s' % STAF_REMOTE_HOSTNAME)
p.append('--searchScope base "(objectClass=*)"')
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'StartTLS Search on I1',
<!-- 4.4. Check StartTLS I2 --> <
message>'++ Check StartTLS OK on I2'</
message>
c = '%s/%
s/
ldapsearch%s' % (SEC_I2_ROOT, fileFolder, fileExt)
p.append('--hostname %s' % STAF_REMOTE_HOSTNAME)
p.append('--searchScope base "(objectClass=*)"')
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'StartTLS Search on I2',
{ 'location' : STAF_REMOTE_HOSTNAME,
'testString': 'dn: cn=user_2,o=o1',
<!-- 5.1. Export server cert I1 --> <
message>'++ Export server cert I1'</
message>
CERT1_FILE = '%
s/
cert1' % OUT_GROUP
<
call function="'runSTAFCommand'">
'location' : STAF_REMOTE_HOSTNAME,
'arguments' : 'FILE %s TEXT' % KEYSTORE1_PIN_FILE
<
call function="'checktestRC'">
KEYSTORE1_PIN = STAFResult[:-1]
p.append('-export -keystore %s' % KEYSTORE1_FILE)
p.append('-storepass "%s"' % KEYSTORE1_PIN)
p.append('-alias admin-cert -file %s' % CERT1_FILE)
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Export I1 server cert',
<!-- 5.2. Export server cert I2 --> <
message>'++ Export server cert I2'</
message>
CERT2_FILE = '%
s/
cert2' % OUT_GROUP
<
call function="'runSTAFCommand'">
'location' : STAF_REMOTE_HOSTNAME,
'arguments' : 'FILE %s TEXT' % KEYSTORE2_PIN_FILE
<
call function="'checktestRC'">
KEYSTORE2_PIN = STAFResult[:-1]
p.append('-export -keystore %s' % KEYSTORE2_FILE)
p.append('-storepass "%s"' % KEYSTORE2_PIN)
p.append('-alias admin-cert -file %s' % CERT2_FILE)
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Export I2 server cert',
<!-- 5.3. Create new JKS keystore with I1 cert --> <
message>'++ Create new JKS keystore with I1 cert'</
message>
p.append('-import -storetype JKS -keystore %s' % MY_KEYSTORE)
p.append('-storepass secret12 -alias admin-cert1')
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Import I1 cert in new JKS keystore',
<!-- 5.4. Import cert I2 --> <
message>'++ Import cert on I2'</
message>
p.append('-import -storetype JKS -keystore %s' % MY_KEYSTORE)
p.append('-storepass secret12 -alias admin-cert2')
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'name' : 'Import I2 cert in new JKS keystore',
<!-- 6.1. Uninstall I1 --> <
message>'++ Uninstall I1'</
message>
p.append('--cli --referencedHostName %s' % STAF_REMOTE_HOSTNAME)
p.append('--adminUID admin --bindPassword %s' % DM_PW)
p.append('--trustStorePath %s' % MY_KEYSTORE)
p.append('--trustStorePassword secret12')
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
<!-- 6.2. Uninstall I2 --> <
message>'++ Uninstall I2'</
message>
p.append('--cli --no-prompt --trustAll')
p.append('--adminUID admin --bindPasswordFile %s' % DM_PW_FILE)
<
message>'%s %s' % (c, p)</
message>
<
call function="'runCommand'">
{ 'location' : STAF_REMOTE_HOSTNAME,
<
call function="'testCase_Postamble'"/>
<
call function="'testSuite_Postamble'"/>