nats and bao can listen on a routable address, opt-in
This commit is contained in:
parent
4b71bd97eb
commit
892675628d
1 changed files with 174 additions and 6 deletions
|
|
@ -505,6 +505,28 @@ in
|
|||
A path, never a value.
|
||||
'';
|
||||
};
|
||||
|
||||
openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Open {option}`services.hyperhive.swarm.nats.port` in the host firewall
|
||||
on every interface, so hives on other hosts can reach the queue on
|
||||
this host's LAN or public address. Off by default: the port is
|
||||
otherwise open only on the agent bridge and, when this host is on the
|
||||
mesh, on `wg-hive`.
|
||||
|
||||
⚠️ This exposes the queue beyond the tunnel. The server binds every
|
||||
address, so the firewall is the only thing this option changes. What
|
||||
protects the port is the queue itself: TLS is required, and
|
||||
`auth_callout` refuses every client it cannot identify. Whether that
|
||||
is enough to expose the queue is the operator's decision.
|
||||
|
||||
Point `nats.<swarm domain>` in the operator's upstream DNS at the
|
||||
address the other hives reach.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf deployCfg.nats.enable {
|
||||
|
|
@ -681,14 +703,18 @@ in
|
|||
# by the firewall and looks exactly like every other NATS failure,
|
||||
# a timeout.
|
||||
#
|
||||
# ⚠️ Never the world. What makes it safe to open at all is that the
|
||||
# queue is fail-closed: `auth_callout` admits nobody until the responder
|
||||
# above answers for them, so an agent that reaches this port still has to
|
||||
# present a token authelia vouches for.
|
||||
# ⚠️ The bridge only, unless `openFirewall` opts in. What makes it safe to
|
||||
# open at all is that the queue is fail-closed: `auth_callout` admits
|
||||
# nobody until the responder above answers for them, so a client that
|
||||
# reaches this port still has to present a token authelia vouches for.
|
||||
#
|
||||
# An agent reaches it by name, which dnsmasq answers with the bridge IP.
|
||||
services.hyperhive.network.exposeHostPorts = [ cfg.port ];
|
||||
|
||||
# The server binds every address (the container shares the host netns and
|
||||
# sets no listen host), so reachability is the firewall alone.
|
||||
networking.firewall.allowedTCPPorts = lib.mkIf deployCfg.nats.openFirewall [ cfg.port ];
|
||||
|
||||
# The bind source has to exist before the container starts, leaf or not:
|
||||
# nixos-container refuses to start over a missing one, which would take
|
||||
# the whole queue down rather than only its TLS.
|
||||
|
|
|
|||
Loading…
Reference in a new issue