< back to notes

Setting up new Root + Intermediate ACME CA with step-ca

Overview

As I’m in the middle of setting up the Overlay network for the home lab, I decided that I’d be moving away from the RSA based CA (which is also step-ca based) I had setup back in early 2025.

I’ll be setting up a new CA that is ECDSA based rather than RSA based.

I eventually want to expand into SSH CA to manage short lived SSH keys to control logins, however I won’t go into that in this post.

Generating the Root CA certificate

I initially wanted to use a YubiKey with PIV operations to be the holder of the Root CA and Intermediate CA, however, everything runs in a load-balancing virtual environment, so that wont be possible. Maybe some day I’ll move it to a physical machine. (ref: “Build a Tiny Certificate Authority For Your Homelab”)

Generating the root CA with:

step certificate create "Caffeinated.Technology Root CA E1" root_ca.crt root_ca.key \
    --profile root-ca --not-after 87600h \
    --kty EC --curve P-384

This will generate a 10-year ECDSA certificate with the P384 curve.

The CA name is named Caffeinated.Technology Root CA E1, the E1 part designates:

  • E: ECDSA
  • 1: Generation 1 of the key (usually would increment this if a newer key is signed)

The key is generated directly on a USB drive (all contents copied to a second one after)

Generating and Signing the Intermediate CA

Generating and signing the Intermediate CA certificate with:

step certificate create "Caffeinated.Technology Intermediate CA E1" intermediate_ca.crt intermediate_ca.key \
    --profile intermediate-ca --ca root_ca.crt --ca-key root_ca.key \
    --not-after 43800h \
    --kty EC --curve P-384

The same logic as before applies, this time with a 5-year validity period.

Verify that the Intermediate CA has the root in the trust chain:

step certificate verify intermediate_ca.crt --roots root_ca.crt

Copy fingerprint of root CA:

step certificate fingerprint root_ca.crt
92b5dda4b50d0eb3c2e1988be250944cb50f3728514d0cfd2d6afed2d9dd55c1

At this point, the Root CA key is no longer needed, we will copy the intermediate CA’s Public/Private Key off the machine along with the Root’s public key. The USB drive is mirrored to another to prevent loss of the keys.

  • root_ca.crt
  • intermediate_ca.crt
  • intermediate_ca.key

The Root CA Private Key should always be offline.

Online Step CA setup

Install Step packages on the CA server (ref: “Install step-ca”):

apt-get update && apt-get install -y --no-install-recommends curl gpg ca-certificates
curl -fsSL https://packages.smallstep.com/keys/apt/repo-signing-key.gpg -o /etc/apt/keyrings/smallstep.asc
cat << EOF > /etc/apt/sources.list.d/smallstep.sources
Types: deb
URIs: https://packages.smallstep.com/stable/debian
Suites: debs
Components: main
Signed-By: /etc/apt/keyrings/smallstep.asc
EOF
apt-get update && apt-get -y install step-cli step-ca

Copy the Intermediate CA Keys and Root CA Public Key to server:

$ ls
intermediate_ca.crt  intermediate_ca.key  root_ca.crt

$ scp * user@10.1.102.11:~
intermediate_ca.crt           100%  757    93.4KB/s   00:00  
intermediate_ca.key           100%  379   653.8KB/s   00:00  
root_ca.crt                   100%  704     1.1MB/s   00:00

$ shred *
$ rm -rf *

Trust our own CA on the CA server:

$ step certificate fingerprint root_ca.crt
92b5dda4b50d0eb3c2e1988be250944cb50f3728514d0cfd2d6afed2d9dd55c1

$ cp root_ca.crt /usr/local/share/ca-certificates/cdt-root-ca.crt && update-ca-certificates 
Updating certificates in /etc/ssl/certs...
rehash: warning: skipping ca-certificates.crt, it does not contain exactly one certificate or CRL
1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.

Manual bootstrap of Step CA:

sudo useradd step && sudo passwd -l step
sudo mkdir -p /etc/step-ca/{certs,secrets,config,db}
sudo mv *.crt /etc/step-ca/certs/
sudo mv intermediate_ca.key /etc/step-ca/secrets/

CA config file at /etc/step-ca/config/ca.json:

{
    "root": "/etc/step-ca/certs/root_ca.crt",
    "crt": "/etc/step-ca/certs/intermediate_ca.crt",
    "key": "/etc/step-ca/secrets/intermediate_ca.key",
    "address": ":443",
    "dnsNames": ["cdt-step-ca-01.i.caffeinated.technology"],
    "logger": { "format": "text" },
    "db": {
        "type": "badgerv2",
        "dataSource": "/etc/step-ca/db"
    },
    "authority": {
        "provisioners": []
    }
}

Manually bootstrapping the CA like this allows us to bypass step ca init.

Generate JWK keypair:

cd /tmp
step crypto jwk create public.json private.json --kty EC --curve P-384

Save encryption secret in Bitwarden

Edit /etc/step-ca/config/ca.json provisioners section:

"authority": {
    "provisioners": [
        {
            "type": "JWK",
            "name": "internal-pki@caffeinated.technology",
            "key": <the content of public.json>,
            "encryptedKey": <the content of (step crypto jose format < private.json)>
        },
        {
            "type": "ACME",
            "name": "acme"
        }
    ]
}

Clean up temp files:

rm -rf *.json

Write Intermediate CA encryption password:

echo -n '<the intermediate ca encryption password>' | sudo tee /etc/step-ca/password.txt > /dev/null
sudo chown -R step:step /etc/step-ca
sudo chmod 600 /etc/step-ca/password.txt /etc/step-ca/secrets/intermediate_ca.key

Grant bind permissions below 1024 if not running as root (for testing vvv):

sudo setcap CAP_NET_BIND_SERVICE=+eip $(which step-ca)

Test launching:

$ sudo -u step step-ca --password-file /etc/step-ca/password.txt /etc/step-ca/config/ca.json
badger 2026/11/04 21:37:52 INFO: All 0 tables opened in 0s
badger 2026/11/04 21:37:52 INFO: Replaying file id: 0 at offset: 0
badger 2026/11/04 21:37:52 INFO: Replay took: 222.073µs
2026/11/04 21:37:52 Building new tls configuration using step-ca x509 Signer Interface
2026/11/04 21:37:53 Starting Smallstep CA/0.30.2 (linux/amd64)
2026/11/04 21:37:53 Documentation: https://u.step.sm/docs/ca
2026/11/04 21:37:53 Community Discord: https://u.step.sm/discord
2026/11/04 21:37:53 Config file: /etc/step-ca/config/ca.json
2026/11/04 21:37:53 The primary server URL is https://cdt-step-ca-01.i.caffeinated.technology:443
2026/11/04 21:37:53 Root certificates are available at https://cdt-step-ca-01.i.caffeinated.technology:443/roots.pem
2026/11/04 21:37:53 X.509 Root Fingerprint: 92b5dda4b50d0eb3c2e1988be250944cb50f3728514d0cfd2d6afed2d9dd55c1
2026/11/04 21:51:39 Serving HTTPS on :443 ...

Ensure x509 root fingerprint matches one from the start.

Create a systemd service at /etc/systemd/system/step-ca.service (ref: “step-ca.service”) :

[Unit]
Description=step-ca service
Documentation=https://smallstep.com/docs/step-ca
Documentation=https://smallstep.com/docs/step-ca/certificate-authority-server-production
After=network-online.target
Wants=network-online.target
StartLimitIntervalSec=30
StartLimitBurst=3
ConditionFileNotEmpty=/etc/step-ca/config/ca.json
ConditionFileNotEmpty=/etc/step-ca/password.txt

[Service]
Type=simple
User=step
Group=step
Environment=STEPPATH=/etc/step-ca
WorkingDirectory=/etc/step-ca
ExecStart=/usr/bin/step-ca config/ca.json --password-file password.txt
ExecReload=/bin/kill --signal HUP $MAINPID
Restart=on-failure
RestartSec=5
TimeoutStopSec=30
StartLimitInterval=30
StartLimitBurst=3

; Process capabilities & privileges
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
SecureBits=keep-caps
NoNewPrivileges=yes

; Sandboxing
; This sandboxing works with YubiKey PIV (via pcscd HTTP API), but it is likely
; too restrictive for PKCS#11 HSMs.
;
; NOTE: Comment out the rest of this section for troubleshooting.
ProtectSystem=full
ProtectHome=true
RestrictNamespaces=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
PrivateTmp=true
ProtectClock=true
ProtectControlGroups=true
ProtectKernelTunables=true
ProtectKernelLogs=true
ProtectKernelModules=true
LockPersonality=true
RestrictSUIDSGID=true
RemoveIPC=true
RestrictRealtime=true
PrivateDevices=true
SystemCallFilter=@system-service
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
ReadWriteDirectories=/etc/step-ca/db

[Install]
WantedBy=multi-user.target

Enable and start:

$ systemctl enable step-ca
$ systemctl start step-ca
$ systemctl status step-ca
● step-ca.service - step-ca service
     Loaded: loaded (/etc/systemd/system/step-ca.service; enabled; preset: enabled)
     Active: active (running) since Wed 2026-11-04 22:05:10 EST; 5s ago
 Invocation: f67ead3f5ee149f1a13efbb7f38f2c30
       Docs: https://smallstep.com/docs/step-ca
             https://smallstep.com/docs/step-ca/certificate-authority-server-production
   Main PID: 3035 (step-ca)
      Tasks: 10 (limit: 4510)
     Memory: 21.5M (peak: 22.2M)
        CPU: 2.771s
     CGroup: /system.slice/step-ca.service
             └─3035 /usr/bin/step-ca config/ca.json --password-file password.txt

Nov 04 22:05:12 cdt-step-ca-01 step-ca[3035]: badger 2026/11/04 22:05:12 INFO: Replay took: 35.67µs
Nov 04 22:05:12 cdt-step-ca-01 step-ca[3035]: 2026/11/04 22:05:12 Building new tls configuration using step-ca x509 Signer Interface
Nov 04 22:05:12 cdt-step-ca-01 step-ca[3035]: 2026/11/04 22:05:12 Starting Smallstep CA/0.30.2 (linux/amd64)
Nov 04 22:05:12 cdt-step-ca-01 step-ca[3035]: 2026/11/04 22:05:12 Documentation: https://u.step.sm/docs/ca
Nov 04 22:05:12 cdt-step-ca-01 step-ca[3035]: 2026/11/04 22:05:12 Community Discord: https://u.step.sm/discord
Nov 04 22:05:12 cdt-step-ca-01 step-ca[3035]: 2026/11/04 22:05:12 Config file: config/ca.json
Nov 04 22:05:12 cdt-step-ca-01 step-ca[3035]: 2026/11/04 22:05:12 The primary server URL is https://cdt-step-ca-01.i.caffeinated.technology:443
Nov 04 22:05:12 cdt-step-ca-01 step-ca[3035]: 2026/11/04 22:05:12 Root certificates are available at https://cdt-step-ca-01.i.caffeinated.technology:443/roots.pem
Nov 04 22:05:12 cdt-step-ca-01 step-ca[3035]: 2026/11/04 22:05:12 X.509 Root Fingerprint: 92b5dda4b50d0eb3c2e1988be250944cb50f3728514d0cfd2d6afed2d9dd55c1
Nov 04 22:05:12 cdt-step-ca-01 step-ca[3035]: 2026/11/04 22:05:12 Serving HTTPS on :443 ...

Service Overlay

We already know the drill. We will add it to the service overlay so the CA can move around without interruption.

For this, Step CA has a health endpoint we can query to check the health, so I’ve adapted our health check config to use Curl to query that:

Health check at /etc/service-health/step-ca_unicast.conf:

PROTO=services
CHECK=curl -fsS -o /dev/null --connect-timeout 1 --max-time 2 https://service.cdt-step-ca-01.i.caffeinated.technology/health

(service.cdt-step-ca-01.i.caffeinated.technology resolves to the service IP, and added this to /etc/step-ca/config/ca.json’s dnsNames so the CA’s web certificate includes that DNS name)

systemctl daemon-reload
systemctl enable --now service-health@step-ca_unicast

Confirm service is up when Step CA is healthy:

$ birdc show proto
BIRD 2.17.5 ready.
Name       Proto      Table      State  Since         Info
...  
services   Direct     ---        up     11:10:32.165  
fortigate  BGP        ---        up     11:08:13.335  Established  
...

Take down Step CA and confirm protocol shows down (route withdrawn) and comes back up after healthy again:

$ sudo systemctl stop step-ca.service 
$ birdc show proto
Name       Proto      Table      State  Since         Info
...
services   Direct     ---        down   11:12:05.023  
fortigate  BGP        ---        up     11:08:13.335  Established   
...
$ sudo systemctl start step-ca.service
$ birdc show proto
...
services   Direct     ---        up   11:12:05.023  
...

DNS-01 (RFC 2136) Certificate Requests

Just a side note, Firefox does NOT trust the systems roots implicitly, you have to either import the Root CA into Firefox or set a flag to allow enterprise roots from the system store for Firefox to trust the CA, otherwise Firefox is going to use it’s own Root CA store.

Now that we have the CA spun up (AND trusted by our clients!!), let’s get some certificates. What’s the best first certificate to sign via DNS? The DNS server’s web GUI certificate.

Technitium DNS automatically reloads the certificate when changes are made to it, so all we have to do is write the certificate to disk and make sure Technitium DNS is pointed at it with the right password.

  1. Fetch and install Roots from CA:
TRUSTED_FP="92b5dda4b50d0eb3c2e1988be250944cb50f3728514d0cfd2d6afed2d9dd55c1"
echo "downloading Root CA"
curl https://service.cdt-step-ca-01.i.caffeinated.technology/roots.pem -k > /tmp/CdT.crt
DOWNLOADED_FP=$(openssl x509 -in /tmp/CdT.crt -noout -fingerprint -sha256 | cut -d= -f2 | tr -d ':' | tr 'A-Z' 'a-z')
echo "checking fingerprint match"
if [ "$DOWNLOADED_FP" = "$TRUSTED_FP" ]; then
    echo "Matches, copying to ssl store"
    sudo cp /tmp/CdT.crt /usr/local/share/ca-certificates/CdT-Root-CA-E1.crt
    echo "running update-ca-certificates"
    sudo update-ca-certificates
else
    echo "The fingerprint did not match!!"
fi

This script downloads the Root CA, checks the Trusted Fingerprint we’ve established earlier, and installs it into the System’s root store if it matches.

!! Not all libraries and programs (like discussed earlier) use the system’s CA store for trust.

  1. Install Certbot and the RFC 2136 plugin:
sudo apt install certbot python3-certbot-dns-rfc2136 -y
  1. Create a TSIG key in Technitium DNS for ACME Challenges:
  • Settings>TSIG>Add: Name: adns-nscl.homeblab.com-acme-challenge, Algorithm: HMAC-SHA256
  • Click save, the secret will generate
  1. Edit Zone’s Dynamic Updates Settings:
  • Zone>Options>Zone Options>Dynamic Updates (RFC 2136)
    • Check Use Specified Network Access Control List (ACL)
    • Enter IP range in Network Access Control List: 10.0.0.0/8
    • Add a new security policy:
      • Select the the newly created TSIG key (adns-nscl.homeblab.com-acme-challenge)
      • Set domain name to _acme-challenge.adns-01.adns-nscl.homeblab.com - no wildcard support :/ - add each name
      • Set Allowed Record Types to TXT
    • Save
  1. Create a config file on the server the certificate needs to live:

This will be on all of the 4 DNS servers, so this will be repeated on each.

  • Create config file at /etc/letsencrypt/adns-rfc2136.ini:
dns_rfc2136_server = 10.98.0.16
dns_rfc2136_port = 53
dns_rfc2136_name = the_tsig_keys_name_you_made_in_technitium_settings
dns_rfc2136_secret = the_tsig_key_you_made_in_technitium_settings
dns_rfc2136_algorithm = HMAC-SHA256

adns-01’s IP address used here, as it’s the Primary Zone holder.

chmod 600 /etc/letsencrypt/adns-rfc2136.ini
  1. Run the certificate request:
sudo REQUESTS_CA_BUNDLE=/usr/local/share/ca-certificates/CdT-Root-CA-E1.crt certbot certonly \
    --server https://service.cdt-step-ca-01.i.caffeinated.technology/acme/acme/directory \
    --dns-rfc2136 --dns-rfc2136-credentials /etc/letsencrypt/adns-rfc2136.ini \
    -d adns-01.adns-nscl.homeblab.com -v
  1. Add CA Bundle into service:
sudo mkdir -p /etc/systemd/system/certbot.service.d
echo -e '[Service]\nEnvironment=REQUESTS_CA_BUNDLE=/usr/local/share/ca-certificates/CdT-Root-CA-E1.crt' \
  | sudo tee /etc/systemd/system/certbot.service.d/ca-bundle.conf
sudo systemctl daemon-reload
  1. Set 12 hour renewal timer:
sudo mkdir -p /etc/systemd/system/certbot.timer.d
echo -e '[Timer]\nOnCalendar=\nOnCalendar=*-*-* 00,12:00:00\nRandomizedDelaySec=5m' \
  | sudo tee /etc/systemd/system/certbot.timer.d/schedule.conf
sudo systemctl daemon-reload
sudo systemctl restart certbot.timer
  1. Create a renewal hook script to convert Public and Private key to PFX

Certbot will execute scripts located in the three folders under /etc/letsencrypt/renewal-hooks/, we will focus on the deploy/ folder, which runs scripts within for each successfully renewed certificate.

Certbot will automatically set shell variables when executing the scripts within, such as RENEWED_LINEAGE, which is the directory which the renewed certificate lives in (ex. /etc/letsencrypt/live/adns-01.adns-nscl.homeblab.com/).

Generate a password for the PFX:

openssl rand -base64 24 | tr -d '\n' | sudo tee /etc/letsencrypt/pfx-password > /dev/null
sudo chmod 600 /etc/letsencrypt/pfx-password

A deploy hook script at /etc/letsencrypt/renewal-hooks/deploy/01-convert-to-pfx.sh:

#!/usr/bin/env bash
set -euo pipefail

LINEAGE="${RENEWED_LINEAGE:?not run by certbot}"
NAME=$(basename "$LINEAGE")
OUT_DIR="/etc/letsencrypt/pfx"
OUT="$OUT_DIR/$NAME.pfx"

mkdir -p "$OUT_DIR"

TMP=$(mktemp "$OUT_DIR/.$NAME.XXXXXX")
trap 'rm -f "$TMP"' EXIT

openssl pkcs12 -export \
    -inkey   "$LINEAGE/privkey.pem" \
    -in      "$LINEAGE/cert.pem" \
    -certfile "$LINEAGE/chain.pem" \
    -name    "$NAME" \
    -passout file:/etc/letsencrypt/pfx-password \
    -out     "$TMP"

chmod 600 "$TMP"
mv -f "$TMP" "$OUT"
trap - EXIT
echo "Wrote $OUT"
sudo chmod +x /etc/letsencrypt/renewal-hooks/deploy/01-convert-to-pfx.sh

Run manually:

$ sudo RENEWED_LINEAGE=/etc/letsencrypt/live/adns-01.adns-nscl.homeblab.com \
  /etc/letsencrypt/renewal-hooks/deploy/01-convert-to-pfx.sh
Wrote /etc/letsencrypt/pfx/adns-01.adns-nscl.homeblab.com.pfx

Great we have a PFX file, but we do have an issue:

$ ls -lah /etc/letsencrypt/pfx
total 12K
drwx------ 2 root root 4.0K Nov  8 17:05 .
drwxr-xr-x 8 root root 4.0K Nov  8 17:04 ..
-rw------- 1 root root 1.9K Nov  8 17:05 adns-01.adns-nscl.homeblab.com.pfx

$ systemctl show dns.service -p User
User=dns-server

The DNS server runs as dns-server and the owner of the PFX is Root, it is not world readable either. Because of this we will make another deploy hook script at /etc/letsencrypt/renewal-hooks/deploy/02-dns-server-pfx-perms.sh:

#!/usr/bin/env bash
set -euo pipefail

for pfx in /etc/letsencrypt/pfx/*.pfx; do
    if [ -f "$pfx" ]; then
        echo "setting permissions on $pfx"
        chown dns-server:dns-server "$pfx"
    fi
done

# ensure parent dir permissions are correct
chgrp dns-server /etc/letsencrypt/pfx
chmod 750 /etc/letsencrypt/pfx
chmod +x /etc/letsencrypt/renewal-hooks/deploy/02-dns-server-pfx-perms.sh

Change the TLS settings under the cluster member we are working on under Settings>Web Service:

“TLS Settings”

Saving this automatically applies the certificate, and Technitium DNS will automatically apply the certificate when it changes.

Verifying in the browser:

“Certificate info in Firefox URL bar”

“Certificate detail in Firefox”

And testing the whole deploy hook chain with certbot renew:

$ certbot renew
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/adns-01.adns-nscl.homeblab.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Renewing an existing certificate for adns-01.adns-nscl.homeblab.com
Waiting 60 seconds for DNS changes to propagate
Hook 'deploy-hook' ran with output:
 Wrote /etc/letsencrypt/pfx/adns-01.adns-nscl.homeblab.com.pfx
Hook 'deploy-hook' ran with output:
 setting permissions on /etc/letsencrypt/pfx/adns-01.adns-nscl.homeblab.com.pfx

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations, all renewals succeeded: 
  /etc/letsencrypt/live/adns-01.adns-nscl.homeblab.com/fullchain.pem (success)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

We can see the deploy hooks have worked, confirming the Technitium DNS’s web GUI certificate fingerprint had changed.

Side note: CAA records

I just learned about CAA records, CAA Records are defined as RFC 8659 to define authorized CAs for a given domain name.

Rather going into the depths of CAA records and how to write them, a tool can be found on SSL Mate’s website here to generate them.

Creating a basic CAA record for Let’s Encrypt looks like the following in Technitium:

“CAA Record”

Closing Notes

We’ve spun up a private two-tier PKI using ECDSA keys, which issues 24 hour TLS certificates using ACME.

There’s a few things below I’d change about the CA for the “E2” itteration, but I’m happy with the rework.

I adjusted the CA’s ACME configuration to ONLY accept DNS-01 challenges, I don’t anticipate using HTTP or TLS-ALPN challenges, therefore I’ve ensured they cannot be used:

{ 
    "type": "ACME",
    "name": "acme",
    "challenges": ["dns-01"]
}

What I will do for E2

Prior to E1, I had a CRL list published by the Intermediate CA, but the certificate life times were about 30 days. Even though the new CA only provisions 24 hour certificates, I’d probably bring back a CRL list incase a certificate’s private key gets compromised, I’d be able to react alot faster instead of waiting 24 hours for it to expire.

Otherwise I’m fine with how it is.