// Please, find the latest version here – Configuring HTTPs in Mule 3.6 //
In this blogpost I aim to clarify some concepts which will show how to configure an HTTPS client and server in Mule for SSL and two-way SSL (Mutual Authentication).
The following is an explanation of the roles both keystore and truststore play in HTTPS as well as how they are referred to in Mule.
Key Store (tls-key-store in Mule): A keystore contains private keys, and the certificates with their corresponding public/private keys. You only need this if Mule is exposing an HTTP endpoint (server) or the remote server requires client authentication. In Mule, this is defined with the ‘tls-key-store’ attribute on the HTTPS connector.
Trust Store (tls-server in Mule): used as a repository of CA (certificate authority) or simple certificates that the client should trust. Note: this is only required if the server we are connecting with, has a certificate which is signed by an authority not recognised in the java truststore or the certificate is self signed. In Mule, this is configured using the ‘tls-server’ attribute on the HTTPS connector.
Note: One main source of ambiguity in using the HTTPS connector is the use of tls-client, this is redundant (see JIRA MULE-5213) and is a known issue. This is not required to configure SSL or two-way SSL.
For normal SSL, on the server connector we need a keystore where the servers’ certificate and private key reside. In this example we are using self signed certificates, therefore we need a trustore on the client side.
The following are server and client HTTPS connectors for normal SSL with self signed certificate on the server side:
Two-way SSL (Mutual Authentication)
When configuring two-way SSL between the HTTPS client and server, in Mule we need to:
1) configure an HTTPS client connector with both client keystore and truststore. The client keystore shall contain the clients public certificate and private key. The client truststore shall contain the servers certificate.
2) configure the server connector with both server keystore and truststore as well as set ‘requireClientAuthentication’ to ‘true’ on the ‘tls-server’ (i.e. truststore) attribute. This shall force the server connector to check client requests in the trust store prior to granting access.
The server keystore shall contain the server’s public certificate and private key. The server truststore shall contain the client’s certificate.
In order to create the self signed certificate, trust store and key store for our HTTPS service, the java keytool was used. However the following graphical tool may prove handy.
The following is HTTPS server connector configuration for two-way SSL:
and a flow with inbound HTTPS using the above connector:
The following is HTTPS client connector configuration for two-way SSL:
Client flow, accepting HTTP requests and sending to HTTPS server:
Useful resources: “What Is An SSL Certificate And Why You Should Care” by pixelprivacy.com