|
HTTP, HTTPS
HTTP is simple protocol we use in web applications to communicate client and server.
HTTPS is same like http but this protocol will work in the secure socket layer so that application data can be protected while data travel in the network.
When we send any request using https protocol it need SSL help to protect data.
|
- We already know SSL uses the Https protocol in the client server communication.
- When it is https protocol communication then application data will travel in secure layer in the network.
- When client send the request to server before request travel in network then request data will be encrypted by using SSL certificate information. This certificate provides the encryption algorithm and public key and private to encrypt the data.
- Once data is encrypted then application data will be travel in secure layer because its https request.
- As soon as request reached by server then server will take the request and it will decrypt the data by using same encryption algorithm, public and private key.
- This information will be available in SSL certificate so that server can get this information and able to decrypt. We already know client and server will use same certificate information and the certificate will be shared by the server and client.
- Once request is decrypted then server processes the request and it will prepare the response. Now server is responsible to encrypt response by using SSL certificate information.
- Once the data is encrypted it will send to client and it will use secure layer while travel in the network.
- As soon as response reached by client then it can decrypt the data by using SSL certificate information.
- This process will apply to each and every request and response while in the communication.
- Create SSL certificate using Java Key Tool
- Configure SSL in Liferay Portal Server
- Generate Key
- Export Key Information into Certificate
- Import certificate into Server JRE
Java Key Tool is default tool which comes with JAVA. Before use these we need to install java. Once install java then we can use Java Key Tool. WE use Java Key Tool from Command Prompt to create certificate.
|
-alias: this is just reference name to key
- keyalg: which specify the encryption algorithm and the algorithm will use when data will encrypt like RSA.
-keypass: password for key and default we will use changeit
|
|
keytool -genkey -alias tomcatserver -keypass changeit -keyalg RSA
|
|
Enter keystore password: changeit
What is your first and last name?
[Unknown]: localhost
What is the name of your organizational unit?
[Unknown]: ASW
What is the name of your organization?
[Unknown]: ASW
What is the name of your City or Locality?
[Unknown]: HK
What is the name of your State or Province?
[Unknown]: HK
What is the two-letter country code for this unit?
[Unknown]: HK
Is CN=localhost, OU=ASW, O=ASW, L=HK, ST=HK, C=HK correct?
[no]: yes
|
|
keytool -genkey -keystore c:\users\localhost.keystore -alias tomcatmeera -keyalg RSA
Provide –keystore value this is path to our keystore file
|
|
keytool -export -alias tomcatserver -keypass changeit -file myserver.cert
|
|
keytool -export -alias tomcatmeera -keypass changeit -file
myserver.cert –keystore c:/users/localhost.keystore
|
|
keytool -import -alias tomcatserver -file
"C:\Users\E5410\myserver.cert" -keypass changeit -keystore "C:\Program Files\Jav
a\jdk1.6.0_43\jre\lib\security\cacerts"
|
|
Enter keystore password:changeit
Owner: CN=meera, OU=meera, O=meera, L=meera, ST=meera, C=meera
Issuer: CN=meera, OU=meera, O=meera, L=meera, ST=meera, C=meera
Serial number: 52e7aad6
Valid from: Tue Jan 28 21:04:22 CST 2014 until: Mon Apr 28 21:04:22 CST 2014
Certificate fingerprints:
MD5: 02:FC:FA:21:68:D1:26:57:07:3B:DB:B0:A2:1C:9A:5E
SHA1: D8:52:61:D6:A3:33:97:1E:F9:2F:8C:56:38:26:0D:6C:59:CC:5E:AC
Signature algorithm name: SHA1withRSA
Version: 3
Trust this certificate? [no]: yes
Certificate was added to keystore
|
- Liferay Portal Tomcat Server
- Liferay Portal JBoss Server
|
tomcat-7.0.40/conf/ server.xml
|
|
<!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="200" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
|
|
<Connector protocol="HTTP/1.1"
port="7443" maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile="C:/Users/localhost.keystore" keystorePass="changeit"
clientAuth="false" sslProtocol="TLS"/>
|
|
jboss-7.1.1\standalone\configuration\ standalone.xml
|
|
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
|
|
<connector name=" http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
<ssl/>
</connector>
|
- SSL use the https protocol to provide secure layer for application data while in the network.
- We need to add trusted certificates information in server JRE so that data will be encrypted or decrypted when the client server communication is occurred.
- In the real environment or production environment we need to get SSL certificate from SSL vendors.
- In the development environment we will use Self Signed Certificates and which can be created by using Java Key Tool
- We need to add self signed SSL certificates to Server JRE default SSL certificates location i.e jre\lib\security\cacerts
- To configure SSL information in server we will use server configuration files these file name varying from server to server.
- To enable SSL is we need to enable HTTPS connector and there we need pass SSL certificate information as attributes values.


