In the last 2 posts, we have seen how to configure Service Bus to use 1-Way SSL and 2-Way SSL. In both of these scenarios, our Service Bus managed server is acting as Server but our server can also become a Client when talking to external services using the Business Services having SSL enabled. So we will discuss about Outbound SSL in this post.
1-Way SSL
Before getting into the required OSB setup, enable our SOAP UI mock service to use SSL. Go to File –> Preferences –> SSL Settings and set properties as shown below.
Access your mock service as shown below to confirm that SSL is enabled.
Now update the business service endpoint URI with this URL in the Service Bus Console as shown below.
Now test your business service and you can observe following error in server logs. This is because you have not yet updated the OSB server trust store with the certificate of SOAP UI mock service.
So now export the Public Certificate from the keystore used for mock service and import into OSB trust store using following commands.
keytool –exportcert -alias localclient -keystore clientkeystore.jks -file localclient.cer
keytool -importcert -alias localclient -keystore osbkeystore.jks -file localclient.cer
Now test your Business Service to see the response as given below.
2-Way SSL
In case of 2-way SSL, our Proxy Service acts as client and need to send the corresponding Public Certificate when server requests(in our case, it’s SOAP UI Mock Service).
In Service Bus, the resource Service Key Provider is used to retrieve the required PKI credentials that includes Private key paired with a certificate. Proxy services use this key-pair to authenticate when acting as a client during an outbound SSL i.e. during routing a message to HTTPS business service or proxy service requiring Client Certificate authentication. You can find more information in Service Bus documentation here.
Service Key Provider makes use of PKI credential mapper to retrieve the PKI credentials which has to be created first.
PKI Credential Mapper
In WLS admin console, navigate to Security Realms –> myrealm –> Providers –> Credential Mapping. Click New.
Give name and select Type as PKICredentialMapper and Click OK.
Verify that new credential mapping provider is created.
Now click SSLPKIProvider and navigate to Provider Specific tab. Mention the Keystore and Pass Phrase specific to OSB managed server and click Save.
Service Key Provider
We will directly use the sbconsole for creating the Service Key Provider and to make other required changes for Business and Proxy Services.
Create a OSB session and select Service Key Provider from drop down menu as shown below once you select the Service Bus Project.
Provide the name and click Create.
Now the Service Provider Definition look like as below. Since we are using this for SSL purpose click search icon for SSL Client Authentication Key.
Choose the Key Alias as shown below and provide the password.
Click OK to bring up following screen and Save your changes done for Service Key Provider. Do activate Service Bus session.
Soap UI Settings
Before proceeding with Proxy and Business service changes, you have to enable the SOAP UI mock service to request for Client Certificate.
To do this, navigate to File –> Preferences –> SSL Settings and choose Client Authentication as shown below.
Now test your Proxy Service to observe the following errors in response tab, jetty log and Service Bus logs respectively. This happens as we have not yet imported OSB server Public Certificate into clientkeystore.jks and also did not configure our Proxy/Business Service to send the client Certificate.
Export OSB server public certificate and import into clientkeystore.jks using following commands.
keytool -exportcert -alias localosb –keystore osbkeystore.jks –file osbcert.cer
keytool -importcert -alias localosb -keystore clientkeystore.jks –file osbcert.cer
With this, we are done with the SOAP UI settings and let us proceed with the changes required for Proxy and Business Services.
Proxy and Business Service changes
Open business service and navigate to Transport Detail tab. Select Client Certificate as shown below for Authentication and save changes.
Open proxy service and navigate to Security –> Security Settings tab. Click search icon for Service Key Provider.
Click Search and select the one that we have created earlier as shown below and click OK.
Now Security tab should show your selection as below.
Remember that you have to create OSB session before making changes and need to activate it once your changes are done.
You should see successful response as shown below, if you test your proxy service now.
Please note that above logs are generated when following JVM options are set in setDomainEnv.cmd file for EXTRA_JAVA_PROPERTIES.
-Dssl.debug=true -Dweblogic.StdoutDebugEnabled=true