fix(m3-hermes): firewall.service failed — ip46tables cannot parse IPv4 CIDR #27

Merged
m3tam3re merged 1 commits from fix/firewall-ip46tables into master 2026-10-31 13:26:56 +01:00
3 changed files with 14 additions and 17 deletions
Showing only changes of commit d8239fcd32 - Show all commits

No files matched your search

+4 -6
View File
@@ -3,10 +3,8 @@
pkgs, pkgs,
... ...
}: let }: let
# Netbird mesh VPN range — the server is only reachable from mesh peers. # Mesh-only via interface match on wt0 (NetBird) — an IPv4 CIDR in -s
# m3-atlas Traefik proxies memory.m3ta.dev to this port over Netbird. # would abort the ip6tables run of ip46tables and fail the unit.
# (Fleet mesh address block is 100.81.0.0/16 — kernel route on wt0.)
netbirdRange = "100.81.0.0/16";
port = config.m3ta.ports.get "ai-memory"; port = config.m3ta.ports.get "ai-memory";
in { in {
# ── ai-memory server ────────────────────────────────────────────────── # ── ai-memory server ──────────────────────────────────────────────────
@@ -47,11 +45,11 @@ in {
networking.firewall = { networking.firewall = {
extraCommands = '' extraCommands = ''
# Allow ai-memory only from Netbird mesh VPN # Allow ai-memory only from Netbird mesh VPN
ip46tables -A nixos-fw -p tcp --dport ${toString port} -s ${netbirdRange} -j nixos-fw-accept ip46tables -A nixos-fw -p tcp --dport ${toString port} -i wt0 -j nixos-fw-accept
''; '';
extraStopCommands = '' extraStopCommands = ''
ip46tables -D nixos-fw -p tcp --dport ${toString port} -s ${netbirdRange} -j nixos-fw-accept 2>/dev/null || true ip46tables -D nixos-fw -p tcp --dport ${toString port} -i wt0 -j nixos-fw-accept 2>/dev/null || true
''; '';
}; };
} }
@@ -4,9 +4,8 @@
inputs, inputs,
... ...
}: let }: let
# Netbird mesh VPN range — dashboard only accessible from mesh peers. # Mesh-only via interface match on wt0 (NetBird) — works for ip46tables
# m3-atlas Traefik proxies to this port over Netbird. # where an IPv4 CIDR in -s would abort the ip6tables run.
netbirdRange = "100.81.0.0/16";
apiPort = config.m3ta.ports.get "hermes-api"; apiPort = config.m3ta.ports.get "hermes-api";
dashboardPort = config.m3ta.ports.get "hermes-dashboard"; dashboardPort = config.m3ta.ports.get "hermes-dashboard";
@@ -57,13 +56,13 @@ in {
networking.firewall = { networking.firewall = {
extraCommands = '' extraCommands = ''
# Allow Hermes Dashboard and OpenAI-compatible API only from Netbird mesh VPN # Allow Hermes Dashboard and OpenAI-compatible API only from Netbird mesh VPN
ip46tables -A nixos-fw -p tcp --dport ${toString dashboardPort} -s ${netbirdRange} -j nixos-fw-accept ip46tables -A nixos-fw -p tcp --dport ${toString dashboardPort} -i wt0 -j nixos-fw-accept
ip46tables -A nixos-fw -p tcp --dport ${toString apiPort} -s ${netbirdRange} -j nixos-fw-accept ip46tables -A nixos-fw -p tcp --dport ${toString apiPort} -i wt0 -j nixos-fw-accept
''; '';
extraStopCommands = '' extraStopCommands = ''
ip46tables -D nixos-fw -p tcp --dport ${toString dashboardPort} -s ${netbirdRange} -j nixos-fw-accept 2>/dev/null || true ip46tables -D nixos-fw -p tcp --dport ${toString dashboardPort} -i wt0 -j nixos-fw-accept 2>/dev/null || true
ip46tables -D nixos-fw -p tcp --dport ${toString apiPort} -s ${netbirdRange} -j nixos-fw-accept 2>/dev/null || true ip46tables -D nixos-fw -p tcp --dport ${toString apiPort} -i wt0 -j nixos-fw-accept 2>/dev/null || true
''; '';
}; };
} }
+4 -4
View File
@@ -25,8 +25,8 @@
pkgs, pkgs,
... ...
}: let }: let
# NetBird mesh range of this fleet (kernel route: 100.81.0.0/16 dev wt0). # Mesh-only via interface match on wt0 (NetBird) — an IPv4 CIDR in -s
netbirdRange = "100.81.0.0/16"; # would abort the ip6tables run of ip46tables and fail the unit.
port = config.m3ta.ports.get "t3code"; port = config.m3ta.ports.get "t3code";
in { in {
# CLI on the system for interactive admin (t3 pair, t3 service status) # CLI on the system for interactive admin (t3 pair, t3 service status)
@@ -67,11 +67,11 @@ in {
networking.firewall = { networking.firewall = {
extraCommands = '' extraCommands = ''
# Allow t3code only from Netbird mesh VPN # Allow t3code only from Netbird mesh VPN
ip46tables -A nixos-fw -p tcp --dport ${toString port} -s ${netbirdRange} -j nixos-fw-accept ip46tables -A nixos-fw -p tcp --dport ${toString port} -i wt0 -j nixos-fw-accept
''; '';
extraStopCommands = '' extraStopCommands = ''
ip46tables -D nixos-fw -p tcp --dport ${toString port} -s ${netbirdRange} -j nixos-fw-accept 2>/dev/null || true ip46tables -D nixos-fw -p tcp --dport ${toString port} -i wt0 -j nixos-fw-accept 2>/dev/null || true
''; '';
}; };
} }