Lab: a two-tier private CA (offline root, issuing CA), server and client certificates, and mutual TLS
Build a private PKI with openssl: an offline root that only signs the issuing CA and its own CRL, an issuing CA with pathlen:0, a server certificate with DNS and IP SANs and client certificates with clientAuth. Run a mutual-TLS service in Python, prove that seven bad clients and servers are rejected, revoke a client certificate through a CRL, and map the setup to nginx.
Contentsand lesson path
On this page
- Goal and setup
- Step 1: The two CA configuration files
- Step 2: Create the offline root
- Step 3: Create the issuing CA and take the root offline
- Step 4: A server certificate with DNS and IP SANs
- Step 5: Client certificates, an expired one and a rogue CA
- Step 6: A mutual-TLS server and client
- Step 7: Seven ways to be rejected
- Step 8: Revoke a client certificate with a CRL
- Step 9: The same setup in nginx
- Troubleshooting
- Check your understanding
- Apply it
- Review prompt
Lessons of TLS & PKI
- What TLS gives you: confidentiality, integrity and authentication Concept · 15 min
- Lab: the TLS 1.3 handshake on the wire, with SNI, ALPN and HTTP/2 vs HTTP/3 Lab · 25 min
- Certificates and chains: how a client decides to trust a server Concept · 20 min
- Lab: a two-tier private CA (offline root, issuing CA), server and client certificates, and mutual TLS Lab · 30 min
- Operating PKI: ACME automation as lifetimes shrink, revocation availability and CA compromise plans Worked example · 25 min
- Check: debug five broken TLS endpoints with openssl s_client Knowledge check · 10 questions
What you will learn
- Explain X.509 certificates, chains of trust, validation rules (names, validity, key usage) and revocation, and inspect them with openssl.
- Issue and automate certificates with a private CA and with ACME, and configure mutual TLS between two services.
- Design a private PKI for an organisation - an offline root and issuing CAs, revocation endpoints that stay available, and a recovery plan for an issuing-CA key compromise.
01. Goal and setup
You will build the kind of private PKI (public key infrastructure) that many organisations run for internal services, and use it for mutual TLS (mTLS), where the server checks the client's certificate as well as the other way round.
The design has two tiers. The root CA is the trust anchor that every client installs. Its key signs only two things: the issuing CA's certificate and the root's own CRL. Because replacing a root means touching every client, its key is kept offline: in production on an air-gapped machine or a hardware security module (HSM), used in a short, witnessed "key ceremony" a few times a year. The issuing CA is online and signs the day-to-day certificates. If it is ever compromised, the root can revoke it and sign a new one without any client changing its trust store; lesson 5 rehearses that.
In this lab the root lives in its own folder, its key is encrypted with a passphrase that you set only for the two signing commands, and no service configuration ever points at that folder. That is a simulation, but it keeps the rule visible: if a command outside a ceremony needs root-offline/private, something is wrong.
You need: openssl 3.x for the CA work (outputs come from OpenSSL 3.0.2) and uv for Python 3.12, which runs the mTLS server and client. No Python packages are needed. Ports 8448 and 8449 on 127.0.0.1. Run every block in the same terminal: later blocks reuse variables such as $EC, $ROOT_PASS and the *_PID values.
pki-lab/
├── root-offline/ root CA: root.cnf, root.crt, private/root.key (encrypted),
│ index.txt (what it signed), crl/root.crl
├── issuing/ issuing CA: issuing.cnf, issuing.crt, private/issuing.key,
│ index.txt, crl/issuing.crl
├── certs/ server and client keys, certificates and chain files
├── trust/root.crt the only file that clients and servers trust
├── rogue/ a CA that nobody trusts, for a negative test
├── mtls_server.py step 6
└── mtls_client.py step 6mkdir pki-lab && cd pki-lab
uv venv -q --managed-python --python 3.12 .venv && source .venv/bin/activate
mkdir -p root-offline/private root-offline/newcerts root-offline/crl \
issuing/private issuing/newcerts issuing/crl certs trust rogue
chmod 700 root-offline/private issuing/private
touch root-offline/index.txt issuing/index.txt
echo 1000 > root-offline/serial && echo 2000 > issuing/serial
echo 01 > root-offline/crlnumber && echo 01 > issuing/crlnumber02. Step 1: The two CA configuration files
openssl ca keeps a small database per CA: index.txt lists every certificate it signed and its status, serial holds the next serial number and crlnumber the next CRL number. The configuration says where those files are and defines extension sections, one per certificate type, so every certificate of a type gets the same constraints. The root defines only v_root and v_issuing; the issuing CA defines v_server and v_client, and nothing that can create a CA.
# Root CA: used only to sign issuing-CA certificates and the root CRL.
[ca]
default_ca = root_ca
[root_ca]
dir = root-offline
database = $dir/index.txt
serial = $dir/serial
crlnumber = $dir/crlnumber
new_certs_dir = $dir/newcerts
certificate = $dir/root.crt
private_key = $dir/private/root.key
default_md = sha256
default_days = 1825
default_crl_days = 180
policy = policy_cn
unique_subject = no
copy_extensions = none
[policy_cn]
commonName = supplied
[v_root]
basicConstraints = critical, CA:TRUE
keyUsage = critical, keyCertSign, cRLSign
subjectKeyIdentifier = hash
[v_issuing]
basicConstraints = critical, CA:TRUE, pathlen:0
keyUsage = critical, keyCertSign, cRLSign
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid
crlDistributionPoints = URI:http://127.0.0.1:8456/root.crl# Issuing CA: online, signs server and client certificates and its own CRL.
[ca]
default_ca = issuing_ca
[issuing_ca]
dir = issuing
database = $dir/index.txt
serial = $dir/serial
crlnumber = $dir/crlnumber
new_certs_dir = $dir/newcerts
certificate = $dir/issuing.crt
private_key = $dir/private/issuing.key
default_md = sha256
default_days = 30
default_crl_days = 7
policy = policy_cn
unique_subject = no
# copy = take extensions from the CSR (the SANs) unless this file already
# sets them, so a CSR cannot ask for CA:TRUE or a different key usage.
copy_extensions = copy
[policy_cn]
commonName = supplied
[v_server]
basicConstraints = critical, CA:FALSE
keyUsage = critical, digitalSignature
extendedKeyUsage = serverAuth
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid
crlDistributionPoints = URI:http://127.0.0.1:8456/issuing.crl
[v_client]
basicConstraints = critical, CA:FALSE
keyUsage = critical, digitalSignature
extendedKeyUsage = clientAuth
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid
crlDistributionPoints = URI:http://127.0.0.1:8456/issuing.crlThree settings deserve attention. pathlen:0 in v_issuing means no CA may exist below the issuing CA. copy_extensions = copy takes extensions from the request only when the section does not set them, so a requester chooses its SANs but not its key usage or CA status; step 4 tests that. And the root signs CRLs valid for 180 days, the issuing CA for 7: the offline root cannot re-sign often, the online issuing CA can and should.
03. Step 2: Create the offline root
export ROOT_PASS='lab-only-root-passphrase' # in production: typed at the ceremony
openssl req -x509 -config root-offline/root.cnf -extensions v_root \
-newkey ec -pkeyopt ec_paramgen_curve:P-384 -passout env:ROOT_PASS \
-keyout root-offline/private/root.key -subj "/CN=Lab Root CA 2026" -days 3650 \
-out root-offline/root.crt 2>/dev/null
openssl ca -config root-offline/root.cnf -gencrl -passin env:ROOT_PASS \
-out root-offline/crl/root.crl 2>/dev/null
cp root-offline/root.crt trust/root.crt
openssl x509 -in trust/root.crt -noout -subject -issuer -ext basicConstraints,keyUsage
head -1 root-offline/private/root.keysubject=CN = Lab Root CA 2026
issuer=CN = Lab Root CA 2026
X509v3 Basic Constraints: critical
CA:TRUE
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
-----BEGIN ENCRYPTED PRIVATE KEY-----The root is self-signed (subject equals issuer), may sign certificates and CRLs, and has no path length limit, so it can have an issuing CA below it. Its key is stored encrypted. Only the certificate is copied to trust/, which is what you would distribute to clients.
04. Step 3: Create the issuing CA and take the root offline
openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
-keyout issuing/private/issuing.key -subj "/CN=Lab Issuing CA 1" \
-out issuing/issuing.csr 2>/dev/null
openssl ca -config root-offline/root.cnf -extensions v_issuing -days 1825 \
-passin env:ROOT_PASS -batch -notext -in issuing/issuing.csr \
-out issuing/issuing.crt 2>/dev/null
unset ROOT_PASS # the ceremony is over
openssl ca -config issuing/issuing.cnf -gencrl -out issuing/crl/issuing.crl 2>/dev/null
openssl verify -CAfile trust/root.crt issuing/issuing.crt
openssl x509 -in issuing/issuing.crt -noout -subject -issuer -serial \
-ext basicConstraints,crlDistributionPoints
cut -f1,4,6 root-offline/index.txtissuing/issuing.crt: OK
subject=CN = Lab Issuing CA 1
issuer=CN = Lab Root CA 2026
serial=1000
X509v3 Basic Constraints: critical
CA:TRUE, pathlen:0
X509v3 CRL Distribution Points:
Full Name:
URI:http://127.0.0.1:8456/root.crl
V 1000 /CN=Lab Issuing CA 1The root's database now holds one valid (V) entry, serial 1000. The issuing CA has CA:TRUE, pathlen:0 and points to where the root's CRL will be published. Its key has no passphrase (-nodes) because an online CA signs without a person present; in production it would sit in an HSM or a cloud key service. You also published an empty CRL for the issuing CA straight away: clients that check revocation fail when there is no CRL at all.
05. Step 4: A server certificate with DNS and IP SANs
The service is called svc.lab.test and is also reached as 127.0.0.1, so the SAN lists both. The request carries the SANs; the v_server section adds everything else. The chain file puts the leaf first and the issuing CA after it, which is what a server must send.
EC="-newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes"
openssl req -new $EC -keyout certs/svc.key -subj "/CN=svc.lab.test" \
-addext "subjectAltName=DNS:svc.lab.test,IP:127.0.0.1" -out certs/svc.csr 2>/dev/null
openssl ca -config issuing/issuing.cnf -extensions v_server -batch -notext \
-in certs/svc.csr -out certs/svc.crt 2>/dev/null
cat certs/svc.crt issuing/issuing.crt > certs/svc-fullchain.pem
openssl x509 -in certs/svc.crt -noout -ext subjectAltName,extendedKeyUsage
openssl verify -CAfile trust/root.crt -untrusted issuing/issuing.crt \
-purpose sslserver -verify_hostname svc.lab.test -verify_ip 127.0.0.1 certs/svc.crtX509v3 Extended Key Usage:
TLS Web Server Authentication
X509v3 Subject Alternative Name:
DNS:svc.lab.test, IP Address:127.0.0.1
certs/svc.crt: OKNow a negative test of the CA itself: a request that asks to become a CA.
openssl req -new $EC -keyout certs/greedy.key -subj "/CN=greedy.lab.test" \
-addext "subjectAltName=DNS:greedy.lab.test" \
-addext "basicConstraints=critical,CA:TRUE" -out certs/greedy.csr 2>/dev/null
openssl req -in certs/greedy.csr -noout -text | grep -A1 'Basic Constraints'
openssl ca -config issuing/issuing.cnf -extensions v_client -batch -notext \
-in certs/greedy.csr -out certs/greedy.crt 2>/dev/null
openssl x509 -in certs/greedy.crt -noout -ext basicConstraints,subjectAltName X509v3 Basic Constraints: critical
CA:TRUE
X509v3 Basic Constraints: critical
CA:FALSE
X509v3 Subject Alternative Name:
DNS:greedy.lab.testThe request asked for CA:TRUE, the certificate says CA:FALSE: the section won and only the SAN was copied. With copy_extensions = copyall, the request would have won, and the CA would have handed out a working sub-CA.
06. Step 5: Client certificates, an expired one and a rogue CA
for n in 1 2; do
openssl req -new $EC -keyout certs/app-$n.key -subj "/CN=app-$n.lab.test" \
-addext "subjectAltName=DNS:app-$n.lab.test" -out certs/app-$n.csr 2>/dev/null
openssl ca -config issuing/issuing.cnf -extensions v_client -batch -notext \
-in certs/app-$n.csr -out certs/app-$n.crt 2>/dev/null
cat certs/app-$n.crt issuing/issuing.crt > certs/app-$n-fullchain.pem
done
openssl req -new $EC -keyout certs/old.key -subj "/CN=old.lab.test" \
-addext "subjectAltName=DNS:old.lab.test" -out certs/old.csr 2>/dev/null
openssl ca -config issuing/issuing.cnf -extensions v_client -batch -notext \
-startdate 20260101000000Z -enddate 20260201000000Z \
-in certs/old.csr -out certs/old.crt 2>/dev/null
cat certs/old.crt issuing/issuing.crt > certs/old-fullchain.pem
openssl req -x509 $EC -keyout rogue/ca.key -out rogue/ca.crt -days 30 \
-subj "/CN=Someone Else CA" -addext "basicConstraints=critical,CA:TRUE" \
-addext "keyUsage=critical,keyCertSign,cRLSign" 2>/dev/null
openssl req -new $EC -keyout rogue/app-1.key -subj "/CN=app-1.lab.test" \
-out rogue/app-1.csr 2>/dev/null
printf '%s\n' "basicConstraints=critical,CA:FALSE" \
"keyUsage=critical,digitalSignature" "extendedKeyUsage=clientAuth" \
"subjectAltName=DNS:app-1.lab.test" > rogue/client.ext
openssl x509 -req -in rogue/app-1.csr -CA rogue/ca.crt -CAkey rogue/ca.key -days 30 \
-extfile rogue/client.ext -out rogue/app-1.crt 2>/dev/null
cut -f1,4,6 issuing/index.txtV 2000 /CN=svc.lab.test
V 2001 /CN=greedy.lab.test
V 2002 /CN=app-1.lab.test
V 2003 /CN=app-2.lab.test
V 2004 /CN=old.lab.testThe issuing CA has now signed five certificates. old.lab.test was valid only in January 2026, which is easy to do in a lab because openssl ca accepts explicit start and end dates. The rogue CA signed a client certificate with exactly the same name as app-1, to show that the name alone means nothing without a trusted issuer.
07. Step 6: A mutual-TLS server and client
In TLS 1.3 the server asks for a client certificate with a CertificateRequest message, sent right after EncryptedExtensions and before its own Certificate (RFC 8446, section 4.3.2). In Python's ssl module, CERT_REQUIRED on a server context does that and makes a missing or invalid certificate fatal. The server trusts only trust/root.crt and checks the client certificate against the issuing CA's CRL. It builds a fresh context for each connection, so a new CRL takes effect at once; real servers reload on a signal instead.
"""mTLS server: only clients with a valid, unrevoked lab certificate get an answer.
Usage: python mtls_server.py PORT CHAIN_FILE (key: certs/svc.key)
"""
import socket
import ssl
import sys
PORT, CHAIN = int(sys.argv[1]), sys.argv[2]
def make_context() -> ssl.SSLContext:
"""Built per connection, so a newly published CRL takes effect at once."""
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
ctx.minimum_version = ssl.TLSVersion.TLSv1_3
ctx.load_cert_chain(CHAIN, "certs/svc.key")
ctx.verify_mode = ssl.CERT_REQUIRED # no client certificate, no entry
ctx.load_verify_locations("trust/root.crt") # the only trust anchor
ctx.load_verify_locations("issuing/crl/issuing.crl")
ctx.verify_flags |= ssl.VERIFY_CRL_CHECK_LEAF # refuse revoked client certs
return ctx
with socket.create_server(("127.0.0.1", PORT)) as listener:
print(f"mTLS server on 127.0.0.1:{PORT} presenting {CHAIN}", flush=True)
while True:
raw, _ = listener.accept()
try:
with make_context().wrap_socket(raw, server_side=True) as tls:
san = dict(tls.getpeercert()["subjectAltName"])
print("accepted", san["DNS"], flush=True)
tls.sendall(f"hello {san['DNS']}".encode()) # the server speaks first
except ssl.SSLError as err:
print("rejected:", getattr(err, "verify_message", None) or err.reason,
flush=True)
except OSError as err:
print("connection error:", err, flush=True)"""mTLS client. Usage: python mtls_client.py PORT NAME [CERT_CHAIN KEY]"""
import socket
import ssl
import sys
port, name = int(sys.argv[1]), sys.argv[2]
ctx = ssl.create_default_context(cafile="trust/root.crt") # verify the server
ctx.minimum_version = ssl.TLSVersion.TLSv1_3
if len(sys.argv) == 5:
ctx.load_cert_chain(sys.argv[3], sys.argv[4]) # our identity for the server
try:
with socket.create_connection(("127.0.0.1", port), timeout=5) as raw:
with ctx.wrap_socket(raw, server_hostname=name) as tls:
# In TLS 1.3 the server checks our certificate after our side of the
# handshake is done, so its verdict arrives with the first read.
print("server said:", tls.recv(100).decode())
except ssl.SSLCertVerificationError as err:
print("client refused server:", err.verify_message)
except ssl.SSLError as err:
print("server refused client:", err.reason)python mtls_server.py 8448 certs/svc-fullchain.pem > server.log 2>&1 &
SERVER_PID=$!
python mtls_server.py 8449 certs/svc.crt > server-leaf-only.log 2>&1 &
LEAF_ONLY_PID=$!
sleep 1
python mtls_client.py 8448 svc.lab.test certs/app-1-fullchain.pem certs/app-1.key
python mtls_client.py 8448 127.0.0.1 certs/app-1-fullchain.pem certs/app-1.keyserver said: hello app-1.lab.test
server said: hello app-1.lab.testBoth sides were authenticated: the client checked the server's chain and name (svc.lab.test, then the IP SAN), and the server checked the client's chain, EKU and revocation status. The server on 8449 is the same program, but it presents only its leaf certificate; you need it in the next step.
08. Step 7: Seven ways to be rejected
A security control is only proven when you have seen it refuse. Each line below breaks one rule. The client prints what it saw; the server's log shows its side.
echo "1 no client certificate:"
python mtls_client.py 8448 svc.lab.test
echo "2 certificate from a CA the server does not trust:"
python mtls_client.py 8448 svc.lab.test rogue/app-1.crt rogue/app-1.key
echo "3 a server certificate used as a client certificate:"
python mtls_client.py 8448 svc.lab.test certs/svc-fullchain.pem certs/svc.key
echo "4 expired client certificate:"
python mtls_client.py 8448 svc.lab.test certs/old-fullchain.pem certs/old.key
echo "5 client chain without the issuing CA:"
python mtls_client.py 8448 svc.lab.test certs/app-1.crt certs/app-1.key
echo "6 wrong server name:"
python mtls_client.py 8448 api.lab.test certs/app-1-fullchain.pem certs/app-1.key
echo "7 server that does not send its intermediate:"
python mtls_client.py 8449 svc.lab.test certs/app-1-fullchain.pem certs/app-1.key
sleep 0.5 && tail -n 6 server.log && cat server-leaf-only.log1 no client certificate:
server refused client: TLSV13_ALERT_CERTIFICATE_REQUIRED
2 certificate from a CA the server does not trust:
server refused client: TLSV1_ALERT_UNKNOWN_CA
3 a server certificate used as a client certificate:
server refused client: SSLV3_ALERT_UNSUPPORTED_CERTIFICATE
4 expired client certificate:
server refused client: SSLV3_ALERT_CERTIFICATE_EXPIRED
5 client chain without the issuing CA:
server refused client: TLSV1_ALERT_UNKNOWN_CA
6 wrong server name:
client refused server: Hostname mismatch, certificate is not valid for 'api.lab.test'.
7 server that does not send its intermediate:
client refused server: unable to get local issuer certificate
rejected: PEER_DID_NOT_RETURN_A_CERTIFICATE
rejected: unable to get local issuer certificate
rejected: unsuitable certificate purpose
rejected: certificate has expired
rejected: unable to get local issuer certificate
rejected: SSLV3_ALERT_BAD_CERTIFICATE
mTLS server on 127.0.0.1:8449 presenting certs/svc.crt
rejected: TLSV1_ALERT_UNKNOWN_CARead the pairs. In case 1 the server logs PEER_DID_NOT_RETURN_A_CERTIFICATE and sends the TLS 1.3 alert certificate_required. In cases 2 and 5 the server cannot build a chain to its root: in case 5 the client sent only its leaf, and the server does not use the intermediate from its own chain file to verify clients. Case 3 fails on the EKU (serverAuth only), case 4 on the validity window. Cases 6 and 7 fail on the client side: wrong name, and a server chain with a missing link, which is the same mistake as case 5 in the other direction.
09. Step 8: Revoke a client certificate with a CRL
Suppose app-2's key was copied from a laptop. Revoke the certificate, publish a new CRL and try again. openssl verify -crl_check gives the same answer offline.
python mtls_client.py 8448 svc.lab.test certs/app-2-fullchain.pem certs/app-2.key
openssl ca -config issuing/issuing.cnf -revoke certs/app-2.crt \
-crl_reason keyCompromise 2>/dev/null
openssl ca -config issuing/issuing.cnf -gencrl -out issuing/crl/issuing.crl 2>/dev/null
python mtls_client.py 8448 svc.lab.test certs/app-2-fullchain.pem certs/app-2.key
python mtls_client.py 8448 svc.lab.test certs/app-1-fullchain.pem certs/app-1.key
openssl verify -crl_check -CAfile trust/root.crt -untrusted issuing/issuing.crt \
-CRLfile issuing/crl/issuing.crl certs/app-2.crt
cut -f1,4,6 issuing/index.txt | grep app-2server said: hello app-2.lab.test
server refused client: SSLV3_ALERT_CERTIFICATE_REVOKED
server said: hello app-1.lab.test
CN = app-2.lab.test
error 23 at 0 depth lookup: certificate revoked
error certs/app-2.crt: verification failed
R 2003 /CN=app-2.lab.testopenssl crl -in issuing/crl/issuing.crl -noout -text \
| grep -E 'Issuer|Update|CRL Number|Serial|Key Compromise' -A1 | grep -v '^--' Issuer: CN = Lab Issuing CA 1
Last Update: Nov 15 18:59:49 2026 GMT
Next Update: Nov 22 18:59:49 2026 GMT
CRL extensions:
X509v3 CRL Number:
2
Serial Number: 2003
Revocation Date: Nov 15 18:59:49 2026 GMT
Key Compromise
Signature Algorithm: ecdsa-with-SHA256The CRL is signed by the issuing CA, numbered, and valid until Next Update, seven days later. Before then the CA must publish a new one, or clients that check revocation strictly will refuse every certificate from this CA. Revocation only works if the CRL stays available; that is the topic of lesson 5.
10. Step 9: The same setup in nginx
The practice project asks for mTLS on nginx or Caddy. nginx is not installed in this lab, so the configuration below is illustrative and was not run. Each line maps to something you just built. One detail differs from the Python server: with ssl_crl set, nginx checks revocation for every certificate in the chain (its source sets OpenSSL's X509_V_FLAG_CRL_CHECK_ALL), so the file must hold the CRLs of the issuing CA and the root. openssl verify -crl_check_all behaves the same way.
server {
listen 443 ssl;
server_name svc.lab.test;
ssl_protocols TLSv1.3;
ssl_certificate /etc/pki/svc-fullchain.pem; # leaf first, then issuing CA
ssl_certificate_key /etc/pki/svc.key;
ssl_verify_client on; # no certificate: HTTP 400 error page
ssl_client_certificate /etc/pki/root.crt; # trust anchor for client certificates
ssl_crl /etc/pki/crls.pem; # issuing.crl and root.crl, as PEM
location / {
proxy_set_header X-Client-DN $ssl_client_s_dn; # identity for the app
proxy_pass http://127.0.0.1:9000;
}
}openssl verify -crl_check_all -CAfile trust/root.crt -untrusted issuing/issuing.crt \
-CRLfile issuing/crl/issuing.crl certs/app-1.crt
cat issuing/crl/issuing.crl root-offline/crl/root.crl > crls.pem
openssl verify -crl_check_all -CAfile trust/root.crt -untrusted issuing/issuing.crt \
-CRLfile crls.pem certs/app-1.crt
kill $SERVER_PID $LEAF_ONLY_PID; cd ..CN = Lab Issuing CA 1
error 3 at 1 depth lookup: unable to get certificate CRL
error certs/app-1.crt: verification failed
certs/app-1.crt: OKError 3 at depth 1: without the root's CRL, nobody can say whether the issuing CA itself was revoked. nginx's default ssl_verify_depth 1 is enough here, because with OpenSSL 1.1 and newer it allows one intermediate between the client certificate and the trust anchor. ssl_client_certificate also sends the names of the trusted CAs to clients so they can pick a certificate; ssl_trusted_certificate trusts without sending names. The $ssl_client_s_dn header lets the application decide what an authenticated client may do: mTLS proves who is calling, and authorisation is a separate decision.
11. Troubleshooting
12. Check your understanding
13. Apply it
This lab is most of the practice project. To finish it, install nginx or Caddy, configure mTLS with the files from pki-lab (for Caddy, the client_auth block with mode require_and_verify and trust_pool file), and prove with curl --cert certs/app-1-fullchain.pem --key certs/app-1.key --cacert trust/root.crt that a client with a certificate gets in and one without is refused. Then add an authorisation rule: only app-1.lab.test may call /admin. Keep the pki-lab folder; lesson 5 uses it for a CA compromise drill.
14. Review prompt
Without looking back, sketch the two tiers and write next to each CA what its key signs, where the key lives and how long its CRL is valid. Then list the seven rejections from step 7 and say for each which side refused and which rule failed. Finish by explaining why copy_extensions = copyall is dangerous and why nginx needs the root's CRL as well as the issuing CA's.
References
- RFC 5280: Internet X.509 PKI Certificate and CRL Profile
- RFC 8446, section 4.3.2: Certificate Request
- OpenSSL 3.0 manual: openssl-ca
- OpenSSL 3.0 manual: x509v3_config
- Python documentation: ssl, client-side and server-side verification
- nginx documentation: ngx_http_ssl_module
- NIST SP 800-57 Part 1 Rev. 5: Recommendation for Key Management
Your progress
Reading state
Sign in to save that you finished reading this lesson.
Prove this skill
10 questions · about 8 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.