From a99711dd02ef4f7cda80d3123a3b2c40338ed323 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Mon, 29 Apr 2013 12:15:26 +0200 Subject: [PATCH] Send daemon logs to a dedicated file and add logrotate templates --- createlinks | 1 + root/etc/e-smith/templates/etc/fail2ban/fail2ban.conf/10All | 2 +- root/etc/e-smith/templates/etc/logrotate.d/fail2ban/10All | 8 ++++++++ smeserver-fail2ban.spec | 4 +--- 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 root/etc/e-smith/templates/etc/logrotate.d/fail2ban/10All diff --git a/createlinks b/createlinks index b7ec217..711bf49 100644 --- a/createlinks +++ b/createlinks @@ -5,6 +5,7 @@ use esmith::Build::CreateLinks qw(:all); templates2events("/etc/rc.d/init.d/masq", "fail2ban-update"); templates2events("/etc/fail2ban/jail.conf", "fail2ban-conf"); templates2events("/etc/fail2ban/fail2ban.conf", "fail2ban-conf"); +templates2events("/etc/logrotate.d/fail2ban", "fail2ban-conf"); safe_symlink("adjust", "root/etc/e-smith/events/fail2ban-update/services2adjust/masq"); safe_symlink("restart", "root/etc/e-smith/events/fail2ban-conf/services2adjust/fail2ban"); diff --git a/root/etc/e-smith/templates/etc/fail2ban/fail2ban.conf/10All b/root/etc/e-smith/templates/etc/fail2ban/fail2ban.conf/10All index b7cc31c..c122d17 100644 --- a/root/etc/e-smith/templates/etc/fail2ban/fail2ban.conf/10All +++ b/root/etc/e-smith/templates/etc/fail2ban/fail2ban.conf/10All @@ -1,4 +1,4 @@ [Definition] loglevel = 3 -logtarget = STDOUT +logtarget = /var/log/fail2ban/daemon.log socket = /var/run/fail2ban/fail2ban.sock diff --git a/root/etc/e-smith/templates/etc/logrotate.d/fail2ban/10All b/root/etc/e-smith/templates/etc/logrotate.d/fail2ban/10All new file mode 100644 index 0000000..d967b30 --- /dev/null +++ b/root/etc/e-smith/templates/etc/logrotate.d/fail2ban/10All @@ -0,0 +1,8 @@ +/var/log/fail2ban/*.log \{ + missingok + weekly + rotate 24 + compress + notifempty + copytruncate +\} diff --git a/smeserver-fail2ban.spec b/smeserver-fail2ban.spec index 88efa6c..cddf55d 100644 --- a/smeserver-fail2ban.spec +++ b/smeserver-fail2ban.spec @@ -37,9 +37,7 @@ perl createlinks (cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) /bin/rm -f %{name}-%{version}-filelist /sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ - --file /var/service/fail2ban/run 'attr(0755,root,root)' \ - --file /var/service/fail2ban/log/run 'attr(0755,root,root)' \ - --dir /var/log/fail2ban 'attr(0750,smelog,smelog)' \ + --dir /var/log/fail2ban 'attr(0750,root,root)' \ > %{name}-%{version}-filelist %files -f %{name}-%{version}-filelist