PKI for FortiGate, Part 7: Running It, and What I Have Not Tested

The earlier parts built a CA and tested how a FortiGate treats its certificates and revocation lists. This last part is about running it afterwards. A PKI mostly fails on dates nobody remembered, so most of what follows is a calendar and a set of procedures. The post ends with the things I have not tested, because a series that claims to be evidence-based owes you that list.

The dates that matter

WhatExpires or lapsesConsequence if missed
Root CA certificate2036-10-22Every certificate in the chain is invalid
Intermediate CA certificate2031-10-24No new certificates can be issued, and existing ones stop validating
Root CRL2027-05-06With expiry revoke, every tunnel fails at its next authentication
Leaf certificate (spoke)2027-10-29That device’s tunnel fails at its next authentication
CRL published by the CANot recordedSee “Not tested” below

Each device has its own leaf date. Check them from the device:

get vpn certificate local details SPOKE1-IPSEC-3

The root CRL is the one most likely to be forgotten. Under the strict settings from Part 6, it is a hard cliff, so its next-update date belongs in a calendar with a reminder well ahead of it.

Re-signing the root CRL

This is done on the workstation holding the root key, in the same working directory used for the first one. The index.txt there is the permanent record of revoked intermediates. It is empty because none has been revoked, and in a real environment you never reset it. (In Part 5 I reset mine only because I had filled a throwaway copy with test data.)

openssl ca -config openssl.cnf -gencrl -crldays 180 -out root.crl.pem
openssl crl -in root.crl.pem -noout -issuer -lastupdate -nextupdate

openssl increments the CRL number itself. Check that the issuer is the root and the dates are what you expect, then load it on each FortiGate by replacing the contents of ROOT-CRL:

config vpn certificate crl
    edit "ROOT-CRL"
        set crl "-----BEGIN X509 CRL-----
        ...
        -----END X509 CRL-----"
    next
end

show full-configuration vpn certificate crl ROOT-CRL | grep -c BEGIN

The count should be 1. Then confirm a tunnel still authenticates:

diagnose vpn ike gateway clear name H1-S1-ISP1
get vpn ipsec tunnel summary

Pasting a PEM into every device does not scale. For a fleet I would host the root CRL on the same kind of HTTP endpoint as the CA’s CRL and give ROOT-CRL an http-url. I have not tested that. See below.

Revoking a compromised device

The procedure that came out of Parts 3 and 5, in order:

  1. Revoke the serial on the CA. The CA rebuilds its CRL at once.
  2. Confirm the CRL lists it. step crl inspect --insecure http://10.10.0.21:9001/1.0/crl prints the serials in decimal, with the hex beside them.
  3. Get the new list onto the hub. Wait for the refresh interval, or import it now: execute vpn certificate crl import auto THEMIS-CRL. The command prints nothing whether it works or not.
  4. Check the hub has a list: show full-configuration vpn certificate crl | grep -c BEGIN.
  5. Clear the gateway for that peer, so it has to authenticate again: diagnose vpn ike gateway clear name H1-S1-ISP1.
  6. Confirm it is refused. The fnbamd debug shows ***CERTIFICATE IS REVOKED***, and the tunnel summary shows the selectors at 0.

Step 5 is the one people skip. Without it a revoked device keeps its tunnel until the IKE SA expires or rekeys.

Revoking an intermediate

Only for a compromised intermediate key. Revoke it in the root’s index.txt, regenerate the root CRL with the same openssl commands, and load it on every device. Every certificate that intermediate ever issued is then rejected, as Part 5 showed on one spoke. Then stand up a new intermediate, sign it with the root, import it as a trust anchor, and re-issue every device certificate.

What to back up

Before the first outage, decide where these go and who can reach them:

  • The root key, encrypted, in at least two places on separate media.
  • The root’s index.txt and crlnumber, which hold the revocation record and CRL sequence.
  • The intermediate key and its password, and the step-ca database under /etc/step-ca/db, which holds what the CA has issued and revoked.
  • A snapshot of the CA VM taken after the build.

I have not tested a restore of any of these.

Not tested

This is the list of what the lab does not prove. Nothing here is a claim that it fails. It is simply not demonstrated.

  • CRL fetch from a non-default VRF. The CRL object has a vrf-select setting in 7.6.8. I have not tested a fetch with the CRL host reachable only through another VRF.
  • Automatic CRL refresh at the default 3600 seconds. I tested at 300. The mechanism is the same, but I did not wait out an hour.
  • A leaf certificate expiring on a running tunnel, and what happens at the next authentication.
  • Automated renewal. FortiOS has an EST client for this, and step-ca as I ran it offers no EST. Every renewal here was manual.
  • The CA’s own CRL validity. I have not recorded how long the CRL step-ca publishes stays valid, which determines how soon expiry revoke bites if the CA host goes down.
  • Hosting the root CRL over HTTP so devices fetch it themselves.
  • Reboot or HA behaviour with no CRL loaded, and ADVPN shortcut tunnels.
  • Intermediate revocation on more than one spoke. The test used one. The rejection happens at the chain, so I expect every leaf to fail, but I only observed one.
  • A CA-issued certificate on the FortiGate admin GUI. Everything here is IPsec.
  • Host hardening beyond the firewall rules in the step-ca post, and an HSM or other protection for the intermediate key.

The step-ca post has the build. Beyond PSK, Part 3 covers the automated enrolment I did not do here.