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 diffwrites it asKind/identity.Declared fields. The
specof a kind’sschema.jsonlists the fields a declaration of the kind sets, each with its default.lemano state pullwrites 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
excludePathsfor 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 thatstate pullcan 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:
Packageon a host with neitherdpkgnorrpm,Serviceon a host where systemd is not running). A skipped or unsupported kind has no objects, and the pass stays complete.lemano target show NAMEshows the state of the latest generation, andlemano diffnames 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 diffandlemano historyname such files.Cron,File,SudoRuleandSshAuthorizedKeysay which file each object comes from; the other kinds read one source or none per object. AFilethat 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 difflists, 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 factssh.effective). The command line of an attribution is shown unless it looks like it holds a secret.Content of a changed file. A
Filewhose content changed shows, in the text oflemano 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’scontentExcludePaths, 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 withcontentExcludePaths. The patterns find common secrets, not every secret: a readable file that holds one they miss is shown.--show-secretsshows the files that only some users can read, the files of sealed text and the files that look like they hold secrets;--no-contentshows none. With-o jsonor-o yamlthe same diffs are underobjects.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 historyandlemano discoversay 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.
| Kind | Identity | Needs root for | Volatile |
|---|---|---|---|
| Package | package name | nothing | candidate |
| File | absolute path | files and directories only root may read; the package check | mtime, atime |
| Checkout | folder | checkouts only root may read | none |
| Service | unit name | nothing | subState, nRestarts, execMainStartTimestamp |
| Cron | scope and a keyed hash of the entry | the users’ crontabs | none |
| Mount | mount point | an unreadable /etc/fstab | usage |
| Swap | the fstab device, else the swap’s path | an unreadable /etc/fstab or /proc/swaps | usage |
| User | login name | the state of the password | lastLogin |
| Group | group name | nothing | none |
| SshAuthorizedKey | account and key fingerprint | the whole kind | none |
| SudoRule | the sudoers file’s path | the whole kind | none |
| FirewallRule | comment, tuple or hash of the rule | nftables, iptables-legacy, firewalld | handle, packets, bytes |
| Sysctl | parameter name | a few parameters | none |
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’sinitial-status.gz,apt-mark showmanualandapt-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.sqlitewith 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
dnfas 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,candidateis the versiondnf -C -q check-updatelists, and is unavailable with the reasonNoDnfCacheorNeedsDnf, 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;manualandoriginare unavailable (NoDnfHistory) on a host without one. - Root: none; the package databases are world-readable.
- Not supported: a host with neither
dpkgnorrpmhas 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
/etcand/usr/local/etc,/usr/local/binand/usr/local/sbin, the cron spool, each user’sauthorized_keysfiles, the signing keys a package source names directly in/usr/share/keyrings/that no package owns, the paths the target adds inspec.discovery.includePaths, the users’ own files named inspec.discovery.userFiles, and any file the package manager reports as changed (a full check,dpkg --verifyorrpm -Va, daily; a check of the files whose metadata changed on the other passes; see package files). Ownership by a package comes fromdpkg-query -Sand 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;contentExcludePathsdoes the same for chosen paths;excludePathsskips 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-idand 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:
mtimeandatime. A change of content, link target, owner, group or mode counts. - Limits:
/run, data under/varand/home(except the cron spool andauthorized_keys),/optand/srvare 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 andpacked-refs, the remote inconfig, 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-unitsandsystemctl list-unit-filesfor the units, thensystemctl showfor 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 effectiveRestart=,Type=andUser=. 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=andExecStart=are not recorded, since they sometimes hold credentials; the unit file’s content is aFile, 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 nosystemctl, 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 throughcrontab -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 thanSHELL,PATH,MAILTO,CRON_TZ,HOMEandLOGNAMEare 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:
findmntfor what the kernel lists, and/etc/fstabas 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. Acredentials=file is a path and is recorded as written. - Root: an unreadable
/etc/fstabis 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
tmpfsare 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/swapsfor what the kernel uses,/etc/fstabas a file for its swap lines, andsystemctlfor 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/fstabor/proc/swapsis 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.swappinessis 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 --quietandcontainer inspectof docker or podman (docker first): its name, its compose project when it has one, and each mount of typebindwith 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/groupand/etc/login.defsdirectly, not through the name service, andlastlog. - 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, andlastLoginis then absent.
Group
Details. A local group.
- Reads:
/etc/groupdirectly. - Identity: the group name.
- Hidden: the group password field and
/etc/gshadoware 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 bysshd -T -C user=NAME(AuthorizedKeysFile, withMatchblocks for the user applied, tokens expanded), andssh-keygen -lfor 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 anenvironment="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 aFile. - Root: the whole kind (
sshd -Treads the host keys). - Limits: keys returned by
AuthorizedKeysCommandare not read (the command is not run; the factssh.effectiveshows when it is set);Matchblocks 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-rswhere 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 shipscvtsudoers. - 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
Defaultsare recorded as written. The content of the files is aFile. - 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 whatiptables-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). Noufwcommand is run. - Identity: the rule’s comment when it has one; otherwise the tuple
direction/protocol/port/sourcewhen 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 -afor the live value, and the filessysctl --systemreads, 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_idandnet.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.
| Kind | Condition | Holds when |
|---|---|---|
| Package | Held | the package is pinned against upgrades |
| File | ModifiedConffile | a regular file a package owns differs from the package’s copy |
| File | PendingConffileMerge | a copy parked by the package manager (*.dpkg-dist, *.rpmnew) waits to be merged |
| File | OversizeContent | the file is larger than the content limit, so its content is not stored |
| Service | Failed | systemd reports the unit as failed |
| Service | Inactive | an enabled service is not running, nothing starts it on demand (no socket, timer or path unit) and it is not a one-shot |
| Service | NeedsDaemonReload | a unit file changed on disk since systemd loaded it |
| User | Locked | the password of an ordinary account, or of root, is locked |
| User | NoPassword | the password field is empty, so the account may log in without a password where the system allows it |
| SshAuthorizedKey | WeakKey | a DSA key, or an RSA key under 3072 bits |
| SudoRule | PermitsAll | a rule grants every command without a password |
| FirewallRule | NoDefaultDropPolicy | the 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 |
| Sysctl | LiveDiffersFromPersisted | the live value differs from the one the files set, so a reboot would change it |
| Sysctl | SetElsewhere | several files set the parameter to different values; the last applied wins, and the note names it |
| Mount | NotMounted | /etc/fstab has a line for the mount point and nothing is mounted there |
| Swap | NotActive | /etc/fstab has a line for the swap and the kernel does not use it |
| Swap | NotPersisted | the kernel uses the swap and nothing turns it on again at boot |
| Swap | FileOpenToOthers | users 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.