Adds fail2ban 0.10.0a2 to Smoothwall Express 3.1 (Update 12 + Update 13).
This is a fork of d4t4king/swe-fail2ban with bug fixes for issue #1.
apache-auth.conf uses %(_apache_error_client)s which is defined in
apache-common.conf via [INCLUDES]. In fail2ban 0.10.0a2, variables defined
in [DEFAULT] of an included file are not interpolated into [Definition]
failregex of the including file — so every failregex silently matches nothing.
Fix: _apache_error_client is now also defined in [DEFAULT] of
apache-auth.conf itself. Same value as apache-common.conf.
Reloading a jail with fail2ban-client reload apache crashed with:
NOK: ('Cannot change database when there are jails present',)
During reload, fail2ban replays the full config stream (including setDatabase)
while jails are still running. server.py::setDatabase() raised RuntimeError
whenever jails were present and the DB wasn't yet initialised.
Fix: setDatabase() now skips the error if self.__reload_state is
non-empty (a reload is in progress). The DB path doesn't change on reload,
so returning early is safe.
Smoothwall reads DETAILS as plain key=value text, not via bash. The line
MOD_LONG_NAME="[3.1] ${MOD_NAME} " displayed literally in the mod browser.
Fix: Hardcoded to MOD_LONG_NAME="[3.1] fail2ban".
rc.fail2ban referenced usr/bin/fail2ban (doesn't exist) using the old
fail2ban 0.8.x API (-c FILE / -k). This prevented fail2ban from
starting or stopping via the management scripts.
config_fail2ban referenced usr/bin/fail2ban-client and
etc/rc.d/rc.fail2ban, neither of which exist after install.
Fix:
rc.fail2banupdated to usebin/fail2ban-clientwith 0.10.x API (start/stop) and exportsPYTHONPATHso the bundled library is found when called from init scripts (before/etc/bashrcis sourced).config_fail2bancorrected tobin/fail2ban-clientandbin/rc.fail2ban.
# On the Smoothwall box, as root:
cd /tmp
git clone https://github.com/petter5/swe-fail2ban.git fail2ban
cd fail2ban
perl enable-fail2banAfter installation, create the SQLite database directory and start:
mkdir -p /var/smoothwall/mods/fail2ban/var/lib/fail2ban
touch /var/smoothwall/mods-available/fail2ban/config
source /etc/bashrc
fail2ban-client -c /etc/fail2ban start| Jail | Port | Log |
|---|---|---|
apache |
81, 441 | /var/log/httpd*/*error.log |
ssh-iptables |
222 | /var/log/messages |
GREEN network is automatically whitelisted during installation.
By Charlie Heselton (dataking / d4t4king). See original README and LICENSE for details.