Skip to Content
Technical Articles

Using a Wild Card SSL Certificate with the SAP Cloud Connector

You may already be using the cloud connector and now you wish to secure it.  Depending upon your server setup and organisation’s policies this can be straight forward or more involved.

For most vanilla setups, we can generate a Certificate Signing Request (CSR) from the SAP Cloud Connector’s user interface and then upload the signed certificate response.  There’s a great tutorial here https://developers.sap.com/tutorials/cp-connectivity-install-cloud-connector.html

If however you have an existing wild card certificate to use there are some additional steps, those are captured in this blog post.

  1. Retrieve Keystore Password
  2. Convert existing private key and existing certificate into p12
  3. Update Keystore with Wildcard Certificate

Pre-requisites

  • Root access to linux installation of SCC
  • Private Key used to generate wildcard certificate, usually .pem
  • Wildcard public certificate, usually .crt

Background

The SAP Cloud Connector (SCC) uses tomcat and a java keystore under the covers. The keystore used by Tomcat hold the SSL certificates. Typically you interact with the java keystore with the keytool command.  Keytool does not support importing private keys.  We therefore need to replace the existing keystore certificate.

1. Retrieve Keystore Password

The keystore used by the SCC is password protected.  This password is generated during install, but it is not displayed.  We can retrieve the password with the following command.

This command should be executed as root.

## Retrieve existing keystore password
java -cp /opt/sap/scc/plugins/com.sap.scc.rt*.jar \
  -Djava.library.path=/opt/sap/scc/auditor \
   com.sap.scc.jni.SecStoreAccess \
  -path /opt/sap/scc/scc_config -p

## Verify access to SAP Cloud Connector keystore
ls -l /opt/sap/scc/config/ks.store

Using the password retrieved we can confirm it is valid and view the contents of our existing keystore (ks.store).

## List existing certificates
keytool -list -keystore /opt/sap/scc/config/ks.store 

The output from keytool shows the alias used for the SCC certificate is tomcat.  We need to replace the tomcat entry with our own certificate.

2. Convert existing private key and existing certificate into p12

The keytool requires a pkcs12 format certificate, we can generate that with the private key (pem) and certificate (crt) file.

We can inspect our 2 files to confirm they have the expected contents.

We should see

—–BEGIN PRIVATE KEY—– in the .pem file

—–BEGIN CERTIFICATE—– in the .crt file

## Convert .pem and .crt into .p12 for keytool
openssl pkcs12 -export \
-name tomcat \ 
-inkey private.pem \
-in cert-x509.crt \
-out server.p12

Let’s understand this command with some placeholders, the name tomcat is the default certificate alias the SCC uses.

openssl pkcs12 -export \
-name [tomcat is the certificatet name the SCC wants] \
-inkey [your private.pem] \
-in [your signed certificate.crt] \
-out [export file to be generated.p12] 

3. Update Keystore with Wildcard Certificate

With the commands below we can update the keystore with our converted (.p12) certificate.

## Backup existing keystore
cp /opt/sap/scc/config/ks.store /opt/sap/scc/config/ks.bak

## Replace existing tomcat alias with our certificate
keytool -importkeystore -deststorepass hM1e3nnT64areVVV -destkeypass hM1e3nnT64areVVV \
-destkeystore /opt/sap/scc/config/ks.store -srckeystore /hana/cloud-connector/certificates/server.p12  \
-srcstoretype PKCS12 -srcstorepass topsecret -alias tomcat

## Set file permissions correctly
chown sccadmin:sccgroup /opt/sap/scc/config/ks.store

## Restart the cloud connector
systemctl restart scc_daemon

To understand the keytool command I have added some placeholders.

## Java keytool command
keytool -importkeystore -deststorepass [SCC password from step 1] \ 
-destkeypass [SCC password from step 1] \
-destkeystore /opt/sap/scc/config/ks.store ## This is the default scc keystore path \
-srckeystore [path to certificated exported by openssl command above]  \
-srcstoretype PKCS12 ## This is the format we exported from openssl \
-srcstorepass [password input into openssl command] \
-alias tomcat ## tomcat is the alias we need to use for the SCC to find our certificate

All being well we should now see the secure padlock in our browser be able to load the SAP Cloud Connector interface without any security warnings.

Troubleshooting

Errors are usually reported in the SCC log found here

## Check the SCC log file for errors
tail /opt/sap/scc/log/ljs_trace.log

The Java version is important, as the SCC and Tomcat rely upon java, using a current java version provides maximum compatibility.  If you see errors such as these below

  • Not Secure
  • This site uses an outdated security configuration
  • Site Is Using Outdated Security Settings
  • Connection Not Secure
  • This page uses weak encryption
  • Your connection to this site is not fully secure

This can can be caused the installer picking an old java version. The SCC is then not able to use modern encryption algorithms. To fix this, update your $JAVA_HOME and re-install the same scc version with the –force and -U options.

rpm --force -U ./com.sap.scc-ui-2.12.3-8.x86_64.rpm

Conclusion

With a few steps we can secure the cloud connector with a wild card certificate. The SAP Cloud Connector is built on open standards that allows it to be configured to meet your organisations needs.

1 Comment
You must be Logged on to comment or reply to a post.
  • I ran the exact steps and got this error “keytool error: java.lang.Exception: Alias <tomcat> does not exist” even though it asked for overwrite the existing tomcat one.

    I ended run the command without ‘alias’ parmeter and have it imported into a different alias. After that I edit tomcat config so SCC https can point to that alias on /opt/sap/scc/config_master/org.eclipse.gemini.web.tomcat/default-server.xml