fail2ban-vl.spec 10 KB

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