Lawliet LAWLIET
Book a demo

9. Security hardening of the server

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.

What to lock down on the Lawliet server before real data goes in, and what to keep checking afterwards. Work through 9.1 and use the sections after it for the detail.

You need
WhoThe server administrator (root), and a console administrator for 9.6
Four-eyesConsole user, role and policy changes in 9.6 are critical actions once a second approver exists

9.1 Checklist#

#ItemCheck with
1TLS is on, with a certificate from a CA your browsers and agent hosts trustsudo ./lawliet tls status
2No agent still uses plain HTTPsudo ./lawliet tls status (Agents on plain HTTP)
3Only the ports in 9.2 are reachable, from the networks that need themYour network firewall rules
4Shell access to the server limited to the people who would hold the Super administrator accountgetent group sudo docker wheel
5.env is mode 600 and owned by rootls -l .env
6Backups run, are copied off the server, keys stored apart, a restore has been testedBackup and restore
7NTP synchronised on the server and every agent hosttimedatectl, sudo ./lawliet doctor
8Named console accounts, two-factor for all, a second approver, the install account sealedSettings > Users
9Dual control on, Super administrators act alone offSettings > Access control
10The settings in 9.8 unchanged from what the installer wrotegrep -E '^(DEBUG|LICENSE_ENFORCE|CORS_ORIGINS|TRUSTED_HOSTS|REQUIRE_TWO_FACTOR)=' .env
11METRICS_TOKEN set if anything scrapes /metrics.env
12sudo ./lawliet doctor reports nothingWeekly

9.2 Network ports#

Inbound to the Lawliet server#

FromPortHTTPS modePlain-HTTP mode
Operator workstations443/tcpConsole and API-
Operator workstations80/tcpOptional; redirects to 443-
Operator workstations3000/tcp and 8000/tcp-Console, and the API the browser calls directly
Monitored hosts (agents)443/tcpAgents-
Monitored hosts (agents)8000/tcpOnly agents of a former plain-HTTP install that have not been reinstalledAgents
Monitored hosts enrolled while TLS was off80/tcpUntil each is reinstalled over HTTPS-
Log senders5514/udp, 5514/tcpOnly if you collect syslogSame

If the installer moved a port because the default was taken, use the port it printed (sudo ./lawliet status shows the console URL).

Never reachable from outside the server: PostgreSQL, Redis and ClickHouse are not published to the host. In HTTPS mode the backend and the console are reachable only through nginx, and nginx serves /docs, /redoc, /openapi.json and /metrics only to loopback and private address ranges.

Nothing connects to an agent. No inbound rule is needed on any monitored host.

Outbound from the Lawliet server#

None is needed for the platform to run. Each row is used only when an operator configures the feature.

ToPortFeature
Your NTP source123/udpTime (needed)
Hosts on your networksTCP 22, 80, 443, 445, 3306, 3389, 5432, 6379, 8080, 8443 (quick scan; a full scan adds more); UDP 137, 161, 1900, 5353; ICMPNetwork discovery, only the ranges you enter
Firewall appliances22/tcp or 443/tcpFirewall configuration import and policy push
Hosts to install agents on22/tcp (SSH), 5986/tcp (WinRM HTTPS), 5985/tcp (WinRM HTTP, insecure)Remote deployment
Domain controllers636/tcp (LDAPS) or 389/tcp (StartTLS); 88/tcp (Kerberos)Directory sign-in, Kerberos for remote deployment and Windows sign-in
Your mail relay587/tcp (as configured)Password-reset links, scheduled reports, alert e-mail
Your SIEMAs configuredSIEM forwarding
The vendor's update feed443/tcpOnly if UPDATE_FEED_URL is set. Leave it empty on an air-gapped site

Licensing never needs any outbound connection.

Agents#

FromToPort
Monitored hostsLawliet server443/tcp (plain HTTP: 8000/tcp)
Monitored hostsYour NTP source123/udp

9.3 The host firewall#

Enforce the inbound rules on a network firewall in front of the server. On the server itself, a host firewall such as ufw is useful for everything else, but Docker publishes container ports through its own iptables rules, which bypass ufw on many distributions. Do not rely on ufw alone for 443, 80, 5514, 3000 or 8000.

Example for the host's own services (SSH from the admin network only):

sudo ufw default deny incoming
sudo ufw allow from <admin-network> to any port 22 proto tcp
sudo ufw enable

9.4 Shell access to the server#

Root on the server, and membership of the docker group (which is equivalent to root), can:

So:

  1. Give shell access only to the people who would hold the Super administrator account.
  2. Use personal accounts with sudo; no shared root password; SSH keys, not passwords.
  3. Do not add operator accounts to the docker group.
  4. Log sudo use to your central log collection.
  5. Review the audit trail for CLI actions that are recorded there: doctor_fix, offline agent packages made through the CLI, and TLS changes (who ran them and when, as the host saw it).

9.5 Files that hold secrets#

FileHoldsProtect by
.envDatabase password, JWT signing key, data encryption key, enrolment secret, licence keyMode 600, root-owned. Copy off the server only encrypted
backups/*.sql.gzThe whole databaseMode 600 (as written). Off-server copies access-controlled
backups/*.keysThe keys stored secrets are encrypted withStore apart from the dumps
infra/docker/ssl/privkey.pemThe TLS private keyMode 600
.tls-snapshots/Copies of .env and the private key from TLS switchesOwner-only; doctor --fix removes old ones
lawliet-agent-*-offline-*An enrolment codeDelete after use; doctor --fix removes expired ones; revoke a lost one under Environment > Install agent > Offline package
.env.backup.*Earlier copies of .envDelete old ones you do not need

lawliet-support-*.txt and lawliet-diag-*.tar.gz are redacted, but still describe your deployment: send them only to support and delete them afterwards.


9.6 Console accounts and four-eyes#

  1. One named account per person. No shared accounts.
  2. Two-factor for everyone. Keep REQUIRE_TWO_FACTOR=true (the default).
  3. A second approver on day one (Installation 2.9, step 5).
  4. Seal the install account. With an LSO and an RSO in place, store the Super administrator's password and recovery codes offline for recovery only.
  5. Least privilege. Analysts as Analyst, read-only staff as Viewer or Auditor. Use per-user denials rather than broad roles.
  6. Dual control on. Settings > Access control: Dual control is on ticked, Super administrators act alone unticked, a reason required.
  7. Review bypasses. In Settings > Audit trail, look for dual_control_bypassed events. After the first day there should be none with reason no_second_approver.
  8. API keys. Create them only for integrations that need them, with the narrowest scope, and revoke unused ones (Settings > API keys).
  9. Disable accounts of leavers the same day (Settings > Users).

Procedures: Users, roles and approvals.


9.7 TLS#

nginx serves TLS 1.2 and 1.3 only and sends HSTS while TLS is on.


9.8 Settings to keep#

The installer writes these. Do not change them on a production server.

Setting in .envKeepWhy
DEBUGfalsetrue is for development: among other things it switches off the TRUSTED_HOSTS check
LICENSE_ENFORCEtrue
CORS_ORIGINSThe exact console origin(s), never *Stops other web pages from calling the API with a user's session
TRUSTED_HOSTSThe server's names and addresses, localhost, 127.0.0.1; never *Refuses requests for other host names
REQUIRE_TWO_FACTORtrue
DEMO_DATA_ENABLEDfalseDemo data is for vendor labs and training
UPDATE_FEED_URLEmpty on an air-gapped siteNo outbound requests
METRICS_TOKENSet, if anything scrapes /metricsWithout it /metrics is unauthenticated to the networks nginx allows
AGENT_REGISTRATION_SECRETSet (never empty)Empty refuses every enrolment; rotate with ./lawliet token --rotate if it leaked

After editing .env, apply with sudo ./lawliet start (a restart does not re-read it).

Retention of collected data#

SettingDefaultMeaning
RETENTION_LOG_EVENT_DAYS90Collected log events older than this are deleted. 0 keeps them for ever
RETENTION_CORRELATION_ALERT_DAYS365Detection alerts

Set them to what your regulations require, and watch disk use.


9.9 Keep it healthy#

How oftenTask
DailyBackups copied off the server (Backup 5.3)
Weeklysudo ./lawliet doctor; review Approvals > History and the audit trail
MonthlyCheck disk growth; check the certificate and licence expiry (Settings > Platform)
Twice a yearTest a restore (Backup 5.6)
Each releaseRead the notes; apply security updates promptly (Updates)

Monitor /health and /health/ready from your monitoring system (Doctor, diag and support 7.4).

Syslog sources#

Syslog carries no authentication. Restrict every syslog log source to the networks of its senders (its allowed networks setting), and open 5514 only from those networks.