Skip to content

Key rotation and compromise

Rotation

A rotation has two steps, rotate and finish, from the console (Settings, Security, Keys, global admins without a device scope; tenant accounts do not see the card) or the command line:

limdm-server keys -env /etc/limdm-server/server.env status
limdm-server keys -env /etc/limdm-server/server.env rotate ca            # or network-ca, command
limdm-server keys -env /etc/limdm-server/server.env finish ca            # when status shows every device moved
limdm-server keys -env /etc/limdm-server/server.env rotate session       # prints the new LIMDM_SESSION_KEY
limdm-server keys -env /etc/limdm-server/server.env rotate webhook       # prints the new webhook signing secret
limdm-server keys -env /etc/limdm-server/server.env rotate logs          # log archive key; finish when status shows every data key moved

Every step is written to the audit log (keys.rotate, keys.finish, keys.reseal, audit.key_rotate) and sends the notification event keys.rotate. A step changes keys.json and takes effect when every server instance has restarted; the console shows "restart required" until then. With an HSM rotate needs -name NAME (console: the name field), and the key limdm-NAME must exist in the token. finish refuses while devices still depend on the old key; -force (console: force) finishes anyway, and those devices must enroll again. Agents must run 0.16 or newer for a rotation: older agents never report the new key and keep finish waiting.

With several instances (High availability) every step also records the key fingerprints in the database. Between rotate and finish an instance starts with the old or the new CA directory; after finish an instance whose directory still holds the old keys refuses to start. A step waits while an instance starts.

Device CA

  1. rotate ca creates a new CA. After the restart it issues every new and renewed client certificate. The agent listener keeps its certificate from the old CA and new enrollments keep pinning the old fingerprint, since not every agent trusts the new CA yet. Both CAs are trusted for client certificates.
  2. At each check in the server sends agents the bundle of both CAs over the mTLS channel; the agent accepts it only if it contains a CA it trusts already, stores it in /etc/limdm/ca.crt and uses it at once. A device whose certificate is from the old CA is asked to renew right away.
  3. The console counts a device as moved when its certificate is from the new CA and it has confirmed the bundle. Wait for all, including laptops that are rarely online.
  4. finish ca, restart. The listener certificate now comes from the new CA, the old CA is no longer trusted, its key file is deleted, and the next check in gives agents a bundle with the new CA only. The enrollment page and install.sh show the new fingerprint.

Network CA

  1. rotate network-ca. After the restart new EAP-TLS certificates come from the new CA; devices with a certificate of the old CA renew at once. /network/ca.pem serves both CAs and /network/crl.pem a CRL for each.
  2. Install the bundle from /network/ca.pem on every RADIUS server (both CAs trusted), and let its CRL fetch job continue.
  3. The console counts valid network certificates of the new CA. When all are moved: finish network-ca, restart, and replace the bundle on the RADIUS servers with the new CA.

Command key

  1. rotate command. After the restart the new key signs commands, library items, catalog apps, managed remotes and device user lists (what the old key signed is signed again at start), and the audit chain starts a new segment keyed from the new key (audit.key_rotate). The first process that starts with the new key records the segment, a server or a later limdm-server keys call; from then on an instance that still runs the old key can no longer write audit entries until it restarts: its /readyz answers 503 ("audit key outdated") and it hands its background jobs to an instance with the new key. An instance whose CA directory lacks the new segment (a copy from before the rotation or before the first restart) refuses to start. Restart every instance right after rotate command.
  2. Every check in carries the new public key with a rollover record signed by the old key. The agent verifies it against its pinned key and pins the new key; commands signed by the old key stay valid for 14 days. A rollover not signed by the pinned key is refused and reported as an event.
  3. The console counts devices that report the new key. When all are moved: finish command (refused until a server has started with the new key), restart. The old key file is deleted; its audit key stays in audit-keys, so old entries remain verifiable.

Session key

  1. rotate session prints LIMDM_SESSION_KEY=<new>,<old>. Put that into the environment and restart. The first key seals and signs, every listed key opens and verifies, so nobody is signed out and nothing becomes unreadable.
  2. After the start the server seals every value again with the new key in the background (OIDC client secret, Google key, notification channel secrets, recovery keys, desktop login client secrets in library items and their version history) and records keys.reseal. The console and keys status show how many values are left.
  3. finish session confirms that nothing depends on an old key. Then keep only the first key in LIMDM_SESSION_KEY and restart.

A session key rotation does not change the webhook signing secret.

Log archive key

rotate logs creates a new key (with an HSM: names the object limdm-NAME). After the restart the new key is active and the old one retiring: the logs job wraps every data key of the log archive again with the new key (the data keys themselves stay, so every archived day stays readable). Status shows the data keys moved; finish refuses until all moved and then deletes the old key file. Data keys of builds before 0.21, wrapped with the session key, are wrapped with this key at the first start.

Webhook signing secret

The secret is stored in the database, sealed with the session key, and stays the same when the session key rotates. An installation upgraded from 0.15 keeps the value receivers already know (until 0.15 it was derived from the session key); a new installation gets a random secret at its first start.

rotate webhook (console: Rotate in the Keys card) generates a new random secret, prints it once and records keys.rotate with a short fingerprint. Give the new secret to every receiver, then restart every server instance: instances sign with the secret they loaded at start. There is no overlap and no finish step. The Keys card shows a fingerprint of the stored secret, so receivers can be compared without showing it.

Release key

Create a new key (limdm-server keygen or in the HSM), build and roll out an agent release that trusts the new public key while still signed with the old one, then sign later releases with the new key. limdm-server sign -pkcs11 LABEL SHA256SUMS signs with an Ed25519 key in the token (LIMDM_PKCS11_* as above).

Compromise

Act on the key that leaked; the order matters when several did.

  • Device CA key. Someone can issue client certificates and a listener certificate that agents trust. Rotate the CA now, push agents to check in (they poll every minute), and finish as soon as the moved count allows, with force if needed: until finish the old CA stays trusted. Check the audit log for enrollments and renewals you do not know. If the attacker could also reach the agent port path, treat devices as possibly commanded and review command.result entries.
  • Command key. Someone can sign commands and items devices accept, and compute audit hashes. Rotate the command key at once; the rollover still needs the old key, which the attacker has too, so finish as soon as devices moved and review commands and audit entries since the suspected time. Entries keyed with the old key can be forged by the attacker; entries of the new segment cannot.
  • Network CA key. Rotate the network CA, deploy the new bundle to RADIUS, finish with force once the important devices have new certificates, so RADIUS stops trusting the old CA.
  • Session key. Someone can forge console sessions and open sealed values from a database copy. Rotate the session key, then also change what was sealed: OIDC client secret at the identity provider, Google service account key, notification channel secrets, desktop login client secret, rotate the webhook signing secret (rotate webhook), and rotate LUKS recovery keys from the device pages.
  • CA directory or HSM PIN. Treat all keys above as leaked.
  • Release key. Remove the CI secret, rotate as above, and publish a notice: agents with the old public key accept anything signed with it until updated.

Keep the old backups of the CA directory until the rotation is finished, then destroy them: a backup with a retired key is as sensitive as the key.