| SYSTEM INFORMATION | |
|---|---|
| OS type and version | Debian 12 |
| Webmin version | 2.670 |
| Virtualmin version | 8.3.0 GPL |
| Webserver version | Apache 2.4.68 |
| Related packages | FirewallD Fail2Ban |
I encountered what may be a potentially serious issue today involving Fail2Ban and FirewallD on one of my Debian 12 Virtualmin servers. It may affect other Virtualmin installations.
I believe my situation relates to an earlier discussion where @Ilia addressed the importance of FirewallD and Fail2Ban startup order:
The Initial Problem
Today I noticed unusually high CPU utilization across Virtualmin servers around 9:40–9:45 AM Eastern Time. One of them was nearly saturated for over an hour. At 10:40 AM, its statistics showed:
-
CPU: 100% utilization
-
Load averages: 14.53, 12.64, 10.75
-
CPU cores: 2
-
RAM: 4 GB
-
Swap usage: approximately 1.37 GB
Investigation revealed numerous PHP-FPM processes consuming CPU across multiple WordPress websites.
Apache access logs showed extensive automated XML-RPC requests and malicious PHP file scanning across several domains.
Fail2Ban Appeared to Be Working
Fail2Ban was running normally and reporting:
-
XML-RPC failures detected: 328,656
-
Total bans: 975
-
Currently banned IPs: 137
-
Ban duration: 86,400 seconds
-
Maximum retries: 3
-
Find time: 600 seconds
-
Ban action: firewallcmd-ipset
My XML-RPC filter was correctly detecting requests such as:
POST //xmlrpc.php HTTP/1.1
However, several addresses reported as already banned continued appearing in Apache’s access logs. That prompted me to examine actual firewall enforcement.
The Actual Problem
Although Fail2Ban reported 137 banned IP addresses, examining the Linux IP sets revealed:
Name: f2b-xmlrpc
References: 0
Number of entries: 0
Name: f2b-apache-404
References: 0
Number of entries: 0
All six Fail2Ban IP sets were empty, with zero firewall references.
Additionally:
-
No Fail2Ban rules appeared in iptables.
-
No matching Fail2Ban rules appeared in nftables.
-
FirewallD was inactive.
-
D-Bus was inactive.
Attempting to use firewall-cmd produced:
Error: DBUS_ERROR: Failed to connect to socket
/run/dbus/system_bus_socket: No such file or directory
The Fail2Ban log also showed:
ERROR Failed to execute ban jail 'apache-404'
action 'firewallcmd-ipset'
Error starting action: 'Script error'
In other words, Fail2Ban was detecting attacks and maintaining its banned-IP list, but the actual firewall was not enforcing those bans.
Service History
The system journal showed that FirewallD stopped on October 21, 2026, at 8:14 AM.
There was no subsequent successful startup recorded until I manually started it today.
Fail2Ban had started on October 27, six days after FirewallD stopped.
The systemd dependencies showed:
firewalld.service:
Requires=dbus.socket sysinit.target system.slice
fail2ban.service:
After=... firewalld.service ...
Fail2Ban has an After=firewalld.service ordering dependency, but no Requires=firewalld.service dependency.
Consequently, Fail2Ban can start while FirewallD is unavailable.
How I Restored Protection
I performed the following steps:
systemctl start dbus.socket
systemctl start dbus.service
systemctl start firewalld
After confirming FirewallD was running and its public zone had loaded correctly, I restarted Fail2Ban:
systemctl restart fail2ban
The results were immediate.
Fail2Ban restored its bans and recreated the firewall rules:
Name: f2b-xmlrpc
References: 1
Number of entries: 120
Name: f2b-apache-404
References: 1
Number of entries: 4
Name: f2b-xmlrpc6
References: 1
Number of entries: 4
The corresponding IPv4 and IPv6 firewall rules were also restored.
The XML-RPC jail then reported 124 currently banned addresses, matching the 120 IPv4 and 4 IPv6 entries.
The server’s load had already returned to normal before these service restarts, so I cannot attribute the CPU recovery directly to restoring FirewallD.
Possible Connection to System Updates
Recently, I’ve discovered that several services on my Debian servers were not being restarted following package updates.
I generally avoid rebooting these servers unless a kernel update requires it. I’ve consequently started using needrestart to identify services requiring attention.
I don’t know whether this contributed to FirewallD being stopped, but the timing makes me wonder.
I have not established what originally stopped FirewallD on October 21.
Questions for Ilia and/or Jamie
-
Should Virtualmin ensure FirewallD is running before Fail2Ban starts, particularly when using
firewallcmd-ipsetactions? -
Should Fail2Ban be restarted automatically if FirewallD is restarted and its firewall rules or IP sets have been lost?
-
Is there an existing Virtualmin mechanism to detect when Fail2Ban reports banned IP addresses that are not actually enforced by the firewall?
-
Could package updates or service restarts leave FirewallD stopped while Fail2Ban continues operating normally?
-
Would you recommend addressing this through Virtualmin, the Debian service configuration, or Fail2Ban’s systemd dependencies?
I have deliberately avoided making custom systemd changes because I would prefer a solution compatible with Virtualmin’s standard configuration and future updates.
I operate Debian 12 and Debian 13 Virtualmin servers, and we recently standardized the Fail2Ban configurations across them. My concern is that other systems might exhibit the same behavior without administrators realizing their reported bans aren’t being enforced.
I would appreciate your thoughts on whether this represents an issue Virtualmin could help detect or prevent.
Thanks, as always, for your continued work on Virtualmin and Webmin!