[packages/ulogd] - rel 2; don't pollute /var/log directly; enable some default logging settings (debian way)

arekm arekm at pld-linux.org
Tue Dec 3 11:20:20 CET 2019


commit 44f1c8bbeb8c6f85bc6a0f869784c1d716ee4db9
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Tue Dec 3 11:20:00 2019 +0100

    - rel 2; don't pollute /var/log directly; enable some default logging settings (debian way)

 configure-logging.patch            | 22 ++++++++++++
 enable-nflog-by-default.patch      | 18 ++++++++++
 put-logfiles-in-var-log-ulog.patch | 72 ++++++++++++++++++++++++++++++++++++++
 ulogd.logrotate                    |  4 ++-
 ulogd.spec                         | 22 ++++++------
 5 files changed, 127 insertions(+), 11 deletions(-)
---
diff --git a/ulogd.spec b/ulogd.spec
index 7f7a4ba..f90cc3d 100644
--- a/ulogd.spec
+++ b/ulogd.spec
@@ -2,7 +2,7 @@ Summary:	ULOGD - the Userspace Logging Daemon for iptables
 Summary(pl.UTF-8):	Demon logujący w trybie użytkownika dla iptables
 Name:		ulogd
 Version:	2.0.7
-Release:	1
+Release:	2
 License:	GPL v2+
 Group:		Networking/Daemons
 Source0:	https://netfilter.org/projects/ulogd/files/%{name}-%{version}.tar.bz2
@@ -12,6 +12,9 @@ Source2:	%{name}.sysconfig
 Source3:	%{name}.logrotate
 Patch0:		%{name}-includes.patch
 Patch1:		%{name}-ac.patch
+Patch2:		configure-logging.patch
+Patch3:		enable-nflog-by-default.patch
+Patch4:		put-logfiles-in-var-log-ulog.patch
 URL:		https://netfilter.org/projects/ulogd/
 BuildRequires:	autoconf >= 2.50
 BuildRequires:	automake >= 1:1.11
@@ -133,6 +136,9 @@ Wtyczka SQLite dla ulogd.
 %setup -q
 %patch0 -p1
 %patch1 -p0
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
 
 %build
 %{__libtoolize}
@@ -154,7 +160,7 @@ sgml2html -s 0 ulogd.sgml
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_sbindir},/etc/{sysconfig,logrotate.d,rc.d/init.d,ulogd}} \
-	$RPM_BUILD_ROOT/var/log
+	$RPM_BUILD_ROOT/var/log/ulog
 
 %{__make} install -j1 \
 	DESTDIR=$RPM_BUILD_ROOT
@@ -166,17 +172,12 @@ install %{name}.conf $RPM_BUILD_ROOT/etc/%{name}.conf
 
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/ulogd/*.la
 
-touch $RPM_BUILD_ROOT/var/log/ulogd{,.pktlog}
+touch $RPM_BUILD_ROOT/var/log/ulog/ulogd{,.pktlog}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post
-if [ ! -f /var/log/ulogd ]; then
-	touch /var/log/ulogd{,.pktlog}
-	chmod 640 /var/log/ulogd{,.pktlog}
-fi
-
 /sbin/chkconfig --add ulogd
 %service ulogd restart "ulogd daemon"
 
@@ -220,8 +221,9 @@ fi
 %attr(755,root,root) %{_libdir}/ulogd/ulogd_output_XML.so
 %attr(755,root,root) %{_libdir}/ulogd/ulogd_raw2packet_BASE.so
 
-%attr(640,root,root) %ghost /var/log/ulogd
-%attr(640,root,root) %ghost /var/log/ulogd.pktlog
+%attr(640,root,root) %dir /var/log/ulog
+%attr(640,root,root) %ghost /var/log/ulog/ulogd
+%attr(640,root,root) %ghost /var/log/ulog/ulogd.pktlog
 %{_mandir}/man8/ulogd.8*
 
 %files dbi
diff --git a/configure-logging.patch b/configure-logging.patch
new file mode 100644
index 0000000..5d74ae1
--- /dev/null
+++ b/configure-logging.patch
@@ -0,0 +1,22 @@
+Description: Tweak log destination and loglevel in ulogd.conf.in
+ Send logging for ulogd itself to syslog rather than to file (not for iptables
+ logging), and explicitly set loglevel to info.
+Forwarded: not-needed
+Author: Chris Boot <bootc at debian.org>
+Last-Update: 2013-04-27
+
+--- ulogd2-2.0.2.orig/ulogd.conf.in
++++ ulogd2-2.0.2/ulogd.conf.in
+@@ -8,10 +8,10 @@
+ 
+ 
+ # logfile for status messages
+-logfile="/var/log/ulogd.log"
++logfile="syslog"
+ 
+ # loglevel: debug(1), info(3), notice(5), error(7) or fatal(8) (default 5)
+-# loglevel=1
++loglevel=3
+ 
+ ######################################################################
+ # PLUGIN OPTIONS
diff --git a/enable-nflog-by-default.patch b/enable-nflog-by-default.patch
new file mode 100644
index 0000000..1b54509
--- /dev/null
+++ b/enable-nflog-by-default.patch
@@ -0,0 +1,18 @@
+Description: Enable NFLOG => LOGEMU stack by default
+ The simplest and likely most common usage scenario is to log packets to a
+ logfile using NFLOG, bypassing the kernel ringbuffer. Enable this by default.
+Forwarded: not-needed
+Author: Chris Boot <bootc at debian.org>
+Last-Update: 2013-04-27
+
+--- a/ulogd.conf.in
++++ b/ulogd.conf.in
+@@ -52,7 +52,7 @@
+ #plugin="@pkglibdir@/ulogd_output_JSON.so"
+ 
+ # this is a stack for logging packet send by system via LOGEMU
+-#stack=log1:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,emu1:LOGEMU
++stack=log1:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,emu1:LOGEMU
+ 
+ # this is a stack for packet-based logging via LOGEMU
+ #stack=log2:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,emu1:LOGEMU
diff --git a/put-logfiles-in-var-log-ulog.patch b/put-logfiles-in-var-log-ulog.patch
new file mode 100644
index 0000000..f040e70
--- /dev/null
+++ b/put-logfiles-in-var-log-ulog.patch
@@ -0,0 +1,72 @@
+Description: Update logfile paths to log to /var/log/ulog/*
+ The standard configuration file sends logs to a number of files under
+ /var/log/. To keep things tidy, including the logrotate script, move all the
+ logs into a common parent directory.
+Forwarded: not-needed
+Author: Chris Boot <bootc at debian.org>
+Last-Update: 2013-04-27
+
+--- a/ulogd.conf.in
++++ b/ulogd.conf.in
+@@ -184,25 +184,25 @@
+ socket_path="/tmp/nuauth_ulogd2.sock"
+ 
+ [emu1]
+-file="/var/log/ulogd_syslogemu.log"
++file="/var/log/ulog/syslogemu.log"
+ sync=1
+ 
+ [op1]
+-file="/var/log/ulogd_oprint.log"
++file="/var/log/ulog/oprint.log"
+ sync=1
+ 
+ [gp1]
+-file="/var/log/ulogd_gprint.log"
++file="/var/log/ulog/gprint.log"
+ sync=1
+ timestamp=1
+ 
+ [xml1]
+-directory="/var/log/"
++directory="/var/log/ulog/"
+ sync=1
+ 
+ [json1]
+ sync=1
+-#file="/var/log/ulogd.json"
++#file="/var/log/ulog/ulogd.json"
+ #timestamp=0
+ # device name to be used in JSON message
+ #device="My awesome Netfilter firewall"
+@@ -216,7 +216,7 @@
+ 
+ [pcap1]
+ #default file is /var/log/ulogd.pcap
+-#file="/var/log/ulogd.pcap"
++#file="/var/log/ulog/ulogd.pcap"
+ sync=1
+ 
+ [mysql1]
+@@ -301,18 +301,18 @@
+ 
+ [sqlite3_ct]
+ table="ulog_ct"
+-db="/var/log/ulogd.sqlite3db"
++db="/var/log/ulog/ulogd.sqlite3db"
+ 
+ [sqlite3_pkt]
+ table="ulog_pkt"
+-db="/var/log/ulogd.sqlite3db"
++db="/var/log/ulog/ulogd.sqlite3db"
+ 
+ [sys2]
+ facility=LOG_LOCAL2
+ 
+ [nacct1]
+ sync = 1
+-#file = /var/log/ulogd_nacct.log
++#file = /var/log/ulog/nacct.log
+ 
+ [mark1]
+ mark = 1
diff --git a/ulogd.logrotate b/ulogd.logrotate
index 99840c6..384dcea 100644
--- a/ulogd.logrotate
+++ b/ulogd.logrotate
@@ -1,4 +1,6 @@
-/var/log/ulogd* {
+/var/log/ulog/*.* {
+        olddir /var/log/archive/ulog
+        sharedscripts
         postrotate
 		/etc/rc.d/init.d/ulogd reload >/dev/null 2>&1
         endscript
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ulogd.git/commitdiff/44f1c8bbeb8c6f85bc6a0f869784c1d716ee4db9



More information about the pld-cvs-commit mailing list