Repository navigation
Breaking. Interfaces that docs/compatibility.md lists as stable and that
change in this release:
- Credential files must be regular files of bounded size. A
password_file, a RADIUSsecret_file, atls_key_file, atls_cert_file
or aca_filethat is a FIFO, a device or a directory, or larger than the
limit (64 KiB;tls_cert_fileandtls_key_file1 MiB;ca_file8 MiB),
is refused now (a directory already failed with a read error; only its
message changed). A link to a regular file still works. Details below. - A heartbeat far in the future counts as stale. Clients stop taking the
store for fresh when the host clock was set back by more than
EMFOR_MAX_STALENESS.emfor statusdoes the same with a fixed 3 s, and
its exit status is 1 now where it was 0. A lookup in such a store sees
every backend as unknown, inemfor lookupand in the client of every
language: aclosedservice givesALL_DOWN(exit status 1 ofemfor lookup) where it gave an address, and anopenservice may give a backend
that is unhealthy. Exit statuses and answers are stable interfaces. Details
below. heartbeat_age_mscan be negative. Inemfor status --jsonand in
emfor lookup --explain --json(store.heartbeat_age_ms), when the
heartbeat is later than the clock of the reader. A parser that expects a
number of at least 0 has to accept a negative one.- Rust API:
Explanation.heartbeat_age_msinemfor-clientis ani64
now (it was au64).
Upgrading.
-
libemforislibemfor.so.0.8now (it waslibemfor.so.0.7). A program
linked against the C library has to be built again, and the Python, Perl,
PHP and Go clients of this release load the new name. Install the new
library next to the old one and move the programs one by one; the old file
stays until the last one is moved. -
Upgrade every member of a peer group before setting
[peers] cipher = "aes-256-gcm": an earlier version countsEMP4asmalformed. -
A config that uses a key added here (
[log] format,[peers] cipher,
[metrics] allow, anhttpcheck'sca_file) failsemfor check-config
on an earlier version, so take it out before a downgrade. -
A reload now writes up to 51 lines about what it changed (50 and one for
the rest), and every start
and reload logs the SHA-256 of each config file it reads. -
After the upgrade,
emfor statusand/metricshave new lines and series
(clock offsets and silent checkers of peer members,emfor_clock_jumps_total). -
Three small fixes around the clock of peer members and the log, and a
threat-model note. None of them is a stable interface.- A clock offset state that ends because no measurement of the member
arrived for 10 s now logsno clock offset of peer … measured for 10 s; the clock offset state is cleared(info). It used to saywithin limits again, which is kept for a member that is back below the limit. emfor statusshowsclock of this host differs from every memberonly
when every member is off in the same direction (all ahead or all
behind). With members on both sides of this host, it lists the members one
by one.- With
[log] format = "json", theconfig file readlines of a start are
JSON, like those of a reload. Lines before the format is known (plugin
start, config errors, warnings about the config files) stay text. - docs/threat-model.md says what the clock measurement does not cover: a
recorded datagram sent again with the source address of a member from
which nothing was accepted yet can make that member look off in
monitoring. Votes are not affected.
- A clock offset state that ends because no measurement of the member
-
The daemon logs a jump of the host clock. At each heartbeat (once a
second) it compares how far the wall clock moved with how far a monotonic
clock moved; when they differ by more than 2 seconds it writes awarn
line withevent=clock_jumped,direction(forwardorbackward) and
jump_ms, andemfor_clock_jumps_totalcounts it. A busy or late tick
moves both clocks alike and is not reported. At most one line is written
every 10 seconds; every jump is still counted. The fields of this line are
not stable. Nothing else changed: the heartbeat, the store and the client's
staleness decision are the same. Chapters 12 and 16 (en and zh_TW) say how
to alert on it. Measured on FreeBSD 15.1 (arm64 VM): 6 busyyesloops and
a loopingddfor 11 minutes (about 675 ticks) gave a largest difference
of 1 ms and no line; setting the clock +30 s, -45 s (3 s later) and +15 s
(12 s later) gave three counts and two lines (forward 29.7 s, forward
15.0 s), the -45 s step being counted but not logged inside the 10 s
period. A second run stepped the clock +30 s, then -45 s 12 s later, then
+15 s 3 s after that: two lines (forward 29.1 s, backward 45.0 s) and three
counts. The same load for 10 minutes in a Debian container on Linux 7.2 (arm64,
597 ticks) also gave a largest difference of 1 ms and no line; the clock
was not stepped there, because a container shares the host's clock. Not
measured: x86-64, a host that suspends and resumes. The 2-second threshold
and the 10-second period are choices, not tuned values. -
A threat model page. New
docs/threat-model.mdsays what emfor
protects, which boundaries an attacker can reach (backends, plugins, DNS,
/metrics, the peer UDP port, local users), where each defense is and which
gaps are open;SECURITY.mdlinks to it. It comes from reading the code,
not from a penetration test. It records that the peers check the sender
against the UDP source address only, and what that allows: one member that
holds the secret cannot turn a backend down (2 of its 3 assigned checkers
must say down), two colluding members can. Nothing in the code changed. -
The manual says how to read emfor with Vector. Chapter 14 (en and
zh_TW) has a Vector section: theprometheus_scrapesource for/metrics,
and the JSON log through aremapwithparse_json!, from a file, from
the journal (journaldneeds adata_dir) or, on FreeBSD, through ased
that cuts the syslog prefix into thestdinsource. New
examples/vector/has the three configs, andtests/vector/run.shand
tests/vector/journald.sh(docker, by hand, not by the CI) ran them with
Vector 0.62.0. Vector itself was not run on FreeBSD: the 15.1 arm64
package repository has no Vector package. Nothing in emfor changed. -
The manual says how to keep emfor on some CPU cores. Chapter 12 (en and
zh_TW):CPUAffinity=in a drop-in, tried on Rocky Linux 9.9 (the daemon and
itsexecchecks follow it).docs/performance.mdreports that pinning
threads withtasksetdid not raise lookup speed. No change to the program. -
The manual says what was run for ping and SCTP checks. Chapter 6 (en and
zh_TW), "Ping and SCTP": theexecrecipes were run under the packaged unit
on Rocky Linux 9.9 and Ubuntu 24.04 (arm64, virtual machines). On Ubuntu the
pingcheck failed for every backend untilnet.ipv4.ping_group_range
included theemforgroup (runuser -u emfor -- pingworks there and is no
proof); Rocky allows every group. SCTP through a Python script worked on both,
after installingkernel-modules-extraand lifting the module blacklist on
Rocky. Use a checktimeoutlonger thanping -W. We still do not plan a
built-in ICMP or SCTP check. Not tried on x86-64 or with IPv6. -
examples/snmp/emfor-snmp-trap.shsent nothing when a service went all
down.emfor status --jsonexits 1 then (and when the daemon is stale or
stopped) but still prints the history; the script treated every non-zero
exit as a failure and stopped, so the trap for the last backend going down
came only after something recovered. It now stops only on exit 2 or no
output. Chapter 14 (en and zh_TW) now says the script and thesnmpd extend
line were run againstsnmptrapdandsnmpd5.9.3 in a Debian 12
container, that every backend sends anunknowntohealthytrap after a
daemon restart, and thatsnmpdcaches the output for 5 seconds. New
tools/snmp-test.shrepeats the run (docker, by hand, not by the CI). -
The manual says what happens under SELinux enforcing. Chapters 4, 13
and 16 (en and zh_TW): the rpm was run on Rocky Linux 9.9 (aarch64, a
virtual machine,targetedpolicy, enforcing). The daemon ran as
unconfined_service_tand, withtcp,httpandexecchecks, DNS,
/metrics, an encrypted peer group, the store and a reload, raised no AVC
denial. We do not ship a policy module: a module that confines the daemon is
extra hardening, not a need. The deb was run the same way on Ubuntu 24.04
(arm64, a virtual machine, AppArmor enabled): no profile applies to the
daemon and the kernel log has noapparmor="DENIED"line. x86-64 is still
untested. -
The manual says what
EMP3andEMP4cost. Chapter 11 (en and zh_TW),
"Choosing AES-GCM": on one arm64 machine a datagram of 150 to 500 bytes took
0.7 to 1.5 microseconds to seal or open inEMP3and 0.8 to 1.0 inEMP4
(EMP4derives a key per datagram: slightly slower for a heartbeat, about
30 % faster for 490 bytes). Newtools/bench-peer-crypto.shrepeats it;
not run on x86-64. Nothing in the daemon changed. -
The manual says when two name servers make HAProxy answer 503. Chapter
14 (en and zh_TW), row "Name servers": with two name servers that disagree
and several backends on one IP (one host, several ports), HAProxy 3.4.8
answered a few requests with 503 (a slot with port 0). Six runs of 400
requests each all had some (1 to 21 per run); six runs with a separate IP
per backend had none. HAProxy 2.8 with the same setup (three runs) and
HAProxy 3.4.8 with one name server (three runs) had none while the
backends stayed up. With one backend stopped and started every 1.5 s, one
name server was not enough when the backends share an IP: 7 runs of 100
requests had 0 to 12 requests of 503 after about 3 s each (6 runs had
some); with a separate IP per backend, 3 runs had 1 failed request each.
On FreeBSD 15.1 (HAProxy 3.4.4) the same test gave 14 to 38 requests of
503 per 100 with a shared IP and 1 to 2 with a separate IP per backend (4
runs each): the 503 that 0.6.0 listed as unexplained there is this case.
The 503s were not checked for port 0 directly. Nothing in emfor changed;
the advice to use one name server stays, with a separate IP per backend. -
Credential files must be regular files of bounded size.
emfor-check
and the TLS options of the daemon readpassword_file, a RADIUS
secret_file,tls_key_file,tls_cert_fileandca_filewithout
waiting for a writer, and refuse a FIFO, a device or a directory (a link to
a regular file is fine) and a file larger than 64 KiB (tls_cert_fileand
tls_key_file: 1 MiB;ca_file: 8 MiB). Before, a path pointed at a FIFO
stopped the thread that read it. Compatibility: systemdLoadCredential,
Docker secrets and Kubernetes secrets end up as regular files, so none of
them is affected as far as we know (not tried on each). A Debian
ca-certificates.crtis 224019 bytes, far below the limit. The daemon's
[peers] secret_fileshares the same code; its checks and messages are
unchanged. The mode of these files is still only a warning; their owner is not checked. -
A peer secret rotation is logged with a stable line. When the content of
[peers] secret_filechanges (no reload needed), the daemon logs oneinfo
line withchange=peers_secret_rotatedandsecret_file=<path>; the message
text is unchanged. It never holds the secret or a hash of it. Chapters 11 and
12 (en and zh_TW) describe it. -
How to scrape
/metricsover TLS./metricsstill has no TLS of its
own. Chapter 12 (en and zh_TW) has a section "Metrics over TLS":listen
stays on loopback, nginx in front terminates TLS and asks the scraper for a
certificate, and Prometheus usestls_config. Chapter 13 and
docs/deploy/daemon.mdpoint to it.tools/metrics-proxy-test.shtries the
recipe in a container with nginx and a throwaway CA; Prometheus, HAProxy and
stunnel were not tried. -
The repository has a Nix flake. It builds
emfor(the daemon and
emfor-check) andlibemfor, and its NixOS moduleservices.emforwrites
emfor.tomlfrom Nix settings and runs the daemon under the hardened unit of
the deb and rpm packages. Chapter 4 (en and zh_TW) has a Nix section. Built
and tested in a container on aarch64 Linux; not started on a NixOS machine. -
A peer member whose clock is off is now shown before its messages are
dropped. The daemon measures, from every message of a member that passes
the checks up tosite(also one dropped asstale), the member's
timestamp minus its own clock. When the last three messages are all at
least 2 seconds off in one direction,emfor statushas a linepeers: clock of <member> is <n.n> s behind this host(orahead of; one line
about this host when every member of a group of three or more differs),
emfor status --jsonhaspeers.clock_offsets, and the log has awarn
and later aninfo. New metricemfor_peer_clock_offset_seconds{peer}
(seconds, negative when the member is behind) for every measured member. The
5 second limit, the votes and the protocol are unchanged. Chapters 11, 12
and 16 (en and zh_TW) say so;tools/peer-clock-test.shchecks it with
three containers and libfaketime. -
The manual says what to do with several data centres. Chapter 11
("Several data centres", en and zh_TW): one peer group per data centre, each
with its ownsite, members and secret; why members of two sites do not
belong in one group (single datagrams, 3-second liveness, 5-second clock
limit); how backends in another data centre are checked and preferred.
Newtools/peer-wan-test.sh(run by hand in docker) measured it: a delay of
1.5 s ± 0.5 s or 30 % loss on the peer messages did not make members leave;
50 % loss did, for 6 of 60 seconds. -
The FreeBSD port is in the ports tree.
net-mgmt/emfor(0.7.1) is now
part of the FreeBSD ports tree. Chapters 1 and 4 (en and zh_TW) say
pkg install emforormake -C /usr/ports/net-mgmt/emfor install clean, and
callpackages/freebsd/a copy of the port. RELEASING.md adds the step of
sending each new version to the ports tree. -
The manual says how big the store gets, from a measurement. New
tools/scale-test.sh(run by hand in docker, not by the CI) starts up to
8,000tcpbackends in 80 services and reports the store size, memory, CPU
and the time to switch. Chapter 12 ("Sizing the store") has the table and a
rule: 6 KB per backend,map_sizeat least twice that; the default 64 MiB
fits about 5,000 backends. Nothing in the daemon changed. -
A peer member that sends no results is now shown. When a member is an
assigned checker of a backend, is live and does not leave the service out,
but sends no fresh result for it (it lacks the service or the backend, its
check keeps givingerror, or its packets do not arrive), the other members
now report it after 10 seconds or 6 intervals of the service, whichever is
longer: a linepeers: no results from <member> for <service> (<n> backends)
inemfor status,peers.silent_checkersinemfor status --json, the
metricemfor_peer_silent_checkers, and awarnand aninfolog line.
Nothing changes in the votes or on the wire. Chapter 11 ("When members
differ", "Silent checkers"), chapter 12 and chapter 16 say so, and
tools/peer-mismatch-test.shruns three members in docker to check it. -
The rpm has a test under systemd, and RHEL 8 is stated as unsupported.
Newtools/rpm-release-test.sh(run before a release, not by the CI) starts
Rocky Linux 9 with systemd as PID 1 in docker and checks install, start,
reload, stop,rpm -V, removal, reinstall, and with the previous rpm an
upgrade and a downgrade. RELEASING.md says how to run it. The rpm and the
deb do not run on RHEL 8 (glibc 2.28; the binary needs 2.30): the manual
(chapter 4) andpackages/README.mdnow say so, and list what was tested. -
The log can be JSON, and the fields of a state change are stable. New
[log] format = "json"(default"text") writes one JSON object per line
once the daemon has started with it (the lines before that, such as plugin
start lines, config errors and the warnings about the config files, are
text), with the fields of the event at the top level and
timestamp,level,targetandmessage. A reload that changesformat
is rejected like any restart-only setting. The state change line gains
event=backend_state_changed(also in text, at the end of the line), and
event,service,backend,from,to,reasonand the JSON
timestampandlevelare now stable. Chapter 14 says why emfor has no SNMP
or hook, and has an example script (examples/snmp/emfor-snmp-trap.sh; the
entry on what was run is above) and net-snmpextend; chapter 12 describes the
historyofemfor status --json. New cratetracing-serde. -
Peer messages can use AES-256-GCM (
EMP4). New[peers] cipher
("chacha20-poly1305", the default, changes nothing;"aes-256-gcm"
sendsEMP4to every member; it needsencrypt = trueand is reloadable).
The nonce is a counter that restarts with each daemon start, under a key
derived per start. Every daemon readsEMP4; an earlier version counts it
asmalformed, so upgrade all members before settingcipher. The audit
log gainsfield=cipher. Chapter 13 has a FIPS section that says
emfor has no FIPS mode: this is a different cipher, not a validated
module. -
The manual shows how to check ping and SCTP with
exec. emfor has no
ICMP or SCTP checker; chapter 6 gives a wrapper script forping(with
what the unit's sandbox andnet.ipv4.ping_group_rangemean for it) and
describes what an SCTP check program needs. The entry above says what was
run. No code change. -
The manual says which releases get fixes. Only the latest one, with no
backports before 1.0, no support contract and no promised response time
(chapter 15). No code change. -
The manual says where emfor stands on SELinux and AppArmor. emfor ships
no policy; the entry above says what was run under SELinux enforcing and
AppArmor. Chapter 13
lists what the daemon reads, writes, listens on and starts, for anyone who
writes a policy; chapter 16 has a short way to find a denial. No code
change. -
emfor statusno longer calls an empty store a version problem. A store
the daemon never wrote to (it exited at start, for example because the DNS
port was taken) givesstore is empty: the daemon has not written to it yet; if it should be running, check its loginstead ofstore format version (missing). A store with a heartbeat or services but no version keeps the
old message. -
A reload logs what it changed. After an accepted reload the log has one
line per difference (services and backends added, removed or changed,
drain, a changed check definition by digest only, peer group settings),
at most 50 per reload and then one line for the rest, beforeconfig reloaded. A change ofsite, of[dns], of[log] levelor a whole
[peers]table added or removed has no line. The daemon also logs the
SHA-256 of every config file it reads, at start and at each reload, with or
withoutinclude_dir. Field names (change,service,backend, ...) are
stable; the wording is not. Check options and secrets are never logged. The
log cannot say who changed the files: use auditd for that. -
[metrics] allowlimits who can read/metrics. A list of networks
("10.0.0.0/8","fd00::/8"); a connection from any other source gets
403 Forbiddenand no metrics. Loopback is not exempt onceallowis set.
Withoutallownothing changes, except a warning at start and after a
reload whenlistenhas a non-loopback address andallowis not set. A changedallowneeds a
restart. -
httpchecks take aca_file. For a server whose certificate a private
CA signed, setca_fileto the CA's PEM file instead of installing it
system-wide or turning offtls_verify. Only that file is trusted, not the
system's CA certificates, as with the other checks that have aca_file.
A replaced file takes effect at the next check without a reload. -
The manual says how far peer clocks may differ. A peer message whose
timestamp is more than 5 seconds from the receiver's clock, in either
direction, is dropped asstale; chapters 11 and 16 now say so. No code
change. -
A heartbeat far in the future counts as stale. When the clock of the
host is set back by more thanEMFOR_MAX_STALENESS(3 s by default) and
the daemon then stops writing, clients no longer take the store for fresh
until the clock catches up; a lookup sees every backend as unknown, so
on_all_downdecides (closed:ALL_DOWN, exit status 1 ofemfor lookup;
open: every backend, healthy or not).emfor statusapplies the same rule with a
fixed limit of 3 s (it does not readEMFOR_MAX_STALENESS) and exits with 1
in that case, where it exited with 0 before. With a live daemon the
clients see a stale store for up to about a second, until its next
heartbeat.emfor statussaysheartbeat <age> in the future, and
heartbeat_age_msin--jsonis negative in that case. -
emfor lookup --explainagrees (without--dns;--dnsexplains the
DNS server, which still takes a future heartbeat for fresh). For a heartbeat later than now it says
heartbeat <age> in the futureand, when that is stale,the heartbeat is more than <max> ahead of the clock, instead of an age of 0 that is
"older than" the limit;store.heartbeat_age_msin--jsonis negative.
In the Rust crateExplanation.heartbeat_age_msis now ani64(it was a
u64).