I do a lot of testing with SSL and many times I don't want to configure an external web server. It seems like everytime I need to configure a JRun web server (JWS) for SSL I never have the steps available to do it. I have done testing with Flash Remoting, Flex and other various apps for SSL testing. The certificate is not a signed certificate but it will work for testing purposes. There are only two things you need - a keystore and a section in your jrun.xml telling JRun to use it....
The keystore:
To create your own keystore it is pretty simple just follow the instructions below. At a command prompt run the following line:
keytool -genkey -alias {name} -validity 9999 -keyalg RSA -keystore c:\my.keystore -keypass changeit -storepass changeit
Chose your -alias based on the hostname you will use SSL through. For instance, if you are accessing this locally use the alias localhost.
You will then be prompted for more information. At the first prompt enter the same name that you used in the command above. The rest is arbitrary.
This will create a keystore containing a certificate for your server.
Configuring JRun
- Put your keystore file (either canned or that you created) into JRun4/lib.
- Open up your jrun.xml file (in JRun4/servers/{your server}/SERVER-INF) and add this SSLService declaration after the WebService declaration. The two items that are of most interest are keyStore and port. If you created your own keystore then replace localhost.keystore with the name of yours (my.keystore in the example above).
<service class="jrun.servlet.http.SSLService" name="SSLService"> <attribute name="port">9100</attribute> <attribute name="keyStore">{jrun.rootdir}/lib/localhost.keystore</attribute> <attribute name="keyStorePassword">changeit</attribute> <attribute name="trustStore">{jrun.rootdir}/lib/trustStore</attribute> <attribute name="socketFactoryName">jrun.servlet.http.JRunSSLServerSocketFactory</attribute> <attribute name="deactivated">false</attribute> <attribute name="bindAddress">*</attribute> <attribute name="interface">*</attribute> <attribute name="clientAuth">false</attribute> </service>
- Restart JRun and request a page using https://{your server}:9100
I have found with CF 8 that you must start jrun4 with the following property in order to get this working correctly... This was a hint given to my team by Adobe support, btw:
-Dcoldfusion.disablejsafe=true
Ryan,
Thanks, that worked! I spent a few hours crawling the net trying to get this to work in CF 8.
FYI. this setting needs to be appended to the end of the java.args parameter inside your {jrun}/bin/jvm.config file.
Eric P.