Beyond the cryptography itself, a handful of operational habits cause or prevent most real PKI incidents. This page lists them.
1. Expiry is the number one outage
Certificates expire on a date nobody remembers, at 3 a.m., on the one system nobody owns. The cryptography does not fail; the calendar does. Big, public outages (payment systems, cloud services, whole mobile networks) have been traced to a single forgotten expired certificate, so this is the first habit to build.
- Inventory every certificate: owner, where it is deployed, expiry, which CA issued it. You cannot manage what you cannot list. A spreadsheet is a start; scanning your networks and logging your CA’s issuances finds the ones that nobody wrote down.
- Automate renewal (ACME, SCEP, MDM). Manual renewal fails because it depends on a person remembering, on a date, years apart.
- Monitor expiry from the outside, as a client sees it:
$ echo | openssl s_client -connect www.example.com:443 -servername www.example.com 2>/dev/null \
| openssl x509 -noout -enddate
notAfter=Feb 23 05:50:28 2027 GMT
$ openssl x509 -in web.crt -noout -checkend 2592000 && echo "OK for 30 days" || echo "EXPIRES SOON"
The second command, -checkend 2592000, asks “will this certificate still be
valid in 2,592,000 seconds (30 days)?” and returns success or failure, so it
slots straight into a monitoring script.
- Alert at 30, 14 and 7 days, to a team and not one person’s inbox (people go on holiday and leave jobs).
- Remember the hidden ones: the IdP’s SAML signing certificate, the internal CA’s own certificate, OCSP responder and CRL freshness, code-signing certificates, device certificates, and the MDM push certificates.
2. Time
Certificates, tokens (exp, nbf) and Kerberos all depend on correct
clocks, because every one of them says “valid between this time and that
time”. A device whose clock is wrong reports “certificate not yet valid”
or “expired”, even though the certificate is fine. A laptop that was off for
months, a virtual machine restored from a snapshot, or a battery-less
device that boots at 1 January 1970 are classic cases. Run NTP/chrony
everywhere, and check the clock first when TLS or SSO suddenly fails: it is
the cheapest check and a surprisingly common cause.
3. Trust stores and distribution
A certificate is trusted because it chains to a root in the client’s trust store. A private CA’s root is not in any store by default, so the first job after creating a CA is distributing it. Know where each platform keeps its store, because they are different, and one application on a machine may use a different store from the rest:
| Platform | Trust store |
|---|---|
| Debian/Ubuntu | /usr/local/share/ca-certificates/ then update-ca-certificates |
| RHEL/Fedora | /etc/pki/ca-trust/source/anchors/ then update-ca-trust |
| macOS | Keychain (System); push via MDM profile |
| Windows | certmgr.msc; push via Group Policy or Intune |
| Java | Its own cacerts keystore |
Python requests, Node, Go | Often their own bundle or env var (SSL_CERT_FILE, NODE_EXTRA_CA_CERTS) |
| Containers | Whatever is inside the image: add the root at build time |
| Firefox | Its own store, unless policy says otherwise |
Only install the root (or the intermediate), never a leaf. Never install a root you did not verify: a malicious root in your trust store lets its owner impersonate any website to you. Compare its fingerprint out-of-band, for example by reading it over the phone or checking it on a trusted internal page, not in the same email as the file.
$ openssl x509 -in root.crt -noout -fingerprint -sha256
sha256 Fingerprint=...
4. Names, not just keys
Clients check the SAN against the name they connected to. A certificate
for www.example.com does not cover example.com, api.example.com, or an
IP address unless listed. A wildcard *.example.com covers one label only:
it matches api.example.com but not a.b.example.com and not the bare
example.com. The CN (Common Name) is a legacy field that modern clients
ignore when a SAN is present. A “hostname mismatch” error is almost always
“the name I typed is not in the SAN list”, for example connecting by IP address
or by an old alias.
5. DNS controls that protect certificates
Public CAs prove you control a name by looking at DNS and web content, so protecting your DNS protects your certificates.
- CAA records list which CAs may issue for your domain
(
example.com. CAA 0 issue "letsencrypt.org"). A compliant CA checks this before issuing and refuses if it is not listed, narrowing the field for mistakes and attackers. - Certificate Transparency logs show every public certificate issued for your names; monitor them (crt.sh, or a CT monitoring service) to spot rogue issuance. Browsers require it, so a certificate that is not logged will not work in them.
- Dangling DNS records (a CNAME pointing to a cloud service you no longer use) enable domain takeover: an attacker claims the service, and can then obtain a perfectly valid certificate for your name.
6. Key hygiene
- One key per purpose and per system. Never share a key between servers “to make it easy”: if one is breached, all are, and you cannot tell which was the source. Avoid reusing a key across renewals so that a leaked old key does not threaten the new certificate.
- Generate keys where they are used. Do not email or chat them. Every copy is a leak waiting to happen.
- Passphrases in a password manager or secret store, never in a script. A passphrase written in the script that uses it protects nothing.
- Know what to do on key compromise: revoke the certificate, reissue with a new key, find what the old key could access, and rotate those dependents. Practise it, because the first time you do it should not be during an incident.
- Do not put private keys in git. Scan for them (
gitleaks,trufflehog); if one ever hits a repository, treat it as burned, even after deleting, because it remains in history, forks and clones, and automated scrapers find new secrets within minutes.
7. Revocation reality
Browsers largely do not check CRL or OCSP in real time for public sites, and many clients “soft-fail”, meaning that if the check cannot complete they accept the certificate anyway (a revocation server that is down would otherwise take the whole web with it). A revoked certificate may therefore still work in some clients. For a private PKI, the practical strategy is short lifetimes plus automated renewal, with CRL/OCSP as backup for high-value cases. See Certificate Revocation: OCSP vs CRL.
8. Algorithm and lifetime hygiene
| Do | Don’t |
|---|---|
| ECDSA P-256/P-384, Ed25519, or RSA ≥ 3072 | RSA 1024, DSA |
| SHA-256 or better | MD5, SHA-1 signatures |
| TLS 1.2 minimum, prefer 1.3 | SSLv3, TLS 1.0/1.1 |
| AES-GCM, ChaCha20-Poly1305 | RC4, 3DES, CBC without authentication |
| Minutes to hours for user/workload certificates | 10-year leaf certificates |
Check what a server actually offers:
$ openssl s_client -connect host:443 -tls1_2 </dev/null 2>&1 | grep -E "Protocol|Cipher"
$ nmap --script ssl-enum-ciphers -p 443 host
9. Plan for post-quantum
This is already covered in the cryptography basics, so here is the operational view. Data recorded today could be decrypted by a future quantum computer ("harvest now, decrypt later"), and RSA/ECC signatures will eventually be forgeable. You do not need to switch today, but you do need crypto agility: know where each algorithm is used, so it can be swapped.
- Inventory algorithms and key sizes in use (item 1 helps).
- Prefer protocols and software that can negotiate hybrid key exchange (X25519 + ML-KEM) in TLS, which major browsers and servers already do.
- Expect larger keys and signatures (an ML-DSA-65 private key file was about 5.6 KB in our lab, against ~240 bytes for P-256) and test your systems for size limits.
- Follow your regulator’s timeline (NIST, NSA CNSA 2.0, EU).
10. Logging, audit and detection
A CA is a machine for issuing trust, so the log of what it issued is your main defence and your main evidence.
- Log every issuance, renewal, revocation and who or what requested it. When something goes wrong you need to answer “who got this certificate and how?”.
- Log every signing operation of CA keys (HSM/KMS audit logs). This is the independent record that cannot be altered by the CA application.
- Alert on unusual issuance: unknown names, high volume, off hours, new
SANs for sensitive domains. A sudden certificate for
vpn.example.comrequested by a build server is worth a look. - Keep logs somewhere an attacker with the CA server cannot erase. Ship them off the machine as they are written.
- SSH: the certificate’s Key ID and principals show in
sshdlogs, so use identifiable Key IDs (for example the user’s email) to see who logged in.
11. Least privilege and separation of duties
- Separate roles: who can request, who can approve, who can administer the CA, who can use the HSM. When no single person can do the whole chain alone, one stolen or careless account cannot issue a rogue certificate unnoticed.
- Scope CAs with name constraints and profiles, so a compromised
department CA cannot issue for
google.com. - Use distinct CAs (or at least intermediates) for servers, users, devices and SSH. The damage from a compromise stays inside one purpose.
- Require MFA for every administrator. The CA’s admin console is among the most valuable logins in the company.
12. Backup and disaster recovery
- Can you restore the CA if the host burns? Test it quarterly. If the CA is lost without a backup, every certificate it issued still works until expiry, but nothing new can be issued or revoked, and you must rebuild trust on every device.
- Back up CA keys only in encrypted/wrapped form, with split custody, so no one person can walk away with the CA.
- Back up the KEK separately from the database it protects. A backup that contains both the encrypted data and the key to open it is not encrypted.
- Keep the offline root truly offline, with documented ceremonies and a list of custodians.
- Document how to roll over an expiring intermediate or root years in advance. It requires every client to learn the new root, which on a large device fleet takes months. Plan it while the old one still has years left.
13. Troubleshooting playbook
| Symptom | First thing to check |
|---|---|
| “unable to get local issuer certificate” | Missing intermediate on the server, or missing root on the client |
| “certificate has expired” / “not yet valid” | Dates, and the clock on both sides |
| “hostname mismatch” | SAN list; are you using an IP or an alias? |
| “unknown CA” / “self-signed in chain” | The root is not in this app’s trust store |
| “key values mismatch” | Key and certificate are from different pairs |
“unsupported” on a .p12 | Old encryption; use -legacy, then re-export |
mTLS fails with bad certificate | Client cert lacks clientAuth EKU, or chain not trusted by the server |
| SSH “Permission denied (publickey)” with a cert | Principal not allowed, certificate expired, CA not trusted (TrustedUserCAKeys) |
| OIDC “invalid token” | iss, aud, clock skew, or JWKS cache after a key rotation |
Your best tools:
$ openssl s_client -connect host:443 -servername host -showcerts # what the server sends
$ openssl verify -CAfile root.crt -untrusted int.crt leaf.crt # does the chain build?
$ openssl x509 -in cert.pem -noout -text # what is in it?
$ ssh -vvv user@host # SSH negotiation
$ curl -v https://host/ # TLS and HTTP in one
14. Other basics worth knowing
- Secrets management: Vault, cloud secret managers, SOPS. Not env files in git.
- Password hygiene and MFA: prefer phishing-resistant MFA (FIDO2 / WebAuthn passkeys, security keys), not SMS codes. WebAuthn itself is public-key crypto with attestation, the same ideas as in this tutorial.
- Disk and backup encryption: full-disk (LUKS, FileVault, BitLocker) and where its recovery keys are kept.
- Zero Trust: identity (certificates, SSO) for every connection, rather than trusting the network.
- mTLS and service meshes for workload identity (SPIFFE/SPIRE, Istio).
- Code signing and supply-chain signing: Sigstore/cosign, signed containers and packages.
- Email: SPF, DKIM, DMARC; S/MIME certificates.
- VPN/Wi-Fi: 802.1X/EAP-TLS uses client certificates (typically SCEP or ACME to enroll).
- Compliance vocabulary: SOC 2, ISO 27001, PCI DSS, HIPAA. Know which controls involve keys and certificates.
- Documentation: a Certificate Policy (CP) and Certification Practice Statement (CPS) for a serious CA, even a private one.
A one-page starter plan
- List every certificate and key you operate (owner, expiry, location).
- Put expiry monitoring on all of them.
- Stand up a private CA with an offline root and intermediates in HSM/KMS.
- Move servers to ACME, devices to attestation or dynamic SCEP, and people to SSO-issued short-lived certificates.
- Shorten lifetimes step by step as automation proves reliable.
- Log and alert on issuance.
- Rehearse a compromise and a restore.
About BastionXP
BastionXP is a cloud-native private PKI CA and device identity management platform that eliminates passwords and shared secrets by issuing hardware-attested certificates to mobile devices and laptops. Secure access to your Wi-Fi, VPN, and SaaS applications in your enterprise network. Replace legacy SCEP with automated ACME Device Attestation. No shared secrets. Zero credential theft. Learn more about BastionXP →