Home / AWS

AWSChecklistAdvanced

ALB mutual TLS rollout checklist: trust stores, CA rotation, CRLs and connection log triage

Roll out client certificate authentication on an ALB without locking out partners - mode choice, trust store limits, revocation, CA rotation and failure codes.

Deepak Bhardwaj7 min read

Applies toApplication Load Balancer HTTPS listeners, ELB trust stores, AWS CLI v2, OpenSSL

You need an Application Load Balancer to authenticate clients by certificate, and you can't break existing callers. A rejected client certificate fails in the TLS handshake, so there is no HTTP status and no ALB access log entry to debug. Set up the evidence first, then enforce.

Before you start: design decisions

  • Choose the mode. Mode is per listener, not per host name or path. Every host name on the listener gets it.
passthrough verify
Who validates Your application The ALB, during the handshake
Trust store Not used Required, one per listener
Forwarded certificate Whole chain in X-Amzn-Mtls-Clientcert Leaf in X-Amzn-Mtls-Clientcert-Leaf
Parsed fields None -Serial-Number, -Issuer, -Subject, -Validity (same X-Amzn-Mtls-Clientcert prefix)
Fits Custom validation such as OCSP or per-tenant CAs Standard PKI with CRLs
  • Separate mTLS traffic onto its own port or its own ALB. Browser users on the same listener would be affected. An ALB has a low fixed limit on verify-mode listeners (two at the time of writing; check the current limits).
  • Check what sits in front. Anything that terminates TLS before the ALB, such as CloudFront, presents its own connection, not the client's. Client certificates must reach the ALB over TCP end to end.
  • Plan authorization. Verify mode proves the certificate chains to your CA. It doesn't prove this caller may use this API. If the bundle contains a public or shared CA, anyone with a certificate from it passes.
  • Budget for handshakes. Session resumption isn't supported with mTLS, so clients without keep-alive pay for a full handshake each time.

Caution

Trust the X-Amzn-Mtls-* headers only when the request can have come only from the mTLS listener. If targets also accept traffic from another listener, or directly, test whether a client can supply those headers itself. Use a separate target group and port for the mTLS listener, and restrict the target security group to the ALB.

Check the certificates

  • X.509v3 leaf, RSA 2K-8K or ECDSA P-256, P-384 or P-521, SHA-256 or stronger signature.
  • Chain depth of four or less.
  • Client authentication in the extended key usage. A server-only certificate is a common partner mistake.
openssl x509 -in client.pem -noout -subject -issuer -serial -dates -ext extendedKeyUsage
openssl verify -purpose sslclient -CAfile ca-bundle.pem -untrusted intermediates.pem client.pem
  • Clients send their intermediates, or the bundle includes them.
  • The bundle is PEM without blank lines. Comments start with # and contain no -.
sed -i '/^[[:space:]]*$/d' ca-bundle.pem
grep -c 'BEGIN CERTIFICATE' ca-bundle.pem

Turn on connection logs first

Access logs record requests. Connection logs record handshakes, including the failed ones. The bucket must be in the load balancer's Region, use SSE-S3, and allow the log delivery service to write:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": {"Service": "logdelivery.elasticloadbalancing.amazonaws.com"},
    "Action": "s3:PutObject",
    "Resource": "arn:aws:s3:::my-elb-logs/mtls/AWSLogs/111122223333/*"
  }]
}
aws elbv2 modify-load-balancer-attributes --load-balancer-arn "$ALB_ARN" --attributes \
  Key=connection_logs.s3.enabled,Value=true \
  Key=connection_logs.s3.bucket,Value=my-elb-logs \
  Key=connection_logs.s3.prefix,Value=mtls
  • ELBConnectionLogTestFile appears under the prefix.

Create the trust store and a canary listener

TS_ARN=$(aws elbv2 create-trust-store --name partners-v1 \
  --ca-certificates-bundle-s3-bucket my-pki --ca-certificates-bundle-s3-key ca-bundle.pem \
  --query 'TrustStores[0].TrustStoreArn' --output text)

aws elbv2 create-listener --load-balancer-arn "$ALB_ARN" \
  --protocol HTTPS --port 8443 --certificates CertificateArn="$CERT_ARN" \
  --ssl-policy "$SSL_POLICY" \
  --mutual-authentication Mode=verify,TrustStoreArn="$TS_ARN",IgnoreClientCertificateExpiry=false \
  --default-actions Type=forward,TargetGroupArn="$TG_ARN"
  • A good certificate works, and a missing, expired or wrong-CA certificate fails:
curl -sv --cert client.pem --key client.key https://api.example.com:8443/health
curl -sv https://api.example.com:8443/health            # must fail
curl -sv --cert wrong-ca.pem --key wrong-ca.key https://api.example.com:8443/health

Tip

Test with a full request, not only openssl s_client. In TLS 1.3 the client finishes its side of the handshake before the server has validated the client certificate. s_client can print a completed handshake, and the alert arrives on the first read.

  • If clients hold several certificates, consider AdvertiseTrustStoreCaNames=on, which sends your CA subject names so clients can choose. Test old clients, because it makes the handshake larger.

Read the failures

Fields are space-delimited with quoted values that contain spaces, so parse them properly:

import collections, glob, gzip, shlex

# 0 timestamp 1 client_ip 2 client_port 3 listener_port 4 protocol 5 cipher
# 6 latency 7 subject 8 validity 9 serial 10 verify_status 11 conn_trace_id
hits = collections.Counter()
for path in glob.glob("logs/**/*.log.gz", recursive=True):
    with gzip.open(path, "rt") as fh:
        for line in fh:
            f = shlex.split(line)
            if f[10].startswith("Failed"):
                hits[(f[10], f[1], f[7], f[9])] += 1

for key, n in hits.most_common(30):
    print(n, *key, sep="\t")
Code Usual cause Fix
ClientCertUntrusted Missing intermediate, or a CA not in the bundle Client sends chain, or add the CA
ClientCertExpired / ClientCertNotYetValid Expiry or client clock drift during issue Reissue; check the issuing host's clock
ClientCertPurposeInvalid Server-only certificate Reissue with client authentication
ClientCertMaxChainDepthExceeded Too many intermediates Shorten the chain
ClientCertCrlHit Certificate is revoked Confirm with the PKI owner; reissue
ClientCertCrlProcessingError Unusable CRL Replace the CRL
ClientCertTypeUnsupported / ClientCertIncompatible Key or signature algorithm Reissue with a supported type

ClientTLSNegotiationErrorCount in AWS/ApplicationELB counts all client TLS errors, so internet scanners also move it. Use it as a trigger and the logs as the answer. For accepted connections, join on conn_trace_id, which also appears in access logs.

Revocation

  • Understand the limits: CRLs only, PEM only, and loaded through an API call. Publishing a new CRL to S3 doesn't update the trust store.
  • Convert DER CRLs, which many CAs publish:
openssl crl -inform DER -in ca.crl -outform PEM -out ca.crl.pem
openssl crl -in ca.crl.pem -noout -lastupdate -nextupdate
aws s3 cp ca.crl.pem s3://my-pki/crl/ca-20261125.pem
aws elbv2 add-trust-store-revocations --trust-store-arn "$TS_ARN" \
  --revocation-contents S3Bucket=my-pki,S3Key=crl/ca-20261125.pem,RevocationType=CRL
  • Automate in this order: add the new CRL, verify, then remove the old revocation ID. Removing first opens a window where revoked certificates pass.
aws elbv2 describe-trust-store-revocations --trust-store-arn "$TS_ARN"
aws elbv2 remove-trust-store-revocations --trust-store-arn "$TS_ARN" --revocation-ids <old-id>

CA rotation without an outage

Warning

modify-trust-store replaces the whole bundle, and you can't append to it. Uploading only the new CA rejects every client still on the old one.

  • Build a bundle with the old and new CAs, and save the previous file as the rollback.
  • Apply it before any client gets a certificate from the new CA:
aws elbv2 modify-trust-store --trust-store-arn "$TS_ARN" \
  --ca-certificates-bundle-s3-bucket my-pki --ca-certificates-bundle-s3-key ca-bundle-old-plus-new.pem
  • List the listeners affected. One trust store can serve many:
aws elbv2 describe-trust-store-associations --trust-store-arn "$TS_ARN"
  • Remove the old CA only when application logs of the X-Amzn-Mtls-Clientcert-Issuer header show it unused for a full business cycle. Include month-end clients.

Emergency rollback

If enforcement locks out critical clients, options in order of preference:

  1. Restore the previous CA bundle.
  2. For an expired-certificate incident, allow expired certificates temporarily. Chain validation stays on.
  3. Turn mTLS off, only if the application enforces authentication itself.
aws elbv2 modify-listener --listener-arn "$LISTENER_ARN" \
  --mutual-authentication Mode=verify,TrustStoreArn="$TS_ARN",IgnoreClientCertificateExpiry=true

Caution

Mode=off removes client authentication for everyone on that listener. If the application trusts the mTLS headers, this can mean open access or a full outage.

Prevent it next time

  • Alarm on CA and CRL expiry dates at 60, 30 and 7 days from a scheduled job.
  • Report client certificates that expire within 30 days, from leaf_client_cert_validity in connection logs.
  • Store bundles and CRLs in a versioned bucket with restricted write access. Whoever writes there decides who gets in.
  • Run the good, missing, expired and wrong-CA tests from CI against a staging listener after every bundle change.