fail2ban-vl.spec 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. %bcond_with systemd
  2. %bcond_with tests
  3. %global py2to3 /usr/bin/2to3-3.8
  4. Summary: Ban IPs that make too many password failures
  5. Name: fail2ban
  6. Version: 0.11.1
  7. Release: 2%{?_dist_release}%{?with_systemd:.systemd}
  8. Group: system
  9. Vendor: Project Vine
  10. Distribution: Vine Linux
  11. License: GPLv2+
  12. URL: https://github.com/fail2ban/fail2ban
  13. Source0: https://github.com/fail2ban/fail2ban/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
  14. Source1: fail2ban-logrotate
  15. # Fix nginx-block-map
  16. Patch1: https://github.com/fail2ban/fail2ban/commit/ec37b1942c4da76f7a0f71efe81bea6835466648.patch
  17. # testIPAddr_CompareDNS: add missing network constraint
  18. Patch2: https://github.com/fail2ban/fail2ban/commit/b158f83aa3795f387c8475ceb48df197a94a37e8.patch
  19. # Fix test thread stack size on aarch64
  20. Patch3: https://github.com/fail2ban/fail2ban/commit/8694c547285c4030d4bf7661981673038e6e9829.patch
  21. # Fix handling of journal in tests
  22. Patch4: https://github.com/fail2ban/fail2ban/commit/8dc6f30cdd855c41b80ebdde3fe2bc91cc94e594.patch
  23. # Fix test install
  24. Patch5: https://patch-diff.githubusercontent.com/raw/fail2ban/fail2ban/pull/2605.patch
  25. # Patch for Python 3.9
  26. # https://bugzilla.redhat.com/show_bug.cgi?id=1808347
  27. #Patch6: https://patch-diff.githubusercontent.com/raw/fail2ban/fail2ban/pull/2651.patch
  28. #Patch7: https://github.com/fail2ban/fail2ban/commit/343ec1cdd296530f331637c725bd2bb0549e01e6.patch
  29. BuildArch: noarch
  30. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
  31. BuildRequires: python3-devel
  32. BuildRequires: python3-rpm-macros
  33. BuildRequires: python3-setuptools
  34. Requires: iptables, ipset
  35. #Requires: tcp_wrappers
  36. Requires: python3-inotify
  37. %if %{with systemd}
  38. %{?systemd_requires}
  39. %else
  40. Requires: initscripts
  41. Requires(post): /sbin/chkconfig
  42. Requires(preun): /sbin/chkconfig
  43. Requires(preun): /sbin/service
  44. %endif
  45. %description
  46. Fail2ban scans log files like /var/log/pwdfail or
  47. /var/log/apache/error_log and bans IP that makes too many password
  48. failures. It updates firewall rules to reject the IP address.
  49. %prep
  50. %setup -q
  51. %autosetup -p1
  52. %{py2to3} --write --nobackups .
  53. find -type f -exec sed -i -e '1s,^#!/usr/bin/python *,#!/usr/bin/python%{python3_version},' {} +
  54. %build
  55. %{py3_build}
  56. %install
  57. rm -rf %{buildroot}
  58. %{py3_install}
  59. %if %{with systemd}
  60. mkdir -p %{buildroot}%{_unitdir}
  61. install -p -m 0644 build/fail2ban.service %{buildroot}%{_unitdir}/
  62. mkdir -p %{buildroot}%{_tmpfilesdir}
  63. install -p -m 0644 files/fail2ban-tmpfiles.conf %{buildroot}%{_tmpfilesdir}/fail2ban.conf
  64. install -d -m 0755 %{buildroot}/run/fail2ban/
  65. install -m 0600 /dev/null %{buildroot}/run/fail2ban/fail2ban.pid
  66. # systemd journal configuration
  67. cat > %{buildroot}%{_sysconfdir}/%{name}/jail.d/00-systemd.conf <<EOF
  68. # This file is part of the fail2ban-systemd package to configure the use of
  69. # the systemd journal as the default backend. You can remove this package
  70. # (along with the empty fail2ban meta-package) if you do not want to use the
  71. # journal backend
  72. [DEFAULT]
  73. backend=systemd
  74. EOF
  75. %else
  76. mkdir -p %{buildroot}%{_initddir}
  77. install -p -m 755 files/redhat-initd %{buildroot}%{_initddir}/fail2ban
  78. %endif
  79. mkdir -p %{buildroot}%{_mandir}/man{1,5}
  80. install -p -m 644 man/*.1 %{buildroot}%{_mandir}/man1
  81. install -p -m 644 man/*.5 %{buildroot}%{_mandir}/man5
  82. mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
  83. install -p -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/fail2ban
  84. install -d -m 0755 %{buildroot}%{_localstatedir}/run/fail2ban/
  85. install -d -m 0755 %{buildroot}%{_localstatedir}/lib/fail2ban/
  86. rm -rf %{buildroot}%{_docdir}/fail2ban
  87. # Remove non-Linux actions
  88. rm %{buildroot}%{_sysconfdir}/%{name}/action.d/*ipfw.conf
  89. rm %{buildroot}%{_sysconfdir}/%{name}/action.d/{ipfilter,pf,ufw}.conf
  90. rm %{buildroot}%{_sysconfdir}/%{name}/action.d/osx-*.conf
  91. %if %{with tests}
  92. %check
  93. export LANG=ja_JP.UTF-8
  94. %{__python3} bin/fail2ban-testcases --verbosity=2 --no-network
  95. %endif
  96. %clean
  97. rm -rf %{buildroot}
  98. %post
  99. %if %{with systemd}
  100. %systemd_post fail2ban.service
  101. %else
  102. /sbin/chkconfig --add %{name}
  103. %endif
  104. %preun
  105. %if %{with systemd}
  106. %systemd_preun fail2ban.service
  107. %else
  108. if [ $1 = 0 -o -x /bin/systemctl ]; then
  109. /sbin/service %{name} stop > /dev/null 2>&1
  110. /sbin/chkconfig --del %{name}
  111. fi
  112. %endif
  113. %if %{with systemd}
  114. %postun
  115. %systemd_postun_with_restart fail2ban.service
  116. %endif
  117. %files
  118. %defattr(-,root,root,-)
  119. %license COPYING
  120. %doc ChangeLog DEVELOP FILTERS README.md THANKS TODO doc/*.txt
  121. #doc config/fail2ban.conf*
  122. %{_bindir}/fail2ban-python
  123. %{_bindir}/fail2ban-server
  124. %{_bindir}/fail2ban-client
  125. %{_bindir}/fail2ban-regex
  126. %{_bindir}/fail2ban-testcases
  127. #%{_datadir}/fail2ban
  128. %{python3_sitelib}/fail2ban*
  129. %{_mandir}/man1/*.1*
  130. %{_mandir}/man5/*.5*
  131. %dir %{_sysconfdir}/fail2ban
  132. %dir %{_sysconfdir}/fail2ban/action.d
  133. %dir %{_sysconfdir}/fail2ban/filter.d
  134. %dir %{_sysconfdir}/fail2ban/filter.d/ignorecommands
  135. %dir %{_sysconfdir}/fail2ban/jail.d
  136. %config(noreplace) %{_sysconfdir}/fail2ban/*.conf
  137. %config(noreplace) %{_sysconfdir}/fail2ban/action.d/*
  138. %config(noreplace) %{_sysconfdir}/fail2ban/filter.d/*.conf
  139. %config(noreplace) %{_sysconfdir}/fail2ban/filter.d/ignorecommands/*
  140. %config(noreplace) %{_sysconfdir}/logrotate.d/fail2ban
  141. %dir %{_localstatedir}/lib/fail2ban/
  142. %if %{with systemd}
  143. %{_unitdir}/*
  144. %config(noreplace) %{_sysconfdir}/fail2ban/jail.d/*
  145. %config(noreplace) %{_tmpfilesdir}/fail2ban.conf
  146. %dir /run/%{name}/
  147. %ghost %verify(not size mtime md5) /run/%{name}/%{name}.pid
  148. %else
  149. %{_initddir}/fail2ban
  150. %dir %{_localstatedir}/run/fail2ban/
  151. %endif
  152. %changelog
  153. * Sat Aug 15 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.11.1-2
  154. - rebuilt with python-3.8.
  155. * Fri May 01 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.11.1-1
  156. - new upstream release.
  157. - added systemd support (disabled as default).
  158. * Tue Aug 27 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.10.4-1
  159. - new upstream release.
  160. - switched to python3.
  161. * Sat Dec 30 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.10.1-1
  162. - new upstream release.
  163. * Fri Jun 3 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.9.4-1
  164. - new upstream release.
  165. * Sun Feb 8 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.8.14-1
  166. - new upstream release.
  167. * Mon Jun 10 2013 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.8.9-1
  168. - new upstream release.
  169. * Thu Oct 18 2012 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.8.7.1-2
  170. - initial build on Vine Linux.
  171. * Thu Oct 11 2012 Orion Poplawski <orion@cora.nwra.com> - 0.8.7.1-1
  172. - Update to 0.8.7.1
  173. - Drop fd_cloexec, pyinotify, and examplemail patches fixed upstream
  174. - Rebase sshd and notmp patches
  175. - Use _initddir macro
  176. * Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.4-29
  177. - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
  178. * Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.4-28
  179. - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
  180. * Sat Apr 9 2011 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.4-27
  181. - Move tmp files to /var/lib (suggested by Phil Anderson).
  182. - Enable inotify support (by Jonathan Underwood).
  183. - Fixes RH bugs #669966, #669965, #551895, #552947, #658849, #656584.
  184. * Sun Feb 14 2010 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.4-24
  185. - Patch by Jonathan G. Underwood <jonathan.underwood@gmail.com> to
  186. cloexec another fd leak.
  187. * Fri Sep 11 2009 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.4-23
  188. - update to 0.8.4.
  189. * Wed Sep 2 2009 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.3-22
  190. - Update to a newer svn snapshot to fix python 2.6 issue.
  191. * Thu Aug 27 2009 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.3-21
  192. - Log to syslog (RH bug #491983). Also deals with RH bug #515116.
  193. - Check inodes of log files (RH bug #503852).
  194. * Sat Feb 14 2009 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.3-18
  195. - Fix CVE-2009-0362 (Fedora bugs #485461, #485464, #485465, #485466).
  196. * Mon Dec 01 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.8.3-17
  197. - Rebuild for Python 2.6
  198. * Sun Aug 24 2008 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.3-16
  199. - Update to 0.8.3.
  200. * Wed May 21 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 0.8.2-15
  201. - fix license tag
  202. * Thu Mar 27 2008 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.2-14
  203. - Close on exec fixes by Jonathan Underwood.
  204. * Sun Mar 16 2008 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.2-13
  205. - Add %%{_localstatedir}/run/fail2ban (David Rees).
  206. * Fri Mar 14 2008 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.2-12
  207. - Update to 0.8.2.
  208. * Thu Jan 31 2008 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 0.8.1-11
  209. - Move socket file from /tmp to /var/run to prevent SElinux from stopping
  210. fail2ban from starting (BZ #429281)
  211. - Change logic in init file to start with -x to remove the socket file in case
  212. of unclean shutdown
  213. * Wed Aug 15 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.1-10
  214. - Update to 0.8.1.
  215. - Remove patch fixing CVE-2007-4321 (upstream).
  216. - Remove AllowUsers patch (upstream).
  217. - Add dependency to gamin-python.
  218. * Thu Jun 21 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.0-9
  219. - Fix remote log injection (no CVE assignment yet).
  220. * Sun Jun 3 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.0-8
  221. - Also trigger on non-AllowUsers failures (Jonathan Underwood
  222. <jonathan.underwood@gmail.com>).
  223. * Wed May 23 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.0-7
  224. - logrotate should restart fail2ban (Zing <zing@fastmail.fm>).
  225. - send mail to root; logrotate (Jonathan Underwood
  226. <jonathan.underwood@gmail.com>)
  227. * Sat May 19 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.8.0-4
  228. - Update to 0.8.0.
  229. - enable ssh by default, fix log file for ssh scanning, adjust python
  230. dependency (Jonathan Underwood <jonathan.underwood@gmail.com>)
  231. * Sat Dec 30 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.6.2-3
  232. - Remove forgotten condrestart.
  233. * Fri Dec 29 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.6.2-2
  234. - Move /usr/lib/fail2ban to %%{_datadir}/fail2ban.
  235. - Don't default chkconfig to enabled.
  236. - Add dependencies on service/chkconfig.
  237. - Use example iptables/ssh config as default config.
  238. * Mon Dec 25 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.6.2-1
  239. - Initial build.