From 64208d9568d136f6ab88060051d8fd11961bd00b Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 11 Apr 2025 10:23:26 +0200 Subject: [PATCH] Clean all iptables rules on stop Prevents the "iptables: Chain already exists." error by making sure that we don't leave any chain on start. The ideal solution is to use iptables-restore instead, which will do the right job. But this needs to be changed in NixOS entirely. --- m/hut/configuration.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/m/hut/configuration.nix b/m/hut/configuration.nix index 66cc8811..b00351de 100644 --- a/m/hut/configuration.nix +++ b/m/hut/configuration.nix @@ -56,6 +56,11 @@ iptables -A nixos-fw -p tcp -s 10.0.40.30 --dport 23080 -j nixos-fw-log-refuse iptables -A nixos-fw -p tcp -s 10.0.40.0/24 --dport 23080 -j nixos-fw-accept ''; + # Flush all rules and chains on stop so it won't break on start + extraStopCommands = '' + iptables -F + iptables -X + ''; }; };