2009-02-11 04:32:18 +01:00
|
|
|
#
|
2011-09-01 16:59:53 +02:00
|
|
|
# spec file for package fail2ban
|
2009-02-11 04:32:18 +01:00
|
|
|
#
|
2015-01-23 11:27:14 +01:00
|
|
|
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
2009-02-11 04:32:18 +01:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
2011-11-23 17:46:37 +01:00
|
|
|
|
2009-02-11 04:32:18 +01:00
|
|
|
Name: fail2ban
|
2014-08-21 15:18:17 +02:00
|
|
|
Version: 0.8.14
|
2012-06-03 19:51:16 +02:00
|
|
|
Release: 0
|
2009-02-11 04:32:18 +01:00
|
|
|
Url: http://www.fail2ban.org/
|
2010-05-07 16:09:42 +02:00
|
|
|
Summary: Bans IP addresses that make too many authentication failures
|
2012-06-03 19:51:16 +02:00
|
|
|
License: GPL-2.0+
|
|
|
|
Group: Productivity/Networking/Security
|
2014-04-28 11:16:08 +02:00
|
|
|
|
2014-08-21 15:18:17 +02:00
|
|
|
Source0: https://github.com/fail2ban/fail2ban/archive/%{version}.tar.gz
|
2013-09-23 11:42:53 +02:00
|
|
|
%if 0%{?suse_version} < 1230
|
2014-01-23 22:59:39 +01:00
|
|
|
# the init-script requires lsof
|
|
|
|
Requires: lsof
|
2009-02-11 04:32:18 +01:00
|
|
|
Source1: %{name}.init
|
2013-09-23 11:42:53 +02:00
|
|
|
%endif
|
2009-02-11 04:32:18 +01:00
|
|
|
Source2: %{name}.sysconfig
|
2013-05-29 09:26:03 +02:00
|
|
|
Source3: %{name}.logrotate
|
2013-09-23 11:42:53 +02:00
|
|
|
Source4: %{name}.service
|
|
|
|
Source5: %{name}.tmpfiles
|
2014-04-28 11:16:08 +02:00
|
|
|
Source6: sfw-fail2ban.conf
|
|
|
|
Source7: f2b-restart.conf
|
2015-01-23 11:27:14 +01:00
|
|
|
# PATCH-FIX-OPENSUSE fail2ban-opensuse-locations.patch bnc#878028 jweberhofer@weberhofer.at -- update default locations for logfiles
|
2014-08-21 15:18:17 +02:00
|
|
|
Patch100: fail2ban-opensuse-locations.patch
|
2015-01-23 11:27:14 +01:00
|
|
|
# PATCH-FIX-UPSTREAM fail2ban-issue_906-strptime.patch bnc#914075, gh#fail2ban/fail2ban#906 jweberhofer@weberhofer.at -- Fix strptime thread safety issue
|
|
|
|
Patch101: fail2ban-issue_906-strptime.patch
|
2014-04-28 11:16:08 +02:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
BuildArch: noarch
|
|
|
|
%if 0%{?suse_version} >= 1230
|
|
|
|
%{?systemd_requires}
|
|
|
|
BuildRequires: systemd
|
|
|
|
%endif
|
|
|
|
BuildRequires: logrotate
|
|
|
|
BuildRequires: python-devel
|
2014-01-22 10:26:34 +01:00
|
|
|
Requires: cron
|
|
|
|
Requires: iptables
|
|
|
|
Requires: logrotate
|
|
|
|
Requires: python >= 2.5
|
2014-11-25 15:53:42 +01:00
|
|
|
Requires: syslog
|
2014-01-22 10:26:34 +01:00
|
|
|
%if 0%{?suse_version} >= 1140 && 0%{?sles_version} == 0
|
|
|
|
Requires: python-pyinotify
|
|
|
|
%endif
|
|
|
|
%if 0%{?suse_version} >= 1220
|
|
|
|
Requires: python-gamin
|
|
|
|
%endif
|
2009-02-11 04:32:18 +01:00
|
|
|
|
|
|
|
%description
|
2010-05-07 16:09:42 +02:00
|
|
|
Fail2ban scans log files like /var/log/messages and bans IP addresses
|
2009-02-11 04:32:18 +01:00
|
|
|
that makes too many password failures. It updates firewall rules to
|
|
|
|
reject the IP address, can send e-mails, or set host.deny entries.
|
|
|
|
These rules can be defined by the user. Fail2Ban can read multiple log
|
|
|
|
files such as sshd or Apache web server ones.
|
|
|
|
|
2014-04-28 11:16:08 +02:00
|
|
|
%package -n SuSEfirewall2-fail2ban
|
2014-06-25 17:39:26 +02:00
|
|
|
Summary: Files for integrating fail2ban into SuSEfirewall2 via systemd
|
2014-04-28 11:16:08 +02:00
|
|
|
Group: Productivity/Networking/Security
|
|
|
|
BuildArch: noarch
|
2014-11-17 12:33:06 +01:00
|
|
|
Recommends: packageand(SuSEfirewall2:fail2ban)
|
2014-04-28 11:16:08 +02:00
|
|
|
Requires: SuSEfirewall2
|
|
|
|
Requires: fail2ban
|
|
|
|
|
|
|
|
%description -n SuSEfirewall2-fail2ban
|
|
|
|
This package ships systemd files which will cause fail2ban to be ordered
|
|
|
|
in relation to SuSEfirewall2 such that the two can be run concurrently
|
|
|
|
within reason, i.e. SFW will always run first because it does a table flush.
|
|
|
|
|
2014-06-25 17:39:26 +02:00
|
|
|
%package -n nagios-plugins-fail2ban
|
|
|
|
Summary: Check fail2ban server and how many IPs are currently banned
|
|
|
|
Group: System/Monitoring
|
|
|
|
%define nagios_plugindir %{_prefix}/lib/nagios/plugins
|
|
|
|
|
|
|
|
%description -n nagios-plugins-fail2ban
|
|
|
|
This plugin checks if the fail2ban server is running and how many IPs are
|
|
|
|
currently banned. You can use this plugin to monitor all the jails or just a
|
|
|
|
specific jail.
|
|
|
|
|
|
|
|
How to use
|
|
|
|
----------
|
|
|
|
Just have to run the following command:
|
|
|
|
$ ./check_fail2ban --help
|
|
|
|
|
|
|
|
|
2009-02-11 04:32:18 +01:00
|
|
|
%prep
|
|
|
|
%setup
|
2014-08-21 15:18:17 +02:00
|
|
|
%patch100 -p1
|
2015-01-23 11:27:14 +01:00
|
|
|
%patch101 -p1
|
|
|
|
|
2013-05-15 09:27:16 +02:00
|
|
|
# correct doc-path
|
2014-08-21 18:58:13 +02:00
|
|
|
sed -i -e 's|%{_prefix}/share/doc/fail2ban|%{_docdir}/%{name}|' setup.py
|
2009-02-11 04:32:18 +01:00
|
|
|
|
|
|
|
%build
|
|
|
|
export CFLAGS="$RPM_OPT_FLAGS"
|
|
|
|
python setup.py build
|
|
|
|
gzip man/*.1
|
|
|
|
|
|
|
|
%install
|
|
|
|
python setup.py install \
|
|
|
|
--root=$RPM_BUILD_ROOT \
|
|
|
|
--prefix=%{_prefix}
|
|
|
|
install -d -m755 $RPM_BUILD_ROOT/%{_mandir}/man1
|
|
|
|
for i in fail2ban-client fail2ban-regex fail2ban-server; do
|
|
|
|
install -m644 man/${i}.1.gz $RPM_BUILD_ROOT/%{_mandir}/man1
|
|
|
|
done
|
2012-10-03 11:45:50 +02:00
|
|
|
install -d -m755 $RPM_BUILD_ROOT/%{_initrddir}
|
|
|
|
install -d -m755 $RPM_BUILD_ROOT/%{_sbindir}
|
2013-09-23 11:42:53 +02:00
|
|
|
%if 0%{?suse_version} < 1230
|
2012-10-03 11:45:50 +02:00
|
|
|
install -m755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initrddir}/%{name}
|
|
|
|
ln -sf %{_initrddir}/%{name} ${RPM_BUILD_ROOT}%{_sbindir}/rc%{name}
|
2013-09-23 11:42:53 +02:00
|
|
|
%endif
|
2009-02-11 04:32:18 +01:00
|
|
|
install -d -m755 $RPM_BUILD_ROOT/var/adm/fillup-templates
|
|
|
|
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.%{name}
|
|
|
|
|
2013-05-29 09:26:03 +02:00
|
|
|
install -d -m755 $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d
|
|
|
|
install -m 644 %{SOURCE3} $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/fail2ban
|
|
|
|
|
2013-09-23 11:42:53 +02:00
|
|
|
%if 0%{?suse_version} >= 1230
|
|
|
|
install -d -m755 $RPM_BUILD_ROOT/%{_unitdir}
|
|
|
|
install -m644 %{SOURCE4} $RPM_BUILD_ROOT/%{_unitdir}/%{name}.service
|
|
|
|
|
2014-08-21 18:58:13 +02:00
|
|
|
install -d -m755 $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/
|
|
|
|
install -m644 %{SOURCE5} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/%{name}.conf
|
2013-09-23 11:42:53 +02:00
|
|
|
%endif
|
2014-08-21 18:58:13 +02:00
|
|
|
%if 0%{?_unitdir:1}
|
2014-04-28 11:16:08 +02:00
|
|
|
install -Dm0644 "%_sourcedir/sfw-fail2ban.conf" \
|
|
|
|
"%buildroot/%_unitdir/SuSEfirewall2.service.d/fail2ban.conf"
|
|
|
|
install -Dm0644 "%_sourcedir/f2b-restart.conf" \
|
|
|
|
"%buildroot/%_unitdir/fail2ban.service.d/SuSEfirewall2.conf"
|
|
|
|
%endif
|
2014-06-25 17:39:26 +02:00
|
|
|
install -Dm755 files/nagios/check_fail2ban %{buildroot}/%{nagios_plugindir}/check_fail2ban
|
2013-09-23 11:42:53 +02:00
|
|
|
|
|
|
|
%pre
|
|
|
|
%if 0%{?suse_version} >= 1230
|
|
|
|
%service_add_pre %{name}.service
|
|
|
|
%endif
|
|
|
|
|
2009-02-11 04:32:18 +01:00
|
|
|
%post
|
|
|
|
%{fillup_only}
|
2013-09-23 11:42:53 +02:00
|
|
|
%if 0%{?suse_version} >= 1230
|
2014-08-21 18:58:13 +02:00
|
|
|
systemd-tmpfiles --create %{_prefix}/lib/tmpfiles.d/%{name}.conf
|
2013-09-23 11:42:53 +02:00
|
|
|
%service_add_post %{name}.service
|
|
|
|
%endif
|
2009-02-11 04:32:18 +01:00
|
|
|
|
|
|
|
%preun
|
2013-09-23 11:42:53 +02:00
|
|
|
%if 0%{?suse_version} >= 1230
|
|
|
|
%service_del_preun %{name}.service
|
|
|
|
%else
|
2009-02-11 04:32:18 +01:00
|
|
|
%stop_on_removal %{name}
|
2013-09-23 11:42:53 +02:00
|
|
|
%endif
|
2009-02-11 04:32:18 +01:00
|
|
|
|
|
|
|
%postun
|
2013-09-23 11:42:53 +02:00
|
|
|
%if 0%{?suse_version} >= 1230
|
|
|
|
%service_del_postun %{name}.service
|
|
|
|
%else
|
2009-02-11 04:32:18 +01:00
|
|
|
%restart_on_update %{name}
|
|
|
|
%insserv_cleanup
|
2013-09-23 11:42:53 +02:00
|
|
|
%endif
|
2009-02-11 04:32:18 +01:00
|
|
|
|
2014-08-21 18:58:13 +02:00
|
|
|
%if 0%{?_unitdir:1}
|
2014-04-28 11:16:08 +02:00
|
|
|
%post -n SuSEfirewall2-fail2ban
|
|
|
|
%_bindir/systemctl daemon-reload >/dev/null 2>&1 || :
|
|
|
|
|
|
|
|
%postun -n SuSEfirewall2-fail2ban
|
|
|
|
%_bindir/systemctl daemon-reload >/dev/null 2>&1 || :
|
|
|
|
%endif
|
|
|
|
|
2009-02-11 04:32:18 +01:00
|
|
|
%files
|
|
|
|
%defattr(-, root, root)
|
|
|
|
%dir %{_sysconfdir}/%{name}
|
|
|
|
%dir %{_sysconfdir}/%{name}/action.d
|
|
|
|
%dir %{_sysconfdir}/%{name}/filter.d
|
2012-10-03 11:45:50 +02:00
|
|
|
%config(noreplace) %{_sysconfdir}/%{name}/*.conf
|
|
|
|
%config(noreplace) %{_sysconfdir}/%{name}/action.d/*.conf
|
|
|
|
%config(noreplace) %{_sysconfdir}/%{name}/filter.d/*.conf
|
2013-05-29 09:26:03 +02:00
|
|
|
%config %{_sysconfdir}/logrotate.d/fail2ban
|
2013-09-23 11:42:53 +02:00
|
|
|
%if 0%{?suse_version} >= 1230
|
|
|
|
%{_unitdir}/%{name}.service
|
2014-08-21 18:58:13 +02:00
|
|
|
%{_prefix}/lib/tmpfiles.d/%{name}.conf
|
2013-09-23 11:42:53 +02:00
|
|
|
%else
|
2012-10-03 11:45:50 +02:00
|
|
|
%{_initrddir}/%{name}
|
|
|
|
%{_sbindir}/rc%{name}
|
2010-05-07 16:09:42 +02:00
|
|
|
%dir %ghost /var/run/%{name}
|
2013-09-23 11:42:53 +02:00
|
|
|
%endif
|
|
|
|
%{_bindir}/%{name}*
|
|
|
|
%{_datadir}/%{name}
|
2009-02-11 04:32:18 +01:00
|
|
|
/var/adm/fillup-templates/sysconfig.%{name}
|
|
|
|
%doc %{_mandir}/man1/*
|
2013-05-15 09:27:16 +02:00
|
|
|
%doc COPYING ChangeLog DEVELOP README.md TODO files/cacti
|
2009-02-11 04:32:18 +01:00
|
|
|
|
2014-08-21 18:58:13 +02:00
|
|
|
%if 0%{?_unitdir:1}
|
2014-04-28 11:16:08 +02:00
|
|
|
%files -n SuSEfirewall2-fail2ban
|
|
|
|
%defattr(-,root,root)
|
|
|
|
%_unitdir/SuSEfirewall2.service.d
|
|
|
|
%_unitdir/fail2ban.service.d
|
|
|
|
%endif
|
|
|
|
|
2014-06-25 17:39:26 +02:00
|
|
|
%files -n nagios-plugins-fail2ban
|
|
|
|
%defattr(-,root,root)
|
|
|
|
%doc files/nagios/README COPYING
|
|
|
|
%dir %{_prefix}/lib/nagios
|
|
|
|
%dir %{nagios_plugindir}
|
|
|
|
%{nagios_plugindir}/check_fail2ban
|
|
|
|
|
2009-02-11 04:32:18 +01:00
|
|
|
%changelog
|