Skip to content

Fortified IDDocs

4. mTLS in Apache HTTPD using a Self-Signed CA and Client Certificates

Creating a Self-Signed CA and Client Certificate Using Keystore Explorer (PKCS#12) for mTLS in Apache HTTPD

This optional example adds client certificate authentication to the Fortified ID Access route /access/authn/cert. Clients still verify Apache’s server certificate from step 2. For this route, Apache also verifies the client certificate against a CA you configure.

Use the self-signed CA below for a test setup. For your deployment, choose the client CA, certificate lifetimes, and trust policy that fit your environment. Keep the CA private key separate from the Apache server and give each test client only its own client key pair.

  • Keystore Explorer installed.
  • Working HTTPS and a verified Access route from step 3.
  • mod_ssl and mod_headers enabled in Apache. The example uses mod_headers to pass certificate information to Access.

Step 1: Create a Self-Signed CA Certificate

Section titled “Step 1: Create a Self-Signed CA Certificate”
  1. Open Keystore Explorer and create a new keystore (PKCS#12 format).
  2. Click Tools → Generate Key Pair.
  3. Select RSA (2048-bit or higher) and click OK.
  4. Enter the Distinguished Name (DN) details (e.g., CN=MyCA, O=MyOrg, C=SE).
  5. Set the validity period (e.g., 3650 days for 10 years). Press Apply to update the years.
  6. Click Add Extensions
  7. Click Use Standard Template
  8. Select CA and click OK
  9. Click OK.
  10. Click OK.
  11. Keep or change the Alias. Click OK
  12. Set a password for the key pair and click OK.
  13. Click OK.
  14. Save the keystore (myCA.p12).
  15. Set a password for the keystore and click OK.

  1. Open myCA.p12 in Keystore Explorer.
  2. Right-click the CA key pair → Export → Export Certificate Chain.
  3. Choose Head Only, X.509 and PEM format and save it as ca.cer.

  1. Open myCA.p12 in Keystore Explorer.
  2. Right-click the CA key pair → Sign
  3. Select Sign new key pair, select (2048-bit or higher) and click OK.
  4. Set the validity period (e.g., 3650 days for 10 years). Press Apply to update the years.
  5. Enter the Distinguished Name (DN) details (e.g., CN=Client, O=MyOrg, C=SE).
  6. Click Add Extensions
  7. Click Use Standard Template
  8. Select SSL Client and click OK
  9. Click OK
  10. Click OK.
  11. Keep or change the Alias. Click OK
  12. Set a password for the key pair and click OK.
  13. Right-click the Client key pair → Export → Export Key Pair.
  14. Select PKCS#12, set a password for the key pair and the path for the Export File.
  15. Click Export.
  16. Save the keystore if you would like to keep the client certificate in the keystore.

Step 4: Configure Apache HTTPD for mTLS on /access/authn/cert

Section titled “Step 4: Configure Apache HTTPD for mTLS on /access/authn/cert”

Copy the exported public CA certificate, ca.cer, to C:\Apache24\conf. Use your actual installation path if it differs.

  1. Open C:\Apache24\conf\extra\httpd-ssl.conf and locate the HTTPS virtual host that serves Access.

  2. Add the CA trust directive and the route configuration inside that virtual host. This example uses TLS 1.2 for the client-facing connection so Apache can request a client certificate on the selected route. The protocol setting applies to the whole virtual host. Check that this scope and protocol fit your deployment before applying it.

    SSLCACertificateFile "${SRVROOT}/conf/ca.cer"
    SSLProtocol -all +TLSv1.2

    Set the certificate headers from the TLS connection. Use the example only for the Access route that expects them.

    <Location "/access/authn/cert">
    SSLVerifyClient require
    SSLVerifyDepth 10
    RequestHeader set SSL_CLIENT_CERT "%{SSL_CLIENT_CERT}s"
    RequestHeader set SSL_CLIENT_VERIFY "%{SSL_CLIENT_VERIFY}s"
    RequestHeader add X-Forwarded-Scheme https
    </Location>
  3. From C:\Apache24\bin, test the Windows service configuration in PowerShell. Substitute your service name if needed.

    Terminal window
    .\httpd.exe -n "Apache HTTP Server" -t
  4. Restart the service after the test reports Syntax OK.

Step 5: Import the client keystore and verify access

Section titled “Step 5: Import the client keystore and verify access”
  1. Import the exported client PKCS#12 file into the certificate store your browser or test client uses.
  2. Open the configured Access certificate route and confirm that authentication succeeds with the trusted client certificate.
  3. Repeat the request without a client certificate and with an untrusted client certificate. Confirm that both requests are rejected.
  4. Verify that normal Access routes still work without requesting a client certificate.