]> git.pld-linux.org Git - packages/fail2ban.git/blob - fail2ban.spec
Up to 1.0.2; switch to python3
[packages/fail2ban.git] / fail2ban.spec
1 Summary:        Ban IPs that make too many password failures
2 Summary(pl.UTF-8):      Blokowanie IP powodujących zbyt dużo prób logowań z błędnym hasłem
3 Name:           fail2ban
4 Version:        1.0.2
5 Release:        1
6 License:        GPL
7 Group:          Daemons
8 Source0:        https://github.com/fail2ban/fail2ban/archive/%{version}.tar.gz
9 # Source0-md5:  96582af04e60bf56617da9f9cbda0aa7
10 Source1:        %{name}.init
11 Source2:        %{name}.logrotate
12 Source3:        paths-pld.conf
13 Source4:        %{name}.sysconfig
14 Patch0:         logifiles.patch
15 URL:            http://fail2ban.sourceforge.net/
16 BuildRequires:  python3-2to3
17 BuildRequires:  python3-devel
18 BuildRequires:  python3-modules
19 BuildRequires:  rpm-pythonprov
20 BuildRequires:  rpmbuild(macros) >= 1.710
21 Requires(post,preun):   /sbin/chkconfig
22 Requires(post,preun,postun):    systemd-units >= 38
23 Requires:       python3-dns
24 Requires:       python3-pyinotify >= 0.8.3
25 Requires:       rc-scripts
26 Requires:       systemd-units >= 38
27 BuildArch:      noarch
28 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
29
30 %description
31 Fail2Ban scans log files like /var/log/secure and bans IP that makes
32 too many password failures. It updates firewall rules to reject the IP
33 address. These rules can be defined by the user. Fail2Ban can read
34 multiple log files including sshd or Apache web server logs.
35
36 %description -l pl.UTF-8
37 Fail2Ban skanuje pliki logów takie jak /var/log/secure i blokuje IP
38 powodujące zbyt dużo prób logowań z błędnym hasłem. Uaktualnia regułki
39 firewalla, aby odrzucić adres IP. Regułki te mogą być definiowane
40 przez użytkownika. Fail2Ban potrafi czytać wiele plików logów włącznie
41 z sshd czy plikami logów serwera WWW Apache.
42
43 %prep
44 %setup -q
45 %patch0 -p1
46 rm setup.cfg
47
48 sed -E -i -e '1s,#!\s*/usr/bin/env\s+python2(\s|$),#!%{__python3}\1,' -e '1s,#!\s*/usr/bin/env\s+python(\s|$),#!%{__python3}\1,' -e '1s,#!\s*/usr/bin/python(\s|$),#!%{__python3}\1,' \
49       bin/fail2ban-client \
50       bin/fail2ban-regex \
51       bin/fail2ban-server \
52       bin/fail2ban-testcases \
53       setup.py
54
55 sed -E -i -e '1s,#!\s*/usr/bin/env\s+(.*),#!%{__bindir}\1,' \
56       config/filter.d/ignorecommands/apache-fakegooglebot \
57       fail2ban/tests/files/config/apache-auth/digest.py \
58       fail2ban/tests/files/ignorecommand.py
59
60 sed -i -e 's#2to3#2to3-%{py3_ver}#g' fail2ban-2to3
61 ./fail2ban-2to3
62
63 %build
64 %py3_build
65
66 %install
67 rm -rf $RPM_BUILD_ROOT
68 install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d,sysconfig} \
69         $RPM_BUILD_ROOT{%{_mandir}/man1,/var/{log,run/fail2ban}} \
70         $RPM_BUILD_ROOT{%{systemdunitdir},%{systemdtmpfilesdir}}
71
72 %py3_install \
73         --install-lib=%{py3_sitescriptdir} \
74         --root=$RPM_BUILD_ROOT
75
76 install -p man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
77
78 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/fail2ban
79 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/fail2ban
80 install -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/fail2ban/paths-pld.conf
81 install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
82
83 sed -e 's# /run# /var/run#g' files/fail2ban-tmpfiles.conf > $RPM_BUILD_ROOT%{systemdtmpfilesdir}/fail2ban.conf
84 install -p build-3/fail2ban.service $RPM_BUILD_ROOT%{systemdunitdir}/fail2ban.service
85
86 :> $RPM_BUILD_ROOT/var/log/fail2ban.log
87
88 %py_postclean
89
90 rm $RPM_BUILD_ROOT%{_bindir}/fail2ban-testcases
91
92 %clean
93 rm -rf $RPM_BUILD_ROOT
94
95 %post
96 /sbin/chkconfig --add %{name}
97 %service %{name} restart
98 %systemd_post fail2ban.service
99
100 %preun
101 if [ "$1" = "0" ]; then
102         %service -q %{name} stop
103         /sbin/chkconfig --del %{name}
104 fi
105 %systemd_preun fail2ban.service
106
107 %postun
108 %systemd_reload
109
110 %triggerpostun -- fail2ban < 0.8.11-3
111 %systemd_trigger fail2ban.service
112
113 %files
114 %defattr(644,root,root,755)
115 %doc CONTRIBUTING.md ChangeLog DEVELOP FILTERS README.md RELEASE THANKS TODO COPYING doc/run-rootless.txt
116 %attr(754,root,root) /etc/rc.d/init.d/fail2ban
117 %attr(755,root,root) %{_bindir}/fail2ban-client
118 %attr(755,root,root) %{_bindir}/fail2ban-python
119 %attr(755,root,root) %{_bindir}/fail2ban-regex
120 %attr(755,root,root) %{_bindir}/fail2ban-server
121 %{systemdunitdir}/fail2ban.service
122 %{systemdtmpfilesdir}/fail2ban.conf
123 %dir /var/run/fail2ban
124 %dir %{_sysconfdir}/fail2ban
125 %dir %{_sysconfdir}/fail2ban/action.d
126 %attr(755,root,root) %{_sysconfdir}/fail2ban/action.d/smtp.py
127 %dir %{_sysconfdir}/fail2ban/fail2ban.d
128 %dir %{_sysconfdir}/fail2ban/filter.d
129 %dir %{_sysconfdir}/fail2ban/filter.d/ignorecommands
130 %attr(755,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fail2ban/filter.d/ignorecommands/apache-fakegooglebot
131 %dir %{_sysconfdir}/fail2ban/jail.d
132 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fail2ban/*.conf
133 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fail2ban/*/*.conf
134 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/fail2ban
135 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
136 %{py3_sitescriptdir}/%{name}
137 %{py3_sitescriptdir}/%{name}-%{version}-py*.egg-info
138 %{_mandir}/man1/fail2ban-client.1*
139 %{_mandir}/man1/fail2ban-python.1*
140 %{_mandir}/man1/fail2ban-regex.1*
141 %{_mandir}/man1/fail2ban-server.1*
142 %{_mandir}/man1/fail2ban-testcases.1*
143 %{_mandir}/man1/fail2ban.1*
144 %attr(750,root,root) %dir /var/lib/%{name}
145 %attr(640,root,logs) %ghost /var/log/fail2ban.log
This page took 0.057227 seconds and 3 git commands to generate.