HTTPS and SSL
All endpoints in Data Hub and Data Hub Adapter are secured using HTTPS. When HTTPS is disabled, Data Hub and Data Hub Adapter function as in version 6.5. New properties are available to enable/disable SSL communication between Data Hub and Data Hub Adapter.
Enabling Data Hub Security
It is a common practice to enable security when deploying an application to a production environment. When it comes to enabling Data Hub security, there are multiple layers that must be considered. To illustrate the different layers in Data Hub security, think about it as you might the different layers in a cake. The layers in the Data Hub security cake are: /Tomcat/Data Hub/Data Hub Adapter/and SAP Commerce Cloud. By default, all applications or layers have enabled HTTPS except Tomcat, so let's examine the necessary changes for Tomcat.
Setting Up a Secure Apache Tomcat 8.5.x
To enable security for Tomcat, open <TOMCAT_HOME>/conf/Catalina/server.xml. Search the file for <Connector port="8080" protocol="HTTP/1.1". At a point of your choosing but somewhat close after this entry, add the following:
<Connector port="8443" maxThreads="200" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" secure="true" SSLEnabled="true" keystoreFile="webapps/datahub-webapp/WEB-INF/classes/datahub.jks" keystorePass="123456" clientAuth="false" sslProtocol="TLS"/>
You can reference the Tomcat 8.5.x server basic configuration from http://tomcat.apache.org/tomcat-8.0-doc/ssl-howto.html#Edit_the_Tomcat_Configuration_File
. Out of the box, the datahub.jks creates a trust relationship with SAP Commerce Cloud by default.
Setting Up a Secure Data Hub
- Data Hub and SAP Commerce Cloud ship with synchronized certificates. You can modify the key values, if you choose, but the values for Data Hub and SAP Commerce Cloud must remain synchronized.
- The Data Hub HTTPS security is on by default. You can verify it is by going to the local.properties file and looking at the property datahub.security.https.enabled=true.
- There are two other properties in the file. datahub.server.url=https://localhost:8443/datahub-webapp/v1 and datahub.extension.exportURL=https://localhost:9002/datahubadapter.
- Optionally, you can set your Data Hub port to another valid value with the following setting datahub.tomcat.http.port=8080.
Enabling HTTPS with the Installer
The Data Hub plugin for the SAP Commerce Cloud platform installer provides the option to configure a custom SSL certificate to handle https traffic. The user can configure their given keyStore and trustStore as a part of existing Data Hub configuration with new certificates elements.
certificates {
keyStore Paths.get(“${customLocation}/datahub_keystore"), "123456"
trustStore Paths.get(“${customLocation}/datahub_truststore"), "123456"
}
If the user doesn’t have this optional configuration, then the installer copies the certificate from the deployed Data Hub webapp to the Tomcat work directory. It also configures the Tomcat server.xml with the default keyStore location.
The trustStore value configures as a property. The user can override datahub.security.ssl.trustStore. If there is no configuration given at Data Hub server startup, then it configures the default trustStore from the Data Hub work directory.
Set Up and Start Up
task setupDatahub << {
datahub(datahubServerId).setup datahubCfg
}
task startDataHub << {
datahub(datahubServerId).start CATALINA_OPTS
}
Disabling Data Hub Security for a Developer Environment
Typically, there are two assumptions about a developer environment. First, a developer does not want the development environment cluttered up with a bunch of security, so it is best to disable it. Second, when development of the feature is complete, re-enable security for the testing environment. The following steps demonstrate how to disable security as is commonly done in the development environment.
Disabling Security in Data Hub, Data Hub Adapter, and SAP Commerce Cloud
- By default, Tomcat does not have security enabled. If you have not activated security for Tomcat, then you can ignore it.
- By default, Data Hub security is active. Open your Data Hub local.properties file with a text editor and set datahub.security.https.enabled to false. While in the local.properties file, comment out datahub.server.url=https://localhost:8443/datahub-webapp/v1 and add datahub.server.url=http://localhost:8080/datahub-webapp/v1.
- By default, Data Hub Adapter security is active. To disable it, go to SAP Commerce Cloud and open its local.properties file. Add the property datahubadapter.security.https.enabled, and set it to false.
- To trust the platform by default (development use case), Data Hub is configured to use the truststore.jks (located in the webapps/datahub-webapp-SOME-VERSION/WEB-INF/classes/datahub.jks). However, the configuration can be different as shown in the following example.
//Configuration of the Data Hub instance level trustStore datahub.security.ssl.trustStore=yourTrustStore.jks datahub.security.ssl.trustStorePassword=yourTrustStorePassword
Activating Security for Testing Purposes
- Setting Up a Secure Apache Tomcat
- Setting Up a Secure Data Hub
- Setting Up a Secure Data Hub Adapter
- Setting Up a Secure SAP Commerce Cloud