Back to Engineering Blog
Systems Design 5 min read

Self-Hosted PKI: Deploying Smallstep step-ca with Offline Root Protection

Browser security warnings and manual certificate rotations degrade infrastructure. We built an enterprise internal CA using Smallstep step-ca with ACME automation and an offline root key.

Jason NevillBy , Houston, TX
#PKI#StepCA#TLS#Security

Key Architectural Takeaways

  • Self-signed certificates create security blind spots and break automated mTLS authentication.
  • Smallstep step-ca provides an automated ACME provisioner for zero-touch local certificate renewals.
  • The Root CA private key is encrypted and stored offline; the online daemon operates strictly using an intermediate key.

The failure of self-signed certificates

In early homelab environments, self-signed certificates are ubiquitous. Engineers generate an openssl certificate with a 10-year validity, bypass browser warnings with "Proceed (unsafe)", and move on.

As infrastructure matures, this practice becomes catastrophic:

  1. Security Desensitization: Users and operators become trained to ignore invalid certificate warnings, destroying the primary defense against man-in-the-middle attacks.
  2. Automated Tool Failure: API calls, curl commands, Docker registries, and mobile operating systems strictly refuse connections to untrusted certificates without clumsy --insecure flags.
  3. Renewal Burden: Tracking expiration across dozens of standalone web interfaces guarantees unexpected outages.

We replaced this ad-hoc model with an enterprise-grade internal Public Key Infrastructure (PKI) powered by Smallstep `step-ca`.

The two-tier certificate hierarchy

A production PKI must never issue end-entity certificates directly from a Root CA. If a single compromised server exposes the root private key, every device, server, and credential across the enterprise must be untrusted and re-enrolled.

We implemented a strict two-tier architecture:

  • Root CA: A 10-year elliptic-curve (ECDSA P-256) certificate authority (CN=HTX Lab Internal CA Root CA). Its sole purpose is to sign the Intermediate CA.
  • Intermediate CA: A 1-year signing certificate used by the active step-ca daemon to issue short-lived (24-hour to 90-day) leaf certificates for internal services.

Air-gapping the root key

The most critical security decision in this deployment was key custody.

Automated configuration roles frequently take the easy path: generating the root and intermediate keys in the same container and leaving both on disk. We deliberately broke this convenience:

  1. During initial bootstrapping, the root and intermediate pairs were minted.
  2. The root_ca_key was immediately exported and encrypted.
  3. The encrypted root key was moved offline, off the CA host.
  4. The root private key was completely shredded from the online CA container.

The running step-ca daemon only ever possesses the intermediate private key. If the CA container were ever compromised, an attacker gains only the intermediate key—which can be revoked immediately by bringing the offline root key back to sign a replacement intermediate.

Zero-touch renewals via the ACME provisioner

Manual certificate management is an anti-pattern. step-ca includes a native ACME (Automated Certificate Management Environment) provisioner—the exact same protocol used by Let's Encrypt.

Any internal service (such as pfSense, reverse proxies, and internal web portals) simply runs standard ACME clients like certbot or acme.sh pointing to our private CA endpoint:

# Issuing a certificate using our private ACME directory
step ca certificate service.internal cert.crt cert.key \
    --provisioner acme

Certificates are short-lived and renew automatically well before they expire. If an individual host is decommissioned or compromised, its certificate naturally expires without administrative overhead.

Least privilege on the host

To minimize blast radius, the step-ca daemon does not run as root or a generic administrative user:

  • It executes under a locked, unprivileged system account (step-ca).
  • Systemd protects the process with ProtectSystem=strict, ProtectHome=true, and NoNewPrivileges=true.
  • TLS certificates and keys on disk are restricted to 0600 ownership by the step-ca user.

Verification

We verified the deployment with four automated tests:

  1. Validated that the CA's health endpoint answered with a healthy status.
  2. Verified that the root certificate fingerprint matched the hash distributed to client trust stores.
  3. Successfully issued and renewed an ACME certificate on an edge router without manual intervention.
  4. Confirmed via raw disk inspection that root_ca_key was completely absent from the container filesystem.

Engineering takeaway

A private PKI eliminates self-signed browser warnings while establishing cryptographic mutual authentication across internal services. Separating the offline root from the online intermediate ensures that zero-touch ACME automation never compromises long-term trust.

Follow the build on LinkedIn or by RSS.

All Articles

Follow the build

Questions about the build, or spotted something we got wrong? Find us on LinkedIn and GitHub.