glue: nats firewall on the wireguard interface moves out of the nats module
The wg-hive allowedTCPPorts rule gated on deploy.wireguard.enable was a cross-service toggle read in swarm-nats.nix; it now lives in glue-nats-wireguard.nix under the same condition and value.
This commit is contained in:
parent
7d95973d83
commit
4a36e53982
3 changed files with 22 additions and 8 deletions
21
nix/host-modules/glue-nats-wireguard.nix
Normal file
21
nix/host-modules/glue-nats-wireguard.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Glue: where the queue and the wireguard mesh share a host, the queue's port
|
||||
# is open on the mesh interface.
|
||||
#
|
||||
# Interface-scoped, never host-wide: the firewall is default-deny before a
|
||||
# packet reaches the listener, so without this no other hive can reach the
|
||||
# queue. Gated on BOTH being here — the queue's own module gate
|
||||
# (`deploy.nats.enable`) is restated below; a change there must change here.
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hyperhiveCfg = config.services.hyperhive;
|
||||
deployCfg = hyperhiveCfg.deploy;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf (deployCfg.nats.enable && deployCfg.wireguard.enable) {
|
||||
networking.firewall.interfaces.wg-hive.allowedTCPPorts = [ hyperhiveCfg.swarm.nats.port ];
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue