Preparing Source System Security for Data Hub
You need to do some preparation to ensure clear communication between your source system and Data Hub.
Use the Data Hub certificate keystore for the source system. There are a few ways you can use the Data Hub certificate keystore.
- The keystore file can be found in the Data Hub distribution package and can be used directly within the source system. For example, the source system only has to access the end point of the Data Hub instance. Then, the Data Hub certificate keystore can be configured by javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword system property from the JVM.
- The Data Hub certificate can be added into the JRE keystore (see the following section about Adding the Data Hub certificate to JRE keystore). Then the Java client uses the Data Hub certificate by default. It also trusts the Data Hub instance only if there is no javax.net.ssl.trustStore configured in the Java environment.
- The Data Hub certificate can be added into the existing keystore (see the following section about Adding a Data Hub certificate to your existing Trusted store). Then program the Java client to use the keystore as a trust store. Programming the Java client to use the keystore as a trust store is under the hood using javax.net.ssl.SSLContext. Such a configuration depends on a different client library, for example Jersey, Spring rest template, or something else.
Adding the Data Hub Certificate to the JRE Keystore
- List the datahub.jks entries, and record the Alias name, for example, "1".
keytool -list -v -keystore datahub.jks -storepass 123456
Console output:
Keystore type: JKS Keystore provider: SUN Your keystore contains 1 entry Alias name: 1 Creation date: 19-Sep-2017 Entry type: PrivateKeyEntry ...
- Export the Data Hub certificate.
keytool -export -keystore datahub.jks -alias 1 -file myDatahubCertificate.pem -storepass 123456
- Import the certificate to your local JRE (you may need sudo or root user).
sudo keytool -import -alias myDatahubCertificate -file myDatahubCertificate.pem -keystore /Library/Java/JavaVirtualMachines/jdk11.0.3.jdk/Contents/Home/jre/lib/security/cacerts -storepass changeit
- Check and verify the local JRE keystore.,
sudo keytool -list -v -keystore /Library/Java/JavaVirtualMachines/jdk11.0.3.jdk/Contents/Home/jre/lib/security/cacerts -storepass changeit
- (Optional) Remove the Data Hub certificate from the JRE when it is not needed.
sudo keytool -delete -alias myDatahubCertificate -keystore /Library/Java/JavaVirtualMachines/jdk11.0.3.jdk/Contents/Home/jre/lib/security/cacerts -storepass changeit
Adding Data Hub Certificate to Your Existing Trusted Store
- List the datahub.jks entries, and record the Alias name, for example, "1".
keytool -list -v -keystore datahub.jks -storepass 123456
Console output:
Keystore type: JKS Keystore provider: SUN Your keystore contains 1 entry Alias name: 1 Creation date: 19-Sep-2017 Entry type: PrivateKeyEntry ...
- Export the Data Hub certificate.
keytool -export -keystore datahub.jks -alias 1 -file myDatahubCertificate.pem -storepass 123456
- Import the myDatahubCertificate.pem into the existing keystore.
keytool -import -alias mydatahubcertificate -file myDatahubCertificate.pem -keystore myExistingKeystore
- Check and verify the local JRE keystore.
keytool -list -v -keystore myExistingKeystore
- (Optional) Remove the Data Hub certificate from the existing keystore when it is not needed.
keytool -delete -alias mydatahubcertificate -keystore myExsitingKeystore