3. CLI reference: ./lawliet
This guide describes Lawliet 1.5.13.s (the current release). 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..envis mode 600. - Output marks.
OKa check passed or a step succeeded;FAILit did not;!a warning you should read; a line starting with>begins a new section. Colour is used only on a terminal and never whenNO_COLORis set. - Exit status. 0 on success, 1 when the command stopped (the last line starting with
FAILsays 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--yesfor scripts. - 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
uninstalldeletes data.uninstallrequires typingDELETE. No command overwrites.envwithout asking or keeping a copy.
3.2 Summary#
| Command | Aliases | What it does | Changes the server? |
|---|---|---|---|
install | Guided installation | Yes | |
status | st | Health, versions, licence, schema, estate size | No |
start [service] | up | Start everything, or one service | Yes (starts containers) |
stop [service] | down | Stop containers; data untouched | Yes (stops containers) |
restart [service] | Restart and wait for health | Yes | |
logs [service] [-f] [-n N] | log | Read logs | No |
backup [dir] | Database dump, keys file, agent artefacts | Writes files only | |
restore <dump> | Replace the database with a dump | Yes: replaces all data | |
update <bundle> [--no-cert-repair], update --staged | upgrade | Upgrade to a new bundle or delta | Yes |
rollback [--yes] [--to DIR] [--backup DUMP] | Back to the version before the last update | Yes | |
doctor [--fix [--yes]] | diagnostics | Findings and safe fixes, support file | --fix only |
diag [options] | One redacted archive for the vendor | Writes one file | |
token [--rotate] | Enrolment secret and install commands | --rotate only | |
agent-package --os OS [options] | Offline agent package | Writes one file, creates an enrolment code | |
passwd | password | Reset the administrator password (and two-factor) | Yes |
tls [options], tls --export [path] | cert | Inspect, replace or export the certificate | Replace: yes |
tls on, tls off, tls status | Turn encryption on or off, or show it | on/off: yes | |
tls repair [options], tls cancel | Re-issue a self-signed certificate; withdraw a staged one | Yes | |
licence [key or file] | license | Show or install the licence | Install: yes |
uninstall | Delete containers and the database | Yes: deletes all data | |
version | --version | Print the bundle version | No |
help | --help, -h | The command list | No |
3.3 status#
sudo ./lawliet statusRead-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>.
| Section | What it shows | What to look for |
|---|---|---|
| Deployment | Directory, bundle version, mode (tls or direct), TLS on/off, console URL | TLS off prints a red warning |
| Services | Each container: healthy/running with the date it started, starting, or a failure state | Anything not OK |
| API | Whether /health answers; version, build id (quote it to support), licensed to, installation fingerprint | FAIL ... not responding |
| TLS certificate | HTTPS mode only: whether the certificate covers every address this server is reached by | certificate does not cover <address> |
| Schema | The database migration revision | Not stamped is a fault |
| Estate | Counts: agents, compliance scans, FIM events, DLP incidents, firewall rules, network nodes, review queue | - means the count could not be read |
| Disk | Free space on the installation's filesystem | Low 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- Loads any of the bundle's images that are not loaded yet (each checked against its checksum first).
- Applies the TLS state recorded in
.lawliet.confto.env. - Starts the containers (
docker compose up -d), which also recreates any container whose configuration changed. This is how edits to.envtake effect. - Waits up to 5 minutes for every service to become healthy.
- Reports a certificate that does not cover an address, if any.
- 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 serviceStops 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 backendRestarts 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| Option | Meaning |
|---|---|
[service] | postgres, redis, clickhouse, backend, frontend, and in HTTPS mode nginx, db-backup. Omit for all |
-f, --follow | Keep printing new lines |
-n N | Number 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 installThe 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 directoryWrites three files, all owner-only (mode 600):
| File | Contents |
|---|---|
lawliet-<YYYYmmdd-HHMMSS>.sql.gz | The PostgreSQL database |
lawliet-<YYYYmmdd-HHMMSS>.keys | SECRET_KEY and DATA_ENCRYPTION_KEY: the keys stored secrets are encrypted with |
lawliet-<YYYYmmdd-HHMMSS>.agent-artifacts.tar.gz | Agent 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.gzReplaces the whole database with the dump. Asks first (default no).
- Stops the application (PostgreSQL stays up).
- Empties the database schema, then loads the dump in one transaction.
- If a
.keysfile sits beside the dump and differs from.env, adopts its keys (keeping the previous.envas.env.backup.<timestamp>) and recreates the application. Otherwise restarts it. - Puts back the agent artefacts archived beside the dump, if any.
| Message | Meaning |
|---|---|
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 dump | A 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 afterwardsBacks 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. The full procedure, every message and how to go back: Updates, rollback and delta updates.
| Option | Meaning |
|---|---|
<file> | A full bundle .tar.gz, a delta .tar.gz, or an unpacked bundle directory |
--staged | Use the bundle the console downloaded or received by upload and verified |
--no-cert-repair | Do not run the certificate check after the update. Run sudo ./lawliet tls repair later |
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.gzReturns 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.
| Option | Meaning |
|---|---|
--yes, -y | Do 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 --helpChecks 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.
| Option | Meaning |
|---|---|
| (none) | Report, then write lawliet-support-<timestamp>.txt (no secrets, no database rows) |
--fix | For each finding with a safe fix: show what it will do and ask (default no). Then check again |
--yes | Only with --fix: answer yes to doctor's own questions |
3.14 diag#
sudo ./lawliet diag
sudo ./lawliet diag --since 24h --output /media/usbWrites 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.
| Option | Meaning |
|---|---|
--since <time> | Logs since 30m, 24h, 7d or a timestamp. Default: the last N lines |
--output <path>, -o | A directory (the file name is generated) or a file name |
--lines N, -n N | Log lines per service (default 1000) |
--keep-emails | Keep 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 secretWithout 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(-CaCerton Windows) pointing at/path/to/lawliet-server.pem; export the file first withsudo ./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 --helpBuilds 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).
| Option | Default | Meaning |
|---|---|---|
--os linux or --os windows | (required) | Target operating system |
--arch amd64 or --arch arm64 | amd64 | CPU. Windows: amd64 only |
--hosts N | 50 | How many hosts may enrol with the code (1 to 1000) |
--days N | 7 (30 with --gpo) | How long the code is valid (1 to 30) |
--label TEXT | A name for the code, shown in the console | |
--server URL | This server's agent address | The address agents will use |
--out DIR | The installation directory | Where to write the package |
--gpo | Windows 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 passwdThe recovery path for a locked-out administrator. It:
- Asks for a new password twice (12 to 128 characters, not a known default).
- Writes it to
.envasLAWLIET_ADMIN_PASSWORD. - If the administrator account exists: Also change it on the existing '<user>' account now? (default yes). Sets the password, re-activates the account, and clears the forced password change.
- If two-factor is on for that account: Turn two-factor OFF for this account? (default no). Answer yes when the authenticator is lost; enrol it again after signing in.
- Restart the backend now? (default yes).
It acts on the account named by LAWLIET_ADMIN_USERNAME in .env (the install-time administrator). For other users see 15.2 A user forgot their password.
Risk: anyone with root on the server can take over the administrator account this way. That is why shell access must be restricted (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.pemtls 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.
| Option | Meaning |
|---|---|
--export [path] | Copy the served certificate (no private key) to path, default ./lawliet-server.pem, mode 644 |
--force | When replacing with agents enrolled: switch even if not every agent holds the new certificate yet |
--timeout S | Seconds to wait for agents to take the new certificate (default 600) |
--ack P | Switch once P percent of agents hold it (default 100) |
--allow-public-root | Also 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| Command | What it does |
|---|---|
tls status | State (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 cancel | Withdraw 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:
- Checks the key with the server's own validator. Nothing changes if it is refused.
- Refuses a key issued before the licence in use.
- Writes
LAWLIET_LICENSE_KEYto.env, keeping the previous file as.env.backup.<timestamp>. - Recreates the backend so it reads the new value, and waits for health.
- Confirms
Licence in effect.
No console approval applies. See Installation, step 2.10.
3.21 uninstall#
sudo ./lawliet uninstallDeletes 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.
- Take a final backup first? (default yes). If the backup fails it asks whether to delete anyway (default no).
- Type
DELETEin 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 URLWhat 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.
| Path | What it is | Mode |
|---|---|---|
.env | All configuration and secrets | 600 |
.env.backup.<timestamp> | Copies kept before install, licence and restore change .env | 600 or as before |
.lawliet.conf | Deployment choices: mode, address, tls, cert, installed_at, update and rollback records. No secrets | |
infra/docker/ssl/fullchain.pem, privkey.pem | The certificate and key nginx serves | key 600 |
infra/docker/ssl/*.backup.<time> | Previous certificate pairs kept by tls repair | 600 |
infra/docker/ssl/.staged/ | A certificate being handed to agents before a switch | owner only |
.tls-snapshots/tls-switch-<time>/ | Configuration saved before tls on/off; the newest 5 are kept | 700 |
backups/ | Dumps from backup, update and the daily backup service | 600 |
updates/ | Bundles the console staged, for update --staged | |
lawliet-server.pem | Written by tls --export | 644 |
lawliet-support-<time>.txt | Written by doctor | 600 |
lawliet-diag-<host>-<time>.tar.gz | Written by diag | 600 |
lawliet-agent-<os>-<arch>-offline-<id>.tar.gz or .zip | Written by agent-package | 600 |
doctor-fix.log | Fixes applied by doctor --fix while the backend was down | 600 |

