fix: a paired replica asks the other member for Anubis's key (common#56) #187

Merged
navigator merged 3 commits from fix/anubis-key-from-the-pair-common56 into main 2026-10-16 10:41:30 -03:00
Owner

Fixes Keel-Linux/common#56. Based on main after #185.

On a pair, keel-overlay-anubis-key.service makes no key on the database replica: the key is shared and comes from the primary (decision 0041, shared: true). Nothing copied it, so anubis@keel did not start on the replica, and the apply failed the anubis overlay. The LNMP and LNPP pair tests copied the key by hand.

What changes:

  • The secret message of the members' channel gives a second name, anubis/signing_key. It is answered with /etc/anubis/keel.key, only to the other member of the pair record, as the replication credential is (keel.mesh.vipserve.shared).
  • keel.system.anubiskey: on the live system, in a run that may change the machine, a node whose spec makes it a database replica, with Anubis enabled, no key file and no secrets.anubis_signing_key, asks the other member of its pair. The plan writes the key with mode 0600 before the overlay's units start. The key unit then finds the key and leaves it. The key is not in the plan's output.
  • Before the pair record exists, the apply starts nothing for Anubis and says why. So the first boot of a replica does not fail the overlay.
  • A key that is there is never replaced. While the primary has no key yet or does not answer, the apply starts nothing for Anubis, says why, and a later apply asks again. An answer that is no key refuses the step. A link whose target is gone is removed before the write.
  • docs/replication.md says it, for both engines.

Tests: tests/test_system_anubiskey.py (the channel: the other member gets the key, a member outside the pair does not, a holder with no key, an answer that is no key, a key through a link; the observation: asks, waits, refuses, asks nothing in a dry run) and tests/test_system_appliance.py (the write comes before the start, a waiting replica starts nothing, a problem refuses). The real-node proof is the cross-site test of LNMP and LNPP 19.0-3.

keel 0.23.34.

Fixes Keel-Linux/common#56. Based on main after #185. On a pair, `keel-overlay-anubis-key.service` makes no key on the database replica: the key is shared and comes from the primary (decision 0041, `shared: true`). Nothing copied it, so `anubis@keel` did not start on the replica, and the apply failed the anubis overlay. The LNMP and LNPP pair tests copied the key by hand. What changes: - The `secret` message of the members' channel gives a second name, `anubis/signing_key`. It is answered with `/etc/anubis/keel.key`, only to the other member of the pair record, as the replication credential is (`keel.mesh.vipserve.shared`). - `keel.system.anubiskey`: on the live system, in a run that may change the machine, a node whose spec makes it a database replica, with Anubis enabled, no key file and no `secrets.anubis_signing_key`, asks the other member of its pair. The plan writes the key with mode 0600 before the overlay's units start. The key unit then finds the key and leaves it. The key is not in the plan's output. - Before the pair record exists, the apply starts nothing for Anubis and says why. So the first boot of a replica does not fail the overlay. - A key that is there is never replaced. While the primary has no key yet or does not answer, the apply starts nothing for Anubis, says why, and a later apply asks again. An answer that is no key refuses the step. A link whose target is gone is removed before the write. - `docs/replication.md` says it, for both engines. Tests: `tests/test_system_anubiskey.py` (the channel: the other member gets the key, a member outside the pair does not, a holder with no key, an answer that is no key, a key through a link; the observation: asks, waits, refuses, asks nothing in a dry run) and `tests/test_system_appliance.py` (the write comes before the start, a waiting replica starts nothing, a problem refuses). The real-node proof is the cross-site test of LNMP and LNPP 19.0-3. keel 0.23.34.
The reseed probe sums pg_database_size() over every database as the
role repl. That function needs CONNECT on the database. The keel-lnpp
check database revoked CONNECT from PUBLIC, and every reseed of the
LNPP pair refused: "permission denied for database keel_check".

The netns test of the pair now revokes CONNECT on the shop database
from PUBLIC before case (d), as the check database did. The unit tests
ask that the probe measures only the databases repl may connect to,
and that a refusal for lack of space names the databases it left out.
pg_database_size() needs CONNECT on the database or the role
pg_read_all_stats. An application database with REVOKE CONNECT FROM
PUBLIC stopped every reseed with "permission denied".

The probe now sums the size with a FILTER on
has_database_privilege(oid, 'CONNECT') and counts the databases it
leaves out. The free space check uses the size it has. When the check
refuses, the message says how many databases the need leaves out. The
base backup itself is not changed: it copies the whole cluster.

pg_read_all_stats is not granted to repl: it gives more read access
than the reseed needs.
chore: keel 0.23.33 (keel#183)
All checks were successful
tests / etcd (pull_request) Successful in 6m27s
tests / postgres (pull_request) Successful in 11m17s
tests / vip (pull_request) Successful in 7m14s
tests / mesh (pull_request) Successful in 11m7s
tests / etcd-auth (pull_request) Successful in 5m7s
tests / package (pull_request) Successful in 8s
tests / vip-upgrade (pull_request) Successful in 7m41s
tests / mariadb-simple (pull_request) Successful in 5m16s
tests / mariadb (pull_request) Successful in 7m12s
tests / tests (pull_request) Successful in 18m41s
security / security (pull_request) Successful in 1m35s
a6271bbc9b
On a pair, keel-overlay-anubis-key.service makes no key on the database
replica: the key is shared and comes from the primary (decision 0041).
Nothing copied it, so anubis@keel did not start there, and the apply
failed the anubis overlay. The LNMP and LNPP pair tests copied the key
by hand (Keel-Linux/common#56).

The tests ask that the other member of the pair record, and no other
member, gets the key over the members' channel; that a paired replica
with no key asks for it in a run that may change the machine, and
writes it with mode 0600 before Anubis starts; that a replica in no
pair yet starts nothing and says why; and that an unreachable primary
refuses the step.
The secret message of the members' channel gives a second name,
anubis/signing_key, answered with /etc/anubis/keel.key only to the
other member of the pair record, as the replication credential is.

keel.system.anubiskey observes, on the live system and only in a run
that may change the machine, a node whose spec makes it a database
replica, with Anubis enabled, no key file and no
secrets.anubis_signing_key declared. It asks the other member of its
pair, and the plan writes the key (mode 0600) before the overlay's
units start. The key unit then finds the key and leaves it.

Before the pair record exists, the apply starts nothing for Anubis and
says why, so the first boot of a replica no longer fails the overlay. A
key that is there is never replaced.
chore: keel 0.23.34 (common#56)
Some checks are pending
security / security (pull_request) Waiting to run
tests / tests (pull_request) Waiting to run
tests / mesh (pull_request) Waiting to run
tests / etcd (pull_request) Waiting to run
tests / mariadb-simple (pull_request) Waiting to run
tests / postgres (pull_request) Waiting to run
tests / package (pull_request) Waiting to run
tests / vip (pull_request) Waiting to run
tests / vip-upgrade (pull_request) Waiting to run
tests / etcd-auth (pull_request) Waiting to run
tests / mariadb (pull_request) Waiting to run
240512d44c
navigator force-pushed fix/anubis-key-from-the-pair-common56 from 240512d44c
Some checks are pending
security / security (pull_request) Waiting to run
tests / tests (pull_request) Waiting to run
tests / mesh (pull_request) Waiting to run
tests / etcd (pull_request) Waiting to run
tests / mariadb-simple (pull_request) Waiting to run
tests / postgres (pull_request) Waiting to run
tests / package (pull_request) Waiting to run
tests / vip (pull_request) Waiting to run
tests / vip-upgrade (pull_request) Waiting to run
tests / etcd-auth (pull_request) Waiting to run
tests / mariadb (pull_request) Waiting to run
to 8fc10142ee
Some checks failed
tests / mesh (pull_request) Successful in 11m45s
tests / vip (pull_request) Successful in 7m5s
tests / tests (pull_request) Has been cancelled
security / security (pull_request) Failing after 1m40s
tests / vip-upgrade (pull_request) Has been cancelled
tests / etcd-auth (pull_request) Has been cancelled
tests / mariadb (pull_request) Has been cancelled
tests / package (pull_request) Has been cancelled
tests / mariadb-simple (pull_request) Has been cancelled
tests / postgres (pull_request) Has been cancelled
tests / etcd (pull_request) Successful in 7m8s
2026-10-16 07:16:00 -03:00
Compare
navigator force-pushed fix/anubis-key-from-the-pair-common56 from 8fc10142ee
Some checks failed
tests / mesh (pull_request) Successful in 11m45s
tests / vip (pull_request) Successful in 7m5s
tests / tests (pull_request) Has been cancelled
security / security (pull_request) Failing after 1m40s
tests / vip-upgrade (pull_request) Has been cancelled
tests / etcd-auth (pull_request) Has been cancelled
tests / mariadb (pull_request) Has been cancelled
tests / package (pull_request) Has been cancelled
tests / mariadb-simple (pull_request) Has been cancelled
tests / postgres (pull_request) Has been cancelled
tests / etcd (pull_request) Successful in 7m8s
to e1beb9c4cf
Some checks failed
tests / mariadb (pull_request) Successful in 6m25s
tests / tests (pull_request) Successful in 20m55s
tests / postgres (pull_request) Successful in 10m36s
security / security (pull_request) Successful in 1m52s
tests / etcd (pull_request) Failing after 7m1s
tests / vip (pull_request) Successful in 7m3s
tests / mesh (pull_request) Successful in 11m49s
tests / etcd-auth (pull_request) Successful in 5m36s
tests / package (pull_request) Successful in 10s
tests / vip-upgrade (pull_request) Successful in 8m20s
tests / mariadb-simple (pull_request) Successful in 4m52s
2026-10-16 07:54:58 -03:00
Compare
navigator force-pushed fix/anubis-key-from-the-pair-common56 from e1beb9c4cf
Some checks failed
tests / mariadb (pull_request) Successful in 6m25s
tests / tests (pull_request) Successful in 20m55s
tests / postgres (pull_request) Successful in 10m36s
security / security (pull_request) Successful in 1m52s
tests / etcd (pull_request) Failing after 7m1s
tests / vip (pull_request) Successful in 7m3s
tests / mesh (pull_request) Successful in 11m49s
tests / etcd-auth (pull_request) Successful in 5m36s
tests / package (pull_request) Successful in 10s
tests / vip-upgrade (pull_request) Successful in 8m20s
tests / mariadb-simple (pull_request) Successful in 4m52s
to 5adbb9dc61
All checks were successful
tests / vip (pull_request) Successful in 6m48s
tests / mesh (pull_request) Successful in 11m14s
tests / vip-upgrade (pull_request) Successful in 7m40s
tests / package (pull_request) Successful in 9s
tests / etcd-auth (pull_request) Successful in 5m32s
tests / mariadb-simple (pull_request) Successful in 4m58s
tests / mariadb (pull_request) Successful in 6m8s
tests / tests (pull_request) Successful in 19m37s
security / security (pull_request) Successful in 1m29s
tests / postgres (pull_request) Successful in 11m16s
tests / etcd (pull_request) Successful in 6m42s
2026-10-16 10:04:19 -03:00
Compare
Sign in to join this conversation.
No description provided.