Skip to content

Audit log

Append only (a trigger blocks UPDATE and TRUNCATE always, DELETE outside the retention job) and hash chained. Recorded: console actions, settings changes, sign ins (also failed ones: local as login.local.failed, and OIDC as login.failed with the reason state, code exchange, id token or claims and the client address, never codes or tokens; failed ones at most 30 per minute each, lockouts always, the process log has all), refused MFA sign ins (login.denied), enrollments, certificate rotations, commands, tamper events, recovery key escrow and every recovery key view, policy actions, exports (export, export.done with SHA-256), four eyes requests and decisions (approval.*), risk exceptions, key rotations (keys.rotate), notification channel changes, remote shell sessions (start and end), audit verification, key segments and pruning (audit.verify, audit.keyed, audit.key_rotate, audit.prune).

Keyed chain. Each entry stores prev (the hash of the entry before) and hash:

hash = HMAC-SHA256(key, prev || be64(at_us) || be64(len(actor)) || actor || be64(len(action)) || action
                        || be64(len(target)) || target || be64(len(detail)) || detail)

at_us is the time in Unix microseconds, be64 an unsigned 64 bit big endian integer; the first entry has 32 zero bytes as prev. An entry that belongs to a tenant (Tenants) appends be64(len(tenant)) || tenant with the tenant ID in decimal; entries without a tenant (all from before tenants existed) hash as above. CSV and JSON Lines exports carry tenant_id. The key is derived from command.key with HKDF (SHA-256, info limdm audit chain v1), so it never lives in the database: whoever can only write to the database cannot recompute the chain after changing a row. Entries written before the keyed chain was introduced use plain SHA-256 over the same bytes; the first keyed entry is recorded in audit-keyed-from next to command.key and as the entry audit.keyed. Back up the CA directory: without command.key and that file, keyed entries cannot be verified. Stop all server instances for the upgrade, an old instance would write plain entries after the switch.

Key rotation. A command key rotation starts a new segment: the first server started with the new key records the first entry of the segment in audit-keys (one line per segment: first entry, key id, and the key of every earlier segment) and writes audit.key_rotate under the new key, and signs the retention cut again. The table audit_key names the current key; an instance with another key refuses to write entries until it restarts, fails /readyz and leaves background jobs to the other instances, so the chain never mixes keys. With an HSM command key the audit key is derived from a deterministic Ed25519 signature over the label instead of the seed (Keys and HSM).

Verification. The audit page verifies incrementally from the last checkpoint, a background run verifies the whole chain daily, and Verify whole chain does it on demand (audited as audit.verify). A break shows the first changed entry.

Export and outside verification. The page filters by text, actor, action, target and date and pages through the whole log. CSV and JSON Lines export the filtered entries with prev and hash; JSON Lines has the raw values (at_us, the fields, prev, hash in hex, scheme). Recompute an export on the server, or give the key to an auditor:

limdm-server audit verify limdm-20261126-audit.jsonl   # reads LIMDM_CA_DIR
limdm-server audit key                                 # key=<hex> keyed_from=<id>, one line per segment
limdm-server audit -key <hex> -keyed-from <id> verify limdm-20261126-audit.jsonl

audit verify prints <n> entries, <first> to <last>: chain intact or names the first broken entry and exits with an error. -ca DIR (default LIMDM_CA_DIR, else /var/lib/limdm-server/ca) reads every segment from command.key, audit-keyed-from and audit-keys (with an HSM through LIMDM_KEY_PROVIDER). -key covers one segment only: an export that spans a command key rotation is verified with the CA directory, or split at the segment start. An export of a date range starts in the middle of the chain: the first entry's prev is taken as given and every following entry must continue it. Whoever holds the key can compute valid hashes, so hand it only to the verifying auditor.

Commands are linked through the chain alone: the enqueue entry (command.<type>, actor the admin) and the result entry (command.result, actor device:<id>) both have the device as target and start with command <id>; the result adds the type, ok or failed and, for failures, the last line of the output.

SIEM. With LIMDM_SYSLOG=udp://host:514 or tcp://host:514 (octet counting framing) the server forwards new audit entries (MSGID audit, structured data id, actor, action, target, hash) and device events (MSGID event) as RFC 5424 messages, facility 13 (log audit). Control characters in values are replaced, structured data is escaped. Forwarding starts with the entries written after the server started and retries unsent ones; there is no TLS, so use it on a trusted network or a local relay. The copy outside the database is the external anchor of the chain.

Routine agent events (every change the agent makes on a device, desktop logins) are high volume and kept separately in device_events: append only, 365 days, shown on the device page (Commands tab). They do not take part in the hash chain.

Retention. The audit log is kept forever unless Settings, Security, Audit log retention sets 365 days or more. Then, once a day and only after the whole chain verified intact, entries older than the period are deleted. The id and hash of the last deleted entry are stored as the cut, with an HMAC under the audit chain key (the HKDF key from command.key above), and the incremental, daily and on demand verification start from there; entries behind the cut keep their scheme (plain before audit-keyed-from, keyed after it). The prune itself is an audit entry (audit.prune). A cut whose HMAC does not match is ignored, so the first remaining entry shows as broken; losing command.key therefore shows the chain as broken from the cut on. Rows of audit_log and device_events can only be deleted in a transaction that sets limdm.retention, which only the retention job and the device deletion do; a database administrator can still bypass any trigger, which the hash chain makes visible for the audit log. Finished commands are deleted after 180 days, except lock, lost mode and wipe, which the device page shows.

Deleting devices. A retired device can be deleted on its page (admins, confirmed with the host name): the device row with its events, metrics, commands, recovery keys and app requests is removed. Audit entries naming the device stay until the audit retention removes them; the deletion is one of them (device.delete).