From 427d59c82c26c01625dd7ce55fcd392b61177785 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jan 2025 17:46:20 +0000 Subject: [PATCH 01/13] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- fail2ban.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fail2ban.spec b/fail2ban.spec index d9176f1..4c25528 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -14,7 +14,7 @@ Name: fail2ban Version: 1.1.0 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Daemon to ban hosts that cause multiple authentication errors License: GPL-2.0-or-later @@ -475,6 +475,9 @@ fi %changelog +* Thu Jan 16 2025 Fedora Release Engineering - 1.1.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Thu Dec 19 2024 Orion Poplawski - 1.1.0-6 - Add upstream fix for sshd filter (rhbz#2332945) From e05e420f1136e7e279af42e8fb87ada5ea61c7f3 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Tue, 3 Jun 2025 12:20:18 +0200 Subject: [PATCH 02/13] Rebuilt for Python 3.14 --- fail2ban.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fail2ban.spec b/fail2ban.spec index 4c25528..3c8abf9 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -14,7 +14,7 @@ Name: fail2ban Version: 1.1.0 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Daemon to ban hosts that cause multiple authentication errors License: GPL-2.0-or-later @@ -475,6 +475,9 @@ fi %changelog +* Tue Jun 03 2025 Python Maint - 1.1.0-8 +- Rebuilt for Python 3.14 + * Thu Jan 16 2025 Fedora Release Engineering - 1.1.0-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 8ca2e0c0934f7780584cca2fff51ff66c918c5f1 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 23 Jul 2025 20:16:38 +0000 Subject: [PATCH 03/13] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- fail2ban.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fail2ban.spec b/fail2ban.spec index 3c8abf9..fa917b6 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -14,7 +14,7 @@ Name: fail2ban Version: 1.1.0 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Daemon to ban hosts that cause multiple authentication errors License: GPL-2.0-or-later @@ -475,6 +475,9 @@ fi %changelog +* Wed Jul 23 2025 Fedora Release Engineering - 1.1.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Tue Jun 03 2025 Python Maint - 1.1.0-8 - Rebuilt for Python 3.14 From 787d2fc9453d827e9e4d4e15b83cd9773bc1c4ff Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 15 Aug 2025 12:46:21 +0200 Subject: [PATCH 04/13] Rebuilt for Python 3.14.0rc2 bytecode --- fail2ban.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fail2ban.spec b/fail2ban.spec index fa917b6..018f5d0 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -14,7 +14,7 @@ Name: fail2ban Version: 1.1.0 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Daemon to ban hosts that cause multiple authentication errors License: GPL-2.0-or-later @@ -475,6 +475,9 @@ fi %changelog +* Fri Aug 15 2025 Python Maint - 1.1.0-10 +- Rebuilt for Python 3.14.0rc2 bytecode + * Wed Jul 23 2025 Fedora Release Engineering - 1.1.0-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From 96f951a7b46e32315c0018a874e2634dcf6154f8 Mon Sep 17 00:00:00 2001 From: Richard Shaw Date: Wed, 20 Aug 2025 21:01:27 -0500 Subject: [PATCH 05/13] Migrate from from Python setup.py to Wheels. --- fail2ban.spec | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fail2ban.spec b/fail2ban.spec index 3c8abf9..64847f0 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -279,11 +279,15 @@ sed -i 's|^/run/|/var/run/|' %{name}.fc sed -i "/use_2to3/d" setup.py +%generate_buildrequires +%pyproject_buildrequires + + %build %if 0%{?rhel} && 0%{?rhel} < 8 %py2_build %else -%py3_build +%pyproject_wheel %endif make -f %SOURCE6 @@ -294,8 +298,11 @@ make -f %SOURCE6 # Make symbolic link relative ln -fs python2 %{buildroot}%{_bindir}/fail2ban-python %else -%py3_install +%pyproject_install ln -fs python3 %{buildroot}%{_bindir}/fail2ban-python +mv %{buildroot}%{python3_sitelib}/etc %{buildroot} +mv %{buildroot}%{python3_sitelib}/%{_datadir} %{buildroot}%{_datadir} +rmdir %{buildroot}%{python3_sitelib}%{_prefix} %endif mkdir -p %{buildroot}%{_unitdir} @@ -310,6 +317,7 @@ install -m 0600 /dev/null %{buildroot}/run/fail2ban/fail2ban.pid install -d -m 0755 %{buildroot}%{_localstatedir}/lib/fail2ban/ mkdir -p %{buildroot}%{_tmpfilesdir} install -p -m 0644 files/fail2ban-tmpfiles.conf %{buildroot}%{_tmpfilesdir}/fail2ban.conf +mkdir -p %{buildroot}%{_sysconfdir}/%{name}/jail.d # Remove non-Linux actions rm %{buildroot}%{_sysconfdir}/%{name}/action.d/*ipfw.conf From 1e81dc17a061fe1481bc42c4a0a02886e5081805 Mon Sep 17 00:00:00 2001 From: Richard Shaw Date: Wed, 20 Aug 2025 21:05:46 -0500 Subject: [PATCH 06/13] Move from setup.py to wheels per https://fedoraproject.org/wiki/Changes/DeprecateSetuppyMacros. --- fail2ban.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fail2ban.spec b/fail2ban.spec index c30c794..1747ec4 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -14,7 +14,7 @@ Name: fail2ban Version: 1.1.0 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Daemon to ban hosts that cause multiple authentication errors License: GPL-2.0-or-later @@ -483,6 +483,10 @@ fi %changelog +* Thu Aug 21 2025 Richard Shaw - 1.1.0-11 +- Move from setup.py to wheels per + https://fedoraproject.org/wiki/Changes/DeprecateSetuppyMacros. + * Fri Aug 15 2025 Python Maint - 1.1.0-10 - Rebuilt for Python 3.14.0rc2 bytecode From 3534afe23c6cb3eaa5af4845e27755761737a9c8 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 19 Sep 2025 12:15:56 +0200 Subject: [PATCH 07/13] Rebuilt for Python 3.14.0rc3 bytecode --- fail2ban.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fail2ban.spec b/fail2ban.spec index 1747ec4..a0850e3 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -14,7 +14,7 @@ Name: fail2ban Version: 1.1.0 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Daemon to ban hosts that cause multiple authentication errors License: GPL-2.0-or-later @@ -483,6 +483,9 @@ fi %changelog +* Fri Sep 19 2025 Python Maint - 1.1.0-12 +- Rebuilt for Python 3.14.0rc3 bytecode + * Thu Aug 21 2025 Richard Shaw - 1.1.0-11 - Move from setup.py to wheels per https://fedoraproject.org/wiki/Changes/DeprecateSetuppyMacros. From 497c1cf25ac0e6fa9b5fb6e183728df50e2fcf05 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Thu, 9 Oct 2025 21:36:47 -0600 Subject: [PATCH 08/13] Fix paths in fail2ban.service (rhbz#2399981) --- fail2ban.spec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fail2ban.spec b/fail2ban.spec index a0850e3..44bf5d9 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -14,7 +14,7 @@ Name: fail2ban Version: 1.1.0 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Daemon to ban hosts that cause multiple authentication errors License: GPL-2.0-or-later @@ -306,7 +306,9 @@ rmdir %{buildroot}%{python3_sitelib}%{_prefix} %endif mkdir -p %{buildroot}%{_unitdir} -cp -p build/fail2ban.service %{buildroot}%{_unitdir}/ +# Note that the tests rewrite build/fail2ban.service, but it uses build/ paths before the rewrite +# so we will do our own modification +sed -e 's,@BINDIR@,%{_bindir},' files/fail2ban.service.in > %{buildroot}%{_unitdir}/fail2ban.service mkdir -p %{buildroot}%{_mandir}/man{1,5} install -p -m 644 man/*.1 %{buildroot}%{_mandir}/man1 install -p -m 644 man/*.5 %{buildroot}%{_mandir}/man5 @@ -483,6 +485,9 @@ fi %changelog +* Fri Oct 10 2025 Orion Poplawski - 1.1.0-13 +- Fix paths in fail2ban.service (rhbz#2399981) + * Fri Sep 19 2025 Python Maint - 1.1.0-12 - Rebuilt for Python 3.14.0rc3 bytecode From cef4e690dbfee185c71854313a257ede2c103bae Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Sat, 11 Oct 2025 17:24:44 -0600 Subject: [PATCH 09/13] Cleanup old confitionals --- fail2ban.spec | 71 +++++---------------------------------------------- 1 file changed, 7 insertions(+), 64 deletions(-) diff --git a/fail2ban.spec b/fail2ban.spec index 44bf5d9..59c39ca 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -8,13 +8,10 @@ %if %{defined rhel} && 0%{?rhel} < 10 %define legacy_var_run 1 %endif -%if %{defined fedora} && 0%{?fedora} < 40 -%define legacy_var_run 1 -%endif Name: fail2ban Version: 1.1.0 -Release: 13%{?dist} +Release: 14%{?dist} Summary: Daemon to ban hosts that cause multiple authentication errors License: GPL-2.0-or-later @@ -57,24 +54,17 @@ Patch5: https://github.com/fail2ban/fail2ban/commit/54c0effceb998b73545073ac59c4 BuildArch: noarch -%if 0%{?rhel} && 0%{?rhel} < 8 -BuildRequires: python-devel -BuildRequires: python-setuptools -# For testcases -BuildRequires: python-inotify -%else BuildRequires: python3-devel BuildRequires: python3-setuptools # For testcases BuildRequires: python3-inotify -%endif # using a python3_version-based conditional does not work here, so # this is a proxy for "Python version greater than 3.12". asyncore # and asynchat were dropped from cpython core in 3.12, these modules # make them available again. See: # https://github.com/fail2ban/fail2ban/issues/3487 # https://bugzilla.redhat.com/show_bug.cgi?id=2219991 -%if 0%{?fedora} > 38 +%if 0%{?fedora} || 0%{?rhel} >= 10 BuildRequires: python3-pyasyncore BuildRequires: python3-pyasynchat %endif @@ -82,7 +72,7 @@ BuildRequires: sqlite BuildRequires: systemd BuildRequires: selinux-policy-devel BuildRequires: make -%if 0%{?fedora} >= 41 +%if 0%{?fedora} || 0%{?rhel} >= 11 BuildRequires: bash-completion-devel %else BuildRequires: bash-completion @@ -123,24 +113,14 @@ SELinux policies for Fail2Ban. %package server Summary: Core server component for Fail2Ban -%if 0%{?rhel} && 0%{?rhel} < 8 -Requires: systemd-python -Requires: ipset -Requires: iptables -%else Requires: python3-systemd Requires: nftables -%endif Requires(post): systemd Requires(preun): systemd Requires(postun): systemd -%if 0%{?fedora} || 0%{?rhel} >= 8 Requires: (%{name}-selinux if selinux-policy-%{selinuxtype}) -%else -Requires: %{name}-selinux -%endif # see note above in BuildRequires section -%if 0%{?fedora} > 38 +%if 0%{?fedora} || 0%{?rhel} >= 10 Requires: python3-pyasyncore Requires: python3-pyasynchat %endif @@ -162,13 +142,7 @@ Requires: %{name}-server = %{version}-%{release} Requires: %{name}-shorewall = %{version}-%{release} %endif Requires: perl-interpreter -%if 0%{?rhel} && 0%{?rhel} < 8 -Requires: python-inotify -# No python3 support for gamin so epel only -Requires: gamin-python -%else Requires: python3-inotify -%endif Requires: /usr/bin/whois %description all @@ -258,11 +232,6 @@ by default. %prep %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %autosetup -p1 -# this test uses smtpd which is removed in Python 3.12, rewriting it -# isn't trivial -%if 0%{?fedora} > 38 -rm -f fail2ban/tests/action_d/test_smtp.py -%endif # Use Fedora paths sed -i -e 's/^before = paths-.*/before = paths-fedora.conf/' config/jail.conf @@ -284,26 +253,16 @@ sed -i "/use_2to3/d" setup.py %build -%if 0%{?rhel} && 0%{?rhel} < 8 -%py2_build -%else %pyproject_wheel -%endif make -f %SOURCE6 %install -%if 0%{?rhel} && 0%{?rhel} < 8 -%py2_install -# Make symbolic link relative -ln -fs python2 %{buildroot}%{_bindir}/fail2ban-python -%else %pyproject_install ln -fs python3 %{buildroot}%{_bindir}/fail2ban-python mv %{buildroot}%{python3_sitelib}/etc %{buildroot} mv %{buildroot}%{python3_sitelib}/%{_datadir} %{buildroot}%{_datadir} rmdir %{buildroot}%{python3_sitelib}%{_prefix} -%endif mkdir -p %{buildroot}%{_unitdir} # Note that the tests rewrite build/fail2ban.service, but it uses build/ paths before the rewrite @@ -364,17 +323,7 @@ COMPLETIONDIR=%{buildroot}$(pkg-config --variable=completionsdir bash-completion %check -%if 0%{?rhel} && 0%{?rhel} < 8 -%python2 bin/fail2ban-testcases --verbosity=2 --no-network -%else -%if 0%{?fedora} > 38 -# testRepairDb does not work with sqlite 3.42.0+ -# https://github.com/fail2ban/fail2ban/issues/3586 -%python3 bin/fail2ban-testcases --verbosity=2 --no-network -i testRepairDb -%else %python3 bin/fail2ban-testcases --verbosity=2 --no-network -%endif -%endif %pre selinux @@ -414,13 +363,8 @@ fi %{_bindir}/fail2ban-python %{_bindir}/fail2ban-regex %{_bindir}/fail2ban-server -%if 0%{?rhel} && 0%{?rhel} < 8 -%{python2_sitelib}/* -%exclude %{python2_sitelib}/fail2ban/tests -%else %{python3_sitelib}/* %exclude %{python3_sitelib}/fail2ban/tests -%endif %{_unitdir}/fail2ban.service %{_datadir}/bash-completion/ %{_mandir}/man1/fail2ban.1* @@ -456,11 +400,7 @@ fi %files tests %{_bindir}/fail2ban-testcases %{_mandir}/man1/fail2ban-testcases.1* -%if 0%{?rhel} && 0%{?rhel} < 8 -%{python2_sitelib}/fail2ban/tests -%else %{python3_sitelib}/fail2ban/tests -%endif %files mail %config(noreplace) %{_sysconfdir}/fail2ban/action.d/complain.conf @@ -485,6 +425,9 @@ fi %changelog +* Sat Oct 11 2025 Orion Poplawski - 1.1.0-14 +- Cleanup old conditionals + * Fri Oct 10 2025 Orion Poplawski - 1.1.0-13 - Fix paths in fail2ban.service (rhbz#2399981) From 283bb7f670f399e08fc7624d42e3d9e24f75d255 Mon Sep 17 00:00:00 2001 From: Filippo Bonazzi Date: Wed, 15 Oct 2025 12:27:20 +0200 Subject: [PATCH 10/13] fail2ban: allow fail2ban to watch all log files and dirs (bsc#1251952) --- fail2ban.te | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/fail2ban.te b/fail2ban.te index b19bdaa..5bc2394 100644 --- a/fail2ban.te +++ b/fail2ban.te @@ -99,22 +99,12 @@ logging_read_syslog_pid(fail2ban_t) logging_dontaudit_search_audit_logs(fail2ban_t) logging_mmap_generic_logs(fail2ban_t) logging_mmap_journal(fail2ban_t) -allow fail2ban_t fail2ban_log_t:file watch; -gen_require(` - attribute logfile; -') -allow fail2ban_t logfile:dir { watch_dir_perms }; -allow fail2ban_t logfile:file { watch_file_perms }; # Not in EL9 yet #logging_watch_audit_log_files(fail2ban_t) -gen_require(` - type var_log_t, auditd_log_t; -') -watch_files_pattern(fail2ban_t, auditd_log_t, auditd_log_t) -#logging_watch_audit_log_dirs(fail2ban_t) -allow fail2ban_t var_log_t:dir search_dir_perms; -watch_dirs_pattern(fail2ban_t, auditd_log_t, auditd_log_t) -logging_watch_generic_log_dirs(fail2ban_t) +logging_watch_all_log_files(fail2ban_t) +logging_watch_all_log_dirs(fail2ban_t) +logging_watch_audit_log_files(fail2ban_t) +logging_watch_audit_log_dirs(fail2ban_t) logging_watch_journal_dir(fail2ban_t) mta_send_mail(fail2ban_t) From 1243b0dcffbaa69d475a2f5c6e340cee73d34cf9 Mon Sep 17 00:00:00 2001 From: Richard Shaw Date: Wed, 31 Dec 2025 09:07:24 -0600 Subject: [PATCH 11/13] Remove obsolete distro version related conditionals. --- fail2ban.spec | 68 --------------------------------------------------- 1 file changed, 68 deletions(-) diff --git a/fail2ban.spec b/fail2ban.spec index 44bf5d9..d7945ec 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -57,36 +57,17 @@ Patch5: https://github.com/fail2ban/fail2ban/commit/54c0effceb998b73545073ac59c4 BuildArch: noarch -%if 0%{?rhel} && 0%{?rhel} < 8 -BuildRequires: python-devel -BuildRequires: python-setuptools -# For testcases -BuildRequires: python-inotify -%else BuildRequires: python3-devel BuildRequires: python3-setuptools # For testcases BuildRequires: python3-inotify -%endif -# using a python3_version-based conditional does not work here, so -# this is a proxy for "Python version greater than 3.12". asyncore -# and asynchat were dropped from cpython core in 3.12, these modules -# make them available again. See: -# https://github.com/fail2ban/fail2ban/issues/3487 -# https://bugzilla.redhat.com/show_bug.cgi?id=2219991 -%if 0%{?fedora} > 38 BuildRequires: python3-pyasyncore BuildRequires: python3-pyasynchat -%endif BuildRequires: sqlite BuildRequires: systemd BuildRequires: selinux-policy-devel BuildRequires: make -%if 0%{?fedora} >= 41 BuildRequires: bash-completion-devel -%else -BuildRequires: bash-completion -%endif BuildRequires: gnupg2 # Default components @@ -123,27 +104,15 @@ SELinux policies for Fail2Ban. %package server Summary: Core server component for Fail2Ban -%if 0%{?rhel} && 0%{?rhel} < 8 -Requires: systemd-python -Requires: ipset -Requires: iptables -%else Requires: python3-systemd Requires: nftables -%endif Requires(post): systemd Requires(preun): systemd Requires(postun): systemd -%if 0%{?fedora} || 0%{?rhel} >= 8 Requires: (%{name}-selinux if selinux-policy-%{selinuxtype}) -%else -Requires: %{name}-selinux -%endif # see note above in BuildRequires section -%if 0%{?fedora} > 38 Requires: python3-pyasyncore Requires: python3-pyasynchat -%endif %description server This package contains the core server components for Fail2Ban with minimal @@ -162,13 +131,7 @@ Requires: %{name}-server = %{version}-%{release} Requires: %{name}-shorewall = %{version}-%{release} %endif Requires: perl-interpreter -%if 0%{?rhel} && 0%{?rhel} < 8 -Requires: python-inotify -# No python3 support for gamin so epel only -Requires: gamin-python -%else Requires: python3-inotify -%endif Requires: /usr/bin/whois %description all @@ -260,9 +223,7 @@ by default. %autosetup -p1 # this test uses smtpd which is removed in Python 3.12, rewriting it # isn't trivial -%if 0%{?fedora} > 38 rm -f fail2ban/tests/action_d/test_smtp.py -%endif # Use Fedora paths sed -i -e 's/^before = paths-.*/before = paths-fedora.conf/' config/jail.conf @@ -284,26 +245,16 @@ sed -i "/use_2to3/d" setup.py %build -%if 0%{?rhel} && 0%{?rhel} < 8 -%py2_build -%else %pyproject_wheel -%endif make -f %SOURCE6 %install -%if 0%{?rhel} && 0%{?rhel} < 8 -%py2_install -# Make symbolic link relative -ln -fs python2 %{buildroot}%{_bindir}/fail2ban-python -%else %pyproject_install ln -fs python3 %{buildroot}%{_bindir}/fail2ban-python mv %{buildroot}%{python3_sitelib}/etc %{buildroot} mv %{buildroot}%{python3_sitelib}/%{_datadir} %{buildroot}%{_datadir} rmdir %{buildroot}%{python3_sitelib}%{_prefix} -%endif mkdir -p %{buildroot}%{_unitdir} # Note that the tests rewrite build/fail2ban.service, but it uses build/ paths before the rewrite @@ -364,17 +315,7 @@ COMPLETIONDIR=%{buildroot}$(pkg-config --variable=completionsdir bash-completion %check -%if 0%{?rhel} && 0%{?rhel} < 8 -%python2 bin/fail2ban-testcases --verbosity=2 --no-network -%else -%if 0%{?fedora} > 38 -# testRepairDb does not work with sqlite 3.42.0+ -# https://github.com/fail2ban/fail2ban/issues/3586 -%python3 bin/fail2ban-testcases --verbosity=2 --no-network -i testRepairDb -%else %python3 bin/fail2ban-testcases --verbosity=2 --no-network -%endif -%endif %pre selinux @@ -414,13 +355,8 @@ fi %{_bindir}/fail2ban-python %{_bindir}/fail2ban-regex %{_bindir}/fail2ban-server -%if 0%{?rhel} && 0%{?rhel} < 8 -%{python2_sitelib}/* -%exclude %{python2_sitelib}/fail2ban/tests -%else %{python3_sitelib}/* %exclude %{python3_sitelib}/fail2ban/tests -%endif %{_unitdir}/fail2ban.service %{_datadir}/bash-completion/ %{_mandir}/man1/fail2ban.1* @@ -456,11 +392,7 @@ fi %files tests %{_bindir}/fail2ban-testcases %{_mandir}/man1/fail2ban-testcases.1* -%if 0%{?rhel} && 0%{?rhel} < 8 -%{python2_sitelib}/fail2ban/tests -%else %{python3_sitelib}/fail2ban/tests -%endif %files mail %config(noreplace) %{_sysconfdir}/fail2ban/action.d/complain.conf From 6d5ba5175848a0110fc723eca675f51401a6bfff Mon Sep 17 00:00:00 2001 From: Richard Shaw Date: Wed, 31 Dec 2025 11:56:31 -0600 Subject: [PATCH 12/13] Add patch for Dovecot 2.4 jail. Fixes BZ#2426440. --- ...4c060cdc233af9a6deeb85a6523da0416f31.patch | 60 +++++++++++++++++++ fail2ban.spec | 8 ++- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 04ff4c060cdc233af9a6deeb85a6523da0416f31.patch diff --git a/04ff4c060cdc233af9a6deeb85a6523da0416f31.patch b/04ff4c060cdc233af9a6deeb85a6523da0416f31.patch new file mode 100644 index 0000000..cb6d5c2 --- /dev/null +++ b/04ff4c060cdc233af9a6deeb85a6523da0416f31.patch @@ -0,0 +1,60 @@ +From 04ff4c060cdc233af9a6deeb85a6523da0416f31 Mon Sep 17 00:00:00 2001 +From: Nic Boet +Date: Fri, 13 Jun 2025 16:44:57 -0500 +Subject: [PATCH] Dovecot 2.4 filter support + +Dovecot 2.4 release is a major upgrade +Logger event structure has changed, all messages are now +prefixed with: + + "Login aborted: " "auth failed" + +Maintain 2.3 support as many folks have yet to migrate, +community edition is still receiving cretial security patches + +Dovecot 2.4.1 +Python 3.12.10 + +Signed-off-by: Nic Boet +--- + config/filter.d/dovecot.conf | 2 ++ + fail2ban/tests/files/logs/dovecot | 6 ++++++ + 2 files changed, 8 insertions(+) + +diff --git a/config/filter.d/dovecot.conf b/config/filter.d/dovecot.conf +index dc3ebbcd42..f49eebe726 100644 +--- a/config/filter.d/dovecot.conf ++++ b/config/filter.d/dovecot.conf +@@ -17,6 +17,7 @@ prefregex = ^%(__prefix_line)s(?:%(_auth_worker)s(?:\([^\)]+\))?: )?(?:%(__pam_a + + failregex = ^authentication failure; logname=\S* uid=\S* euid=\S* tty=dovecot ruser=\S* rhost=(?:\s+user=\S*)?\s*$ + ^(?:Aborted login|Disconnected|Remote closed connection|Client has quit the connection)%(_bypass_reject_reason)s \((?:auth failed, \d+ attempts(?: in \d+ secs)?|tried to use (?:disabled|disallowed) \S+ auth|proxy dest auth failed)\):(?: user=<[^>]*>,)?(?: method=\S+,)? rip=(?:[^>]*(?:, session=<\S+>)?)\s*$ ++ ^(?:Login aborted):\s*%(_bypass_reject_reason)s.*?\((?:auth failed, \d+ attempts(?: in \d+ secs)?|tried to use (?:disabled|disallowed) \S+ auth|proxy dest auth failed)\)(?:\s*\([^)]+\))?:\s*(?:user=<[^>]*>,?\s*)?(?:,?\s*method=\S+,\s*)?rip=(?:[^>]*(?:, session=<\S+>)?)\s*$ + ^pam\(\S+,(?:,\S*)?\): pam_authenticate\(\) failed: (?:User not known to the underlying authentication module: \d+ Time\(s\)|Authentication failure \([Pp]assword mismatch\?\)|Permission denied)\s*$ + ^[a-z\-]{3,15}\(\S*,(?:,\S*)?\): (?:[Uu]nknown user|[Ii]nvalid credentials|[Pp]assword mismatch) + > +@@ -43,6 +44,7 @@ datepattern = {^LN-BEG}TAI64N + # DEV Notes: + # * the first regex is essentially a copy of pam-generic.conf + # * Probably doesn't do dovecot sql/ldap backends properly (resolved in edit 21/03/2016) ++# * Dovecot version 2.4 changed event log structure, line prior needed to maintain 2.3 support + # + # Author: Martin Waschbuesch + # Daniel Black (rewrote with begin and end anchors) +diff --git a/fail2ban/tests/files/logs/dovecot b/fail2ban/tests/files/logs/dovecot +index 0e33296129..4f5a0b7867 100644 +--- a/fail2ban/tests/files/logs/dovecot ++++ b/fail2ban/tests/files/logs/dovecot +@@ -22,6 +22,12 @@ Jun 14 00:48:21 platypus dovecot: imap-login: Disconnected (auth failed, 1 attem + # failJSON: { "time": "2005-06-23T00:52:43", "match": true , "host": "193.95.245.163" } + Jun 23 00:52:43 vhost1-ua dovecot: pop3-login: Disconnected: Inactivity (auth failed, 1 attempts): user=, method=PLAIN, rip=193.95.245.163, lip=176.214.13.210 + ++# Dovecot version 2.4 ++# failJSON: { "time": "2005-06-12T19:07:29", "match": true , "host": "192.0.2.241" } ++Jun 12 19:07:29 hostname dovecot[241]: imap-login: Login aborted: Connection closed (auth failed, 3 attempts in 16 secs) (auth_failed): user=, method=PLAIN, rip=192.0.2.241, lip=203.0.113.104, TLS, session=<9ZHq02g3J8S60fan> ++# failJSON: { "time": "2005-06-13T16:35:56", "match": true , "host": "192.0.2.241" } ++Jun 13 16:35:56 mx dovecot[241]: managesieve-login: Login aborted: Logged out (auth failed, 1 attempts in 10 secs) (auth_failed): user=, method=PLAIN, rip=192.0.2.241, lip=203.0.113.104, TLS, session= ++ + # failJSON: { "time": "2005-07-02T13:49:31", "match": true , "host": "192.51.100.13" } + Jul 02 13:49:31 hostname dovecot[442]: pop3-login: Aborted login (auth failed, 1 attempts in 17 secs): user=, method=PLAIN, rip=192.51.100.13, lip=203.0.113.17, session= + diff --git a/fail2ban.spec b/fail2ban.spec index d7945ec..6ca2a95 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -14,7 +14,7 @@ Name: fail2ban Version: 1.1.0 -Release: 13%{?dist} +Release: 14%{?dist} Summary: Daemon to ban hosts that cause multiple authentication errors License: GPL-2.0-or-later @@ -53,6 +53,9 @@ Patch4: https://patch-diff.githubusercontent.com/raw/fail2ban/fail2ban/pull/3728 # Upstream fix to also catch sshd-session logs # https://bugzilla.redhat.com/show_bug.cgi?id=2332945 Patch5: https://github.com/fail2ban/fail2ban/commit/54c0effceb998b73545073ac59c479d9d9bf19a4.patch +# Needed for Dovecot change to loging format in 2.4 but has not fail2ban version 1.1.0 +# https://bugzilla.redhat.com/show_bug.cgi?id=2426440 +Patch6: https://github.com/fail2ban/fail2ban/commit/04ff4c060cdc233af9a6deeb85a6523da0416f31.patch BuildArch: noarch @@ -417,6 +420,9 @@ fi %changelog +* Wed Dec 31 2025 Richard Shaw - 1.1.0-14 +- Add patch for Dovecot 2.4 jail. Fixes BZ#2426440. + * Fri Oct 10 2025 Orion Poplawski - 1.1.0-13 - Fix paths in fail2ban.service (rhbz#2399981) From 800dd5db0fa0fd497dcd325d2cb628606b327a03 Mon Sep 17 00:00:00 2001 From: Richard Shaw Date: Wed, 31 Dec 2025 12:04:38 -0600 Subject: [PATCH 13/13] Add patch for Dovecot 2.4 jail. Fixes BZ#2426440. --- fail2ban.spec | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/fail2ban.spec b/fail2ban.spec index 6ca2a95..6ca56b5 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -8,13 +8,10 @@ %if %{defined rhel} && 0%{?rhel} < 10 %define legacy_var_run 1 %endif -%if %{defined fedora} && 0%{?fedora} < 40 -%define legacy_var_run 1 -%endif Name: fail2ban Version: 1.1.0 -Release: 14%{?dist} +Release: 15%{?dist} Summary: Daemon to ban hosts that cause multiple authentication errors License: GPL-2.0-or-later @@ -53,7 +50,7 @@ Patch4: https://patch-diff.githubusercontent.com/raw/fail2ban/fail2ban/pull/3728 # Upstream fix to also catch sshd-session logs # https://bugzilla.redhat.com/show_bug.cgi?id=2332945 Patch5: https://github.com/fail2ban/fail2ban/commit/54c0effceb998b73545073ac59c479d9d9bf19a4.patch -# Needed for Dovecot change to loging format in 2.4 but has not fail2ban version 1.1.0 +# Needed for Dovecot change to loging format in 2.4, fixed in f2b version 1.1.1. # https://bugzilla.redhat.com/show_bug.cgi?id=2426440 Patch6: https://github.com/fail2ban/fail2ban/commit/04ff4c060cdc233af9a6deeb85a6523da0416f31.patch @@ -64,13 +61,25 @@ BuildRequires: python3-devel BuildRequires: python3-setuptools # For testcases BuildRequires: python3-inotify +# using a python3_version-based conditional does not work here, so +# this is a proxy for "Python version greater than 3.12". asyncore +# and asynchat were dropped from cpython core in 3.12, these modules +# make them available again. See: +# https://github.com/fail2ban/fail2ban/issues/3487 +# https://bugzilla.redhat.com/show_bug.cgi?id=2219991 +%if 0%{?fedora} || 0%{?rhel} >= 10 BuildRequires: python3-pyasyncore BuildRequires: python3-pyasynchat +%endif BuildRequires: sqlite BuildRequires: systemd BuildRequires: selinux-policy-devel BuildRequires: make +%if 0%{?fedora} || 0%{?rhel} >= 11 BuildRequires: bash-completion-devel +%else +BuildRequires: bash-completion +%endif BuildRequires: gnupg2 # Default components @@ -114,8 +123,10 @@ Requires(preun): systemd Requires(postun): systemd Requires: (%{name}-selinux if selinux-policy-%{selinuxtype}) # see note above in BuildRequires section +%if 0%{?fedora} || 0%{?rhel} >= 10 Requires: python3-pyasyncore Requires: python3-pyasynchat +%endif %description server This package contains the core server components for Fail2Ban with minimal @@ -224,9 +235,6 @@ by default. %prep %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %autosetup -p1 -# this test uses smtpd which is removed in Python 3.12, rewriting it -# isn't trivial -rm -f fail2ban/tests/action_d/test_smtp.py # Use Fedora paths sed -i -e 's/^before = paths-.*/before = paths-fedora.conf/' config/jail.conf @@ -420,9 +428,12 @@ fi %changelog -* Wed Dec 31 2025 Richard Shaw - 1.1.0-14 +* Wed Dec 31 2025 Richard Shaw - 1.1.0-15 - Add patch for Dovecot 2.4 jail. Fixes BZ#2426440. +* Sat Oct 11 2025 Orion Poplawski - 1.1.0-14 +- Cleanup old conditionals + * Fri Oct 10 2025 Orion Poplawski - 1.1.0-13 - Fix paths in fail2ban.service (rhbz#2399981)