TLS Improvements in Mule 3.8
Mule 3.8 has unleashed new improvements to TLS, as well as several other aspects.
Join the DZone community and get the full member experience.Join For Free
as you might have read, mule 3.8 includes a number of improvements regarding tls. in this post, we will analyze the tls environment prior to this release and explore all of the new enhancements in detail so that you can start taking advantage of them.
the basics of transport layer security
tls (as ssl), is a protocol that provides security across a network. it guarantees privacy by encrypting each message (no one else can see the data), providing integrity with an authentication code for each message (no one else can modify the data) and confirming authenticity of each party's digital certificates (no one can pretend to be someone they are not).
there are many versions of the protocol, including the ssl ones, so the first step when establishing a connection is for the client and server to agree on one. then they must agree on which cipher suite to use: said cipher suite will determine the key exchange, authentication, encryption and message authentication code algorithms to be used. these steps are crucial because some versions might be less secure than others (or even insecure) and some algorithms might be stronger and others easier to break or obsolete.
when it comes to authentication, the server sends the client its certificate, so it can check whether the server is to be trusted. this is determined by analyzing the certificate's digital signature: if the signing entity that's verifying the certificate is trusted then so is the certificate. that entity is usually a well-known certificate authority (ca) that all clients trust. the same process is repeated from client to server if both ends need authenticating, as in two-way authentication. for this step, it's important to note that, at the very least, a server will need its own certificate and a client will need a list of trusted ones.
tls and mule
setting up tls/ssl with mule has always been a pain point, mainly because each connector has had its own way of dealing with it. that's why in the 3.6 release we introduced the tls context component, currently used by http, oauth , and the ws consumer, but meant to become the standard for all connectors requiring tls.
this component lets you establish a keystore (from where to take your own certificate) and a truststore (with a list of certificates considered safe). it can be defined globally in your app to share it across connectors or on each one of them, as in the example below for an http listener.
the other piece of the puzzle is the setup of allowed protocols and cipher suites. these can be rendered insecure from one day to another because of a new exploit (think poodle and sslv3) so being able to decide which protocols are to be used is of utmost importance and a system administration's main concern. that's where the runtime's tls configuration file (found in mule_home/conf) comes in. in it you can list the enabled protocols and cipher suites that the tls connections established should respect, covering all applications at once. below is the default one in 3.8, where you can notice tlsv1 is no longer included because of it's known vulnerabilities.
tls and mule 3.8
protocols and cipher suites per connector
as you can see, the protocols and cipher suites configuration was only possible at the container level, meaning it would affect all apps deployed in that runtime and should one of them require a higher security level, all others would be affected by the changes needed to support it.
in 3.8 you can now define your enabled protocols and cipher suites in the tls context component, next to your keystore and truststore. should there be any global restrictions from a tls configuration file, those would still apply, but you’ll be able to tweak it for your connector as desired.
in the example below, the http requester will only establish connections using tlsv1.2.
another improvement came from seeing the proliferation of the same keystore and truststore files replicated across applications and the need to share their passwords with each application owner. though tls contexts could be shared among connectors, they couldn’t be shared among apps.
now, however, you'll be able to define your tls context in a domain and share it with all apps in it. your keystore and truststore along with their passwords will only need to be available for that domain and only the context name shared with the app owners.
for example, if your app is part of the domain below you’ll be able to select "domaintlsconfig" as a global configuration for your http requester.
configuring tls was even more troublesome considering the time it may take to get a proper certificate signed or your truststore ready with a self-signed version. thankfully, we have now added a way to disable certificate validation so that prototyping, development, and testing are not held back by the truststore setup. of course, this renders your connections vulnerable to attacks, so it should not be used in production environments.
if you have yet to add the required certificates to truststore.jks but want to test your app, you can mark the tls config as insecure as shown below:
mule user guide for more details on tls config
i hope you found these improvements useful and can start taking advantage of them soon! for more details on this and for a guide to creating your own certificates, you can check out our mule user guide on tls configuration .
Published at DZone with permission of , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.