ca499bc
Summary: Ban IPs that make too many password failures
ca499bc
Name: fail2ban
49aafa1
Version: 0.8.11
49aafa1
Release: 1%{?dist}
473ded4
License: GPLv2+
ca499bc
Group: System Environment/Daemons
ca499bc
URL: http://fail2ban.sourceforge.net/
d0f8175
Source0: https://github.com/%{name}/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
2d07810
Source1: fail2ban-logrotate
8bfc6bb
Patch0: fail2ban-0.8.3-init.patch
6ebbe08
Patch1: fail2ban-0.8.7.1-sshd.patch
d0f8175
Patch6: fail2ban-log2syslog.patch
ca499bc
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
bed4e7c
BuildRequires: python-devel >= 2.3
d1c947a
# For testcases
d1c947a
BuildRequires: python-inotify
ca499bc
BuildArch: noarch
625535d
Requires: ed
83ab8cd
Requires: iptables
83ab8cd
Requires: gamin-python
Axel Thimm af90cd2
Requires: python-inotify
6bfd65e
%if 0%{?fedora} >= 19
6bfd65e
BuildRequires: systemd
6bfd65e
Requires(post): systemd
6bfd65e
Requires(preun): systemd
6bfd65e
Requires(postun): systemd
6bfd65e
%else
Axel Thimm af90cd2
Requires: initscripts
ca499bc
Requires(post): /sbin/chkconfig
ca499bc
Requires(preun): /sbin/chkconfig
ca499bc
Requires(preun): /sbin/service
6bfd65e
%endif
ca499bc
ca499bc
%description
ca499bc
Fail2ban scans log files like /var/log/pwdfail or
ca499bc
/var/log/apache/error_log and bans IP that makes too many password
ca499bc
failures. It updates firewall rules to reject the IP address.
ca499bc
83ab8cd
To use the hostsdeny and shorewall actions you must install tcp_wrappers
83ab8cd
and shorewall respectively.
83ab8cd
83ab8cd
ca499bc
%prep
4ab5ea7
%setup -q
ca499bc
%patch0 -p1 -b .init
959d57f
%patch1 -p1 -b .sshd
41c8d5a
%patch6 -p1 -b .log2syslog
ca499bc
ca499bc
%build
ca499bc
python setup.py build
ca499bc
ca499bc
%install
ca499bc
rm -rf %{buildroot}
ca499bc
python setup.py install -O1 --root %{buildroot}
6bfd65e
%if 0%{?fedora} >= 19
6bfd65e
mkdir -p %{buildroot}%{_unitdir}
d0f8175
cp -p files/fail2ban.service %{buildroot}%{_unitdir}/
6bfd65e
%else
6ebbe08
mkdir -p %{buildroot}%{_initddir}
6ebbe08
install -p -m 755 files/redhat-initd %{buildroot}%{_initddir}/fail2ban
6bfd65e
%endif
959d57f
mkdir -p %{buildroot}%{_mandir}/man1
959d57f
install -p -m 644 man/fail2ban*.1 %{buildroot}%{_mandir}/man1
2d07810
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
2d07810
install -p -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/fail2ban
Axel Thimm af90cd2
install -d -m 0755 %{buildroot}%{_localstatedir}/run/fail2ban/
Axel Thimm af90cd2
install -d -m 0755 %{buildroot}%{_localstatedir}/lib/fail2ban/
Axel Thimm af90cd2
mkdir -p %{buildroot}%{_sysconfdir}/tmpfiles.d
d0f8175
install -p -m 0644 files/fail2ban-tmpfiles.conf %{buildroot}%{_sysconfdir}/tmpfiles.d/fail2ban.conf
d0f8175
# Remove installed doc, use doc macro instead
d0f8175
rm -r %{buildroot}%{_docdir}/%{name}
bd068d0
fc604fe
# Testcases need network access
fc604fe
#%check
fc604fe
#./fail2ban-testcases
d1c947a
ca499bc
%clean
ca499bc
rm -rf %{buildroot}
ca499bc
ca499bc
%post
6bfd65e
%if 0%{?fedora} >= 19
6bfd65e
%systemd_post fail2ban.service
6bfd65e
%else
ca499bc
/sbin/chkconfig --add %{name}
6bfd65e
%endif
ca499bc
ca499bc
%preun
6bfd65e
%if 0%{?fedora} >= 19
6bfd65e
%systemd_preun fail2ban.service
6bfd65e
%else
ca499bc
if [ $1 = 0 ]; then
ca499bc
  /sbin/service %{name} stop > /dev/null 2>&1
ca499bc
  /sbin/chkconfig --del %{name}
ca499bc
fi
6bfd65e
%endif
6bfd65e
6bfd65e
%if 0%{?fedora} >= 19
6bfd65e
%postun
6bfd65e
%systemd_postun_with_restart fail2ban.service
6bfd65e
%endif
ca499bc
ca499bc
%files
ca499bc
%defattr(-,root,root,-)
d0f8175
%doc README.md TODO ChangeLog COPYING doc/*.txt
959d57f
#doc config/fail2ban.conf*
959d57f
%{_bindir}/fail2ban-server
959d57f
%{_bindir}/fail2ban-client
959d57f
%{_bindir}/fail2ban-regex
ca499bc
%{_datadir}/fail2ban
6bfd65e
%if 0%{?fedora} >= 19
6bfd65e
%{_unitdir}/fail2ban.service
6bfd65e
%else
6ebbe08
%{_initddir}/fail2ban
6bfd65e
%endif
d0f8175
%{_mandir}/man1/fail2ban*.1*
959d57f
%dir %{_sysconfdir}/fail2ban
959d57f
%dir %{_sysconfdir}/fail2ban/action.d
959d57f
%dir %{_sysconfdir}/fail2ban/filter.d
959d57f
%config(noreplace) %{_sysconfdir}/fail2ban/fail2ban.conf
959d57f
%config(noreplace) %{_sysconfdir}/fail2ban/jail.conf
959d57f
%config(noreplace) %{_sysconfdir}/fail2ban/action.d/*.conf
959d57f
%config(noreplace) %{_sysconfdir}/fail2ban/filter.d/*.conf
2d07810
%config(noreplace) %{_sysconfdir}/logrotate.d/fail2ban
Axel Thimm af90cd2
%dir %{_localstatedir}/run/fail2ban/
Axel Thimm af90cd2
%config(noreplace) %{_sysconfdir}/tmpfiles.d/fail2ban.conf
Axel Thimm af90cd2
%dir %{_localstatedir}/lib/fail2ban/
ca499bc
ca499bc
%changelog
49aafa1
* Mon Nov 25 2013 Adam Tkac <vonsch@gmail.com> - 0.8.11-1
49aafa1
- update to 0.8.11 (#1034355)
49aafa1
- drop part of the fail2ban-0.8.3-init.patch (merged)
49aafa1
- fail2ban-hostsdeny.patch has been merged
49aafa1
- fail2ban-mailx.patch has been merged
49aafa1
- fail2ban-notmp.patch has been merged
49aafa1
1a340b2
* Wed Aug 28 2013 Orion Poplawski <orion@cora.nwra.com> - 0.8.10-3
1a340b2
- Add upstream patch to fix mailx argument ordering (bug #998020)
1a340b2
625535d
* Fri Aug 16 2013 Orion Poplawski <orion@cora.nwra.com> - 0.8.10-2
625535d
- Add upstream patch to fix hostsdeny permission issue
625535d
d0f8175
* Wed Jun 12 2013 Orion Poplawski <orion@cora.nwra.com> - 0.8.10-1
d0f8175
- Update to 0.8.10 security release
d0f8175
- Use upstream provided systemd files
d0f8175
- Drop upstreamed patches, rebase log2syslog and notmp patches
d0f8175
6bfd65e
* Fri Mar 15 2013 Orion Poplawski <orion@cora.nwra.com> - 0.8.8-4
6bfd65e
- Use systemd init for Fedora 19+ (bug #883158)
6bfd65e
83ab8cd
* Thu Feb 14 2013 Orion Poplawski <orion@cora.nwra.com> - 0.8.8-3
83ab8cd
- Add patch from upstream to fix module imports (Bug #892365)
83ab8cd
- Add patch from upstream to UTF-8 characters in syslog (Bug #905097)
680209b
- Drop Requires: tcp_wrappers and shorewall (Bug #781341)
83ab8cd
260f069
* Fri Jan 18 2013 Orion Poplawski <orion@cora.nwra.com> - 0.8.8-2
260f069
- Add patch to prevent sshd blocks of successful logins for systems that use
260f069
  sssd or ldap
260f069
9bcdcc2
* Mon Dec 17 2012 Orion Poplawski <orion@cora.nwra.com> - 0.8.8-1
9bcdcc2
- Update to 0.8.8 (CVE-2012-5642 Bug #887914)
9bcdcc2
6ebbe08
* Thu Oct 11 2012 Orion Poplawski <orion@cora.nwra.com> - 0.8.7.1-1
6ebbe08
- Update to 0.8.7.1
6ebbe08
- Drop fd_cloexec, pyinotify, and examplemail patches fixed upstream
6ebbe08
- Rebase sshd and notmp patches
6ebbe08
- Use _initddir macro
6ebbe08
358d708
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.4-29
358d708
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
358d708
744512b
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.4-28
744512b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
744512b
Axel Thimm af90cd2
* Sat Apr  9 2011 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.4-27
Axel Thimm af90cd2
- Move tmp files to /var/lib (suggested by Phil Anderson).
Axel Thimm af90cd2
- Enable inotify support (by Jonathan Underwood).
Axel Thimm af90cd2
- Fixes RH bugs #669966, #669965, #551895, #552947, #658849, #656584.
f7225b0
91ef859
* Sun Feb 14 2010 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.4-24
91ef859
- Patch by Jonathan G. Underwood <jonathan.underwood@gmail.com> to
91ef859
  cloexec another fd leak.
91ef859
4ab5ea7
* Fri Sep 11 2009 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.4-23
4ab5ea7
- update to 0.8.4.
4ab5ea7
1a350e8
* Wed Sep  2 2009 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.3-22
1a350e8
- Update to a newer svn snapshot to fix python 2.6 issue.
1a350e8
41c8d5a
* Thu Aug 27 2009 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.3-21
41c8d5a
- Log to syslog (RH bug #491983). Also deals with RH bug #515116.
41c8d5a
- Check inodes of log files (RH bug #503852).
36b030b
08b9eed
* Sat Feb 14 2009 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.3-18
08b9eed
- Fix CVE-2009-0362 (Fedora bugs #485461, #485464, #485465, #485466).
08b9eed
508c8e4
* Mon Dec 01 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.8.3-17
508c8e4
- Rebuild for Python 2.6
508c8e4
8bfc6bb
* Sun Aug 24 2008 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.3-16
8bfc6bb
- Update to 0.8.3.
8bfc6bb
473ded4
* Wed May 21 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 0.8.2-15
473ded4
- fix license tag
473ded4
7069b0f
* Thu Mar 27 2008 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.2-14
7069b0f
- Close on exec fixes by Jonathan Underwood.
7069b0f
bd068d0
* Sun Mar 16 2008 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.2-13
bd068d0
- Add %%{_localstatedir}/run/fail2ban (David Rees).
bd068d0
bed4e7c
* Fri Mar 14 2008 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.2-12
bed4e7c
- Update to 0.8.2.
bed4e7c
129a6fe
* Thu Jan 31 2008 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 0.8.1-11
129a6fe
- Move socket file from /tmp to /var/run to prevent SElinux from stopping
129a6fe
  fail2ban from starting (BZ #429281)
129a6fe
- Change logic in init file to start with -x to remove the socket file in case
129a6fe
  of unclean shutdown
129a6fe
25ce90b
* Wed Aug 15 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.1-10
25ce90b
- Update to 0.8.1.
25ce90b
- Remove patch fixing CVE-2007-4321 (upstream).
25ce90b
- Remove AllowUsers patch (upstream).
25ce90b
- Add dependency to gamin-python.
25ce90b
372f288
* Thu Jun 21 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.0-9
372f288
- Fix remote log injection (no CVE assignment yet).
372f288
8c6d2a1
* Sun Jun  3 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.0-8
8c6d2a1
- Also trigger on non-AllowUsers failures (Jonathan Underwood
8c6d2a1
  <jonathan.underwood@gmail.com>).
8c6d2a1
ea3c694
* Wed May 23 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.0-7
ea3c694
- logrotate should restart fail2ban (Zing <zing@fastmail.fm>).
2d07810
- send mail to root; logrotate (Jonathan Underwood
2d07810
  <jonathan.underwood@gmail.com>)
2d07810
959d57f
* Sat May 19 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.0-4
959d57f
- Update to 0.8.0.
959d57f
- enable ssh by default, fix log file for ssh scanning, adjust python
959d57f
  dependency (Jonathan Underwood <jonathan.underwood@gmail.com>)
959d57f
ca499bc
* Sat Dec 30 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.6.2-3
ca499bc
- Remove forgotten condrestart.
ca499bc
ca499bc
* Fri Dec 29 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.6.2-2
ca499bc
- Move /usr/lib/fail2ban to %%{_datadir}/fail2ban.
ca499bc
- Don't default chkconfig to enabled.
ca499bc
- Add dependencies on service/chkconfig.
ca499bc
- Use example iptables/ssh config as default config.
ca499bc
ca499bc
* Mon Dec 25 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.6.2-1
ca499bc
- Initial build.