Thanks for following up. I’ve investigated this further and was able to reproduce the same behaviour on a second server.
Regarding your questions:
-
FASTPANEL firewall management: Yes, it is enabled on both servers.
-
FASTPANEL version on the original Debian 12 server: 8.0+deb12p23.
Here is an exact Fail2ban error from the original incident (27 November 2026):
2026-11-27 05:02:49,795 fail2ban.utils [620]: ERROR -- stderr: 'iptables: Bad rule (does a matching rule exist in that chain?).'
2026-11-27 05:02:49,795 fail2ban.CommandAction [620]: ERROR Invariant check failed. Trying to restore a sane environment
The corresponding IPv6 check failed in the same way:
ip6tables: Bad rule (does a matching rule exist in that chain?).
The command being checked was looking for a rule matching the f2b-nginx-404 IPSET in the INPUT chain.
Original server — Debian 12:
-
FASTPANEL 8.0+deb12p23
-
Fail2ban 1.0.2
-
iptables/ip6tables 1.8.9 (nf_tables)
-
FASTPANEL firewall global policy: “Deny everything that is not explicitly allowed”, with 12 explicit ACCEPT rules.
Second server — Debian 11:
-
FASTPANEL 8.0+deb11p23
-
Fail2ban 0.11.2
-
iptables/ip6tables 1.8.7 (nf_tables)
-
FASTPANEL firewall global policy: “Allow everything that is not explicitly denied”, with two explicit ACCEPT rules.
On both servers, monitoring nftables changes confirmed that restarting the fastpanel2 service rebuilds the IPv4 and IPv6 filter tables, removing Fail2ban’s --match-set rules.
On the Debian 11 server, the IPSET sets and their entries remained intact after the rebuild, while the corresponding firewall rules were missing. I have not independently established the same IPSET persistence result on the Debian 12 server.
On the original Debian 12 server, manually restarting Fail2ban restored the expected IPv4 and IPv6 match-set rules. I also implemented and tested a delayed systemd hook to restart Fail2ban after FASTPANEL starts. This restores the rules as a workaround, although it does not address the underlying issue.
The same behaviour occurring with two different FASTPANEL firewall policies suggests that the issue is not specific to the default firewall policy.
The key point is that FASTPANEL’s firewall table rebuild removes rules installed by Fail2ban, leaving its IPSET-based bans without the corresponding rules in the INPUT chain.