Skip to content

emfor 0.7.0

Choose a tag to compare

@vanillahsu vanillahsu released this 21 Nov 16:52
· 135 commits to main since this release

The store format (meta/schema_version 2) and the plugin protocol (1) are
unchanged: clients and plugins of 0.6.0 keep working with this daemon. The
shared library's name carries the minor version, so libemfor is now
libemfor.so.0.7: rebuild or reinstall what links against it
(docs/compatibility.md).

Read before you upgrade. Several changes tighten defaults and can stop an
install that relied on the old behaviour; each has an entry below with the
fix:

  • exec checks and plugins get a small environment: a check program that
    reads HOME, a proxy variable or the like needs env_pass.
  • The store files are 0640 and 0660 by default: an application user that
    is not in the daemon's group gets UNAVAILABLE until it is added to it.
  • A daemon that encrypts peer messages drops plaintext ones by default.
  • A peer secret file must be owned by root or by the user running emfor.
  • The main config file must not be writable by group or others, and must be
    owned by root or the user running emfor, as the fragments already had to
    be.
  • previous_secret_file is used only for the secret the daemon replaced.

exec checks and plugins no longer get the daemon's whole environment (hardening, breaking).
A program that an exec check or a plugin starts used to inherit every
variable of the daemon's environment, so a secret set there (by a unit file,
for example) reached every check program. It now gets only PATH, LANG,
TZ and the LC_* variables, with the daemon's values, and exec also
gets EMFOR_IP, EMFOR_PORT and EMFOR_SERVICE. New: env_pass, a list of
variable names (never values), in check_options of an exec check and in
[plugins."<name>"], adds variables the daemon has; a name the daemon does
not have is skipped. Action on upgrade: a check program or plugin that
reads HOME, a proxy variable, LD_LIBRARY_PATH or any other variable now
needs its name in env_pass (emfor-check also reads SSL_CERT_FILE and
SSL_CERT_DIR, to find the system CAs of a TLS check without ca_file); without it the program runs without that
variable, and emfor check-config does not warn about it. Changing a plugin's
env_pass restarts the plugin on reload, like changing its command, and
the names are part of the check definition that peers compare, so hosts of a
group must list the same names for a service.
Checked in a Debian container: fmt, clippy -D warnings and the full gate;
new tests for the environment of exec and of a plugin (also after a
restart), for the validation of env_pass, and for the restart on reload;
the tests of the environment fail when the clearing is taken out, and the
reload test fails when the comparison of env_pass is taken out; tests/nagios/run.sh passes. Not verified: on
macOS or FreeBSD, the PATH that systemd gives the daemon, and installs
whose check programs need variables that are not known here.

Example scripts check what they hand on, and a flaky test is fixed (hardening).
examples/pf/emfor-pf-table.sh now gives pfctl only addresses: an SRV
target that is not an IPv4 or IPv6 address in emfor's dashed form is skipped
with a line on stderr, EMPTY and the table name are checked at the start,
and the first line of a pfctl error is part of the script's own error.
examples/nagios/check_emfor.sh writes a | in a service name, backend id or
reason as / and a line feed as a space, so the text cannot end early and
start the perfdata; a quote in a perfdata label is doubled. The fuzz.yml
workflow takes its seconds input through an environment variable and
rejects anything that is not a number above 0 (0 would mean no time limit). The test
removed_directory_is_a_failure waits for the watch to report its failure
(up to 3 s) instead of sleeping a fixed time. Checked in a Debian container:
tests/pf/validate.sh (new; fails on the old script, which passed junk to
pfctl), tests/nagios/run.sh with a new case, fmt, clippy -D warnings
and the full gate. Not verified: a real FreeBSD with pf, a real Nagios, the
fuzz.yml change on GitHub Actions, and the race in the watch test, which was
not reproduced under CPU stress with either the old or the new test;
tests/pf/validate.sh is run by hand, not by the gate.

An older peer result or heartbeat no longer overwrites a newer one (bug fix).
The replay check lets a message that the network delivered late through, as
long as its seq is within 64 of the highest. The daemon then kept it as the
sender's latest result for the backend, or as the member's service tags,
replacing what a later message had set (and, for a result, making it look
fresh again). Each kept result and each member's tag list now remember the
boot and seq of the message they came from, and a message with the same
boot and a lower seq is counted as received but leaves them alone; one
with another boot (the sender restarted) replaces them. The wire format
and the replay window are unchanged. Checked in a Debian container: fmt,
clippy -D warnings and 1052 tests pass, 17 ignored; seven new tests, six of which fail when
the comparison is turned off (the seventh checks that stamps are dropped with
the member). Not verified: real network reordering between
hosts (the tests feed messages in the reordered sequence); the new tests were
not run against the old code as such, only with the comparison removed.

A client that opens the store while the daemon pads it no longer fails (bug fix).
The daemon commits a write and only then extends the data file to the length
LMDB records, so for a moment the file is shorter than recorded. A client
that opened the store in that gap refused it as truncated and kept that
failure for one second. It now measures the file again up to 5 times, 20 ms
apart (about 100 ms), and opens the store once it is long enough; a file that
stays short fails as before, with the same message, after those 100 ms (other
lookups of that client wait meanwhile). The switch to a replaced store does
not recheck, because it runs under the same lock every 100 ms. Only the Rust client opens the store;
the other languages use it through libemfor. Checked in a Debian container:
the gap measured with a temporary test (longest 11.9 µs, one run, Linux
only); two new tests, both of which fail with the rechecks set to 0, and a time limit added to the replaced-store test, which fails when that path rechecks; the
existing truncated-store tests are unchanged and pass. Not verified: macOS,
FreeBSD, a writer that is descheduled for long between commit and padding.

http checks work on a host without system CA certificates (bug fix).
On a host without CA certificates (a minimal install without
ca-certificates) every http check was an error with cannot build http client: builder error, even with scheme = "http", because building the
client read the system roots for a verifier that a plain request never uses.
With scheme = "http" the client is now built without certificate
verification (no TLS handshake happens on that scheme), so the check works.
https with verification on still needs the CA certificates, and its reason
now says so (https checks need the system CA certificates unless tls_verify = false). The deb and rpm packages
already depend on ca-certificates. Checked: the failure reproduced (one run) in a
Debian 13 container with its CA certificates removed (plain http and
verified https gave builder error), and after the change http is up
for 200 and down for 503 there, while with the old argument put back both
fail again; two unit tests (the reason text, and when verification is skipped); fmt, clippy -D warnings and the full
gate pass (1066 passed, 0 failed, 17 ignored). Not verified: macOS and
FreeBSD, other distributions.

A hung config file no longer blocks a stop request, and a restarted plugin leaves no tasks behind (bug fixes).
On SIGHUP the daemon read the config on the thread that runs its main
loop, so a config on a hung file system kept the daemon from handling
SIGTERM and from running its supervisor until the read returned; the read
now runs on a blocking thread and a stop request ends the reload (the stuck
thread is abandoned at exit, as before). When a plugin exited, stalled or was
stopped, the tasks that read its stdout and stderr and wrote to its stdin
lived on if a process outside the plugin's process group kept a pipe open;
they now end 100 ms after the plugin was reaped, after reading what was
left in the pipes, so the last stderr lines are still logged, also when the
plugin fails its handshake. Checked in a
Debian container: fmt, clippy -D warnings and 1045 tests pass, 17 ignored;
four new tests. Run against the old code, the stop-request test and the
restarted-plugin test fail (the latter also with the explicit abort taken
out); the other two were not run against it (one checks the single extra
reload, one that the last stderr lines survive, also for a failed handshake).
Not verified: a real hung NFS mount (a named pipe stands in for it);
FreeBSD and macOS; the task count uses tokio's live-task metric, not a count
of file descriptors.

Plugin log text is escaped, the redis checker hides the AUTH password, the writer lock file is 0600 (bug fixes).
A plugin's stderr lines and the name and version in its handshake reached the
log as sent, so a control character or a bidi override could forge a log line;
they now get the escaping that check reasons already had. A redis server that
echoed the AUTH password in its error put it into the check reason; the
password is now written as ***. The <store>.writer lock file followed the
umask; it is now 0600, and an older file is set to 0600 at start (a failure
only warns). Checked in a Debian container: fmt, clippy -D warnings and
1041 tests pass, 17 ignored; five new unit tests. Not verified: a real redis that echoes
the password; a real package upgrade over an existing 0644 lock file; the
chmod failure path of the lock file; the plugin start line is tested through
its formatting function, not through a real handshake; the new tests were not
run against the old code.

Three small fixes in the reading of peers.secret_file (bug fixes).
A read of the old path that returned after a reload had changed secret_file
was applied as the current secret; it is now dropped, and the new path is
read. The kqueue watch (FreeBSD, macOS) opened the directory and the file
without O_NONBLOCK, so a path replaced by a FIFO could stop the watch thread
in open; it now opens them as read_secret does. read_secret read the whole
file into memory; it now reads at most 65537 bytes, and a secret_file or
previous_secret_file larger than 65536 bytes (the line feed included) is a
config error at that key (a compatibility change in name only: a secret
needs 32 bytes). Checked in a Debian container: fmt, clippy -D warnings and
1036 tests pass, 17 ignored; new tests for the dropped result of the old
path and for the size limit; on macOS cargo check and cargo clippy -D warnings pass for the kqueue code. Not verified: the new tests were not run
against the old code; the kqueue open with a FIFO was not tried, on macOS or
FreeBSD, and the kqueue watch did not run on FreeBSD.

previous_secret_file is used only for the secret the daemon replaced (compatibility change).
A daemon that starts with previous_secret_file used it whenever it held a
secret other than the current one and secret_file had been modified less
than 120 seconds before. A retired secret could come back: after a later
change (K1 to K2) with previous_secret_file still holding K0, a restart within
120 seconds signed with K0 for 60 seconds and accepted it for 120, and the
members that had dropped K0 stopped hearing the host; touch or a restored
secret_file did the same. The daemon now keeps a record of the secrets it
has used in <store path>-peers (state.mdb-peers by default, mode 0600): a
SHA-256 fingerprint of the current secret and of the one it replaced, and when,
and never a secret. It is written at start (synchronously, once) and at each
change of the secret, on a thread of its own that the peer loop never waits for. At start previous_secret_file is used only when it
holds the secret the record says was replaced less than 120 seconds ago; a
change made while the daemon was stopped is dated by the modification time of
secret_file, as before. Otherwise it has no effect, with one info line that
says why. The first start of this version has no record, so it ignores
previous_secret_file, and a start in the middle of a secret change at that
moment behaves as when the option is not set; the next change is covered. A
record that cannot be written gives a warning, at most once a minute. Checked
in a Debian container: fmt, clippy -D warnings and the tests pass,
including new unit tests for the record (a round trip with mode 0600, no secret
in it, a garbled or missing file), for the decision (a secret replaced while
running, a change made while stopped, a secret retired earlier, a touched
file, no record) and for the write after a change of the running daemon, and
the restart test of the peer task changed to the new rule. Not verified: the new
tests were not run against the old code (it has no function to call; by
construction the old rule used K0 in the retired and touched cases), a real
rotation across several hosts, a record directory that is slow or full.

The deploy scripts run emfor check-config as the daemon's user.
examples/deploy/emfor-peers-sync.sh and emfor-drain.sh ran
emfor check-config as root, and check-config starts the plugins the config
declares, so a plugin ran as root outside the service's sandbox. They now run it
as EMFOR_USER (default emfor) with runuser -u, or su -m where there is
no runuser; they run it directly when not run as root or when the user is
root. The user must be able to read the config files and the secret file.
status --json and the reload are unchanged. Checked in a Debian container as
root: a declared plugin ran as uid 999 (the emfor user) through runuser and
through the su -m path (with SHELL set), and as uid 0 with
EMFOR_USER=root; without a plugin emfor-peers-sync.sh wrote the file and ran
the reload, and emfor-drain.sh on changed the line; a user that does not exist
makes check-config fail and the old file stay. Not verified: FreeBSD (su -m
there), su -m on Linux with the user's nologin shell and no SHELL (it fails
without a message; runuser is used first), the wait for the drained state of
emfor-drain.sh on (jq was not in the container), and the order of the
scripts (the new file is moved into place before check-config, as before).

The main config file is checked like the fragments (compatibility change).
emfor server (at start and at every reload) and emfor check-config now
refuse a main config file that group or others can write (mode & 0o022), or
that a user other than root and the user running emfor owns, with the same
error as for a file of include_dir, now followed by the command that fixes
it (chmod g-w,o-w <path> or chown root <path>; the fragments get the
same addition). The main file can declare a plugin command, which runs with
the daemon's rights, as a fragment can; only the fragments were checked. The
file is checked after it is opened and read from that open file; a link is
judged by the file it points to. emfor status and emfor lookup read only
[store] and do not check it, and the directory of the main file is not
checked. At start a refusal exits with status 2 before the store is opened; at
a reload the old config keeps running. The deb and rpm packages install the
file root-owned with mode 0644 (read from the 0.6.0 packages) and the FreeBSD
port copies a sample with INSTALL_DATA, so they are not affected; an
installation with a 0664 file, or one owned by another account, does not
start after the upgrade until chmod g-w,o-w /etc/emfor/emfor.toml (or chown root) is run, which emfor check-config with the new binary reports first.
Checked with unit and integration tests in a Debian container (the mode table,
the owner, a link, the refusal at start and by check-config, the rejected
reload that then recovers, status and lookup with a 0664 file) and the
whole gate there: fmt, clippy -D warnings and 995 tests passed, 14 ignored,
also with umask 002 (the tests write the main file with mode 0644 and no
longer depend on the umask); the four new refusal unit tests fail on the old
code. Not run on macOS or
FreeBSD by hand, and not tried on a real deb or rpm upgrade.

The store files are only for the daemon's group by default (compatibility change).
[store] file_mode and lock_file_mode now default to "0640" and "0660"
instead of "0644" and "0666", so that only the daemon's user and its group
can read the store and write the lock file; the lock file holds LMDB's reader
table and the lock the daemon takes for every commit, and it was writable by
every local user. The daemon sets these modes on the existing files at every
start, so the first start of 0.7.0 changes the files that 0.6 left, and an
application whose user is not in the daemon's group (emfor in the deb and rpm
packages, which ship an emfor.toml without [store] keys and so take the
new defaults) gets UNAVAILABLE from the client. Before the upgrade, add the
application users to the group of the daemon (usermod -aG emfor <user>), or
write file_mode = "0644" and lock_file_mode = "0666" in [store] to keep
the old behaviour. emfor check-config and the daemon at start now warn, in
one line for each option, about a file_mode or lock_file_mode that other
users can write; the line says what the mode allows, what to set instead and
that the value takes effect at the next start. The warning is not an error and
is not repeated at a reload, because [store] is applied at start. Checked
with unit and integration tests in a Debian container (the defaults, the modes
set on existing files, the warning in check-config and at start). Not run on
macOS or FreeBSD by hand, and not tried on a real deb or rpm upgrade or with a
client in another group.

Unencrypted peer messages are refused by default (compatibility change).
[peers] accept_plaintext no longer defaults to true. Without a value it is
false while encrypt is true (the default since 0.4.0) and true while
encrypt = false. A daemon that encrypts now drops the plaintext (EMP1)
messages of a member that has encrypt = false or runs 0.3.0, counts them as
plaintext in emfor_peer_messages_rejected_total, and does not see that
member as live; it used to accept them and log a warning. A group in which
every member sends encrypted messages is not affected, and no config that was
valid becomes invalid: encrypt = false still accepts plaintext by default,
and accept_plaintext = false with encrypt = false is still an error.
To upgrade a group that still has members sending plaintext, give the hosts
that encrypt an explicit accept_plaintext = true: in the same config change
as the upgrade on a host that runs 0.3.0 or 0.4.0 (they do not know the key,
which was added in 0.5.0), or before the upgrade on one that runs 0.5.0 or
0.6.0. Once every member has encrypt = true and the plaintext counter stops
increasing, remove the line and reload. To keep the old behaviour, set
accept_plaintext = true and reload. Checked with the unit tests of the
default and the peer integration tests in a Debian container; four of the
existing peer tests (they sent EMP1 to a daemon with the default, or relied
on it to take plaintext back after a reload) changed with it. Not run on macOS
or FreeBSD by hand, and not tried on a real group of 0.6 and 0.7 members.

A peer secret that another account owns is refused (compatibility change).
secret_file and previous_secret_file must now be owned by root or by the
user running emfor, as include_dir fragments already had to be: whoever owns
a file can rewrite it, whatever its mode says, and the secret authenticates and
encrypts every peer message. The group does not matter, and the modes
(0600 or 0640) are unchanged. A secret created by another account, for example
alice with mode 0640 and group emfor, is refused at start, by emfor check-config and at reload, with an error at peers.secret_file that names
the owner's uid. To fix it, chown root:emfor (or emfor:emfor) the file on
every host before updating. emfor check-config compares the owner with the
user that runs it, so a secret owned by the emfor user is refused when another
account (not root) runs it; a secret owned by root is accepted for everyone.
A daemon that is running when the owner of the file changes keeps the last
valid secret and logs a warning, as it does for any secret file it can no
longer read. Checked with the unit tests in a Debian container (as root, so
the refusal of a file owned by another uid ran); not on macOS or FreeBSD by
hand.

The systemd unit hides other processes and sets a umask. The packaged unit
and examples/systemd/emfor.service now set UMask=0027, ProtectProc=invisible
and ProcSubset=pid, and carry a commented #MemoryDenyWriteExecute=yes for
setups whose plugins do not generate code at run time. The store files set their
own modes, so clients still read the store (the writer lock file is 0640).
systemd-analyze security rates the unit 1.5 (it was 1.7).
Checked with the deb in a Debian 12 (arm64) container running systemd 252: the
daemon, the dns plugin, emfor lookup as another user and systemctl reload
work, also with MemoryDenyWriteExecute=yes; not on Rocky Linux or FreeBSD.
A copy of the example unit has to be updated by hand.

The peer secret is wiped from memory when it is dropped. Secret in the
daemon zeroizes the secret and the keys derived from it (the zeroize crate,
already in the tree) when a value is dropped, for example after a reload that
changes the secret. A copy that was made elsewhere in memory is not tracked.

The systemd unit stops retrying after five failed starts in a minute.
With an invalid config (for example a conf.d file that group or others can
write), the config check in ExecStartPre fails with status 2, which
RestartPreventExitStatus does not see, so systemd retried every RestartSec
(2 seconds) until its default start limit stopped it, and with that limit and
RestartSec=2s it may never do: on systemd 252 (Rocky Linux 9) the unit was
retried 11 times in 22 seconds and was still retrying. The packaged unit
(packages/common/emfor.service, so the deb and the rpm) and
examples/systemd/emfor.service now set StartLimitIntervalSec=60 and
StartLimitBurst=5: the unit is failed about nine seconds after the restart
and stays down until systemctl reset-failed emfor and systemctl start emfor.
The same limit stops a daemon that crashes five times in a minute. A copy of the
example unit has to be updated by hand; the packages bring the new one. Checked
with the rpm in a Rocky Linux 9.9 (arm64) container running systemd 252 as PID 1;
not on Debian or FreeBSD (which has no unit).

The client's fork handlers no longer abort the process in a thread that is
exiting.
On FreeBSD libemfor registers pthread_atfork handlers that keep
the store lock in a thread-local while a fork is prepared. A fork from a
thread-local destructor, or a signal handler that forks in a thread whose
thread-locals are being destroyed, found that thread-local gone, and the
handler panicked; as it is an extern "C" function the panic cannot unwind, and
the process was aborted. The handlers now do nothing in that case (that fork
is not guarded, as before the handlers existed, but it returns). Found as an
occasional abort or hang of the test fork_guard_signal (about once in 800 runs
on Debian, and once in the CI of 0.6.0); that test now stops its signal thread
before it ends, and a new test, fork_guard_tls_exit, reproduces the case
every time. Checked on Debian (the stress run of 3600 passed, the new test
failed before the change and passes after) and in the CI on FreeBSD 14.5 and
15.1; not by hand on FreeBSD, and the hang, which was never caught while it
happened, is taken to have the same cause.

Durations in the config are parsed by emfor itself. The humantime crate,
which parsed interval, timeout and the other durations, is now flagged
unmaintained in the RustSec advisory database (RUSTSEC-2026-0542), and the new
cargo deny job in the CI failed on it. A small parser in
crates/emfor-daemon/src/config.rs replaces it and accepts the same syntax: one
or more number-and-unit terms such as "500ms", "1.5s" or "1h 30m", the
spelled-out units (seconds, minutes, ...) and "0". The error message for
an invalid duration is the same. Checked on Debian: the tests of the old
parser's uses pass, and a new test lists forms that parse and forms that do not;
not compared against humantime on a large corpus, so a form that only it
accepted may be refused now.

Warnings about secret files and clear-text passwords. emfor check-config
(on standard error), the daemon at startup and on reload now warn when a
password_file, secret_file or tls_key_file in a service's check_options
can be read by every user or written by anyone but its owner, one line for each
file naming the services that use it, and when a redis or ldap check has a
password_file without tls (or starttls for ldap). Nothing is refused and
the exit status of check-config is the same; a config that works keeps
working. From the CASA self-assessment (docs/TODO.md 67). Checked on Debian with
unit tests of the warnings; the check-config and log output was not run
against a real redis or ldap plugin, and mysql, pgsql and mongodb are not
warned about (whether their password is sent in clear depends on the server).

The peer secret file is checked on the file that was opened. The peer
secret_file and previous_secret_file are now opened first and the opened file
is checked (mode, and that it is a regular file) and read, as the include_dir
fragments already were; before, the mode was checked on the name and the file
read from the name afterwards, so the file could be replaced in between, and a
FIFO named as the secret made the once-a-second re-read wait for a writer. A link
to a good file still works. The owner of the file is checked too, by the entry
above. From the CASA self-assessment (docs/TODO.md 67). Checked on
Debian with a unit test (a link works, a FIFO is refused without waiting); not on
macOS or FreeBSD by hand.

Invisible format characters in a check's reason are escaped. The reason of a
check result now has the invisible format characters that can hide or reorder
text (U+202E and the other bidirectional controls, the zero-width characters, the
soft hyphen, the tag characters) escaped as \u{202e}, as the control characters
already were, so a backend cannot make emfor status or a log show a service as
something else. Not the whole of Unicode category Cf, only that set, and no new
dependency. The "Reasons are bounded and printable" requirement of the
health-checking spec lists the characters (Spectra change
emfor-reason-format-chars). Checked on Debian with unit tests; not on macOS or
FreeBSD by hand.

Peer members from a cloud API (manual chapter 8, both languages).
examples/deploy/emfor-peers-sync.sh writes [peers] members into a conf.d
file from a list of addresses on its standard input, for a group whose hosts
come and go, and reloads emfor. It changes nothing for an unchanged list, an
empty answer, fewer than 2 or more than 64 addresses, or a line that is not an
address; it runs emfor check-config and puts the old file back if that
refuses. The chapter gives example commands for AWS and Google Cloud, and says
what a group sees while the hosts hold different lists. No change to the
daemon. Checked in a Debian container with three daemons on 127.0.0.1 to
127.0.0.3: a member added and removed by the script, unchanged and refused
inputs, and the rollback of a list that check-config refuses. Not run
against a real AWS or Google Cloud account, with systemd (systemctl reload)
or on FreeBSD.

The rpm keeps a changed main config file on upgrade (bug fix).
The rpm marked /etc/emfor/emfor.toml as %config and not %config(noreplace)
(conf.d/README already was). When the packaged file differs between two
versions, an upgrade then replaced a file the administrator had changed with
the packaged one, which holds only include_dir, and saved the changed one as
emfor.toml.rpmsave; the services, [peers] and [store] written in the main
file were gone, and the restart of the package script started the daemon
without them. The flag is now noreplace: an upgrade keeps the changed file
and writes the packaged one as emfor.toml.rpmnew. The packaged file is the
same in 0.6.0 and 0.7.0, so an upgrade from 0.6.0 does not meet the difference
in any case. Checked in a Rocky Linux 9 container with rpm: the flags of the
built package are cn for emfor.toml and conf.d/README (the 0.6.0 package
has c for emfor.toml); two test packages whose packaged emfor.toml has one
more line, built with each flag, upgraded from the 0.6.0 package after a local
edit: with %config the local file was replaced and emfor.toml.rpmsave
written, with noreplace the local file stayed and emfor.toml.rpmnew was
written (the scripts were not run: --noscripts, --nodeps). Not verified:
the real packaged scripts on an upgrade, a systemd start, other rpm versions
than the one of Rocky Linux 9, and the deb (dpkg asks about a changed
conffile and was not changed).

The reason of a failed http check no longer holds the request URL (bug fix).
The HTTP client appends the request URL to its error messages, so a path with
a token in its query string (path = "/health?token=abc", which the validation
allows) ended up in the reason of a check that failed to connect or to
complete a TLS handshake, and the reason goes to the store, the log and
emfor status. The URL is now left out of the reasons the client's errors
produce; the backend address is in the service's configuration anyway. Checked in a Debian
container: fmt, clippy -D warnings and 1014 tests passed (17 ignored,
three of them benchmarks); three new tests (a refused connection, a failed
TLS handshake, a failed body read) check that the reason holds neither the
token nor the path, and the first two fail with the old code (the reason was
error sending request for url (http://127.0.0.1:<port>/health?token=s3cret): ...);
the body test also passes with the old code, because the client does not add
the URL to that error. Not checked: the other plugins of emfor-check
and the http3 check, which the review did not point at and which were not
read for this; a TLS failure other than a clear-text answer to a handshake.

check-config and the start-up log warn about more passwords sent without TLS (bug fix).
The warning about a password_file without tls was given only for a check
named redis or ldap. It is now also given for mysql, pgsql and amqp
(when the plugin runs emfor-check), and the kind is read from the plugin's
command, so a plugin called redis-check that runs emfor-check redis is
warned about too. The reasons the review gave, read by the reviewer in the
drivers and not tried against real servers: amqp sends the password in
clear text with SASL PLAIN; with SslMode::Disable the pgsql driver sends it
in clear text to a server that asks, and a server that is not the real one
chooses what to ask; without TLS the mysql driver sends it encrypted with a
key that the server supplies. The old reason for leaving them out, that it
depends on the server's authentication method, does not hold because the one
who answers chooses the method. mongodb is still not warned about (SCRAM does
not send the password). It is a warning, never an error, and the defaults are
unchanged. A config with a mysql, pgsql or amqp check that has a
password_file and no tls now prints a line in emfor check-config and
in the start-up log. docs/deploy/plugins.md says so. Config now carries the
valid plugin declarations (plugins). Checked in a Debian container: fmt,
clippy -D warnings and 1017 tests passed (17 ignored, three of them
benchmarks); new unit tests for the five kinds with and without tls, a
renamed plugin, mongodb, and a plugin called pgsql that is not
emfor-check, while the existing redis and ldap tests pass unchanged. Not
verified: the new tests were not run against the old code (it could not
compile them; by construction it never warned for those kinds); no real
servers; the claims about the drivers.

The peer secret file is watched, and a hung read no longer stops the peer loop (bug fix).
The peer task read [peers] secret_file every second and waited for the
read, with no time limit, before it sent the heartbeats, checked which members
were live and handled received messages. With the file on a network file
system that does not answer, the read never returned, the whole loop stood
still, and the other members saw the host as not live after 3 seconds while
its checks and DNS went on. Two changes. First, the read is on a blocking
thread that the loop does not wait for: a read that does not finish within 200
milliseconds stays in flight, the loop goes on with the last valid secret, and
a new read starts only after the last one has finished, so a stuck read never
costs more than one thread; a read in flight for more than 5 seconds is warned
about, at most once a minute. Second, where the system allows it (inotify on
Linux, kqueue on FreeBSD and macOS) the directory of the file is watched, and
the file itself with kqueue, so that a write in place and a new file renamed
over it are seen when they happen and the file is read then, and not every
second (an event less than 100 milliseconds after the last read, or while a
read is running, is read by the next heartbeat instead, at most a second
later); it is also read every 30 seconds, for an event that was lost and for a
change made from another host to a file on a network file system. When the
watch cannot be set up or stops working, one info line says so and the file
is read every second as before; the watch is set up on a blocking thread too,
so a directory on a file system that does not answer does not stop the loop:
the file is read every heartbeat until the watch is ready. On a file system that answers, a new secret is
still applied before the next heartbeats. While a read hangs a secret change
is not seen, so a host whose file is stuck during a rotation signs and checks
with the old secret and its peers' new-secret messages are dropped as auth.
nix gets the features inotify, event and poll; no new crate. Checked in
a Debian container: fmt, clippy -D warnings and 1011 tests pass, 14 ignored
(twice in a row), including new ones for the reader (one read however many ticks pass, the warning after 5
seconds and not again within a minute, a slow read, a quick read, a read that
panics, a path changed during a read), for the watch with inotify (a write in
place, a rename over the file twice and then a write, a file created later, a
missing directory, a removed directory), for the source (a read on every tick
without a watch, a read on events and every 30 seconds with one, a changed
path, a watch that stops working) and for the loop (two hosts staying live
while a read hangs, a replaced file read at once with no read on the ticks),
and for the gap between event reads, an event during a running read, and a
watch that is slow to start. The watch tests (5) and the test of a watch that
stops working also passed on macOS (kqueue) once, after a fix: a removed
directory was not reported when the first events were only of the file. Not
verified: the kqueue watch on FreeBSD; no real hung
NFS mount; the 200 milliseconds, the 5 seconds and the 30 seconds are chosen,
not measured; the new tests were not run against the old code.

Known limits

  • The pf recipe (tests/pf/run.sh, with a real pf) and the Nagios examples
    (tests/nagios/inside.sh, and check_tcp and check_http of
    monitoring-plugins as exec checks) were run on FreeBSD 15.1-RELEASE
    (arm64, in a VM) after the changes of this release. Not tested: Nagios
    itself (only its plugins), 13.x, 14.x, poudriere, and amd64 beyond what the
    CI job covers.
  • The container check that an http check works without system CA
    certificates was run once, on Debian 13, and is not part of the test gate.
  • Everything in 0.6.0's known limits that is not listed here has not
    changed: the HAProxy 503 after a server-template slot with port 0 on
    FreeBSD, the deb and rpm tested in containers without systemd and not
    signed, the packages and the port not in any repository, no forward secrecy
    for peer messages, the ldap plugin against Active Directory only without
    a certificate, lookup throughput levelling off at about two million a second
    across threads on Linux (docs/performance.md), the
    store that a host crash can damage with [store] sync = false, and at most
    80 services announced by a host to the peer group.