Of the myriad ways to lend security to your enterprise, one that you certainly cannot afford to miss is securing the channel over which your partners communicate with you. An important step in this direction is configuring HTTPS on the OC4J. This is the subject matter of this post. Readers would do well to realize that this is not the final security enforcement point, but merely one among the plethora of policies that one must have in place.
Create a keystore
Your first step is to create a keystore (nothing but a repository of security certificates). Open command prompt and navigate to <JDEV_HOME>\jdk\bin directory. Now, use SUN's keytool to generate the keystore:
keytool -genkey -dname "CN=Sankash Thakuria, OU=Oracle, O=Fujitsu Consulting, L=Bangalore, S=Karnataka, C=IN" -keyalg RSA -sigalg Sha1WithRSA -keypass sankash -storepass sankash -keystore sankashkeystore.jks -alias nebulasky
Copy sankashkeystore.jks to <ORACLE_HOME>/j2ee/home/config.
Configure SSL in OC4J
The default behavior of the OC4J is to expose all resources (services) over HTTP, which is in turn is because of certain settings that are already in place in <ORACLE_HOME>/j2ee/home/config/default-web-site.xml file. We shall override this file to achieve SSL over HTTP. Create a copy of this file under the config directory and rename it as secure-web-site.xml. Open secure-web-site.xml in your favourite text editor and do the following:
- Inside the <web-site> tag, change the port to 4443 and add the element secure="true".
- Add <ssl-config> element and and point this to the newly created keystore.
Here is how the file will look like once these are done:
...
<ssl-config keystore="sankashkeystore.jks" keystore-password="sankash" />
...
Now, you need to make the OC4J aware of these changes. To do that, go ahead and open the server.xml file. Add the following to the file:
<web-site default="true" path="./default-web-site.xml" />
<web-site path="./secure-web-site.xml" />
Bounce OC4J and test
Restart the container and test. For instance, if the BPEL console was available over http://172.28.10.60:7777/BPELConsole it should now be also available over https://172.28.10.60:4443/BPELConsole provided the entry for the same exists in the secure-website.xml file.
1 comment:
Thanks - nice and easy to follow. If you want it to be valid for longer than the default 3 months though you'll need to add the following option to keytool -validity 1000 eg for 1000 days.
Post a Comment