Manage certificates manually
If your internal or third party certificates are not stored in a remote configuration management center such as Vault, we can also define the certificates locally in a JSON file.
Internal certificates
For the internal certification between the WebSphere Commerce Docker containers, ensure that the Common Name (CN) in your certificate and "SubjectAlternativeName" can match the host name that the Docker containers will use. Also, when other source containers connect to a target container, the source container must use the target container's host name. There is strict verification logic in place to check whether the host name used in a request is the same as the SubjectAlternativeName in the certificate on the target container. If the host names do not match, then the connection fails. Here are the SubjectAlternativeNames in the default internal certification included in the WebSphere Commerce Docker containers:
SubjectAlternativeName [ [DNSName: app, DNSName: db, DNSName: search, DNSName: store, DNSName: xc] ]If you do not use the default host names (app/search/store/xc/db) then you need to reconfigure the connections between containers. Here are some options that we can consider.
- Create new certificates and specify the appropriate Common Name (CN)and SubjectAlternativeName in the certificates.
- If we are using docker run to deploy containers, use the --add-host variable to map the IP address to the default host name. See Docker run documentation.
- If we are using docker-compose to deploy containers, leverage the extra_hosts variable to map the IP address to the default host name. See Docker extra_hosts documentation. For example, the default host name for the database is db. If we are not using a database Docker container, then you need to use the extra_hosts variable to map the database IP address to the host name db. For example,
extra_hosts: - "db:<DB server IP>"Here are two sample YAML files that we can use as a reference for how to use the extra_hosts variable.
Note: If the link does not prompt us to save, right-click and save the file. Open the file in a source code editor to view and edit in the proper YAML format.
Add a proxy container to map the default host name and target server.
Note: To replace the default internal certificates, we must name the JSON file as default.json. Otherwise, the certificates are imported using the name of JSON file as an alias in the keystore list.
External certificates
- For external certification between WebSphere Commerce and third party software, ensure that we are importing the proper one-way or two-way certification information.
- Ensure that our customization code, created to connect to third party software, use the correct certification name.
How do I define certificate information in a JSON file?
Note: When you copy the certificates to the JSON file, we must replace the line break with \n to ensure that the entire certificate string is on one line.
- For one-way SSL certificate validation, where one application needs a certificate to a communicate with another application that has SSL enabled, you only need to define the issuing_ca in the JSON file. For example,
{ "issuing_ca": "-----BEGIN CERTIFICATE-----\nMIIFJjCCAw6gAwIBAgIUDUnfHPvwqpztM2lJh40lVUmTjV8wDQYJKoZIhv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nFzDtRa6zfB1UNqUTiacmr9ISqTDGJPOE7o7+5//31yS63/VuPAb\nsskfjtbywGUcjLEoa//vqDUA5VPQSr2MGpqZItt+QQ7eIQPQEt6IaqohmIxvgyDI\nvV35Ld06slZju9IZJdOx5GyRU49ZrhTciNeHBFJbPTzTWw7swjP1Kj13BJ9++YlU\ndHHnJecMgRPXbbFn8cThcIUwhaTEWFhlC7zc4YUpTm8nmHaCLmG8TM7tYLaymHqd\nypMBa3TrGr4+XIgwkWWb9h9+JnlBXc+aq2pJulErzN3raytzv+iTOwcI+YCufgee\nAf25Zzk9t75KIHjSdqu1U/QXiPSgJgr7o2yrtZbeLT+eMHuhCfbuWduipuRgTlUk\na8hvoiFDabCrlJABDYHNO8WMCIqX9qja0crqA1JbPXAEMiYwdtoU+p27CtNupGVE\nQENamacyYD5VhApTnxACwwakMep0jDYQUXUYTeLz6Aj3vVUJl54/3Uqbh6fxKamh\n8xDeb+HjhO5UKDkfAH0qe17qSGGVftMI3YMPCEqrvnnoVl8VHxpvdVjjJoHEEKoE\ne8mrX4Jp9O3xVcGFItMQQzvWc1A47ewqIy6x+bk+0W8fL6+rKd+8U7aRIvC7LFiw\nluvq3QIacuHULtox36A7HFmlYDQ1ozh+tLI=\n-----END CERTIFICATE-----" }
For two-way SSL certificate validation, where SSL is enabled on both applications define more information. For example, { "certificate": "-----BEGIN CERTIFICATE-----\nMIIETDCCAjSgAwIBAgIUTrvpjzgpyt6L9AWj2E0W4ps2woswDQYJKoZIhvcNAQEL\nBQAwKzEpMCcGA1UEAwwgc2VsZnNlcnZlX3Byb2R1Y3Rpb25fcGtpIFJvb3QgQ0Ew\nHhcNMTcwOTI2MDQ1NzM3WhcNMTcxMTIxMDQ1ODA3WjAPMQ0wCwYDVQQDEwR0ZXN0\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtuWgQ5P9KjpgplOyejAE\nj5pDgSmQ6mZkbqY6gnIIKlw1I4Vulaigmeiir37NcAHtLA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aCLmG8TM7tYLaymHqd\nypMBa3TrGr4+XIgwkWWb9h9+JnlBXc+aq2pJulErzN3raytzv+iTOwcI+YCufgee\nAf25Zzk9t75KIHjSdqu1U/QXiPSgJgr7o2yrtZbeLT+eMHuhCfbuWduipuRgTlUk\na8hvoiFDabCrlJABDYHNO8WMCIqX9qja0crqA1JbPXAEMiYwdtoU+p27CtNupGVE\nQENamacyYD5VhApTnxACwwakMep0jDYQUXUYTeLz6Aj3vVUJl54/3Uqbh6fxKamh\n8xDeb+HjhO5UKDkfAH0qe17qSGGVftMI3YMPCEqrvnnoVl8VHxpvdVjjJoHEEKoE\ne8mrX4Jp9O3xVcGFItMQQzvWc1A47ewqIy6x+bk+0W8fL6+rKd+8U7aRIvC7LFiw\nluvq3QIacuHULtox36A7HFmlYDQ1ozh+tLI=\n-----END CERTIFICATE-----", "keystorepass": "ibmkey", "destination_host": "desthost" //just need for transaction server. }
- keystorepass
- If certification defines a new password for keystore, which will be used to generate a new keystore with the certificate and private_key, then import the keystore to the default keystore.
Note: If you defined the password when your generated the private_key, ensure that the keystorepass is the same as the private_key password.
- destination_host
- Only needed for in the JSON file for the Transaction server Docker container. The Transaction server uses the destination_host name to generate dynamic SSL in the WebSphere Application Server that is running in the container.
How do I generate self-signed certificates?
Here is a general example of how to generate certificate. We can also use our own method of generating certificates.
- Create a configuration file to include certificate information. Here is a template for a myconfiguration.conf file.
[req] default_bits = 2048 prompt = no default_md = sha256 req_extensions = req_ext distinguished_name = dn [ dn ] C=US ST=California L=Los Angeles O=MyOrg OU=Commerce emailAddress=<email address> CN = <current_domain_name> [ req_ext ] basicConstraints = CA:FALSE keyUsage = nonRepudiation, digitalSignature, keyEncipherment subjectAltName = @alt_names [ alt_names ] DNS.0 = <current_domain_name>
- Create a private_key. Use the key in the server.key.secure file as the private_key name/value pair of the JSON file.
openssl genrsa -out server.key.secure 2048
- Create a request certificate with parameters from the configuration file.
openssl req -new -key server.key.secure -out server.csr -config myconfiguration.conf
- Create a certificate with parameters from the configuration file. Use the certificate in server.crt file as the value of the certificate name/value pair in the JSON file. For self-signed certificates, this value is also the issuing_ca.
openssl x509 -req -days 365 -in server.csr -signkey server.insecure.key -out server.crt -extensions req_ext -extfile myconfiguration.confIf we are using a CA, the issuing_ca is provided by the CA.
- Check the request file and certificate to ensure SubjectAltName exists.
openssl req -text -noout -in server.csr openssl x509 -in server.crt -text -noout
How do I load the JSON files to the /SETUP/certs/custom directory of a Docker container?
Here are two methods of copying the JSON files to our Docker image.
- We can use the COPY instruction in a Dockerfile to copy the JSON files to the /SETUP/certs/custom directory and create a new Docker image. For example, the following Dockerfile copies a default.json file to the /SETUP/certs/custom directory.
FROM <Docker_registry>/commerce/crs-app:<source_image_tag> COPY default.json /SETUP/certs/custom/
We can customize the WCB utility to package your JSON files into the output customization package. Then, when you build a new Docker image with our customization package, the /SETUP/bin/applyCustomization.sh script automatically puts your JSON files into the /SETUP/certs/custom directory. See Customizing the WebSphere Commerce Build tool.
Importing the local certificates from the JSON file into your running Docker container are handled by the /SETUP/bin/updateLocaCerts.sh script included in all the IBM provided Docker containers. The updateLocalCerts.sh script looks in the /SETUP/certs/custom directory and loads all JSON files.
Related tasks
Accessing Docker image Help
Related reference
Environment data structure in Consul/Vault
Manage certificates with Vault