Accepting request 200162 from security
I've added a systemd service file for openSUSE >= 12.3. Previous systemd based versions would require an additional variant of the service file, because SuSEfirewall2.service (which is an ordering dependency) used to be named SuSEfirewall2_setup.service in these versions. I don't think it would be worth the trouble of adding yet another switch, but I can of course do so if desired. (forwarded request 199913 from marc_schuetz) OBS-URL: https://build.opensuse.org/request/show/200162 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/fail2ban?expand=0&rev=29
This commit is contained in:
commit
7831ea0a7a
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Sep 21 11:38:29 UTC 2013 - schuetzm@gmx.net
|
||||||
|
|
||||||
|
- Added systemd service file and systemd-tmpfiles configuration
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Jun 13 08:58:53 UTC 2013 - jweberhofer@weberhofer.at
|
Thu Jun 13 08:58:53 UTC 2013 - jweberhofer@weberhofer.at
|
||||||
|
|
||||||
|
15
fail2ban.service
Normal file
15
fail2ban.service
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Bans IPs with too many authentication failures
|
||||||
|
After=network.target SuSEfirewall2.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
EnvironmentFile=-/etc/sysconfig/fail2ban
|
||||||
|
PIDFile=/run/fail2ban/fail2ban.pid
|
||||||
|
ExecStart=/usr/bin/fail2ban-client -x $FAIL2BAN_OPTIONS start
|
||||||
|
ExecReload=/usr/bin/fail2ban-client reload
|
||||||
|
ExecStop=/usr/bin/fail2ban-client stop
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
@ -28,6 +28,10 @@ Requires: python-pyinotify
|
|||||||
%if 0%{?suse_version} >= 1220
|
%if 0%{?suse_version} >= 1220
|
||||||
Requires: python-gamin
|
Requires: python-gamin
|
||||||
%endif
|
%endif
|
||||||
|
%if 0%{?suse_version} >= 1230
|
||||||
|
%{?systemd_requires}
|
||||||
|
BuildRequires: systemd
|
||||||
|
%endif
|
||||||
BuildRequires: logrotate
|
BuildRequires: logrotate
|
||||||
BuildRequires: python-devel
|
BuildRequires: python-devel
|
||||||
PreReq: %fillup_prereq
|
PreReq: %fillup_prereq
|
||||||
@ -41,9 +45,15 @@ License: GPL-2.0+
|
|||||||
Group: Productivity/Networking/Security
|
Group: Productivity/Networking/Security
|
||||||
#URL https://codeload.github.com/fail2ban/fail2ban/tar.gz/0.8.9
|
#URL https://codeload.github.com/fail2ban/fail2ban/tar.gz/0.8.9
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
|
%if 0%{?suse_version} < 1230
|
||||||
Source1: %{name}.init
|
Source1: %{name}.init
|
||||||
|
%endif
|
||||||
Source2: %{name}.sysconfig
|
Source2: %{name}.sysconfig
|
||||||
Source3: %{name}.logrotate
|
Source3: %{name}.logrotate
|
||||||
|
%if 0%{?suse_version} >= 1230
|
||||||
|
Source4: %{name}.service
|
||||||
|
Source5: %{name}.tmpfiles
|
||||||
|
%endif
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Fail2ban scans log files like /var/log/messages and bans IP addresses
|
Fail2ban scans log files like /var/log/messages and bans IP addresses
|
||||||
@ -72,23 +82,50 @@ for i in fail2ban-client fail2ban-regex fail2ban-server; do
|
|||||||
done
|
done
|
||||||
install -d -m755 $RPM_BUILD_ROOT/%{_initrddir}
|
install -d -m755 $RPM_BUILD_ROOT/%{_initrddir}
|
||||||
install -d -m755 $RPM_BUILD_ROOT/%{_sbindir}
|
install -d -m755 $RPM_BUILD_ROOT/%{_sbindir}
|
||||||
|
%if 0%{?suse_version} < 1230
|
||||||
install -m755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initrddir}/%{name}
|
install -m755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initrddir}/%{name}
|
||||||
ln -sf %{_initrddir}/%{name} ${RPM_BUILD_ROOT}%{_sbindir}/rc%{name}
|
ln -sf %{_initrddir}/%{name} ${RPM_BUILD_ROOT}%{_sbindir}/rc%{name}
|
||||||
|
%endif
|
||||||
install -d -m755 $RPM_BUILD_ROOT/var/adm/fillup-templates
|
install -d -m755 $RPM_BUILD_ROOT/var/adm/fillup-templates
|
||||||
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.%{name}
|
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.%{name}
|
||||||
|
|
||||||
install -d -m755 $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d
|
install -d -m755 $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d
|
||||||
install -m 644 %{SOURCE3} $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/fail2ban
|
install -m 644 %{SOURCE3} $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/fail2ban
|
||||||
|
|
||||||
|
%if 0%{?suse_version} >= 1230
|
||||||
|
install -d -m755 $RPM_BUILD_ROOT/%{_unitdir}
|
||||||
|
install -m644 %{SOURCE4} $RPM_BUILD_ROOT/%{_unitdir}/%{name}.service
|
||||||
|
|
||||||
|
install -d -m755 $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/
|
||||||
|
install -m644 %{SOURCE5} $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/%{name}.conf
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%pre
|
||||||
|
%if 0%{?suse_version} >= 1230
|
||||||
|
%service_add_pre %{name}.service
|
||||||
|
%endif
|
||||||
|
|
||||||
%post
|
%post
|
||||||
%{fillup_only}
|
%{fillup_only}
|
||||||
|
%if 0%{?suse_version} >= 1230
|
||||||
|
systemd-tmpfiles --create /usr/lib/tmpfiles.d/%{name}.conf
|
||||||
|
%service_add_post %{name}.service
|
||||||
|
%endif
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
|
%if 0%{?suse_version} >= 1230
|
||||||
|
%service_del_preun %{name}.service
|
||||||
|
%else
|
||||||
%stop_on_removal %{name}
|
%stop_on_removal %{name}
|
||||||
|
%endif
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
|
%if 0%{?suse_version} >= 1230
|
||||||
|
%service_del_postun %{name}.service
|
||||||
|
%else
|
||||||
%restart_on_update %{name}
|
%restart_on_update %{name}
|
||||||
%insserv_cleanup
|
%insserv_cleanup
|
||||||
|
%endif
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-, root, root)
|
%defattr(-, root, root)
|
||||||
@ -99,11 +136,16 @@ install -m 644 %{SOURCE3} $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/fail2ban
|
|||||||
%config(noreplace) %{_sysconfdir}/%{name}/action.d/*.conf
|
%config(noreplace) %{_sysconfdir}/%{name}/action.d/*.conf
|
||||||
%config(noreplace) %{_sysconfdir}/%{name}/filter.d/*.conf
|
%config(noreplace) %{_sysconfdir}/%{name}/filter.d/*.conf
|
||||||
%config %{_sysconfdir}/logrotate.d/fail2ban
|
%config %{_sysconfdir}/logrotate.d/fail2ban
|
||||||
|
%if 0%{?suse_version} >= 1230
|
||||||
|
%{_unitdir}/%{name}.service
|
||||||
|
/usr/lib/tmpfiles.d/%{name}.conf
|
||||||
|
%else
|
||||||
%{_initrddir}/%{name}
|
%{_initrddir}/%{name}
|
||||||
%{_bindir}/%{name}*
|
|
||||||
%{_sbindir}/rc%{name}
|
%{_sbindir}/rc%{name}
|
||||||
%{_datadir}/%{name}
|
|
||||||
%dir %ghost /var/run/%{name}
|
%dir %ghost /var/run/%{name}
|
||||||
|
%endif
|
||||||
|
%{_bindir}/%{name}*
|
||||||
|
%{_datadir}/%{name}
|
||||||
/var/adm/fillup-templates/sysconfig.%{name}
|
/var/adm/fillup-templates/sysconfig.%{name}
|
||||||
%doc %{_mandir}/man1/*
|
%doc %{_mandir}/man1/*
|
||||||
%doc COPYING ChangeLog DEVELOP README.md TODO files/cacti
|
%doc COPYING ChangeLog DEVELOP README.md TODO files/cacti
|
||||||
|
1
fail2ban.tmpfiles
Normal file
1
fail2ban.tmpfiles
Normal file
@ -0,0 +1 @@
|
|||||||
|
d /run/fail2ban 0755 root root
|
Loading…
Reference in New Issue
Block a user