From 4e32ffc794fb42475387e124c1054044f1f1e7cb Mon Sep 17 00:00:00 2001
From: madiot <madiot@localhost>
Date: Tue, 06 May 2008 15:19:09 +0000
Subject: [PATCH] configuring SSL environment for DSML test suite
---
opendj-sdk/opends/tests/functional-tests/staf-installer/functional-tests.cfg | 4 +++-
opendj-sdk/opends/tests/shared/functions/webcontainer.xml | 46 +++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/opendj-sdk/opends/tests/functional-tests/staf-installer/functional-tests.cfg b/opendj-sdk/opends/tests/functional-tests/staf-installer/functional-tests.cfg
index b0fed65..d7800a2 100644
--- a/opendj-sdk/opends/tests/functional-tests/staf-installer/functional-tests.cfg
+++ b/opendj-sdk/opends/tests/functional-tests/staf-installer/functional-tests.cfg
@@ -80,7 +80,9 @@
SERVICE Http LIBRARY JSTAF \
EXECUTE {STAF/Config/STAFRoot}/services/http/STAFHTTP.jar \
OPTION JVMNAME=httpJVM \
- OPTION J2=-Xmx128m -Xms32m
+ OPTION J2=-Xmx128m -Xms32m \
+ -Djavax.net.ssl.trustStorePassword=changeit \
+ -Djavax.net.ssl.trustStore={STAF/Config/STAFRoot}/services/http/tomcatCertificate
#DSML SERVICE CONFIGURATION
#uncomment following if you want it to be in separate JVMs
diff --git a/opendj-sdk/opends/tests/shared/functions/webcontainer.xml b/opendj-sdk/opends/tests/shared/functions/webcontainer.xml
index 0550eed..d546870 100755
--- a/opendj-sdk/opends/tests/shared/functions/webcontainer.xml
+++ b/opendj-sdk/opends/tests/shared/functions/webcontainer.xml
@@ -78,7 +78,7 @@
</call>
<!-- chmod +x all the .sh file in tomcat bin directory -->
- <stafcmd name="'create import temp directory'">
+ <stafcmd name="'make tomcat shell scripts executable'">
<location>'%s' % mylocation</location>
<service>'fs'</service>
<request>' LIST DIRECTORY %s/%s-%s/bin EXT sh' % \
@@ -100,6 +100,36 @@
<returnstdout/>
</process>
+ <!-- generate SSL certificate -->
+ <stafcmd>
+ <location>STAXServiceMachine</location>
+ <service>'var'</service>
+ <request>'resolve string {STAF/Config/STAFRoot}'</request>
+ </stafcmd>
+
+ <script>stafRoot=STAFResult</script>
+
+ <call function="'runCommand'">
+ { 'name' : 'Generate a Certificate',
+ 'location' : STAXServiceMachine,
+ 'command' : '%s/bin/keytool' % (JAVA_HOME),
+ 'arguments' : '-genkey -alias tomcat -keyalg rsa \
+ -dname "cn=tomcat,O=Sun Microsystems,C=US" \
+ -keystore "%s/services/http/tomcatCertificate" \
+ -storepass "changeit" -keypass "changeit" \
+ -storetype JKS ' % (stafRoot),
+ 'path' : '%s/bin' % (JAVA_HOME),
+ 'expectedRC': 0
+ }
+ </call>
+
+ <call function="'copyFile'">
+ { 'location' : STAXServiceMachine,
+ 'srcfile' : '%s/services/http/tomcatCertificate' % (stafRoot),
+ 'destfile' : '%s/%s-%s/conf/tomcatCertificate' % (wcPath, WC_TYPE, WC_VERSION),
+ 'remotehost' : mylocation
+ }
+ </call>
<!-- configure webcontainer's PORTs -->
<message>
'Configure webcontainer ports HTTP %s / HTTPS %s' % (WC_PORT, WC_SSL_PORT)
@@ -117,6 +147,15 @@
sslPortRegEx = re.compile('8443')
content=portRegEx.sub(WC_PORT, serverXmlInput)
content=sslPortRegEx.sub(WC_SSL_PORT, content)
+ sslConnectorRegEx = re.compile('<Service name="Catalina">')
+ SSL_CONNECTOR = '<Service name="Catalina">\n \
+ <Connector port="%s" protocole="HTTP/1.1" \
+ SSLEnabled="true" maxThreads="150" scheme="https" secure="true" \
+ clientAuth="false" sslProtocol="SSL" \
+ keystoreFile="%s/%s-%s/conf/tomcatCertificate" \
+ keystorePass="changeit" />' % \
+ (WC_SSL_PORT, wcPath, WC_TYPE, WC_VERSION)
+ content=sslConnectorRegEx.sub(SSL_CONNECTOR, content)
serverXmlOutput=open('%s/%s-%s-%s_server.xml' % \
(TMPDIR,STAF_REMOTE_HOSTNAME,WC_TYPE,WC_VERSION),'w')
serverXmlOutput.write(content)
@@ -133,10 +172,7 @@
<message>
'Configure webcontainer SSL keystore '
</message>
- <message>
- 'TODO....'
- </message>
-
+
<if expr="RC != 0">
<return>RC</return>
</if>
--
Gitblit v1.10.0