]> git.pld-linux.org Git - packages/fail2ban.git/blob - fail2ban.spec
Install jail.conf.5, too
[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:        2
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}/man{1,5},/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 install -p man/*.5 $RPM_BUILD_ROOT%{_mandir}/man5
78
79 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/fail2ban
80 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/fail2ban
81 install -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/fail2ban/paths-pld.conf
82 install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
83
84 sed -e 's# /run# /var/run#g' files/fail2ban-tmpfiles.conf > $RPM_BUILD_ROOT%{systemdtmpfilesdir}/fail2ban.conf
85 install -p build-3/fail2ban.service $RPM_BUILD_ROOT%{systemdunitdir}/fail2ban.service
86
87 :> $RPM_BUILD_ROOT/var/log/fail2ban.log
88
89 %py_postclean
90
91 rm $RPM_BUILD_ROOT%{_bindir}/fail2ban-testcases
92
93 %clean
94 rm -rf $RPM_BUILD_ROOT
95
96 %post
97 /sbin/chkconfig --add %{name}
98 %service %{name} restart
99 %systemd_post fail2ban.service
100
101 %preun
102 if [ "$1" = "0" ]; then
103         %service -q %{name} stop
104         /sbin/chkconfig --del %{name}
105 fi
106 %systemd_preun fail2ban.service
107
108 %postun
109 %systemd_reload
110
111 %triggerpostun -- fail2ban < 0.8.11-3
112 %systemd_trigger fail2ban.service
113
114 %files
115 %defattr(644,root,root,755)
116 %doc CONTRIBUTING.md ChangeLog DEVELOP FILTERS README.md RELEASE THANKS TODO COPYING doc/run-rootless.txt
117 %attr(754,root,root) /etc/rc.d/init.d/fail2ban
118 %attr(755,root,root) %{_bindir}/fail2ban-client
119 %attr(755,root,root) %{_bindir}/fail2ban-python
120 %attr(755,root,root) %{_bindir}/fail2ban-regex
121 %attr(755,root,root) %{_bindir}/fail2ban-server
122 %{systemdunitdir}/fail2ban.service
123 %{systemdtmpfilesdir}/fail2ban.conf
124 %dir /var/run/fail2ban
125 %dir %{_sysconfdir}/fail2ban
126 %dir %{_sysconfdir}/fail2ban/action.d
127 %attr(755,root,root) %{_sysconfdir}/fail2ban/action.d/smtp.py
128 %dir %{_sysconfdir}/fail2ban/fail2ban.d
129 %dir %{_sysconfdir}/fail2ban/filter.d
130 %dir %{_sysconfdir}/fail2ban/filter.d/ignorecommands
131 %attr(755,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fail2ban/filter.d/ignorecommands/apache-fakegooglebot
132 %dir %{_sysconfdir}/fail2ban/jail.d
133 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fail2ban/*.conf
134 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fail2ban/*/*.conf
135 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/fail2ban
136 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
137 %{py3_sitescriptdir}/%{name}
138 %{py3_sitescriptdir}/%{name}-%{version}-py*.egg-info
139 %{_mandir}/man1/fail2ban-client.1*
140 %{_mandir}/man1/fail2ban-python.1*
141 %{_mandir}/man1/fail2ban-regex.1*
142 %{_mandir}/man1/fail2ban-server.1*
143 %{_mandir}/man1/fail2ban-testcases.1*
144 %{_mandir}/man1/fail2ban.1*
145 %{_mandir}/man5/jail.conf.5*
146 %attr(750,root,root) %dir /var/lib/%{name}
147 %attr(640,root,logs) %ghost /var/log/fail2ban.log
This page took 0.056844 seconds and 3 git commands to generate.