LawlietRequest demo ↗

32. Data loss prevention (DLP)

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.

DLP finds sensitive data on hosts (at rest) and watches it leave (USB and removable media, cloud or web upload, email attachments, clipboard, print, network shares). A policy says what is sensitive and what to do on each channel: allow, alert, block or quarantine. The agent on each host enforces the policy and reports incidents.

DLP is a licensed module. What a host can actually enforce depends on its operating system and on the agent running with full privileges; the Enforcement status tab reads it live from the agent (32.6). Do not assume a block happened: every incident says what was actually enforced.

Permissions:

TaskPermissionFour-eyes
See policies, inventory, schedules, enforcement statusView DLP-
See incidents (the list, one incident, a policy's or a host's incidents)View DLP and View findings-
Create, edit, enable, disable, delete policies; run and schedule discovery; locate files; test a policyManage DLPno
Triage incidentsTriage findingsno

32.1 The tabs#

Path: DLP. The page title is Data loss prevention.

TabContent
Incident queueTiles (Incidents, Open queue, Critical), the Incident stream and the policy catalog
PoliciesThe Policy catalogue and the policy editor (32.3)
DiscoveryDiscovery scans, the sensitive-file inventory, scheduled discovery (32.4)
Where is this fileFind a file across hosts (32.5)
Enforcement statusWhat each host can enforce, per channel, read live (32.6)

32.2 Incidents#

The Incident stream: Incident, Severity, Status, Action, Enforcement, Residual risk, Source, Detected. Filter incidents... narrows the list.

The Enforcement column says what really happened:

ValueMeaning
stoppedBlocked at the boundary - the data did not move
alertedThe transfer completed and somebody was told
not stoppedRecorded after the fact - nothing stopped this, and nothing can now
pendingEnforcement requested and not yet confirmed - treat as not stopped
log onlyA log-only policy - no enforcement was expected
-Not recorded

Residual risk is the exposure that remains given what was done.

On Linux hosts a file that matches a blocking policy raises an incident every time any program opens it, titled "DLP file access: <program> opened <file>". The incident drawer shows Process chain - the program, the programs that started it (nearest first, for example cat (pid 412) < bash (pid 377) < sshd (pid 201)), and the SHA-256 of its binary. When the binary is a known upload tool the drawer also says "identified by binary hash as curl". Repeated opens by the same program in five minutes are one incident with an attempt count.

Procedure: triage an incident#

Permission: Triage findings.

  1. Click the incident. The drawer shows File, Data type, Severity, Matches, Residual risk, Host, User, Process, Attempts, Destination, Policy action, Actually enforced, Matched patterns and Context.
  2. Under Set status press one of the statuses:
StatusMeaning
investigatingBeing looked at now
confirmedReal exposure of sensitive data. Treat as an incident
false positiveThe detector matched something that is not sensitive
authorisedGenuinely sensitive, but this transfer was approved
resolvedDealt with; no further action needed
  1. Type the reason in the note box ("Kept with the finding. A status change without a reason is a decision nobody can review later.") and press Save. You see "Saved.".

A confirmed exposure is a security incident: open an investigation (chapter 34) and, if the host must be contained, use Defense (chapter 36).

Incidents are never deleted from the console. Close them with resolved, false positive or authorised; they stay as the record.


32.3 Policies#

Procedure: create a DLP policy#

Permission: Manage DLP. Four-eyes: no.

Risk: a block or quarantine action stops users' work on every host in scope; a broad device-control setting can block every USB stick. Rollback: edit the policy back, or disable it; agents pick up the change on their next policy refresh.

  1. Open DLP > Policies and press New policy.
  2. Fill Name, Data type (pii, pci, phi, credentials, financial, ip, confidential, custom) and Severity. Leave Enabled off until tested.
  3. Detection rules: choose + add rule... and the rule type:
Rule typeFields
keywordskeywords (comma separated), threshold, proximity (chars)
regexa regular expression
builtina built-in detector
sha256known file hashes
fingerprinta sample document; finds edited copies
filetypefile families: pdf, zip, docx, elf...
name_globname patterns: *.kdbx, id_rsa*
size_rangemin and max bytes

"A policy with no rules falls back to the built-in detector for its data type."

The built-in detectors are one list, the same on the server and on every Windows, Linux and macOS host: card numbers (Visa, Mastercard, Amex, Discover, JCB, Diners Club, UnionPay, Maestro, checked with the Luhn digit), IBANs (any country, checked with mod-97, no keyword needed), about 60 cloud and SaaS token formats and private keys, JSON web tokens, passwords in connection strings, and national IDs with their checksums (UK NINO and NHS, Canadian SIN, Indian Aadhaar and PAN, German tax ID, French NIR, Spanish DNI and NIE, Italian codice fiscale, Dutch BSN, Polish PESEL, Swedish personnummer, Russian SNILS and INN, Brazilian CPF, Turkish ID). Base64 and hex runs of 24 characters or more are decoded and read, and full-width digits and invisible characters inside a number are normalised. A number that sits right after "order" or "tracking" with no card word near it is not reported as a card. None of the policy templates carries regular expressions of its own any more: the built-in detectors do the finding, with checksums and context, so an order number is not read as a card. Mir, ArCa, Troy, Dankort and RuPay cards are included.

  1. Per-channel action: for each channel (USB / removable, Cloud / web upload, Email attachments, Clipboard, Print, Network shares, At-rest / discovery) choose allow, alert, block or quarantine.
  2. Optional controls:
ControlMeaning
Egress programs (Linux open-deny)Programs (for example curl, wget, rclone) refused when they open this policy's files while upload or email is blocked. The agent recognises each program by the SHA-256 of its binary, so a renamed or copied tool is refused too; any other program is allowed and reported. Reset to built-in list restores the default
Removable media device controlNo device control, Block all removable storage, Read-only (except allow list), Block all except allow list, with device IDs to allow. Enforced below the file system on each host
Blocked upload destinationsExact host names (for example dropbox.com), refused in each host's firewall. A name that shares a CDN address with other sites blocks those too
Quarantine files that cannot be fully inspectedOff by default. A file the agent cannot read is always reported as a blind spot; with this on, a password-locked archive or Office file is also quarantined and the incident is high severity. Other blind spots (scanned PDFs, big logs, .7z, .rar) are never moved
ScopeAll agents or Selected agents
ExceptionsValues excluded from the policy (comma or newline separated)
  1. Test against sample: paste text into Paste text to test this policy against... and press Test text (or test a file) to see what would match. The text is limited to 1 MB; a larger file is tested by sending it to an agent. The test never holds up the console for other users.
  2. Press Save policy. Then tick Enabled and save again when you are satisfied.

What you see: the policy in the Policy catalogue (Name, Data type, Severity, Rules, Blocking channels, Enabled).

If it fails: the form names the problem (for example an invalid regular expression). Save is disabled while Name is empty.

Procedure: change, disable or delete a DLP policy#

Permission: Manage DLP. Four-eyes: no. Risk: a change to a blocking action or device control takes effect on every host in scope at its next policy refresh. Rollback: change it back the same way.

To change it:

  1. Open DLP > Policies and click the policy's row. The drawer Edit DLP policy opens.
  2. Change the fields (as in "Create a DLP policy"). Test against a sample again.
  3. Press Save policy. If it fails, the drawer shows the reason ("Save failed" or the server's message).

To disable it (stop enforcing, keep it and its incidents):

  1. Open the policy, untick Enabled, and press Save policy.
  2. The catalogue shows off in the Enabled column. Agents stop applying it at their next policy refresh. Tick Enabled and save to turn it back on.

To delete it:

  1. Press the bin on the policy's row and confirm "Delete this policy?".
  2. A policy that has raised incidents is not deleted: the page shows "Policy has N incident(s); archive it instead of deleting it (archiving disables it on every agent and keeps the incident trail)." The console has no archive button in this release: disable the policy instead (above). It keeps the incident trail and stops enforcement.

32.4 Discovery (data at rest)#

Procedure: run a discovery scan#

Permission: Manage DLP. Risk: the agent reads every file under the paths; on a large share this takes time and disk I/O. Run large scans out of hours.

  1. Open DLP > Discovery. Under Start a discovery scan choose the Agent and enter Paths (comma separated).
  2. Press Start scan.
  3. Watch Recent scans (Name, Host, Status, Files scanned, Sensitive found, Completed); Refresh updates it.
  4. Read the Sensitive-file inventory: Host, Path, Rules, Detail, Size, SHA-256. CSV and JSON download it for the auditor.

What the agent scan reads#

The periodic scan every agent runs by itself (and a discovery scan) opens every file under its paths and works out what it is from its first bytes, not from its name. It reads Word, Excel, PowerPoint and OpenDocument files, PDF text (including text from subset fonts), mail files, zip, tar, gzip, bzip2 and xz archives (nested up to six levels), and old binary Office files. There is no list of file extensions and no limit on files per folder. Hidden folders are scanned: ~/.aws, ~/.ssh, ~/.kube, ~/.config; .git/config is read but .git/objects is not. Caches, node_modules and similar vendored folders are skipped, and so are the macOS Library and Windows AppData folders.

What the scan cannot read is reported, never counted as clean. A blind spot incident says why: password-protected, an archive format the agent cannot open (rar, 7z), nested deeper than six levels, a scanned PDF with no text layer, an archive or Office file bigger than 25 MB, or one whose text is longer than the extractor reads (reported "partially scanned"), permission denied, or an archive member too large to open. With Quarantine files that cannot be fully inspected ticked on a policy, only a file somebody locked with a password (an encrypted zip or Office file) is also quarantined. A scanned PDF, a PDF with only an owner password, a large log, a .7z or .rar and a deeply nested archive are reported and never moved. Images are not read (no OCR).

Plain text files of any size are read whole, in overlapping chunks (a secret at 19 MB of a 20 MB log is found). The scan is time-boxed so it never holds the agent up: a large disk, and a large file, are covered over several cycles, and a file that has not changed since it was last read costs one status call. All reading and extraction runs in a separate worker process that is stopped at a deadline, so a crafted file cannot freeze the agent. If that worker cannot start or keeps crashing, the host reports a blind-spot incident "the DLP scan worker is unavailable", and files it could not read are reported "scan failed", never counted clean.

Procedure: schedule discovery#

  1. In Scheduled discovery press New schedule.
  2. Set the cadence (Every N minutes - 15 or more, Daily, Weekly, Monthly (30 days)), the hosts (All hosts, Selected hosts, All hosts of a platform), and Paths ("empty = the platform defaults"). Leave Enabled ticked.
  3. Press Save schedule.

"No schedules. Discovery runs only when started by hand." until you create one.

Procedure: run, change, pause or delete a discovery schedule#

Permission: Manage DLP. Four-eyes: no.

  1. Open DLP > Discovery, section Scheduled discovery. Each row shows the name, hosts, paths, cadence, next run, last run and the last result.
  2. To run it now: press the play button (Run now). You see "<name>: N scan(s) dispatched".
  3. To change it: click the row. The drawer Edit discovery schedule opens; change the fields and press Save schedule.
  4. To pause or resume it: press disable (or enable) on the row. A paused schedule shows "(disabled)" after its name and no next run.
  5. To delete it: press the bin (Delete) and confirm "Delete schedule "<name>"?". Scans it already ran, and the inventory they built, are kept.

If it fails: "Run failed", "<name> could not be disabled" (or enabled), "<name> could not be deleted", with the reason.

Discovery scans themselves are kept as a record; there is no delete for a scan or for the sensitive-file inventory in the console.


32.5 Where is this file#

Find copies of a file across the estate.

  1. Open DLP > Where is this file.
  2. Enter a SHA-256 (64 hex characters), a Name contains fragment, and/or a Sample document (fingerprint, finds edited copies).
  3. Tick Search online agents live to ask the agents now, not only the inventory.
  4. Press Search.

Results: Host, Path, Matched by, Source. "No matches." means none was found in the inventory or on the online agents.

A live search shows each host's progress under the results (waiting for the agent, searching..., done with its hits and locations searched, or failed) and checks every 3 s for up to 10 minutes, adding hits as hosts answer; Stop ends the checking, Check again resumes it, and an answer that arrives later still shows when you reopen the page.


32.6 Enforcement status#

  1. Open DLP > Enforcement status and choose the host in Select host....
  2. The console asks the agent ("Querying the agent...") and shows each channel with what it can do, and Controls applied now (device rules with Device, Product, Decision, and blocked domains).

On Linux the rule is: a file whose content matches a blocking policy is reported whenever any program opens it, and the open is refused only for a known network or upload tool (curl, wget, rclone, scp, sftp, nc, socat, the browsers and mail clients, and any program the policy names). ssh, rsync and restic are reported but not refused unless a policy names them, because administrators run backups and deployments with them. A tool is never refused for reading its own credentials or configuration (~/.ssh, .netrc, rclone.conf, ~/.aws, known_hosts...), and rclone is refused only when its command line names a remote. Every verdict is bounded: a program that is not a known tool is let through at once and examined afterwards; for a known tool the agent reads the head and tail of the file (and a whole zip or Office file up to 16 MB) and scans it in a separate process that is stopped after one second, which lets the open through and logs it; a file bigger than that is then scanned in full in the background, and the incident says "partially inspected at open" or "found by the full scan after the open". A 2 MB file is checked in under 100 ms. Files are hashed up to 64 MB. If the guard sheds work (checks timed out, the background queue overflowed, alerts were held back), the host reports a blind-spot incident "the DLP guard on this host is shedding work". The agent identifies a tool by the SHA-256 of its binary on this host, so copying or renaming it does not help; cat, cp and editors are never refused. What this cannot stop is a tool whose binary is not on the host to be recognised (one an attacker downloaded), and cat file | curl ..., where curl never opens the file: the incident for the cat open is the evidence. Windows and macOS keep their existing enforcement (the file is closed or the process ended after the open).

"not root (enforcement limited)" means the agent does not run with full privileges; blocking will not work on that host. "Agent did not answer: ... Enforcement status is unknown." means the host is offline.


32.7 If it fails#

SymptomCauseFix
Incidents say not stopped although the policy blocksThe channel cannot be enforced on that hostCheck Enforcement status for the host
No incidents at allPolicy disabled, out of scope, or no agentCheck Enabled, Scope, and the agent
Too many false positivesRules too broadAdd a threshold or proximity, add exceptions, test against samples
Discovery shows nothingWrong paths, or the agent cannot read themCheck paths and agent privileges
Blind-spot incidents for archives or PDFsPassword-protected, rar/7z, scanned image, or too deepOpen the file yourself; remove the password or convert it; nothing the agent could do reads it
Incident "the DLP scan worker is unavailable"The agent could not start or keeps losing its scan worker processCheck the agent log and the agent binary's integrity; update or reinstall the agent
Incident "the DLP guard on this host is shedding work"Verdict checks timed out or the background queue overflowed (a very busy host, or a policy with an expensive regex)Narrow the policy's paths, simplify its regexes, or exclude the busy indexer or backup process
A file-access incident names a program you do not recogniseA tool opened a protected fileRead Process chain; check the binary hash on the host; refuse the program in Egress programs