the queue's exporter asks every request for a login the gateway supplies
This commit is contained in:
parent
f54aae7927
commit
893b693b46
1 changed files with 488 additions and 133 deletions
|
|
@ -256,6 +256,30 @@ strategy, and the removed container stops before the pod can start.
|
|||
cluster's policy engine always admits traffic from an address of the node, so
|
||||
the gateway and the kubelet's probes reach the pod, and a pod of the cluster,
|
||||
or a client of the bridge that the host forwards, doesn't reach the exporter.
|
||||
- **The exporter's login.** The node's processes reach the exporter too, so it
|
||||
asks every request for a login. The exporter's container runs with
|
||||
`-http_user swarm-exporter` and `-http_pass $(EXPORTER_HASH)`, the variable
|
||||
coming from the key `hash` of the Secret `swarm-nats-exporter-auth`. The
|
||||
exporter's flag takes no file, and it treats a value as bcrypt only when it
|
||||
starts with `$2a$` (`exporter/exporter.go`, `bcryptPrefix`, in 0.15.0), so the
|
||||
command line, which anyone who reads the pod spec or `/proc` sees, carries a
|
||||
`$2a$11$` hash: cost 11 is the default of `nats server passwd`, and a hash of
|
||||
a 64-digit random password is no credential. An exporter whose Secret is
|
||||
missing doesn't start; it never runs open. TLS client verification isn't an
|
||||
option in 0.15.0: `-tlscacert` sets the client CA pool and leaves `ClientAuth`
|
||||
at `NoClientCert` (`exporter/exporter.go`), so the exporter never asks for a client certificate.
|
||||
The unit `swarm-bao-store-auth` creates the password in the swarm
|
||||
secret store at `swarm/services/nats/exporter-auth`, under the same
|
||||
`swarm-store-auth` principal as the stores' with one more create-and-read
|
||||
leaf, makes the hash with `htpasswd` (the password on stdin, never an
|
||||
argument), and writes the password's `Authorization` header to
|
||||
`/var/lib/swarm-store-auth/nats.conf`, which the gateway's `/metrics`
|
||||
location `include`s in place of the caller's header. Without that file's
|
||||
content the location sends no login and the exporter answers 401, so a
|
||||
gateway that lacks it fails closed. A host that runs the queue gets the unit
|
||||
and the leaf by default, with no option to name. Rotating works as for the
|
||||
stores, and the exporter reads the hash as it starts, so the queue's pod
|
||||
restarts after it.
|
||||
- **The leaf.** `tls-issue` logs in to the store with the pod's token as the
|
||||
role `swarm-nats` and issues the server's leaf from the same script as the
|
||||
host's `swarm-bao-nats-tls`. The key lands in a volume in memory. The
|
||||
|
|
|
|||
Loading…
Reference in a new issue