AEM SSL Setup: AEM 6.1/6.2 & Java Keystore Based SSL Configuration

AEM SSL Setup: AEM 6.1/6.2 & Java Keystore Based SSL Configuration

July 18, 2018 0 By Tad Reeves

As I noted in my other post on setting up AEM for server-to-server SSL, doing full SSL on AEM 6.3 and 6.4 can be done fairly simply these days using a relatively easy-to-use UI for the most part, with the SSL keys themselves stored in the repository.  AEM 6.1 and 6.2 however required one to use a Java Keystore with the keys stored on-disk, a paradigm which still works for AEM 6.3/6.4 as well, though it’s somewhat deprecated and also significantly more difficult.

Most of the steps are in the official Adobe docs, though there are a few gotchas which I’ll document here to make it easier, should you need to set this up or debug it.

Generating SSL Certificates & Importing into Java Keystore

First, I’ll assume here that you’re going to need to generate SSL certificates that need to be signed by an external cert signing authority.  Self-signed certs will work in AEM as well, but let’s just assume for the purposes of the docs here that you’re doing this for PRD and are required to use externally-valid SSL certs.

First, generate your cert-signing request (CSR) which will also create a JKS file and embed the private key for the SSL cert into the JKS file:

Then, once you get the signed certs back from your certificate authority, you may first need to install their intermediate certs or root certs into your JKS file, presuming their intermediate certs aren’t embedded in the JDK.  This is a vital step if your organization runs its own cert authority.

After this, you’ll want to import your signed cert back into the JKS file.  First, make sure you have the alias correct for the cert you’re importing (important if you’re doing this for many servers).   To see the certs which are loaded in a given JKS file use:

In this case, the ‘alias’ you would use for your import command would be ‘aem-author-test’.   The alias is just a key to the entries in the JKS database.  It’s an arbitrary name and can be anything you want.

(Important Note: have not tested this alias with ¯\_(ツ)_/¯ emoji, so perhaps not anything you want)

Import the signed cert back in with:

Assuming the alias names line up between the CSR and the imported signed cert, you’ll see:

When you import the cert.

Configuring AEM to use SSL

To get AEM to run on SSL using the certificate you’ve just created, you’ll need to do the following:

  1. Open CRXDE Lite and select the /apps folder. Click Create > Create Folder to create a folder named system (http://localhost:4502/crx/de).
  2. Below the system folder create a folder named config.author (or config.publish if this is a publisher)
  3. Select the /apps/system/config.author node.
  4. Click Create Create Node and enter the following properties:
    1. Nameorg.apache.felix.http
    2. Typesling:OsgiConfig
  5. Add properties to the node according to the following table:
Name Type Value
org.apache.felix.https.enable Boolean true
org.osgi.service.http.port.secure Long 5443 (what you want as your AEM SSL port)
org.apache.felix.https.nio Boolean true
org.apache.felix.https.keystore String /opt/aem/ssl/AEM_author_dev.jks
(or wherever you’ve put this keystore)
org.apache.felix.https.keystore.password String The keystore password
org.apache.felix.https.keystore.key String The SSL key alias noted above (i.e. aem-author-test)
(optional) org.apache.felix.https.keystore.key.password String JKS files support a password on individual certificate entries in addition to the keystore password.  If your key has one, put the password here.  Otherwise, do not include this value.
(optional) org.apache.felix.https.truststore String Path to truststore.  If you use a 3rd-party cert signing authority, you may need to create a separate truststore which includes the 3rd-party intermedia/root certs.  If so, add this truststore path here.
(optional) org.apache.felix.https.truststore.password String Truststore password.
(Optional) org.apache.felix.https.clientcertificate String Defaults to none

 

After you’ve added these nodes, click Save All in crxde.  If you’re tailing the log, you’ll see a number of org.apache.felix entries streaming past, and you may see SSL attempt to be enabled.  Once Felix finishes refreshing, restart the entire AEM instance.

Once AEM restarts, you should see an entry like this in the logs, indicating that it’s listening on the HTTPS port:

 

Adding Truststore to the JVM

Some features of AEM, when making outbound calls, originate from within Felix and will use the  org.apache.felix.https.truststore value you set up above for the truststore.  However, some other calls (replication, flush agent requests) are made directly by the JDK, and require that the truststore you added be loaded into the JDK as well.  

To do this, you will need to add an extra argument into your AEM start script to add a truststore to the JVM as well: