Skip to content

Kinds

A pass reads a server as objects of fourteen kinds. This page says, for each kind, what it reads and how, how an object is named, what is kept out of the record, what needs root, and what is volatile. Each kind’s own page (linked from its heading) holds the details: every field, the limits and the tests.

What every kind follows

  • Nothing is written on the server. Lemano writes no files there. The kinds run read commands (the host’s log records the login) and read files; where a tool would write as a side effect of reading, the kind does not call it or turns the writing off. One accepted exception, in the facts of the RHEL family, is described under pending updates.

  • Identity. An object is named by its kind and an identity that does not change when the object is edited, so a changed object is one object changed, not one removed and one added. lemano diff writes it as Kind/identity.

  • Declared fields. The spec of a kind’s schema.json lists the fields a declaration of the kind sets, each with its default. lemano state pull writes them from what a pass observed: see State for what each kind gives.

  • Volatile fields (a restart counter, a file’s times, a mount’s usage, firewall counters) are shown with each pass and never stored: they never write a generation.

  • Size of a generation. A generation is one document with a line per object, and the store accepts at most 8 MiB of it (tens of thousands of objects). Past that the pass is recorded as partial with an error, no generation is written, and the error suggests excludePaths for the trees with many files.

  • Sensitive fields. A field that is free text an administrator may have put a secret in (a cron command, a sudo command, the command an SSH key is forced to run, a CIFS password in a mount’s options) is stored as a keyed hash, hmac-sha256: and 64 hexadecimal digits, under the store’s key. The same value always gives the same hash in one store, so an unchanged value writes no generation and a changed value shows as a change; the hash cannot be checked against a guess without the store’s key. An identity never holds such a value, nor a plain hash of one. The text of a cron command, of the commands of a sudo rule and of the options of an authorized key that hold one is also kept in the store, encrypted under the store’s keys and named by that hash, so that state pull can write it unless the text looks like it holds a secret (a cron command also needs the file that holds it to be readable by every user); it is in no record, generation or output otherwise. It is kept again at each pass, so a record read before texts were kept has its text after the next read.

  • What needs root. Each kind reads what an ordinary account can read and reports the rest as “permission denied”, never as empty. On a target that expects root (the default), such a gap makes the pass partial (exit code 7). On a target declared with spec.connector.privilege: user, which runs without sudo on purpose, the gap is recorded as skipped (needs root) and the pass stays complete.

  • Coverage. Every pass records, for each kind, one of four states: read; failed (a tool is missing or failed: the pass is partial, and the objects of the previous generation are kept, so a failed read never looks like removed resources); skipped (needs root, on a target run without it); not supported on this host (the host lacks what the kind is about: Package on a host with neither dpkg nor rpm, Service on a host where systemd is not running). A skipped or unsupported kind has no objects, and the pass stays complete. lemano target show NAME shows the state of the latest generation, and lemano diff names a kind that was skipped or unsupported in one of the two generations compared, instead of listing its objects as added or removed.

  • A file a kind cannot read. When a kind that was read cannot read one of its files or directories for lack of privilege (a crontab made readable by root only, on a target read without sudo), the objects read from it before are kept unchanged and marked not read, with the first pass that could not read them, instead of being recorded as removed. lemano target show, lemano diff and lemano history name such files. Cron, File, SudoRule and SshAuthorizedKey say which file each object comes from; the other kinds read one source or none per object. A File that can be listed but not read keeps its record from the pass, with the fields of the earlier record that describe its content (the keyed hash, the stored content): its mode, owner and size are compared as usual, and its content is shown as not read, never as removed.

  • Diff by field. lemano diff lists, under each changed object, the fields that changed. A sensitive field shows as (sensitive value), with neither its old nor its new value, nor the keyed hash that stands in its place. The same holds for the sealed settings of sshd (the fact ssh.effective). The command line of an attribution is shown unless it looks like it holds a secret.

  • Content of a changed file. A File whose content changed shows, in the text of lemano diff, the lines that changed (~ content changed, then a unified diff of 3 lines of context, cut after 200 lines), taken from the two stored copies and decrypted in memory; the keyed hashes that stand for the content are not printed. It is shown only when it is safe: the file is readable by every user (mode with the “other read” bit) in both generations, is not under the target’s contentExcludePaths, is text, was stored, and is not a file whose text Lemano keeps sealed elsewhere (crontabs, sudoers files, /etc/fstab, sshd’s configuration, authorized_keys: their hashes would otherwise be undone by the file’s content), and does not look like it holds secrets by its name or its content (see Secrets by pattern). Otherwise the line says (not shown: ...) with the reason, and for a secret found by pattern the name of the rule, never the text it matched. Directory permissions are not considered: a file with mode 0644 in a directory only root can enter counts as readable by every user, so keep such files out with contentExcludePaths. The patterns find common secrets, not every secret: a readable file that holds one they miss is shown. --show-secrets shows the files that only some users can read, the files of sealed text and the files that look like they hold secrets; --no-content shows none. With -o json or -o yaml the same diffs are under objects.content, with the same rules and the same cut; the field list stays as it is.

  • A new version of a kind. Every record names the version of the kind that read it, so a new version writes all the records of its kind again. A record that differs from the one before in that version alone is not a change of the object: lemano diff, lemano history and lemano discover say once, per kind, Package: kind updated 1.0.0 -> 1.1.0, 181 objects, no content change, and list no object as changed. The generation is still written, since its records differ. An object whose content changed as well is listed as changed, and nothing is attributed to a kind update. Against a baseline, such an object is in sync.

  • Conditions and notes. A kind can name states of its objects worth attention (a kernel value that a reboot would change, a package held back, a sudo rule that permits every command without a password) in CEL expressions on the object’s status; see Conditions. They are computed when an object is shown, with lemano state list, and never stored in a record.

KindIdentityNeeds root forVolatile
Packagepackage namenothingcandidate
Fileabsolute pathfiles and directories only root may read; the package checkmtime, atime
Checkoutfoldercheckouts only root may readnone
Serviceunit namenothingsubState, nRestarts, execMainStartTimestamp
Cronscope and a keyed hash of the entrythe users’ crontabsnone
Mountmount pointan unreadable /etc/fstabusage
Swapthe fstab device, else the swap’s pathan unreadable /etc/fstab or /proc/swapsusage
Userlogin namethe state of the passwordlastLogin
Groupgroup namenothingnone
SshAuthorizedKeyaccount and key fingerprintthe whole kindnone
SudoRulethe sudoers file’s paththe whole kindnone
FirewallRulecomment, tuple or hash of the rulenftables, iptables-legacy, firewalldhandle, packets, bytes
Sysctlparameter namea few parametersnone

Besides the objects, a pass records facts about the server itself (host name, operating system, kernel, virtualization, CPU count and memory, pending updates, whether a reboot is needed, and sshd’s effective settings): see the architecture.

Pending updates on the RHEL family

On the Debian family the pending and security update counts come from a simulation of apt-get upgrade that writes nothing. On the RHEL family they come from dnf, from the metadata it already holds (dnf -C -q check-update, and check-update --security for the security count; exit status 100 means updates are available). -C makes dnf download nothing: a host whose metadata was never fetched, or was cleaned, has the reason NoDnfCache for both counts, and Lemano does not refresh it. The counts are volatile facts: they are shown with the pass and never write a generation.

dnf is never run as root, because run as root it writes its history database, its logs and the system cache even to answer a question. When the pass runs as root through sudo, dnf runs as the login user (SUDO_USER), by setpriv; when the login is root itself, as nobody. A host without setpriv, or without such an account, has the reason NeedsDnf. When the login is an ordinary account, dnf runs as that account.

This is the one write Lemano accepts on a host: run as an ordinary user, dnf keeps a folder of its own, /var/tmp/dnf-<user>-<random>/, holding its lock and its logs. It is created at the first pass (about 13 KB; two steps call dnf at the same time, so a first pass can create two), reused by the next ones, and grows by under 1 KB of log for each pass: dnf is run with --setopt=logfilelevel=0, which keeps its main log to critical errors (about a seventh of the growth by default, measured on Rocky 9). dnf rotates that log at 1 MB. Nothing else is written. The Package kind runs check-update once more, for the candidate version of each package, in the same way, which adds about half a second to a pass, on top of the second that the two runs of the facts step take.

Package

Details. A package installed by the system’s package manager.

  • Reads: on the Debian family, dpkg-query -W (version, architecture, state, hold, priority, section), the installer’s initial-status.gz, apt-mark showmanual and apt-cache policy (installed with the system, installed by hand, origin, candidate version); on the RHEL family, rpm -qa, dnf -C -q check-update (the candidate version, run as an ordinary account), the versionlock plugin’s own list for held packages, and dnf’s history database (/var/lib/dnf/history.sqlite with its write-ahead log), fetched by the engine and read in memory, for installed by hand, for installed with the system (its first transaction) and for origin (the repository dnf installed the version from).
  • Identity: the package’s name; a package of another architecture than the host’s is named as the package manager names it (libc6:i386, glibc.i686).
  • Hidden: nothing sensitive. The cache files of apt are turned off, so nothing is written. The kind never runs dnf as root (run as root, it writes its history and logs even when it only reads), but as the facts step does, above: on the RHEL family, candidate is the version dnf -C -q check-update lists, and is unavailable with the reason NoDnfCache or NeedsDnf, never left empty, when dnf has no cache or cannot be run; that does not make the pass partial. dnf’s history database is never stored; manual and origin are unavailable (NoDnfHistory) on a host without one.
  • Root: none; the package databases are world-readable.
  • Not supported: a host with neither dpkg nor rpm has no objects and the state not supported on this host.
  • Limits: the versionlock list and the history of dnf 5 are not read yet.

File

Details. A file, directory or symbolic link in the configuration locations, with its content stored encrypted.

  • Reads: all of /etc and /usr/local/etc, /usr/local/bin and /usr/local/sbin, the cron spool, each user’s authorized_keys files, the signing keys a package source names directly in /usr/share/keyrings/ that no package owns, the paths the target adds in spec.discovery.includePaths, the users’ own files named in spec.discovery.userFiles, and any file the package manager reports as changed (a full check, dpkg --verify or rpm -Va, daily; a check of the files whose metadata changed on the other passes; see package files). Ownership by a package comes from dpkg-query -S and rpm’s file lists.
  • Identity: the absolute path.
  • Hidden: content is never in the object record: it is kept as an encrypted copy, fetched once and reused while unchanged. A file larger than the target’s contentLimit (1 MiB by default) keeps its metadata and a keyed hash only; contentExcludePaths does the same for chosen paths; excludePaths skips paths entirely. The plain SHA-256 of a file’s content is never stored, only a keyed hash of it. Version-control folders and the generated files of a shipped list are left out, and so are the files that hold the machine ID or the boot ID (/etc/machine-id and its copies): a host’s identity is tracked only as a keyed fact. Files that hold credentials (private keys, including the SSH server’s host keys, login files, cloud and container clients’ logins, command histories, and any file whose content holds a private key or a registry login) keep their metadata only: neither their content nor a hash of it is read or kept (Files never read).
  • Root: a file or directory only root may read keeps its metadata (no content) and is reported as permission denied; so is a package file the package manager could not check.
  • Volatile: mtime and atime. A change of content, link target, owner, group or mode counts.
  • Limits: /run, data under /var and /home (except the cron spool and authorized_keys), /opt and /srv are not read unless the target includes them. Sockets, pipes and device files are not recorded. The files a git checkout’s index tracks belong to the Checkout and are left out.

Checkout

Details. A version-control checkout in the configuration locations (a folder holding .git, .hg or .svn), such as an application deployed as a git clone: one object, not one per file.

  • Reads: the metadata files themselves, never with a version-control tool (a repository’s own configuration can make one run commands): for git, HEAD, the refs and packed-refs, the remote in config, and the index (versions 2, 3 and 4), from which it counts the tracked files and those changed in place (a file whose size or time differs from the index is hashed as git hashes a blob). Mercurial gives its branch, revision and default path; Subversion only that it is a checkout.
  • Identity: the checkout’s folder.
  • Hidden: the user and password of a remote URL.
  • The files of a checkout: those the index tracks belong to it, and the File kind leaves them out; untracked and ignored files stay files, with the content rules. When the index is not read (localChanges: not read: ...), every file stays a file.
  • Volatile: none.

Service

Details. A systemd service unit.

  • Reads: systemctl list-units and systemctl list-unit-files for the units, then systemctl show for each: load, active and unit-file state, the unit file and drop-ins, the sockets and timers that trigger it, whether a daemon reload is pending, and the effective Restart=, Type= and User=. The ordering of the other loaded units is read too, so that a service lists the services that start before it through the targets of the boot as well (on the later service only).
  • Identity: the unit name without .service (ssh, getty@tty1).
  • Hidden: Environment= and ExecStart= are not recorded, since they sometimes hold credentials; the unit file’s content is a File, stored encrypted.
  • Root: none.
  • Volatile: subState, nRestarts, execMainStartTimestamp.
  • Limits: transient units, aliases and per-login or per-connection instances are left out; socket and timer units are not objects yet. On a host where systemd is not running (no /run/systemd/system) or that has no systemctl, the kind is not supported on this host.

Cron

Details. One scheduled command: a line of a crontab, or a script run from /etc/cron.daily and its siblings.

  • Reads: /etc/crontab, the files of /etc/cron.d, the users' crontabs in the spool, and the periodic scripts. They are read as files, not through crontab -l, and only files that the host’s cron would run count.
  • Identity: the scope and a keyed hash of the entry’s schedule, user and command (deploy/9f3c1a07be42), or the script’s path for a periodic script. The name never repeats the command line.
  • Hidden: the command is a sensitive field, stored as a keyed hash; its text is kept encrypted for a declaration that may show it (see state pull). Environment settings other than SHELL, PATH, MAILTO, CRON_TZ, HOME and LOGNAME are not recorded.
  • Root: the users’ spool can only be listed by root.
  • Limits: the last runs of a command, anacron’s table and systemd timers are not read.

Mount

Details. A filesystem mounted at a path, or listed in /etc/fstab, or both.

  • Reads: findmnt for what the kernel lists, and /etc/fstab as a file for what is configured.
  • Identity: the mount point without a trailing slash.
  • Hidden: a CIFS password in an fstab line (password=, pass=, password2=, pass2=) leaves the options, where the option keeps its name, and is stored as a keyed hash; the kernel’s own options are treated the same way. A credentials= file is a path and is recorded as written.
  • Root: an unreadable /etc/fstab is reported as permission denied.
  • Volatile: usage (size, used and available bytes), read with a time limit per mount point so a network filesystem that hangs cannot stall the pass.
  • Limits: kernel and virtual filesystems, container layers and the per-login tmpfs are left out. Options are compared as the kernel prints them.

Swap

Details. A swap area, a file or a device, that the kernel uses, that /etc/fstab lists, or that a systemd swap unit turns on.

  • Reads: /proc/swaps for what the kernel uses, /etc/fstab as a file for its swap lines, and systemctl for the swap units; names are resolved (UUID= through /dev/disk/by-uuid) before they are joined.
  • Identity: the device of the fstab line as written, else the path the kernel or systemd gives it.
  • Origin: what turns the swap on at boot: fstab, a unit, a generator (a compressed swap in memory, made from its own configuration file), or nothing (turned on by hand).
  • Root: an unreadable /etc/fstab or /proc/swaps is reported as permission denied.
  • Volatile: usage (the bytes in use).
  • Limits: a swap that nothing in the system read names belongs to another mount namespace (the host, seen from a container) and is left out when the system is a container, or when its path exists nowhere in it. vm.swappiness is a Sysctl.

ContainerMount

Details. A bind mount of a container: the host folder or file a container uses, and where it sees it. A file no package owns under such a folder is explained by that container.

  • Reads: every container, running or not, with container ls --all --quiet and container inspect of docker or podman (docker first): its name, its compose project when it has one, and each mount of type bind with its host path and the path inside the container. Volumes and temporary file systems are not host paths and are left out.
  • Identity: the container’s name followed by the path inside it, web/etc/nginx/conf.d.
  • Root: the engines’ commands usually need root, or membership of the engine’s group.
  • Volatile: none.
  • Off: without docker or podman the kind is not supported on the host.

User

Details. A local user account.

  • Reads: /etc/passwd, /etc/shadow, /etc/group and /etc/login.defs directly, not through the name service, and lastlog.
  • Identity: the login name.
  • Hidden: the password field is classified on the host and only the result (locked, hasPassword, emptyPassword) leaves it. The hash, any part of it and any hash of it never leave the host, not even in an error. The comment (GECOS) field is not read.
  • Root: only root can read /etc/shadow; without it the three password fields are left out and one error says so.
  • Volatile: lastLogin.
  • Limits: accounts of a directory service are not recorded. Some distributions no longer ship lastlog, and lastLogin is then absent.

Group

Details. A local group.

  • Reads: /etc/group directly.
  • Identity: the group name.
  • Hidden: the group password field and /etc/gshadow are not read.
  • Root: none.
  • Limits: groups of a directory service are not recorded; an account whose primary group this is does not appear in members.

SshAuthorizedKey

Details. A public key that lets someone log in as a local account: one key line of a file sshd reads.

  • Reads: for each account in /etc/passwd, the files given by sshd -T -C user=NAME (AuthorizedKeysFile, with Match blocks for the user applied, tokens expanded), and ssh-keygen -l for the fingerprint and size.
  • Identity: the account and the key’s SHA-256 fingerprint (deploy/SHA256:...).
  • Hidden: the command of a command="..." option and the text of an environment="NAME=value" option are sensitive fields, stored as keyed hashes; their text is kept encrypted for a declaration that may show it. The public key itself is stored as it is. The content of the files is a File.
  • Root: the whole kind (sshd -T reads the host keys).
  • Limits: keys returned by AuthorizedKeysCommand are not read (the command is not run; the fact ssh.effective shows when it is set); Match blocks that depend on the client’s address are not evaluated.

SudoRule

Details. A sudoers file that sudo reads, with its rules, aliases, Defaults lines and includes parsed.

  • Reads: /etc/sudoers (or /etc/sudoers-rs where it exists) and the files its include directives name, found as sudo finds them. The parser is the kind’s own, because not every sudo ships cvtsudoers.
  • Identity: the file’s path.
  • Hidden: the commands of each rule and of each command alias are sensitive fields, stored as keyed hashes; their number and order stay visible. The text of the commands is kept encrypted for a declaration that may show it, as for a cron command. Users, hosts, run-as lists, options, tags and Defaults are recorded as written. The content of the files is a File.
  • Root: the whole kind.
  • Limits: aliases are recorded, not expanded; effective rights (sudo -l) and policies kept in a directory service are not read; a line the parser does not understand gives an error naming the file and line.

FirewallRule

Details. A firewall rule, and the default policy of a base chain.

  • Reads: three views, each object saying which one it comes from: nftables’ kernel ruleset (nft -j list ruleset, which also holds what iptables-nft, ufw and firewalld wrote), ufw’s own files (/etc/default/ufw, /etc/ufw/user.rules), and firewalld’s zones (firewall-cmd --list-all-zones). No ufw command is run.
  • Identity: the rule’s comment when it has one; otherwise the tuple direction/protocol/port/source when the rule maps onto it; otherwise its family, table and chain with a short hash of its normalised expression. A repeat gets #2, #3. A chain’s default policy is an object of its own, named with a trailing slash. A nftables handle is never an identity.
  • Hidden: nothing sensitive; the tool’s own messages are never relayed.
  • Root: nftables, iptables-legacy and firewalld each report permission denied without root, and so does ufw when its files cannot be read.
  • Volatile: handle, packets, bytes. The position of a rule in its chain counts, since moving a rule changes what the firewall does.
  • Limits: rules of iptables-legacy are not read, and their presence is reported; sets, maps and named counters are not objects. Rules belong to a network namespace: a container shows its own.

Sysctl

Details. A kernel parameter, with its live value and the value the configuration files set at boot.

  • Reads: sysctl -a for the live value, and the files sysctl --system reads, in its order, for the persisted value and the files that set it.
  • Identity: the parameter’s dotted name.
  • Hidden: parameters that hold a secret are dropped on the host: kernel.random.boot_id and net.ipv4.tcp_fastopen_key. Counters and identifiers that change on every read (fs.file-nr, kernel.random.uuid, net.netfilter.nf_conntrack_count, and a few more) are not recorded.
  • Root: a few parameters cannot be read by an ordinary account; the others are read, and one error counts the ones that were not.
  • Limits: a container shows its host’s kernel parameters, except the network stack’s, which are its own. A glob key in a file is recorded as written, not expanded.

Conditions

lemano state list NAME lists the objects of a target’s latest generation (or of the one --generation names) with their conditions and notes; --kind keeps one kind and --flagged the objects that have a condition or a note. Without --all, the list holds the objects that define the server and counts the others, kind by kind, below the table; the rules are in the state reference. lemano target show NAME counts, below its table, the objects that have each condition. A condition shown with a question mark (Name?) could not be evaluated on that status, and the reason follows the table. The expressions are written in each kind’s kind.yaml; see the kinds directory for the language.

KindConditionHolds when
PackageHeldthe package is pinned against upgrades
FileModifiedConffilea regular file a package owns differs from the package’s copy
FilePendingConffileMergea copy parked by the package manager (*.dpkg-dist, *.rpmnew) waits to be merged
FileOversizeContentthe file is larger than the content limit, so its content is not stored
ServiceFailedsystemd reports the unit as failed
ServiceInactivean enabled service is not running, nothing starts it on demand (no socket, timer or path unit) and it is not a one-shot
ServiceNeedsDaemonReloada unit file changed on disk since systemd loaded it
UserLockedthe password of an ordinary account, or of root, is locked
UserNoPasswordthe password field is empty, so the account may log in without a password where the system allows it
SshAuthorizedKeyWeakKeya DSA key, or an RSA key under 3072 bits
SudoRulePermitsAlla rule grants every command without a password
FirewallRuleNoDefaultDropPolicythe default policy of an incoming filter chain (an nftables input chain, ufw’s incoming direction) is accept; the chains of firewalld’s own table are left out, because they accept by policy and end in a rejecting rule that a condition does not see
SysctlLiveDiffersFromPersistedthe live value differs from the one the files set, so a reboot would change it
SysctlSetElsewhereseveral files set the parameter to different values; the last applied wins, and the note names it
MountNotMounted/etc/fstab has a line for the mount point and nothing is mounted there
SwapNotActive/etc/fstab has a line for the swap and the kernel does not use it
SwapNotPersistedthe kernel uses the swap and nothing turns it on again at boot
SwapFileOpenToOthersusers other than the swap file’s owner can access it, and with it what memory held

Cron and Group declare none. A service’s restart counter and a mount’s or a swap’s usage are volatile, so no expression sees them.