Merging changes for EL 7 back into master.

i9ce
Richard Shaw 4 years ago
commit 97931ba530

1
.gitignore vendored

@ -3,6 +3,7 @@ fail2ban-0.8.4.tar.bz2
/fail2ban_0.8.7.1.orig.tar.gz
/fail2ban_0.8.8.orig.tar.gz
/fail2ban-0.8.10.tar.gz
/fail2ban-0.8.11.tar.gz
/fail2ban-0.9-d529151.tar.xz
/fail2ban-0.9-1f1a561.tar.xz
/fail2ban-0.9.tar.gz

@ -35,10 +35,16 @@ Patch8: https://github.com/fail2ban/fail2ban/commit/309c8dddd7adc2de140ed5a72088
BuildArch: noarch
%if 0%{?rhel} && 0%{?rhel} < 8
BuildRequires: python2-devel
# For testcases
BuildRequires: python-inotify
%else
BuildRequires: python3-devel
BuildRequires: /usr/bin/2to3
# For testcases
BuildRequires: python3-inotify
%endif
BuildRequires: sqlite
BuildRequires: systemd
BuildRequires: selinux-policy-devel
@ -79,14 +85,20 @@ SELinux policies for Fail2Ban.
%package server
Summary: Core server component for Fail2Ban
%if 0%{?rhel} && 0%{?rhel} < 8
Requires: python2-systemd
%else
Requires: python3-systemd
%endif
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Requires: ipset
Requires: iptables
%if 0%{?fedora}
Requires: (%{name}-selinux if selinux-policy-%{selinuxtype})
%endif
%description server
This package contains the core server components for Fail2Ban with minimal
@ -104,10 +116,14 @@ Requires: %{name}-server = %{version}-%{release}
Requires: %{name}-shorewall = %{version}-%{release}
# Currently this breaks jails that don't log to the journal
#Requires: %{name}-systemd = %{version}-%{release}
# No python3 support for gamin
#Requires: gamin-python
Requires: perl-interpreter
Requires: python3-inotify
%if 0%{?rhel} && 0%{?rhel} < 8
Requires: python-inotify
# No python3 support for gamin so epel only
Requires: gamin-python
%else
Requires: python2-inotify
%endif
Requires: /usr/bin/whois
%description all
@ -186,23 +202,32 @@ by default.
# Use Fedora paths
sed -i -e 's/^before = paths-.*/before = paths-fedora.conf/' config/jail.conf
%if 0%{?fedora} || 0%{?rhel} >= 8
2to3 --write --nobackups .
find -type f -exec sed -i -e '1s,^#!/usr/bin/python *,#!/usr/bin/python%{python3_version},' {} +
%endif
# SELinux sources
cp -p %SOURCE1 %SOURCE2 %SOURCE3 .
%build
%if 0%{?rhel} && 0%{?rhel} < 8
%py2_build
%else
%py3_build
%endif
make -f %SOURCE4
%install
%py3_install
%if 0%{?rhel} && 0%{?rhel} < 8
%py2_install
# Make symbolic link relative
ln -fs python2 %{buildroot}%{_bindir}/fail2ban-python
%else
%py3_install
ln -fs python3 %{buildroot}%{_bindir}/fail2ban-python
%endif
mkdir -p %{buildroot}%{_unitdir}
cp -p build/fail2ban.service %{buildroot}%{_unitdir}/
@ -255,7 +280,11 @@ install -m 0644 %{modulename}.pp.bz2 %{buildroot}%{_datadir}/selinux/packages/%{
%check
%if 0%{?rhel} && 0%{?rhel} < 8
%python2 bin/fail2ban-testcases --verbosity=2 --no-network
%else
%python3 bin/fail2ban-testcases --verbosity=2 --no-network
%endif
%pre selinux
@ -296,8 +325,13 @@ 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
%{_mandir}/man1/fail2ban.1*
%{_mandir}/man1/fail2ban-client.1*
@ -332,7 +366,11 @@ 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

Loading…
Cancel
Save