DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Apache Spark 3 to Apache Spark 4 Migration: What Breaks, What Improves, What's Mandatory
  • Zero Trust, Build High Scale TLS Termination Layer
  • Model Context Protocol Vs Agent2Agent: Practical Integration with Enterprise Data
  • Implementing HTTPS Two-Way Authentication in Android Using Delphi XE10.x

Trending

  • Docker Hardened Images Are Free Now — Here's What You Still Need to Build
  • AI Paradigm Shift: Analytics Without SQL
  • Event-Driven Pipelines With Apache Pulsar and Go
  • How to Format Articles for DZone

Configuring HTTPS in Mule

By 
Gabriel Dimech user avatar
Gabriel Dimech
·
Nov. 27, 13 · Interview
Likes (2)
Comment
Save
Tweet
Share
37.6K Views

Join the DZone community and get the full member experience.

Join For Free

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.

One-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:

<https:connector name="httpsServerConnector" doc:name="HTTP\HTTPS" validateConnections="true">
<https:tls-key-store path="server-keystore.jks" keyPassword="keypass" storePassword="keypass" />
</https:connector>

<https:connector name="httpsClientConnector" doc:name="HTTP\HTTPS" validateConnections="true">
<https:tls-server path="client-truststore.jks" storePassword="keypass"/>
</https:connector>

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:

<https:connector name="httpsServerConnector" doc:name="HTTP\HTTPS" validateConnections="true">
<https:tls-key-store path="server-keystore.jks" keyPassword="keypass" storePassword="keypass" />
<https:tls-server path="server-truststore.jks"  requireClientAuthentication="true" storePassword="keypass" />
</https:connector>

and a flow with inbound HTTPS using the above connector:

<flow name="httpsServer" doc:name="httpsServer">
<https:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8083" connector-ref="httpsServerConnector" doc:name="HTTPS" />
<logger message="accessed https server successfully!" level="INFO" doc:name="Logger" />
</flow>

The following is HTTPS client connector configuration for two-way SSL:

<https:connector name="httpsClientConnector" doc:name="HTTP\HTTPS" validateConnections="true" >
<https:tls-key-store path="client-keystore.jks" keyPassword="keypass" storePassword="keypass" />
<https:tls-server path="client-truststore.jks" storePassword="keypass"/>
</https:connector>

Client flow, accepting HTTP requests and sending to HTTPS server:

<flow name="httpsClient" doc:name="httpsClient">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP" path="test">
</http:inbound-endpoint>
<logger message="sending request from https client to https server..." level="INFO" doc:name="Logger" />
<https:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8083" connector-ref="httpsClientConnector" doc:name="HTTP" />
</flow>
HTTPS

Published at DZone with permission of Gabriel Dimech. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Apache Spark 3 to Apache Spark 4 Migration: What Breaks, What Improves, What's Mandatory
  • Zero Trust, Build High Scale TLS Termination Layer
  • Model Context Protocol Vs Agent2Agent: Practical Integration with Enterprise Data
  • Implementing HTTPS Two-Way Authentication in Android Using Delphi XE10.x

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook