LawlietRequest demo ↗

Agents

A small compiled program on each monitored host. It connects out to your Lawliet server on a heartbeat and never listens on a port.

Supported systems

PlatformAgentRuns as
Linux: 64-bit with systemd, such as Ubuntu, Debian, RHEL, Rocky and AlmaCompiled, amd64 and arm64Two systemd services, the agent and its watchdog, as root
Windows 10, Windows 11 and Windows ServerCompiled, x64 (Windows on ARM runs it too)Two scheduled tasks, the agent and its watchdog, as SYSTEM
macOSCompiled, Apple silicon and IntelTwo LaunchDaemons, the agent and its watchdog

The agent version of the current release is given in the release notes. Each agent is a self-contained program: a host needs no Python, no package manager and no internet, only a route to your Lawliet server. Each binary is signed, and the installer installs it only when it matches the hash the server publishes for it.

The watchdog starts the agent again when it stops, and restores the agent program from a known-good local copy if the file is deleted or changed. A Python version of the agent is used only when the server has no compiled agent for the host's CPU, or when you ask for it.

Full procedure: 10. Agents overview.

What an agent does

  • Runs compliance checks when a scan asks for them.
  • Watches the paths you choose for file integrity changes.
  • Reports data loss prevention findings, stored redacted.
  • Sends host metrics, processes and connections for the inventory.
  • Carries out signed commands: remediation and containment.

Three ways to install an agent

All three are side by side in the console under Environment > Hosts > Install agent. Windows domains have a fourth way, the Windows MSI for Group Policy (12.4 Group Policy).

MethodWhen to use it
Install commandThe host can reach this server: run one command on it.
Remote deploymentThis server can log in to the hosts over SSH or WinRM, with a domain account too, and installs for you.
Offline packageThe host cannot download anything: download a package, carry it to the host and install it there.

Enrolling a host

Run sudo ./lawliet token on the server, or open Environment > Hosts > Install agent in the console, and copy the command for the platform. Each command is one line and carries this server's address, the enrolment token and, when needed, the certificate flags. Copy it rather than typing it.

# Linux, with a certificate the host already trusts
d="$(mktemp -d)" && curl -fsSL -o "$d/install.sh" https://your-server/api/v1/agents/download/linux && head -c 2 "$d/install.sh" | grep -q '^#!' && sudo bash "$d/install.sh" --server https://your-server --token <enrolment-token>; rc=$?; rm -rf "$d"; [ "$rc" -eq 0 ]

# macOS: the same command with download/macos

The installer is downloaded to a fresh temporary folder, checked, run and removed, so a failed download fails the command. It is never piped into a shell.

Windows (PowerShell as Administrator): the command carries the SHA-256 of this server's installer. It downloads the installer into a new folder under the account's own temp folder, runs it only if the hash matches, and exits with the installer's status, so a script or a deployment tool sees a failed install as one. Because of the hash, it can only be copied from the console or ./lawliet token.

Full procedure: 11.2 Install with the copy-paste command (Linux), 12.2 (Windows).

Servers with a self-signed certificate

The usual case for a server reached by IP address. Agents verify the certificate, so each host is given it:

  1. On the server, ./lawliet tls --export writes lawliet-server.pem.
  2. Copy it to the host. The commands expect /path/to/lawliet-server.pem on Linux and macOS and C:\path\to\lawliet-server.pem on Windows; change the path in the command if you put it elsewhere.
  3. Run the self-signed variant of the command, which the console shows whenever the server uses a self-signed certificate. The agent then trusts exactly that certificate.

Windows Server 2016 has no curl.exe. There, import the certificate into the host's Trusted Root store and use the standard command, or run the installer from the bundle with -Server, -Token and -CaCert.

The installer says what is wrong before installing

The Linux and Windows installers first check the connection to the server, with the same certificate trust the downloads use, and stop before anything is installed when that fails, with one plain verdict and its fix:

What happenedWhat the installer says
The certificate does not name the address in --server (curl error 60)The server certificate does not name the address: run sudo ./lawliet tls repair on the server, export it again and re-run with --ca-cert
Self-signed and none given, or a different one givenExport it with ./lawliet tls --export and re-run with --ca-cert (Windows: -CaCert)
Not yet valid, or expiredThis host's clock is behind, or the certificate expired: set the clock, or renew on the server
Connection refusedNothing accepts connections at that address and port: check --server, that the server runs, and its firewall
TimeoutA firewall drops the connection: allow the port from this host to the server
HTTP 403 "Invalid host header"The address is not in the server's TRUSTED_HOSTS: add it in .env and run sudo ./lawliet restart
HTTP 403 on the agent downloadThe server refused the enrolment secret: check --token (sudo ./lawliet token prints it)

The installers say "does not verify" only for a TLS or certificate error, and report anything else as itself. curl's own line is still printed below the verdict, for support.

When the server's certificate changes

An agent trusts exactly the certificate it was installed with. When the server's certificate is replaced or re-issued (./lawliet tls, ./lawliet tls repair, ./lawliet tls on) with agents enrolled, the server first announces the new certificate in every heartbeat reply, signed with this installation's trust key. Agents 2.1.9.s and later add it to the certificates they trust, and the server switches once they hold it (by default when every agent does, waiting up to 10 minutes), so they stay online. Nothing is re-enrolled. Upgrade agents to 2.1.9.s before you replace the certificate.

Agents older than 2.1.9.s, agents that were offline during the switch, and macOS agents are given the new certificate by hand. Export it on the server with sudo ./lawliet tls --export, copy lawliet-server.pem to the host, and run the installer the server serves with the refresh option:

PlatformCommand (as root or Administrator)
Linuxsudo bash install.sh --refresh-ca --ca-cert /path/to/lawliet-server.pem
Windowspowershell -ExecutionPolicy Bypass -File install.ps1 -RefreshCa -CaCert C:\path\to\lawliet-server.pem
macOSNo refresh option yet: copy the file over /etc/lawliet/server-ca.pem, then sudo launchctl kickstart -k system/com.lawliet.agent

The refresh first checks the agent's server with the new certificate and changes nothing if that fails. Then it replaces the agent's trust file, keeping the old one as server-ca.pem.previous, and restarts the agent. The agent keeps its identity and settings; nothing is re-enrolled. The command that switched prints these commands for the hosts that need them.

Full procedure: 16.7 When the server certificate changes.

How commands reach a host

Commands wait in a queue on the server. On its next heartbeat the agent collects them, checks each one's HMAC-SHA256 signature and timestamp, and runs it. A command older than ten minutes, or more than a minute in the future, is refused. This is why time sync matters on both ends.

Host clocks

Every heartbeat carries the host's own time, so the server knows how far each host's clock is from its own. The Clock column on Environment > Hosts shows it, for example clock +7m 12s, and the Host clocks strip above the table names the host furthest off.

OffsetShown asWhy it matters
Under 1 minuteok-
1 to 5 minuteswarningA host more than 60 seconds behind refuses the server's commands and policies
5 minutes or morecriticalAs above, and domain (Kerberos) logons fail too

Crossing 5 minutes raises one notification for that host. The fix is NTP: sudo timedatectl set-ntp true (or chrony pointed at your time server) on Linux, w32tm /resync on Windows.

Full procedure: 10.6 Host clocks.

Self-protection

With self-protection on, an agent cannot be uninstalled without a code issued in the console or the recovery key. The setting reaches every enrolled agent in the signed policy of its next heartbeat, and the console shows a host as protected only after the host confirms it. Turning protection off needs a second signature.

Full procedure: 16.2 Self-protection.

Agent upgrades

Agents can upgrade themselves to a release signed with an Ed25519 key that we hold offline. An agent refuses any release without a valid signature, and is offered only builds for its own system and CPU. Upgrades are off by default: they need AGENT_AUTO_UPGRADE_ENABLED=true and the release public key in .env (customer bundles carry the key). Updating the server itself is covered in Upgrading.

Releases are hosted on your Lawliet server itself, and agents fetch them from the server, never from the internet. After a server update, Environment > Agent versions > Import bundled agents imports the signed agents the bundle carries; Publish a release, then Roll out 10 upgrades up to ten eligible hosts at a time. Publishing, a single-host upgrade and a rollout are four-eyes actions. Each agent keeps its previous program and restores it if the new one does not report in.

Full procedure: 10.8 Agent versions and upgrades.