LawlietRequest demo ↗

3. CLI reference: ./lawliet

This guide describes Lawliet 1.6.3.b (the current release, a beta: earlier releases are beta. The first stable release will be 2.0.0). Screens, commands and procedures may change in later versions; the usage guide is updated with each release. Check the version your server runs under Settings > Platform or with ./lawliet version, and see the Releases page for what changed.

Every command and option of ./lawliet, with examples and what the output means. The script is at the root of the installation directory. It needs only Docker, bash, coreutils and curl on the server.


3.1 Conventions#

  • Where. Run it from the installation directory: cd /opt/lawliet-<version>. After an update, use the new directory (the update prints its path).
  • Who. As root or with sudo, and always the same account. .env is mode 600.
  • Output marks. OK a check passed or a step succeeded; FAIL it did not; ! a warning you should read; a line starting with > begins a new section. Colour is used only on a terminal and never when NO_COLOR is set.
  • Exit status. 0 on success, 1 when the command stopped (the last line starting with FAIL says why), 130 when an update was interrupted with Ctrl-C.
  • Questions. (y/N) means the default is no; (Y/n) means yes; Enter takes the default. Answers can be piped in. When no answer can be read at all, the default is taken and the command says so. Commands that change things offer --yes for scripts.
  • Verbose. Add --verbose (or -v, or set LAWLIET_VERBOSE=1) to any command for a time on every step, every docker / compose / curl command with its exit code and the output it would normally hide, secrets masked (59.5).
  • A second deployment on the same host: prefix every command with its project name, for example sudo COMPOSE_PROJECT_NAME=lawliet-staging ./lawliet status.
  • Safety. No command except uninstall deletes data. uninstall requires typing DELETE. No command overwrites .env without asking or keeping a copy.

3.2 Summary#

CommandAliasesWhat it doesChanges the server?
installGuided installationYes
statusstHealth, versions, licence, schema, estate sizeNo
start [service]upStart everything, or one serviceYes (starts containers)
stop [service]downStop containers; data untouchedYes (stops containers)
restart [service]Restart and wait for healthYes
logs [service] [-f] [-n N]logRead logsNo
backup [dir]Database dump, keys file, agent artefactsWrites files only
restore <dump>Replace the database with a dumpYes: replaces all data
update <bundle> [--no-cert-repair] [--keep-agent-upgrades-off], update --stagedupgradeUpgrade to a new bundle or deltaYes
rollback [--yes] [--to DIR] [--backup DUMP]Back to the version before the last updateYes
doctor [--fix [--yes]]diagnosticsFindings and safe fixes, support file--fix only
diag [options]One redacted archive for the vendorWrites one file
token [--rotate]Enrolment secret and install commands--rotate only
agent-package --os OS [options]Offline agent packageWrites one file, creates an enrolment code
passwdpasswordReset an account password (audited; its sessions end)Yes
security-check [--json]Check permissions, secrets, exposure and four-eyesNo (root for the file checks)
audit-verify [--json]Verify the keyed audit trailNo
integrity verify|init|reseal|rekeyCheck or re-seal accounts, roles, approvals, API keys and agent commandsinit/reseal/rekey: yes
tls [options], tls --export [path]certInspect, replace or export the certificateReplace: yes
tls on, tls off, tls statusTurn encryption on or off, or show iton/off: yes
tls repair [options], tls cancelRe-issue a self-signed certificate; withdraw a staged oneYes
licence [key or file]licenseShow or install the licenceInstall: yes
uninstallDelete containers and the databaseYes: deletes all data
verify-report <file> --key-history KCheck a signed report or evidence pack offlineNo
agent-upgrades [status|on|off]Show or switch the agent upgrade channelon/off: yes
hardening-risks [status|accept-all|normal]Accept every hardening risk automatically, or notaccept-all/normal: yes
version--versionPrint the bundle versionNo
help--help, -hThe command listNo

3.3 status#

sudo ./lawliet status

Read-only. Use it first whenever something looks wrong.

What you see: one block per section below, each line marked OK, ! or FAIL, for example OK <url>/health responding and OK Stamped at <revision>.

SectionWhat it showsWhat to look for
DeploymentDirectory, bundle version, mode (tls or direct), TLS on/off, console URLTLS off prints a red warning
ServicesEach container: healthy/running with the date it started, starting, or a failure stateAnything not OK
APIWhether /health answers; version, build id (quote it to support), licensed to, installation fingerprintFAIL ... not responding
TLS certificateHTTPS mode only: whether the certificate covers every address this server is reached bycertificate does not cover <address>
SchemaThe database migration revisionNot stamped is a fault
EstateCounts: agents, compliance scans, FIM events, DLP incidents, firewall rules, network nodes, review queue- means the count could not be read
DiskFree space on the installation's filesystemLow space

If no container is running it says Nothing is running. Start it with: ./lawliet start. If it finds Lawliet containers that belong to another project name, it says so instead; do not start a second copy, use that project name.


3.4 start#

sudo ./lawliet start            # everything
sudo ./lawliet start backend    # one service
  1. Loads any of the bundle's images that are not loaded yet (each checked against its checksum first).
  2. Applies the TLS state recorded in .lawliet.conf to .env.
  3. Starts the containers (docker compose up -d), which also recreates any container whose configuration changed. This is how edits to .env take effect.
  4. Waits up to 5 minutes for every service to become healthy.
  5. Reports a certificate that does not cover an address, if any.
  6. On the first start after an update to this version, runs that version's post-update steps once (see Updates).

What you see: the live service list, then OK Running - <console URL>.

If it fails: Not all services are healthy yet. ./lawliet status means the wait ran out; the platform may still finish starting. Check with status and logs backend. The console cannot write .../updates means console uploads of updates will not work; run sudo ./lawliet start.


3.5 stop#

sudo ./lawliet stop             # everything
sudo ./lawliet stop frontend    # one service

Stops containers. Volumes, and therefore your data, are untouched. Agents keep their collected data and send it once the server is back.

What you see: Containers are stopped. Volumes, and therefore your data, are untouched. and OK Stopped. Start again with sudo ./lawliet start (3.4).


3.6 restart#

sudo ./lawliet restart
sudo ./lawliet restart backend

Restarts containers and waits up to 5 minutes for health. A restart does not re-read .env. After changing .env, use sudo ./lawliet start instead.

What you see: OK Restarted. If it fails: Not all services are healthy yet. ./lawliet status - check with status and logs backend.


3.7 logs#

sudo ./lawliet logs backend            # last 200 lines of the backend
sudo ./lawliet logs backend -n 1000    # last 1000 lines
sudo ./lawliet logs nginx -f           # follow; Ctrl-C to stop
sudo ./lawliet logs                    # every service
OptionMeaning
[service]postgres, redis, clickhouse, backend, frontend, and in HTTPS mode nginx, db-backup. Omit for all
-f, --followKeep printing new lines
-n NNumber of lines from the end (default 200)

What you see: the log lines, each prefixed with the service name. With -f it keeps printing until you press Ctrl-C. Logs can contain host names and user names: review them before sending them anywhere, or use diag (3.14), which redacts.


3.8 install#

sudo ./lawliet install

The guided installation. Full walk-through: Installation. To change one setting on a running deployment, use the command for it (passwd, tls, token --rotate, licence), not install.


3.9 backup#

sudo ./lawliet backup                    # into ./backups
sudo ./lawliet backup /mnt/backup-share  # into another directory

Writes three files, all owner-only (mode 600):

FileContents
lawliet-<YYYYmmdd-HHMMSS>.sql.gzThe PostgreSQL database
lawliet-<YYYYmmdd-HHMMSS>.keysSECRET_KEY and DATA_ENCRYPTION_KEY: the keys stored secrets are encrypted with
lawliet-<YYYYmmdd-HHMMSS>.agent-artifacts.tar.gzAgent releases hosted on this server

What you see: OK Wrote <file> (<size>, <N> tables) for each file, and the restore command. A dump with no tables is discarded and reported as a failure.

Details, scheduling and what is not included: Backup and restore.


3.10 restore#

sudo ./lawliet restore backups/lawliet-20261014-020000.sql.gz

Replaces the whole database with the dump. Asks first (default no).

  1. Stops the application (PostgreSQL stays up).
  2. Empties the database schema, then loads the dump in one transaction.
  3. If a .keys file sits beside the dump and differs from .env, adopts its keys (keeping the previous .env as .env.backup.<timestamp>) and recreates the application. Otherwise restarts it.
  4. Puts back the agent artefacts archived beside the dump, if any.
MessageMeaning
Restored from <dump> (<N> tables)Done
Could not reset the schema. Nothing was loaded.Nothing changed. Check logs postgres
The dump failed to load. The database is now EMPTY.Restore another dump at once
No <file>.keys beside the dumpA warning. On the same installation this is fine. On another installation, two-factor and stored credentials will fail; see Backup and restore

3.11 update#

sudo ./lawliet update /media/usb/lawliet-docker-<new>-<customer>.tar.gz
sudo ./lawliet update /media/usb/lawliet-delta-<old>-<build>-to-<new>-<build>-amd64.tar.gz
sudo ./lawliet update /opt/lawliet-<new>/          # an already unpacked bundle directory
sudo ./lawliet update --staged                     # the bundle the console staged
sudo ./lawliet update <bundle> --no-cert-repair    # skip the certificate check afterwards
sudo ./lawliet update <bundle> --keep-agent-upgrades-off   # leave agent upgrades off (below 1.5.14.s)

Backs up, checks the new bundle's signature, unpacks it beside this directory, loads its images while the current version keeps running, then switches over and verifies. From 1.5.16.s the signature is checked on this host only: without openssl the update is refused (install it first: apt-get install openssl / dnf install openssl). The update to 1.5.16.s itself is still checked by the previous version's script, so the refusal applies to updates from 1.5.16.s on. The update also generates the Redis, ClickHouse and metrics secrets this version requires, before anything starts. The full procedure, every message and how to go back: Updates, rollback and delta updates.

OptionMeaning
<file>A full bundle .tar.gz, a delta .tar.gz, or an unpacked bundle directory
--stagedUse the bundle the console downloaded or received by upload and verified
--no-cert-repairDo not run the certificate check after the update. Run sudo ./lawliet tls repair later
--keep-agent-upgrades-offUpdating from below 1.5.14.s: do not turn agent upgrades on (by default that update turns them on once). From 1.5.13.s or earlier use sudo LAWLIET_KEEP_AGENT_UPGRADES_OFF=1 ./lawliet update <bundle>: that script refuses options it does not know

3.12 rollback#

cd /opt/lawliet-<new>
sudo ./lawliet rollback                     # asks first
sudo ./lawliet rollback --yes               # no question
sudo ./lawliet rollback --to /opt/lawliet-<old> --backup /opt/lawliet-<old>/backups/lawliet-<time>.sql.gz

Returns to the version this one was updated from, database included. Data written since the update is saved first and not lost. Full procedure: Rolling back.

OptionMeaning
--yes, -yDo not ask
--to <dir>The previous installation directory, when no record of it exists
--backup <dump>The dump taken before the update, when no record of it exists

3.13 doctor#

sudo ./lawliet doctor            # report and write a support file
sudo ./lawliet doctor --fix      # offer each safe fix, one question each
sudo ./lawliet doctor --fix --yes
sudo ./lawliet doctor --diag [directory]   # full diagnostic archive for the vendor (zip)
sudo ./lawliet doctor --help

Checks services, images, TLS state, certificate, TRUSTED_HOSTS, clock, disk, licence, backups and leftovers, and lists each finding with either a safe fix or the command to run. Full list of findings and fixes: Doctor, diag and support.

OptionMeaning
(none)Report, then write lawliet-support-<timestamp>.txt (no secrets, no database rows)
--fixFor each finding with a safe fix: show what it will do and ask (default no). Then check again
--yesOnly with --fix: answer yes to doctor's own questions
--diag [directory]Write the full-detail diagnostic archive lawliet-diag-<host>-<time>.zip (also asks every online agent; works with the backend down; credentials removed). Not combined with --fix. See 7.3a

3.14 diag#

sudo ./lawliet diag
sudo ./lawliet diag --since 24h --output /media/usb

Writes one redacted archive lawliet-diag-<host>-<UTC time>.tar.gz (mode 600) to send to the vendor. It refuses to write the archive if its self-check finds a secret in it.

OptionMeaning
--since <time>Logs since 30m, 24h, 7d or a timestamp. Default: the last N lines
--output <path>, -oA directory (the file name is generated) or a file name
--lines N, -n NLog lines per service (default 1000)
--keep-emailsKeep e-mail addresses (removed by default)

Contents and redaction: Doctor, diag and support.


3.15 token#

sudo ./lawliet token             # show the enrolment secret and install commands
sudo ./lawliet token --rotate    # replace the enrolment secret

Without options it prints the enrolment secret and a one-line install command each for Linux, macOS and Windows (PowerShell as Administrator), correct for this deployment:

  • with a self-signed certificate, the commands include --cacert/--ca-cert (-CaCert on Windows) pointing at /path/to/lawliet-server.pem; export the file first with sudo ./lawliet tls --export;
  • with TLS off, they install over plain HTTP and carry --insecure (-Insecure).

The same commands are in the console under Environment > Install agent. Installing agents: Agents overview.

--rotate asks first (default no), writes a new secret to .env, restarts the backend and prints the new secret. Agents already enrolled are not affected; they use their own per-agent token. Only new installations need the new commands. Rotate when the secret has been shared more widely than intended.

What you see: the secret, then the Linux, macOS and Windows commands. Treat the output as a secret: anyone with it can enrol a host.

No enrolment secret is set - every agent registration will be refused with 401 means AGENT_REGISTRATION_SECRET is empty. Fix with sudo ./lawliet token --rotate.


3.16 agent-package#

sudo ./lawliet agent-package --os linux --arch amd64 --hosts 50 --days 7 --label "Plant floor"
sudo ./lawliet agent-package --os windows
sudo ./lawliet agent-package --os windows --gpo --hosts 400
sudo ./lawliet agent-package --help

Builds an offline agent package for hosts that cannot download from the server. It carries the agent, its installer, the certificate when it is self-signed, and a new enrolment code that expires (never the enrolment secret).

OptionDefaultMeaning
--os linux or --os windows(required)Target operating system
--arch amd64 or --arch arm64amd64CPU. Windows: amd64 only
--hosts N50How many hosts may enrol with the code (1 to 1000)
--days N7 (30 with --gpo)How long the code is valid (1 to 30)
--label TEXTA name for the code, shown in the console
--server URLThis server's agent addressThe address agents will use
--out DIRThe installation directoryWhere to write the package
--gpoWindows only: the MSI and a transform (.mst) for a Group Policy rollout

What you see: Written: <path>, the enrolment code number, hosts, expiry, server, the certificate inside, and Package SHA-256. Compare that value with the copied file on the target host before installing. Then the commands to run on each host.

The file holds an enrolment code: treat it like a password and delete it when done. A lost code can be revoked in the console under Environment > Install agent > Offline package. ./lawliet doctor --fix offers to remove expired packages from the installation directory. Installing from a package: Linux agents, Windows agents.

The CLI is root on the server, so this needs no console approval. The code is recorded in the audit trail as made through the CLI.


3.17 passwd#

sudo ./lawliet passwd

The recovery path for a locked-out account. Since 1.5.16.s it changes the password through the platform, never with SQL. It:

  1. Asks which account (default: LAWLIET_ADMIN_USERNAME from .env) and the new password twice (12 to 128 characters, not a known default, not the account's own name).
  2. Asks Turn two-factor OFF for '<user>'? (default no). Answer yes only when the authenticator is lost; it is set up again at the next sign-in.
  3. Changes the password inside the backend container: every session of that account ends, the account is enabled, and the new password must be changed at the next sign-in.
  4. Writes an audit entry (password_reset, and two_factor_reset when two-factor was turned off) naming the server user who ran it, sends the SIEM event auth.password.reset_on_host, and notifies everyone who manages users (bell, webhook, email) at critical severity.

Nothing is written to .env; an initial password still kept there is removed. The backend must be running.

On a new, empty database (after uninstall then start, or a start on fresh volumes before restore), .env holds no administrator password any more. Outside development the backend then creates the administrator account with a random password nobody holds - never admin - and start prints Nobody has signed in as '<user>' ...: set the password with sudo ./lawliet passwd. For other ways to reset a user see 15.2 A user forgot their password.

Risk: anyone with root on the server can still reset a password this way, but no longer silently. Restrict shell access (Security hardening).


3.18 tls (inspect, replace, export)#

sudo ./lawliet tls                     # show subject and expiry, offer to replace
sudo ./lawliet tls --export            # write ./lawliet-server.pem for agent hosts
sudo ./lawliet tls --export /tmp/srv.pem

tls without options shows the certificate's subject and expiry (warning within 30 days) and asks Replace the certificate? (default no). Yes asks for the new certificate and key paths and installs them safely.

OptionMeaning
--export [path]Copy the served certificate (no private key) to path, default ./lawliet-server.pem, mode 644
--forceWhen replacing with agents enrolled: switch even if not every agent holds the new certificate yet
--timeout SSeconds to wait for agents to take the new certificate (default 600)
--ack PSwitch once P percent of agents hold it (default 100)
--allow-public-rootAlso hand agents a root certificate that is in this server's system trust store

Procedures: TLS and certificates.


3.19 tls on, off, status, repair, cancel#

sudo ./lawliet tls status
sudo ./lawliet tls off          # asks; --yes to skip
sudo ./lawliet tls on           # asks the follow-up questions; --yes accepts them
sudo ./lawliet tls repair       # re-issue a self-signed certificate that misses an address or expires soon
sudo ./lawliet tls repair --yes --timeout 1800 --ack 90
sudo ./lawliet tls cancel       # withdraw a certificate handed to agents but not switched to
CommandWhat it does
tls statusState (on/off), mode, console URL, what port 80/443 serve, certificate subject and expiry, how many agents still use plain HTTP
tls off [--yes]Serve the console and API on plain HTTP (port 80). HTTPS on 443 stays up so agents keep working
tls on [--yes]Serve HTTPS again; on a plain-HTTP install, move it behind nginx. Afterwards offers to sign everyone out, revoke API keys used while off, and rotate the enrolment secret
tls repair [--yes] [--force] [--timeout S] [--ack P] [--allow-public-root]Re-issue a self-signed certificate so it covers every address of this server, or because it expires within 30 days. With agents enrolled, hands the new certificate to agents 2.1.9.s and later before switching
tls cancelWithdraw a staged certificate. nginx is not changed

Every step, message and risk: TLS and certificates.


3.20 licence#

sudo ./lawliet licence                      # show the licence and fingerprint
sudo ./lawliet licence /path/to/customer.key
sudo ./lawliet licence LAWLIET-...

Without an argument it shows: licence type and organisation, valid until (days left), issue date, whether it is bound to this installation, where it was loaded from, and the installation fingerprint to send to your vendor.

With a key or a file, in order:

  1. Checks the key with the server's own validator. Nothing changes if it is refused.
  2. Refuses a key issued before the licence in use.
  3. Writes LAWLIET_LICENSE_KEY to .env, keeping the previous file as .env.backup.<timestamp>.
  4. Recreates the backend so it reads the new value, and waits for health.
  5. Confirms Licence in effect.

No console approval applies. See Installation, step 2.10.


3.21 uninstall#

sudo ./lawliet uninstall

Deletes the containers and every data volume: the database, collected logs, the hosted agent artefacts and the installation fingerprint. After it, this server is a new installation that needs a new licence.

  1. Take a final backup first? (default yes). If the backup fails it asks whether to delete anyway (default no).
  2. Type DELETE in capitals to confirm. Anything else stops it.

.env and ./backups are left in place. To only stop the platform, use stop.

Rollback: only by installing again and restoring the final backup (Backup and restore). A licence bound to the old fingerprint does not work on the new installation.


3.22 version and help#

./lawliet version     # Lawliet 1.5.13.s
./lawliet help        # the command list, and this deployment's console URL

What you see: Lawliet <version>, or the command list followed by Console and Documentation. Neither needs root. An unknown command answers Unknown command: <name> and Try: ./lawliet help.


3.23 Files the CLI reads and writes#

All paths are relative to the installation directory.

PathWhat it isMode
.envAll configuration and secrets600
.env.backup.<timestamp>Copies kept before install, licence and restore change .env600 or as before
.lawliet.confDeployment choices: mode, address, tls, cert, installed_at, update and rollback records. No secrets
infra/docker/ssl/fullchain.pem, privkey.pemThe certificate and key nginx serveskey 600
infra/docker/ssl/*.backup.<time>Previous certificate pairs kept by tls repair600
infra/docker/ssl/.staged/A certificate being handed to agents before a switchowner only
.tls-snapshots/tls-switch-<time>/Configuration saved before tls on/off; the newest 5 are kept700
backups/Dumps from backup, update and the daily backup service600
updates/Bundles the console staged, for update --staged
lawliet-server.pemWritten by tls --export644
lawliet-support-<time>.txtWritten by doctor600
lawliet-diag-<host>-<time>.tar.gzWritten by diag600
lawliet-agent-<os>-<arch>-offline-<id>.tar.gz or .zipWritten by agent-package600
doctor-fix.logFixes applied by doctor --fix while the backend was down600

3.24 verify-report#

./lawliet verify-report REPORT.pdf --key-history lawliet-evidence-keys.json
./lawliet verify-report pack.zip --sig pack.zip.sig --public-key lawliet-evidence-key.pem

Checks a signed compliance report or evidence pack against its detached signature with tools/verify_lawliet_signature.py, offline. The signature defaults to <file>.sig; file names are relative to the directory you run it from. Save the key history first (Compliance > Frameworks > Key history); with --public-key alone an intact signature exits 4, because a retired key cannot be detected. It uses this host's python3 when it has the cryptography package, and otherwise runs the same script in the backend container (the files are copied in and removed afterwards). Root is needed only for that container fallback.

What you see and the exit status are the script's: VALID: ... (0), INVALID: <reason> (1), usage or unreadable input (2), UNCONFIRMED: ... signed by a retired key (3), WARNING: ... key retirement unknown (4). See 43.4 Verify offline. Changes nothing on the server.

3.25 agent-upgrades#

./lawliet agent-upgrades
sudo ./lawliet agent-upgrades on
sudo ./lawliet agent-upgrades off

Shows or switches the agent upgrade channel (AGENT_AUTO_UPGRADE_ENABLED in .env). With it on, agents accept signed upgrades published in Environment > Agent versions; publishing and rolling out stay four-eyes (10.8). It is on in every bundle from 1.5.14.s.

What you see: On: agents accept signed upgrades ... or Off ..., with the command that switches it. on and off write the line to .env and recreate the backend, which reads it at start: Backend restarted: agent upgrades are on. It also marks .env (# lawliet: agent upgrades set by ./lawliet agent-upgrades; ...), so no update changes your choice. Turning it off sends nothing new: no upgrade is dispatched (whatever the release's download address), upgrades queued but not yet picked up by a host are withdrawn (the host goes back to waiting, it does not count as failed), and every running rollout plan pauses with the reason "agent upgrades are off on this server". Hosts that already picked up their upgrade finish it. After on, resume the plan (one signature). Running on when it is on prints Already on and changes nothing.

3.26 hardening-risks#

./lawliet hardening-risks
sudo ./lawliet hardening-risks accept-all
sudo ./lawliet hardening-risks normal

Shows or switches HARDENING_AUTO_ACCEPT_RISKS in .env: with accept-all, every hardening risk check (breakage, a dependency on Lawliet's own access, lockout risk without a break-glass artifact) is accepted automatically and audit-logged. What it does and does not bypass: 41 Accept all hardening risks (server setting). Off in every bundle.

What you see: Normal: ... or Accepted automatically: ..., with the command that switches it. accept-all and normal write the line to .env, mark .env (# lawliet: hardening risks set by ./lawliet hardening-risks; updates leave it as it is) and recreate the backend, which reads it at start. accept-all also prints what is still enforced (the second administrator's approval, OS / domain applicability, the domain controller rename refusal, baseline learning and the NTLM audit) and that Under Attack is not affected. Running it again prints Already accept-all / Already normal and changes nothing.


3.27 security-check#

sudo ./lawliet security-check
sudo ./lawliet security-check --json

Checks what an attacker on this server would look for first. One line per check, PASS, WARN or FAIL, then a count; the exit status is 1 when anything fails. Install runs it at the end. Secret values are compared, never printed.

GroupChecks
files.*.env and its copies, the TLS private key, backups/ and every dump: owner-only and root's; this directory, ./lawliet and the compose files writable by root only; updates/ not a link
secrets.*SECRET_KEY, DATA_ENCRYPTION_KEY, the PostgreSQL, Redis and ClickHouse passwords, METRICS_TOKEN and the agent enrolment secret set, not a shipped default, all different; no administrator password kept in .env
config.*DEBUG off, licence enforcement on, CORS and trusted hosts not *, TLS on (WARN when off)
network.*only nginx (and the syslog receivers) published; /metrics refused through nginx; security headers present
containers.*Redis refuses a client without its password; ClickHouse refuses the old lawliet-logs and an empty password; backend, Redis and ClickHouse run with the secrets in .env; no admin-creation script in the backend image
app.*from the backend: the audit chain verifies, dual control on with an approver pair, super admins do not bypass it, DEBUG / licence / two-factor as running

Each FAIL line says how to fix it. ./lawliet start generates any missing Redis, ClickHouse or metrics secret and recreates the containers with it. When something can be repaired automatically, the run ends with N items can be fixed automatically: run sudo ./lawliet security-check --fix.

sudo ./lawliet security-check --fix          # each fix shown, then Apply this fix? (y/N)
sudo ./lawliet security-check --fix --yes    # unattended: apply every fix

--fix repairs what needs no judgement, one fix per kind of problem, shown before it is applied:

FixClearsWhat it does
Secret filesfiles.env, files.tls_key, files.backups.env and its copies, the TLS key, backups/ and the TLS snapshots owner-only, and root's when run with sudo
Codefiles.installRemoves group and other write from this directory, ./lawliet, the compose files and nginx configurations
Initial passwordsecrets.admin_password, containers.admin_passwordRemoves it from .env once the account exists, recreates the backend, restarts nginx
Service secretssecrets.redis, secrets.clickhouse, secrets.metrics, containers.secrets_applied, containers.redis_auth, containers.clickhouse_authGenerates the missing or default secrets, recreates the containers with them (about a minute of downtime; data is kept), restarts nginx
Bindingsnetwork.publishedRecreates the containers from this version's compose files

--fix acts only on definite findings. A check that could not be made (Docker unreachable, Redis or ClickHouse not answering, a container not running) is listed under Could not be checked with what to do, and nothing is changed on it. Fixes that recreate containers run only while the platform is running: on a stopped platform they say start it first and change nothing, so an unattended run never starts a stack stopped on purpose. Running --fix again once everything is fixed does nothing.

Each applied (or failed) fix is written to the audit trail as security_fix with the server user who ran it, and the whole check runs again (Checking again). A container fix counts as applied only when nginx restarted and every service it touched became healthy; otherwise it is reported and audited as failed, points to ./lawliet status and ./lawliet logs, and no further container fix runs. Anything it does not fix - TLS off, an audit chain that does not verify, dual control, DEBUG, the keys - is listed under Not fixed automatically with what to do. Without --yes and with no terminal to answer, every fix is skipped.


3.28 audit-verify#

./lawliet audit-verify
./lawliet audit-verify --json

Verifies the audit trail inside the backend. From 1.5.16 every audit record carries an HMAC made with the integrity key (.keys/integrity.key), which is not in the database: someone who can write the database can change, insert or remove records but cannot make them verify again. Records written before the upgrade are legacy: unkeyed, listed separately, and never make the result fail. A signed checkpoint of the trail head goes to your SIEM every 15 minutes, so records removed from the end of the trail are also found.

What you see: The keyed audit trail is intact: N records, ids A-B. and, on an upgraded server, a sentence about the legacy records. On a problem: The keyed audit trail is BROKEN at record N: ... with the reason in words (changed, inserted or removed outside Lawliet). Exit code 0 when intact, 2 when broken, 1 when the backend cannot run the check.

3.29 integrity#

./lawliet integrity verify
sudo ./lawliet integrity reseal users 7 --reason "reviewed with the account owner"
sudo ./lawliet integrity reseal users --username admin --reason "..."
sudo ./lawliet integrity init --reason "upgrade ran before the key existed"
sudo ./lawliet integrity rekey --reason "key replaced on purpose"
sudo ./lawliet integrity new-key
sudo ./lawliet integrity checkpoints-archive --reason "database loaded by hand"

Users (password hash, role, two-factor state, permissions), roles, the dual-control policy, approvals, API keys and queued agent commands are sealed with the integrity key. A record changed in the database outside Lawliet stops working at once: the account cannot sign in (This account is locked. Its stored record ... was changed outside Lawliet), the API key is refused, the approval cannot be used, the command is never sent to the agent, a changed role grants nothing and a changed dual-control policy is replaced by the strict defaults. Every administrator and the SIEM are told, and the check runs again every 5 minutes.

  • verify checks everything now and changes nothing. Exit 0 when all is well, 2 otherwise.

  • reseal TABLE ID... is for after you have reviewed a record and know it is right. It is the only way a refused record becomes usable again. It is audited and every administrator is told.

  • init seals records an upgrade left unsealed (the key was not in place when it ran).

  • rekey re-seals everything after the key file was replaced on purpose (for example a database restored on another server), and moves the start of the keyed audit trail to its current end: older audit records were written under the previous key, so they are kept and reported as such ("written under a previous integrity key"), never alerted; everything after the rekey is checked as before. Without it, every record is refused, and sign-in says why: Sign-in is refused: this server's integrity key is not the one its records were sealed with. init and rekey restart the backend so every worker applies them.

  • new-key is only for a lost key: ./lawliet never makes a new key on its own once records are sealed. Without the key file the platform does not start and says Integrity key missing: ... Restore it from your offline copy; restoring the file is always the better choice. After new-key, start the platform and run rekey.

  • checkpoints-archive --reason TEXT sets the signed checkpoint history aside (renamed, never deleted; audited; every administrator is told). Only after you loaded a database yourself (psql or another tool): the history describes the database before it and would otherwise read as removed audit records. restore and rollback do this on their own.

Deleting a user is routine: the records that named them (approvals, the API keys acting as their service account, their audit records) are re-sealed or covered by a keyed erasure record, and nothing is reported. ./lawliet restore sets the signed checkpoint history aside (it describes the database before the restore) and then checks the restored records against this server's key, pointing to rekey when they were sealed with another one.

./lawliet passwd changes the account through the backend, which seals the record it changes. ./lawliet tls on still changes accounts with plain SQL; it re-seals the records it changes (and only those that were intact before), audited the same way.

The key file: ./lawliet install creates .keys/integrity.key (32 random bytes; the directory is mode 0700, the file 0400 and owned by the backend's user, uid 999, when installed as root; 0444 inside the 0700 directory otherwise), records that it exists in .lawliet.conf, and update carries it to the new version. It is not in backups/. Keep an offline copy apart from the database backups. With rootless Docker or userns-remap, uid 999 in the container is a different host uid: make the file readable to that uid, or the backend reports the key missing.

Signed checkpoints of the audit trail are kept in the database, sent to your SIEM, and appended to integrity-checkpoints.jsonl in the lawliet_config volume (outside the database and its backups). Every one of them is checked, so removing recent audit records is found even when the database copies are deleted too.