squid self-check: use a public canary, drop the swarm service names from the allow list
This commit is contained in:
parent
698183c16a
commit
10fdf06334
1 changed files with 44 additions and 30 deletions
|
|
@ -213,17 +213,19 @@ in
|
|||
|
||||
allowedDomains = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = hyperhiveCfg.swarm.serviceDomains;
|
||||
defaultText = lib.literalExpression "config.services.hyperhive.swarm.serviceDomains";
|
||||
default = [ ];
|
||||
example = [
|
||||
"forge.example.com"
|
||||
"github.com"
|
||||
"crates.io"
|
||||
];
|
||||
description = ''
|
||||
Hostnames squid lets a client reach, by CONNECT or plain HTTP. Each
|
||||
entry matches that exact name. Everything else gets a 403, except
|
||||
for an unrestricted user. The self-check canary is allowed on top of
|
||||
this list. A name must resolve, on this host's resolver, to a public
|
||||
for an unrestricted user. The swarm's own service names are not
|
||||
listed: they resolve to the bridge or a private address, which the
|
||||
destination rules refuse, and agents reach them directly. The
|
||||
self-check canary is allowed on top of this list, so it widens the
|
||||
restricted allow list by that one name. A name must resolve, on this host's resolver, to a public
|
||||
address: one in a loopback, link-local, private, shared (100.64.0.0/10),
|
||||
multicast or reserved range (or is `::`), or in the bridge subnet, gets a 403 for
|
||||
every user.
|
||||
|
|
@ -285,15 +287,15 @@ in
|
|||
|
||||
selfcheck.canary = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = hyperhiveCfg.swarm.forge.domain;
|
||||
defaultText = lib.literalExpression "config.services.hyperhive.swarm.forge.domain";
|
||||
default = "cache.nixos.org";
|
||||
description = ''
|
||||
Hostname the self-check CONNECTs to on port 443 and expects squid to
|
||||
let through. Squid resolves it with this host's resolver, not the
|
||||
hive's: a host whose resolver answers a loopback, bridge or other
|
||||
private address for it (a single-host swarm with the gateway's
|
||||
`localHostsEntry`, or a split-horizon LAN) gets a 403, and the
|
||||
self-check reports `ok=false`.
|
||||
let through. It is added to the allowed names, so every restricted
|
||||
agent can reach it too. It must resolve to a public address: squid
|
||||
resolves it with this host's resolver, not the hive's, and a name
|
||||
that answers a loopback, bridge or other private address (a swarm
|
||||
service name on a hive, a split-horizon LAN) gets a 403 before
|
||||
authentication, and the self-check reports `ok=false`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue