Total Pageviews

Saturday, May 25, 2013

Enabling SSL in Liferay-Tomcat Bundle

For enabling the SSL (https) in Liferay-Tomcat bundle, we need to modify the server.xml file inside \liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\conf\ directory. By default the following entry is used:
There are basically two steps for enabling SSL. First - we need to create a self signed certificate (if you don't have one from publisher) and secondly setting up tomcat configurations. You can see approach for certificate creation in my previous post, only STEP 1 is sufficient for this purpose.

Now for enabling SSL, just put the following in server.xml
where the keystore password is the password used at the time of certificate creation.

Now start the server. You will be able to use https://localhost:8181/web/guest/ after complete startup. You can manage ports as per requirements.

You can download the sample server.xml file from here.

Sunday, May 12, 2013

Creating Self Signed Certificate using Keytool

Prerequsites: For using the keytool utility, we have to ensure that our environment is configured to use the bin directory of JDK, otherwise the full path to the utility must be present on the command line. Which can be ensured by typing java or javac on command prompt.

There are basically three steps:
1. Generate the certificate in the keystore file

Here tomcat is an unique alias of certificate. change is the default password, you can change it. You now have a .keystore in the current user's home directory

2. Now export the certificate you just generated:

Now the certificate has been exported to server.crt file.

3. Now, add the exported certificate (server.crt) to your JRE's cacerts file

 Yes, now its done.