Example Documentation: Issue a client certificate
1. Goal
A client certificate suitable for mTLS is created with the clientAuth extended key usage and verified.
This document complements the main README with technical context, review questions and operational framing. It is not a public CA operating manual; it is a reproducible learning and analysis example.
2. What is done
The example runs locally, creates temporary artifacts only below work/ and writes evidence below work/evidence/. Depending on the topic it creates a root, intermediate, CSR, server certificate, client certificate, CRL, revocation event or automation model.
The steps are intentionally small:
- Read the configuration files.
- Run the script.
- Inspect the evidence.
- Interpret OpenSSL output.
- Discuss the failure mode or operational question.
- Confirm cleanup and private key protection.
3. Why it is done
PKI failures are rarely pure syntax failures. A certificate can be technically created but still be wrong: wrong issuer, wrong SAN, overly long validity, missing key usage, unclear chain, missing revocation model or exposed private key. This example therefore binds every technical action to a review structure.
4. Typical commands
openssl version
openssl req -in work/csr/server.csr.pem -noout -subject -text 2>/dev/null || true
openssl x509 -in work/certs/server.crt.pem -noout -subject -issuer -serial -dates 2>/dev/null || true
openssl x509 -in work/certs/server.crt.pem -noout -text 2>/dev/null | sed -n '/X509v3 extensions:/,/Signature Algorithm/p' || true
openssl verify -CAfile work/root/certs/root.crt.pem -untrusted work/intermediate/certs/intermediate.crt.pem work/certs/server.crt.pem 2>/dev/null || true
find work/evidence -type f -maxdepth 2 -print 2>/dev/null | sort || true
5. Verify success
- The script exits without an unexpected error.
- Evidence files match the topic of the example.
- End-entity certificates have
CA:FALSE. - CA certificates have
CA:TRUEand suitable key usage. - Server certificates contain SANs.
- Chain verification separates the root as trust anchor and the intermediate as an untrusted chain certificate.
- Revocation, OCSP or CRL behavior is not claimed without evidence or a clear lab boundary.
6. Common mistakes
| Observation | Likely cause | Correction |
|---|---|---|
| Certificate looks valid, client rejects it | SAN is missing or wrong | Check CSR configuration and sign again |
openssl verify fails |
Chain or trust anchor is wrong | Pass the root with -CAfile and the intermediate with -untrusted |
| CA cannot sign further | Basic constraints or key usage are missing | Correct CA extensions and recreate the certificate |
| Revocation is not visible | CRL was not regenerated or published | Regenerate CRL, check serial number, test client behavior |
| Evidence contains private data | Wrong files were copied | Restrict evidence to public output, fingerprints and serial numbers |
7. Security aspects
Real PKIs must protect root and intermediate keys more strongly than this lab. Root keys are typically kept offline. Intermediate keys are protected by HSMs, strict file permissions, audit logs and separated roles. Publicly trusted certificates have additional requirements that this workshop can explain but does not simulate.
8. Realistic use
This pattern applies to internal TLS certificates, mTLS between services, Kubernetes Ingress, Vault PKI, cert-manager, Smallstep, SPIFFE/SPIRE and traditional enterprise PKIs. The decisive factor is not the tool but the evidence: who signs, what the certificate is valid for, how trust is distributed, when renewal starts and how revocation is handled.
9. Workshop flow
- Read the goal aloud and limit the scope.
- Distinguish repository files from runtime artifacts.
- Open the OpenSSL configuration and mark relevant sections.
- Identify private key paths.
- Check CSR subject and SANs.
- Explain CA extensions before signing.
- Create the certificate or validate the model artifact.
- Compare issuer and subject.
- Interpret basic constraints and key usage.
- Run chain verification.
- Reproduce the failure mode intentionally if the example includes one.
- Open evidence files and check for private keys.
- Ask the operational question: who owns this certificate?
- Ask the security question: how would compromise be detected?
- Ask the renewal question: when must action start?
- Ask the revocation question: which clients check CRL or OCSP?
- Ask the audit question: which decision is traceable?
- Run cleanup.
- Document deviations.
- Convert the result into a short review summary.
10. Review matrix
| Review field | Expected statement |
|---|---|
| Scope | Lab, internal PKI or publicly trusted context is separated. |
| Subject | Entity and purpose are clear. |
| Issuer | Signing CA is documented. |
| Chain | Root and intermediate are used correctly. |
| SAN | Host identity is in the SAN. |
| Basic Constraints | CA and leaf roles are separated. |
| Key Usage | Signature, key encipherment, cRLSign or keyCertSign matches the role. |
| EKU | ServerAuth or ClientAuth is set only where needed. |
| Lifetime | Validity and renewal window are plausible. |
| Revocation | CRL, OCSP or lab boundary is clear. |
| Keys | Private keys are not committed. |
| Evidence | Evidence does not contain secrets. |
Official References
- RFC 5280: Internet X.509 Public Key Infrastructure Certificate and CRL Profile: https://datatracker.ietf.org/doc/html/rfc5280
- CA/Browser Forum Baseline Requirements: https://cabforum.org/working-groups/server/baseline-requirements/requirements/
- NIST SP 800-57 Part 1 Revision 5: https://csrc.nist.gov/pubs/sp/800/57/pt1/r5/final
- OpenSSL Manual Pages: https://www.openssl.org/docs/manpages/
Example Appendix: Evidence, Transfer and Operations
This appendix makes the example more complete as a training component. It is intentionally limited to real PKI questions: certificate content, trust chain, key material, revocation, renewal, audit and operational handover.
Evidence Checklist
openssl versionwas recorded so output can be tied to a concrete tool version.- Subject, issuer, serial and validity were checked with
openssl x509 -noout. - SAN, basic constraints, key usage and EKU were extracted from the certificate text.
- The chain was verified with the root as trust anchor and the intermediate as chain certificate.
- Failure modes were not merely described; they were made visible with a controlled exit code or evidence file.
- Private keys were not copied into evidence files.
- Runtime artifacts live below
work/and are separated from repository content. - Cleanup is possible by removing
work/.
Transfer Questions
- Who owns the certificate and who may approve issuance?
- Which CA signs it and how is that CA protected?
- Which clients or systems must trust the trust anchor?
- Which validity period is justified and when does renewal start?
- How is revocation distributed and how is client behavior checked?
- Which logs or tickets prove request, approval, issuance and change?
- Which deviation would not be acceptable for a public CA?
- Which parts of the lab should be automated by HSM, Vault, cert-manager, ACME or SPIFFE?
Operational Notes
| Topic | Expectation |
|---|---|
| Roles | Requester, approver, CA operator and auditor are separated or explicitly justified. |
| Keys | Private keys are protected, not versioned and accessible only to the required role. |
| Certificates | Leaf certificates have CA:FALSE; CA certificates have CA:TRUE and suitable key usage. |
| Names | DNS and IP identities are in SAN, not only in the common name. |
| Chain | Root, intermediate and leaf are traceable and distributed correctly. |
| Revocation | CRL or OCSP is treated as a process, even when the lab is local only. |
| Renewal | Expiry monitoring and renewal windows are documented. |
| Audit | Evidence contains traceable decisions, but no secrets. |
Review Summary
An example is complete only when technical execution, technical explanation and security evidence fit together. For CA workshops this matters more than the command sequence alone, because a certificate can still be dangerous even when OpenSSL created it successfully.