Shaker and routing: certificates and traffic for your load balancers
Salt can issue wildcard certificates (certificates.md)
and deliver them, together with a routing table, backends and a generated
HAProxy configuration, to the load balancers that serve your hosts. The load
balancer runs Shaker, a small agent (HAProxy first). It enrols with Salt,
keeps one outgoing WebSocket open, receives signed and encrypted envelopes,
applies them, and reports what it applied. Salt never talks to the load
balancer itself, and a load balancer keeps serving from its own disk when Salt
is away. The wire contract is version 1 in
docs/suite/plans/salt-certificates-build.md (section 3) in the product
repository; this page is the operator's view of the whole feature.
The two switches
| Variable | Turns on |
|---|---|
SALT_DNS_CERTIFICATES=on | The certificate module: providers, wildcard certificates, renewal, the store (certificates.md). |
SALT_DNS_SHAKER=on | Delivery: proxy groups, backends, routes, nodes, the Shaker socket and enrolment, the Routing pages, /api/v1/proxy, the delivery metrics. Needs SALT_DNS_CERTIFICATES=on: Salt refuses to boot with a message otherwise. |
Both are off by default. While SALT_DNS_SHAKER is off, POST /shaker/v1/enrol
and GET /shaker/v1/socket answer 404, no Shaker process starts, the menu
has no Routing entry and /api/v1/proxy answers 404.
Set-up from zero
- Switch the modules on (environment of every replica) and restart:
SALT_DNS_CERTIFICATES=onwith its store settings,SALT_DNS_SHAKER=on, andSALT_DNS_SHAKER_URL=https://salt.example.org(the address the load balancers reach Salt on). - Add a provider and register its account: Providers in the console, or
bin/salt_dns eval 'SaltDns.Release.certificate_provider("main", "https://acme.example/directory", contact: "ops@example.org")'. - Request a certificate (Certificates, "Request a certificate"). Salt answers the DNS-01 challenge in its own zone. "For a zone" covers the zone and everything directly below it; "Custom" is one host at any depth inside one of your zones, with or without the wildcard below it (certificates.md).
- Create a proxy group (Routing, "New proxy group"; for example
edge). A group is the set of load balancers that serve the same hosts. - Add a backend: a name and its servers, one per line,
name address:portandcheckif HAProxy should health-check it. For examples1 10.0.0.5:3000 check. Or tick Local backend: it has a name and no servers and is defined in your own HAProxy file (see "Local backends" below). - Add routes: a host (
shop.example.org, or*.example.orgfor every name below it) and the backend it goes to. Salt shows next to each route the certificate that covers it, or no certificate: visitors to that host would get a TLS error. Such a route is allowed (the certificate may still be coming) but the console and the API flag it. Use "Which backend would this host get?" to check a name. - Install Shaker on the load-balancer host (its README: user and group,
binary,
shaker.toml; HAProxy 3.4 with the generated configuration). - Enrol it. On a host that can reach Salt: create an enrolment token on
the group page ("Create enrolment token", shown once), then
sudo -u shaker shaker enrol --url https://salt.example.org --token <token>. Shaker prints the fingerprints of its two public keys; compare them with the ones on the node's row before you trust it. Thensystemctl enable --now shaker. - The very first load balancer cannot reach Salt if Salt is served
through it. Use the offline path (Bootstrapping):
shaker init, a bootstrap file from a Salt host,shaker bootstrap. The certificate and routes are on disk before any connection, and HAProxy can start; the node connects later. - Watch it. The group page shows each node: connected or not, the generation it applied against the group's, the serial of each certificate it serves against the one expected, errors from its last status.
How a change reaches a node
Every group has a generation, an integer that goes up in the database on every change that affects what a node must hold: a route, backend or setting changed, a certificate attached or detached, a new version of a certificate the group serves. After the change Salt tells the group's connected nodes; each fetches its state (a node that is away gets it when it connects). The node applies the state and reports the generation it reached. A node whose number equals the group's is current.
Which certificates a group serves: every live certificate of the organisation
with a current version that covers at least one route host of the group, plus
every certificate you attach to the group by hand, whether or not a route uses
it (the attached certificate may belong to a direct child organisation of the group's, see
certificates.md; Shaker writes each one and puts it in the certificate list, so your own
HAProxy configuration can rely on it). A certificate covers a host by its own names,
never by its zone: an exact name, or *.base for a host exactly one label below
base; a *.base route is covered by a certificate that lists *.base. Where several
certificates cover a route host, the console and the API show the one with the exact
name first, then the first that covers it by a wildcard. Attaching is in the console
and in the API (PUT and DELETE /api/v1/proxy/groups/{group}/certificates/{id},
GET .../certificates lists what the group delivers). A disabled certificate is not
delivered even when attached. Several replicas may see the same renewal; the
generation is raised once.
Local backends
A backend marked local (the checkbox in the console, "local": true in the API)
has a name and no servers. It is defined in the operator's own HAProxy file, the
second one next to Salt's (/etc/haproxy/conf.d), not by Salt: Salt does not render it
into the generated configuration and Shaker does not create, change or delete it on
the socket. Routes and the default backend may point at it. In the state it is
{"name": "mine", "mode": "http", "local": true}. Shaker checks that a backend of that
name exists in the running HAProxy and reports local backend not found in HAProxy
otherwise (the route is still written). Start your backend with from salt_http (the
defaults section Salt writes) to avoid HAProxy's warning about implicit defaults:
backend mine from salt_http
server app 127.0.0.1:9000Saving an existing backend as local clears its servers; servers on a local backend are refused. The wire format of other backends does not change, so Shaker 0.1.0 still reads every state of a group that has no local backend.
The configuration Shaker writes is generated per node from what the node
reports: the socket group (a number renders gid <n>, a name group <name>)
and whether it runs in a container. Outside a container HAProxy is told to
drop privileges to the group's run_user and run_group (default haproxy).
Timeouts. The generated defaults section sets timeout connect 5s,
timeout client 10m, timeout server 10m and timeout http-request 10s. The long
client and server timeouts let a large upload through: HAProxy cuts a request that
is idle for that long on either side, and a backend that writes a big file to
storage before it answers is idle on the server side for a while. The short connect
and request-header timeouts still cut slow openers. The values are the defaults of
SaltDns.Proxy.HaproxyConfig; SaltDns.Proxy.State.build/1 passes a timeouts
map (connect, client, server, http_request) through to it, so a group can be
tuned without a code change once its input carries one.
HTTP-01 challenges: certificates for hosts outside your zones
A customer can keep the DNS of their domain elsewhere and point a name at your load balancers with a CNAME. Salt then gets and renews the certificate for that host with the HTTP-01 challenge (certificates.md), and the load balancers answer the challenge themselves.
The group setting (off by default, nothing changes for a group that leaves it
off): http01_enabled and http01_provider_id (console: Settings of the group;
API: PATCH /api/v1/proxy/groups/{group}). The provider must be one the organisation
may use, with a registered account, and one group answers for one provider: the
rule below carries that account's thumbprint. The provider must belong to the group's organisation
(a provider shared by the installation needs SALT_DNS_CERT_HTTP01_SHARED_PROVIDERS=on, see
configuration.md). A certificate for an external host
through the group is ordered at that provider, and an HTTP-01 certificate on a group
whose provider differs is refused. Changing the setting raises the generation like
any other, and Shaker reloads the configuration as it does for any change of the file.
How it works. The key authorisation of an HTTP-01 challenge is
<token>.<thumbprint of the ACME account key> (RFC 8555, section 8.1). The thumbprint
(RFC 7638: SHA-256 of the account's public key members, base64url) is the same for
every challenge of an account, so a load balancer that knows it can answer any challenge
without being told a token. Salt computes it from the account key it already holds for
the provider and writes one rule into the plain-HTTP frontend of the generated
configuration, before the redirect:
frontend salt_http_redirect from salt_http
bind :::80 v4v6
http-request return status 200 content-type text/plain lf-string "%[path,field(-1,/)].<thumbprint>\n" if { path_reg ^/[.]well-known/acme-challenge/[A-Za-z0-9_-]+$ }
http-request redirect scheme https code 301The token is the last path segment, and it is only answered when it has the characters a
token has (base64url), so nothing else is echoed. Every other request on port 80 is
redirected as before. Without the setting the file is byte for byte what it was. The
rule is part of the configuration Salt already renders and sends as a whole, so Shaker
needs no change and is told no tokens. Shaker sees a changed frontend section like any other change of the file: it checks the file with the node's check_command, installs it and makes one reload (C13 of the
Shaker protocol). Proven against HAProxy 3.4 (the integration
test haproxy_integration_test.exs starts a container with the rendered file and asks
for the challenge path).
Security. Answering with the thumbprint lets nobody else obtain a certificate. A
provider issues for a host only to an account that completes an order, which needs the
account key, and that key never leaves Salt's encrypted store. The thumbprint is a hash
of the public key: it is not secret, and it shows only that the group uses that account.
What it does mean: the load balancers of the group answer the challenge path
(/.well-known/acme-challenge/<token>) for every host that reaches them on port 80,
whether or not Salt has a certificate for that host, and before routing and any backend.
So do not switch it on for a group whose backends must serve that path themselves (for
example another ACME client, or a customer's own HTTP-01, behind the load balancer): the
load balancer answers first, and that cannot work while the setting is on.
Certificates of the group. A certificate of kind external belongs to the group and is served by it without being attached by hand. The route for its host must exist before the certificate is ordered, and a host in no zone can be routed by one group only (first come). No address record is kept for such a route (address names are the names in your zones).
Address records and health: one address per load balancer
When several load balancers serve the same names, Salt can be the one that keeps their addresses in the DNS and takes a dead one out. Each node of a group has public addresses; every served name gets an A record set (and an AAAA record set) with one address per node; when a node is unhealthy its addresses leave the answers, and when it has recovered they come back. It is off for every group until you switch it on.
Turning it on
- Give each node its public addresses (group page, node, "Public addresses";
API
PUT /proxy/groups/{group}/nodes/{id}/addresses). IPv4, IPv6 or both, at most eight. They must be public addresses, with the same rule as the addresses of secondaries (SaltDns.AddressFilter, including its allowlist for private ranges). The address a node connected from is shown as a suggestion and is never published unless you add it. It is the client address behind the reverse proxy in front of Salt (SALT_DNS_TRUSTED_PROXIESandSALT_DNS_CLIENT_IP_HEADER, the same handling as the REST API), shown as plain IPv4 when the listener reports::ffff:a.b.c.d; a private or loopback address (the proxy's own) is never kept as a suggestion. - Check the node's health on the group page. Checks start as soon as a node has an address, even while the feature is off, so you can see them first.
- Switch on Manage addresses in the group's settings (or
PATCH /proxy/groups/{group}with{"manage_addresses": true}).
Switching it off removes the records the feature wrote, and only those.
The names
The address names of a group are every route host that lies inside a zone of
the organisation (a wildcard route *.x.example.org is the record
*.x.example.org), except routes marked "do not publish address records", plus
extra names you add for sites that have no route in Salt (console, or
PUT /proxy/groups/{group}/extra-names/{name}; the name must lie inside a zone
of the organisation). The apex of a zone is allowed. A name below a delegation
inside the zone (an NS record set under the apex) is refused. The record sets
of a name hold the addresses of the nodes currently in the answer, with the
TTL of the group (default 60 seconds, at least 30).
Writes go through the same path as the API, with the audit source proxy
("Load balancer addresses" in the zone's audit trail), so serials, DNSSEC
signing and the edges follow as for any change. One transaction per zone.
What Salt never touches. A name that already has an A, AAAA or CNAME record
set that the feature did not write is a conflict: it is shown in the
console and in GET /proxy/groups/{group}/addresses with what is there, and it
is never overwritten, merged or removed. The feature remembers what it wrote in
the table proxy_published_records (zone, name, type, group, and the records
written); a record set counts as its own only while its records are still
exactly those, so a set you edit afterwards is yours. When a route or an extra
name is removed, a route is marked not to publish, or the setting is switched
off, only the feature's own record sets are removed.
How a node is judged
A node is healthy when all three signals hold:
| Signal | Holds when |
|---|---|
connected | the node's Shaker has a connection to Salt now (any replica). |
status | its last signed status is ok, reports software.running true, and is younger than 20 minutes (Shaker sends a heartbeat at least every 15 minutes, and a status whenever something changes). |
probe | Salt can open a TCP connection to port 443 on each published address of the node and complete a TLS handshake within 5 seconds. The handshake uses a name the group serves as server name when there is one; any certificate counts, the chain is not validated. |
Addresses of an address family Salt's own host cannot reach are left out of the probe (see "An address family Salt cannot probe" below).
The probe runs from the Salt replica that holds the cluster leader lease (the only replica when there is no cluster), for each node every 20 seconds. The console shows the three signals separately.
Each node has a state: in or out. After 3 unhealthy checks in a row an
in node becomes out; after 6 healthy checks in a row an out node
becomes in. One check of the other kind starts the count again, which keeps a
flapping node from flapping in the answers. An operator can drain a node
(out, and it stays out whatever the checks say) and return it to
automatic. Every change is an event in proxy_changes (who or what, why,
the evidence of the last checks) and is shown on the group page.
Thresholds, the interval, the TTL and the status age are group settings:
| Setting | Default | Meaning |
|---|---|---|
manage_addresses | off | Publish the addresses and take unhealthy nodes out. |
address_ttl | 60 | TTL of the records, seconds (30 to 3600). Below the organisation's own minimum on purpose. |
probe_interval | 20 | Seconds between checks of a node. |
fail_threshold | 3 | Unhealthy checks in a row before a node leaves. |
recover_threshold | 6 | Healthy checks in a row before it returns. |
status_max_age | 1200 | How old the last signed status may be, seconds. |
Never an empty answer
An empty answer is certain failure; a possibly wrong one is not. So:
- If the rule would leave a name without any address of a family (A or AAAA)
because every node that has one is out, the addresses of all nodes that
are not drained are kept for that family. The group page shows "No node is
healthy" and the gauge
salt_dns_proxy_group_kept_all_addressesis 1. - If every node is drained by an operator, the last published set stays and
the page shows a loud warning (
salt_dns_proxy_group_all_nodes_drained). - If the prober cannot judge, nothing changes. When, across all groups, every
probe from the checking replica fails for every node (two or more nodes, none
succeeded), the fault is more probably that replica's own network than every
load balancer. The round changes no counter and no state, an event
prober_blindis written once, andsalt_dns_proxy_group_prober_blindis 1 until a probe succeeds.
An address family Salt cannot probe
Salt may run where there is no IPv6 (or no IPv4): in a container without IPv6,
connect to a node's IPv6 address fails at once with enetunreach while the
node answers the world on IPv6. Counting that as a failed probe would take every
node out. Each address therefore has three outcomes: ok, failed, and not
checkable from here. The rule (SaltDns.Proxy.Families), from the inet
error atoms:
eafnosupport(family not supported) andeaddrnotavail(no local address of that family) can only come from Salt's own host: always local.enetunreachandehostunreachare local only when they come back within a second (a host with no route answers in microseconds; a router on the way answers after a round trip, and for one dead host that is a failure).- Everything else (timeout, refused, reset, failed handshake, no certificate) is a failure: the packet left Salt.
- A family is not checkable for a group when, in one round, every address of
that family probed for the group's nodes is local, and either the error is one
of the always-local kind or
enetunreach, or at least two different addresses give a quickehostunreach. A single address withehostunreachis that node's failure; one ok address makes the family checkable.
A node's probe signal is healthy when every address that could be checked is ok
and at least one could be checked. The addresses of a family that is not
checkable are neither a failure nor a proof, and follow the node's state decided
by the other signals and the checkable addresses: they are published while the
node is in, and leave with its IPv4 when its IPv4 fails. A node none of whose
addresses can be checked has a bad probe signal ("no address of the node could
be checked from Salt's host"). When no family can be checked for a group, that is
the "prober cannot judge" case for that group: nothing changes, prober_blind.
The group page shows "IPv6 is not checked: Salt's own host has no IPv6 route"
(same for IPv4); the API has unchecked_families; the gauge
salt_dns_proxy_family_unchecked{organisation,group,family} is 1; an event
family_unchecked / family_checked is written when it changes. The alert
SaltDnsProxyFamilyUnchecked (info) fires after 10 minutes. Giving Salt a
route for the family makes the next round check those addresses.
What a visitor sees, and for how long
A node that stops answering is out of the answers after about 3 checks of 20 seconds (a minute, plus up to a few seconds to notice), and the records change at once; resolvers then hold the old answer for up to the TTL (60 seconds by default). Allow about two minutes from the failure until most visitors are sent elsewhere. A load balancer in front reacts in seconds; this is the price of not depending on one. Coming back takes 6 good checks (2 minutes) and the TTL.
Measured once, on the authors' production installation with two load balancers, on 13 November 2026: 48 seconds after HAProxy was stopped on one, both edge nameservers answered with the other address only, and six public HTTPS requests in a row succeeded. 138 seconds after HAProxy was started again, both addresses were back in the answers. The 48 seconds is shorter than the rule's minute because the stop fell just before a check. It is one run, not a distribution.
Limits
- The checks run from Salt's own network. A fault that cuts all load balancers off from the internet but not from Salt is not seen: the probe still succeeds. Probes from outside (the edge servers, once Shaker runs there) would close this.
- Resolvers that ignore short lifetimes keep a dead address for longer than the TTL; a few visitors see it until their resolver asks again.
- A customer whose DNS is elsewhere and who copied the addresses into their
own zone is not protected: Salt cannot remove what it does not serve. Such a
customer should point a name at a name in Salt with a CNAME (which works for
wwwandshop, not for the bare domain), or move the zone to Salt. - The safeguard works per address family: when the only node with an IPv6 address is out, its IPv6 address stays in the answers (a name that had one is never left without one) even while the IPv4 addresses of healthy nodes are the only ones that work. Give at least two nodes an address of each family.
Console, API and audit
- Console: Routing in the menu. The group page has the nodes (with the two key fingerprints, retire, and the token button), routes, backends, the certificates served, settings (default backend, the HAProxy user and group, optional path overrides, the HTTP-01 setting and the address settings), the address records and health of the nodes (see above), and the generated configuration, read-only.
- API:
/api/v1/proxy/...with its own grant actionproxy, which no DNS grant and nocertificatesgrant implies, and which needs zoneany(routing is not about one zone). Groups and nodes are read-only; backends and routes are managed.PUT /proxy/groups/{group}/routestakes areferenceand a list: it makes the routes of that reference exactly that list in one call, so a provisioning system can declare all routes of one customer without touching anyone else's. Addresses, drain and automatic, extra names, the address settings and the HTTP-01 setting (PATCH /proxy/groups/{group}) and the read of the address names with their state are described in the section above. See the OpenAPI document. - Audit: every change of a group, backend, route, attachment, token and
retirement is written to
proxy_changeswith the user or credential and the interface, like the DNSchangestable. The latest entries of a group:SaltDns.Proxy.list_changes/2.
The three keys
| Key | Holder | Kind | What it does |
|---|---|---|---|
| Shaker encryption key | Shaker keeps the private half; Salt knows the public half (the age1... recipient) | X25519, age | Salt encrypts every payload to it. The private half never leaves the host. |
| Shaker signing key | Shaker keeps the private half; Salt knows the public half | Ed25519 | Proves the node's identity on connect and signs its status reports. |
| Salt signing key | Salt only, one per installation, private half encrypted at rest | Ed25519 | Signs every envelope Salt sends. Every Shaker knows its public half from enrolment or bootstrap. |
The Salt private key is stored in shaker_signing_keys.private_key, encrypted
by SaltDns.Vault (the same vault as TSIG and DNSSEC secrets, context
shaker_salt_signing_key) and covered by SaltDns.Release.rotate_vault. It is
created the first time a signature is needed; several replicas starting at once
converge on one row.
Enrolling a node online
Make a one-time token for a proxy group: on the group page ("Create enrolment token"), or on a Salt host (the name of a proxy group; it must be unambiguous across organisations):
bin/salt_dns eval 'SaltDns.Release.shaker_token("edge")'The token is shown once and only its SHA-256 is stored. A node belongs to the group it was enrolled for.
On the new host, Shaker makes its key pair and sends:
POST /shaker/v1/enrol Content-Type: application/json {"token":"<token>", "recipient":"age1...", "signing_key":"<base64url Ed25519 public key>", "hostname":"heaven", "shaker_version":"0.1.0", "strategy":"haproxy", "software_version":"3.4.7", "socket_group":"haproxy-certs", "in_container":false}socket_groupis optional: a group name, or a number when HAProxy runs in a container (it is stored as a string either way).in_containeris optional (default false); both are updated by everyhello.software_versionis empty for a strategy without software (files).Salt answers
201:{"node_id":"<uuid>", "salt_signing_key":"<base64url Ed25519 public key>", "socket_url":"wss://salt.example/shaker/v1/socket"}The token is spent in the same transaction that stores the node. The node is
activefrom then on.
Error answers
| Status | Body | When |
|---|---|---|
401 | {"error":"invalid_token"} | unknown, malformed or expired token |
409 | {"error":"already_enrolled"} | the token was already spent, or that signing key is already enrolled |
422 | {"error":"validation","errors":{"field":["message"]}} | a field is missing or malformed (the token is not spent) |
429 | {"error":"rate_limited"} | the per-address limit, with Retry-After |
Enrolment is rate limited per client address through SaltDns.RateLimiter
(10 attempts per 60 seconds by default). Behind a reverse proxy the real
address is used only when SALT_DNS_TRUSTED_PROXIES is configured
(configuration.md).
A retired node may not enrol again or connect: make a new token, and (on the host) a new key pair.
Bootstrapping a host that cannot reach Salt yet
The first load balancer has no certificate for Salt's name, so Salt may not be reachable through it. Salt does not need the load balancer (it gets its own certificate through DNS), so the first enrolment can be carried by hand:
On the new host,
shaker initprints a base64url enrolment request (the public keys, hostname, strategy and versions; the contract's offline request, optionally withsocket_group).On a Salt host:
bin/salt_dns eval 'SaltDns.Release.shaker_bootstrap("<request>", "edge")'This registers the node as
pending(it has not connected yet) and prints the bootstrap file as JSON:{"node_id":"<uuid>", "salt_url":"https://salt.example", "salt_signing_key":"<base64url Ed25519 public key>", "envelopes":[<state envelope>, <certificate envelope>, ...]}The envelopes carry the current desired state (from the configured
SaltDns.Shaker.Source) and every certificate the state names. A certificate the source cannot supply is left out; the node asks for it again over the socket.Copy the file to the host by any means. It is useless to anyone but that Shaker: its payloads are encrypted to that node's recipient.
shaker bootstrap <file>decrypts and applies it. On its first successful authentication apendingnode becomesactive.
The node id, salt_url and the signing key are the same values online
enrolment would have given.
The connection
Shaker opens wss://<salt>/shaker/v1/socket?node_id=<uuid> (plain ws:// is
accepted too, for a host behind TLS termination). Text frames, one JSON object
each:
- Salt sends
{"type":"challenge","nonce":"<base64url 32 random bytes>"}. - Shaker answers with
{"type":"auth","signature":"<base64url Ed25519>"}, signing exactly"shaker-auth-v1\n" + node_id + "\n" + nonce(raw bytes). - Salt answers
{"type":"ready","generation":<n>}or closes with code4401. Unknown node ids, retired nodes and a bad signature all close with4401(a malformed nonce is signed differently on every connection, so a capturedauthframe cannot be replayed on another). - Shaker sends
hellowith the generation it applied, the certificate versions it holds, and its versions. - Salt sends a
stateenvelope when the node is behind — always on the first connection. - Shaker sends
need; Salt answers acertificateenvelope for each version it asks for, but only when the node's current desired state names that exact id and version. Anything else is silently skipped. - Shaker sends a signed
status; Salt verifies and stores it. - Later changes are pushed when Salt calls
SaltDns.Shaker.notify/1(below). - Either side sends
{"type":"ping"}when idle (Salt sends one after:ping_interval_mswithout traffic); the other answers{"type":"pong"}.
Whether a node is connected right now is live state, not a database column:
SaltDns.Shaker.connected?/1 and the Presence module ask OTP's distributed
:pg across replicas. SaltDns.Shaker.notify(%Node{}) broadcasts on
"shaker:node:<id>"; SaltDns.Shaker.notify("<group key>") broadcasts on
"shaker:group:<group key>" to every connection in the group (the key is the
proxy group's id, or the plain group name for a node enrolled without a group). The connection holder
recomputes and pushes a state envelope. A node that was offline catches up when
it next connects, so a missed broadcast loses nothing.
Envelopes: what Salt sends
Every payload Salt sends is one envelope:
{"type":"envelope",
"kind":"state",
"node_id":"<uuid>",
"seq":7,
"ciphertext":"<base64url age v1 file>",
"signature":"<base64url Ed25519>"}kindisstateorcertificate.seqincreases per node and per kind. It is the value of an atomicUPDATE ... RETURNINGon the node's counter, so two replicas sending at the same moment cannot reuse a number. Gaps can happen; only increase matters.ciphertextis an age v1 file encrypted to the node's recipient. Salt writes it withSaltDns.Shaker.Age(X25519 + HKDF + ChaCha20-Poly1305, STREAM chunks of 64 KiB); the referenceagetool decrypts it, which the test suite proves.signatureis Ed25519 by Salt over exactly:"shaker-envelope-v1\n" + kind + "\n" + node_id + "\n" + seq(decimal) + "\n" + SHA-256(ciphertext raw bytes)where the digest is the raw 32 bytes, not hex. See "Readings of the contract" below.
Shaker verifies the signature with the key it stored, checks node_id is its
own and seq is higher than the last accepted for that kind, then decrypts.
Anything that fails is dropped and reported in the next status.
The state plaintext is the complete desired state:
{"generation":42,
"issued_at":"2026-11-13T00:00:00Z",
"certificates":[{"id":"<stable id>","version":"<serial, hex>",
"names":["example.org","*.example.org"],"not_after":"..."}],
"routes":[{"host":"shop.example.org","backend":"tienda"}],
"backends":[{"name":"tienda","mode":"http",
"servers":[{"name":"s1","address":"127.0.0.1","port":3000,"check":true}]},
{"name":"mine","mode":"http","local":true}],
"default_backend":null,
"config":{"software":"haproxy","version_line":"3.4","sha256":"...","content":"..."}}A backend with "local": true has no servers. The certificates array holds every
certificate attached to the group, used by a route or not.
The certificate plaintext is
{"id","version","names","not_before","not_after","chain_pem","key_pem"}. The
names are those of the certificate: a zone and its wildcard, or one host at any depth
with or without its wildcard.
Status: what Shaker sends back
{"type":"status",
"generation":42,
"applied_at":"...",
"ok":true,
"certificates":[{"id":"...","version":"...","loaded":true,"served_serial":"..."}],
"routes":12,
"backends":["tienda","site"],
"config_sha256":"...",
"software":{"name":"haproxy","version":"3.4.7","running":true},
"errors":[{"what":"certificate|route|backend|config|envelope","id":"...","message":"..."}],
"signature":"<base64url Ed25519 by Shaker>"}The signature is by the node's signing key over
"shaker-status-v1\n" + node_id + "\n" +
SHA-256(the JSON object without the signature field, keys sorted,
no whitespace)with the digest as raw 32 bytes. Canonicalisation is
SaltDns.Shaker.CanonicalJSON (sorted keys at every level, no whitespace).
A status whose signature does not verify is dropped whole: last_status keeps
its previous value and the connection stays open. A verified status stores the
report without its signature, the applied generation, last_seen_at,
last_status_at and the first error message in last_error.
Looking after the nodes
The group page in the console shows them (Routing). The same data is at
GET /api/v1/proxy/nodes. From a Salt host:
# all nodes, by hostname and group
bin/salt_dns eval 'SaltDns.Shaker.list_nodes() |> Enum.map(&{&1.hostname, &1.group_name, &1.status}) |> IO.inspect()'
# one node, including its last status
bin/salt_dns eval 'SaltDns.Shaker.get_node("<uuid>") |> IO.inspect()'
# is it connected right now (any replica)?
bin/salt_dns eval 'SaltDns.Shaker.connected?("<uuid>") |> IO.inspect()'
# push a new state to one node, or to a whole group
bin/salt_dns eval 'SaltDns.Shaker.notify(SaltDns.Shaker.get_node("<uuid>"))'
bin/salt_dns eval 'SaltDns.Proxy.notify(<group id>)'
# retire (the socket refuses it from then on)
bin/salt_dns eval 'SaltDns.Shaker.retire_node("<uuid>")'Node rows keep hostname, group_name, recipient, signing_key, strategy,
software_version, shaker_version, socket_group, status, enrolled_at,
last_seen_at, last_status_at, applied_generation, last_status,
last_error and the two envelope counters.
Settings
| Setting | Default | Meaning |
|---|---|---|
SALT_DNS_SHAKER | off | on turns the feature on. Anything else leaves it off. |
SALT_DNS_SHAKER_URL | the endpoint URL | Salt's public base URL as nodes reach it (used in a bootstrap file). Without it, SaltDnsWeb.Endpoint.url() is used. |
:source (application env of SaltDns.Shaker) | SaltDns.Shaker.Source.Proxy with the switch on, SaltDns.Shaker.Source.Empty otherwise | The module that supplies the desired state and certificates (SaltDns.Shaker.Source). Source.Proxy builds them from the node's proxy group. A node enrolled without a group gets the empty state. |
:enrol_rate_limit | {10, 60} | Enrolments per client address per window seconds. |
:ping_interval_ms | 30_000 | Idle time before Salt pings a connection. |
:metric_max_nodes | 500 | The most hostnames the per-node status-age metric labels (cardinality bound). |
Environment variables are listed in configuration.md.
Metrics
When the switch is on, SaltDns.Metrics exports:
| Metric | Meaning |
|---|---|
salt_dns_shaker_nodes{status} | nodes by pending/active/retired |
salt_dns_shaker_nodes_connected | nodes with an open connection, on any replica |
salt_dns_shaker_envelopes_total{kind} | envelopes pushed, by kind |
salt_dns_shaker_auth_failures_total{reason} | refused socket auths (auth) and bad status signatures (status) |
salt_dns_shaker_status_reports_total{result} | verified reports by ok/failed |
salt_dns_shaker_node_seconds_since_status{hostname} | age of each node's last verified status, at most :metric_max_nodes series |
salt_dns_shaker_node_connected{hostname} | 1 while the node is connected, else 0 |
salt_dns_shaker_node_generations_behind{hostname} | its group's generation minus the node's |
salt_dns_shaker_node_serial_mismatches{hostname} | certificates whose served serial differs from the expected one |
salt_dns_shaker_node_status_errors{hostname} | errors in the node's last status |
salt_dns_shaker_node_seconds_since_ok_status{hostname} | age of the node's last status with ok: true |
salt_dns_proxy_group_generation{organisation,group} | the group's generation |
salt_dns_proxy_group_nodes_behind{organisation,group} | active nodes behind the group's generation |
salt_dns_proxy_group_routes_without_certificate{organisation,group} | routes no current certificate covers |
The alert rules (deploy/examples/prometheus/alerts.yml, group
salt-dns-shaker) fire when a node is not connected for 10 minutes, is behind
its group's generation for 10 minutes, serves a different serial than expected
for 15 minutes, or reports a status with errors. They are tested with promtool
(deploy/examples/prometheus/check.sh).
Address records and health add:
| Metric | Meaning |
|---|---|
salt_dns_proxy_node_health_state{hostname,group} | 0 in the answers, 1 out (by the checks), 2 drained by an operator; bounded like the per-node series above |
salt_dns_proxy_probe_failures_total{signal} | failed signals of checks: connected, status, probe |
salt_dns_proxy_state_changes_total{to} | changes of state by the checks, in or out |
salt_dns_proxy_group_names_in_conflict{organisation,group} | address names with a record Salt did not write |
salt_dns_proxy_group_kept_all_addresses{organisation,group} | 1 while the answers keep all addresses because no node was healthy |
salt_dns_proxy_group_all_nodes_drained{organisation,group} | 1 while every node is drained |
salt_dns_proxy_group_prober_blind{organisation,group} | 1 while the prober cannot judge |
salt_dns_proxy_family_unchecked{organisation,group,family} | 1 while Salt's own host cannot probe that family (ipv4, ipv6) |
Their alerts (group salt-dns-proxy-health): a node out for 5 minutes
(warning), no healthy node in a group (critical), names in conflict for 30
minutes (warning), the prober cannot judge (critical), an address family is not
checked (info).
A node that has never reported has no age series (there is no last status); an
alert for it uses absent().
Readings of the contract
The contract is followed byte for byte. Two points it leaves open were decided as follows; a Shaker implementation must match:
Hashes inside signatures are raw bytes. Both signature lines write
SHA-256(...)without saying how the digest is carried in the message. Salt appends the 32 raw bytes (not lowercase hex). The exact bytes are inSaltDns.Shaker.Envelope.signature_message/4andSaltDns.Shaker.Status.signature_message/2.409 already_enrolledcovers both causes. It is answered when the token was already spent, and when the presented signing key is already enrolled (with a fresh token). A signing-key conflict rolls the token back, so the token is not silently lost.pendingmeans "registered offline, not yet connected". The socket accepts a pending node and makes itactiveon a successful authentication, which is what lets a bootstrap file's node connect at all. Retired and unknown nodes are refused.needis answered only from the desired state. A certificate id and version that the node's current state does not name is skipped silently; there is no error message for it in the protocol.The ready generation is the current desired-state generation, read from
SaltDns.Shaker.Sourceat authentication time.Hello updates the node.
socket_groupandin_containerinhelloreplace the stored values, and the next state is rendered with them.software_versionmay be empty. A strategy without software (files) sends""; Salt stores nothing for it.The certificate id on the wire is the certificate's number in Salt (a decimal string); the version is the leaf serial in lower-case hex.
Tests
The real exchange (Salt on a real port, the Shaker binary as an OS process with
the files strategy, online and offline) is
test/integration/shaker_exchange_test.exs. It runs with
--include integration against the development stack and is skipped when the
binary is missing (SHAKER_BIN, default
../shaker/dist/shaker-x86_64-unknown-linux-musl).
In CI, ci/fetch-shaker.sh downloads the static binary and sha256sums.txt
from Forgejo's generic package registry
(.../api/packages/external/generic/shaker/latest/) when the Woodpecker secret
shaker_package_token exists, verifies the checksum (a mismatch fails the
pipeline), and puts it in ci/shaker-bin, which the test container mounts at
/shaker (SHAKER_BIN=/shaker/shaker-x86_64-unknown-linux-musl). Without the
secret it prints that the exchange test will be skipped; a failed download does
not fail a pull request. Locally, SHAKER_BIN=/path/to/shaker ./ci/integration.sh
copies a binary you built.
mise exec -- mix test test/salt_dns/shaker/age_test.exs \
test/salt_dns/shaker/age_cli_test.exs \
test/salt_dns/shaker/signing_test.exs \
test/salt_dns/shaker/envelope_test.exs \
test/salt_dns/shaker/source_test.exs \
test/salt_dns/shaker/canonical_json_test.exs \
test/salt_dns/shaker/status_test.exs \
test/salt_dns/shaker_test.exs \
test/salt_dns_web/shaker/enrol_controller_test.exs \
test/salt_dns_web/shaker/socket_controller_test.exs \
test/salt_dns_web/shaker/socket_test.exs \
test/salt_dns_web/shaker/metrics_test.exs \
test/salt_dns/encrypted/registry_test.exs \
test/salt_dns/proxy/health_test.exs \
test/salt_dns/proxy/address_plan_test.exs \
test/salt_dns/proxy_addresses_test.exs \
test/integration/proxy_addresses_knot_test.exs \
--include integrationThe database-backed files carry the :integration tag (the repository's
DataCase convention). The age interoperability file is tagged :age_cli;
the suite skips it when the reference age and age-keygen binaries are not
on PATH.