summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-12-03 00:59:52 +0000
committertv <tv@krebsco.de>2026-12-03 00:59:52 +0000
commitd0a149fbe1984b6bbccf0c12cd67faa4d3e50519 (patch)
tree3fa83b66ee3844de8fce178b15f568737c37aef8
parent7db14aaf5b8c66be49d7c4a8c239a37194b944ab (diff)
wiregrill: route each peer's addresses on the hub
Peers' subnets are empty but for the hub's, so the hub had no route to any other host. The other hosts have only hubs as peers: those without an endpoint were of no use to them.
-rw-r--r--configs/wiregrill.nix13
1 files changed, 11 insertions, 2 deletions
diff --git a/configs/wiregrill.nix b/configs/wiregrill.nix
index d9e407d1..b8d23f49 100644
--- a/configs/wiregrill.nix
+++ b/configs/wiregrill.nix
@@ -3,6 +3,9 @@
enable = cfg.net != null;
net = config.krebs.build.host.nets.wiregrill or null;
};
+ # The hub is the host with a public address; the others reach each other
+ # through it.
+ isHub = cfg.net.via != null;
toCidrNotation = ip: "${ip.addr}/${toString ip.prefixLength}";
keyType = "application/x-wireguard-private-key";
keySlot = config.enstate.channels.secrets.slots."wiregrill.key";
@@ -33,7 +36,12 @@ in
allowedIPsAsRoutes = true;
peers = lib.mapAttrsToList
(_: host: {
- allowedIPs = host.nets.wiregrill.wireguard.subnets;
+ allowedIPs =
+ lib.optionals isHub (
+ lib.optional (host.nets.wiregrill.ip4 != null) host.nets.wiregrill.ip4.addr ++
+ lib.optional (host.nets.wiregrill.ip6 != null) host.nets.wiregrill.ip6.addr
+ ) ++
+ host.nets.wiregrill.wireguard.subnets;
endpoint =
lib.mkIf (host.nets.wiregrill.via != null) (host.nets.wiregrill.via.ip4.addr + ":${toString host.nets.wiregrill.wireguard.port}");
persistentKeepalive = lib.mkIf (host.nets.wiregrill.via != null) 61;
@@ -43,7 +51,8 @@ in
(lib.filterAttrs
(name: host:
name != config.krebs.build.host.name &&
- lib.hasAttr "wiregrill" host.nets)
+ lib.hasAttr "wiregrill" host.nets &&
+ (isHub || host.nets.wiregrill.via != null))
config.krebs.hosts);
};
systemd.network.networks.wiregrill = {
[cgit] Unable to lock slot /tmp/cgit/8b100000.lock: Permission denied (13)