diff -rupN old/app-admin/rsyslog/files/8-stable/20-rsyslog-json_tokener_errors.patch new/app-admin/rsyslog/files/8-stable/20-rsyslog-json_tokener_errors.patch --- old/app-admin/rsyslog/files/8-stable/20-rsyslog-json_tokener_errors.patch 1970-01-01 01:00:00.000000000 +0100 +++ new/app-admin/rsyslog/files/8-stable/20-rsyslog-json_tokener_errors.patch 2014-08-19 12:00:42.076935177 +0200 @@ -0,0 +1,49 @@ +From 6b47dd542d07ed557f02af9970d1004eb262e1c1 Mon Sep 17 00:00:00 2001 +From: Rainer Gerhards +Date: Tue, 19 Aug 2014 11:33:41 +0200 +Subject: [PATCH] bugfix: build failure on systems which don't have + json_tokener_errors + +Older versions of json-c need to use a different API (which don't exists +on newer versions, unfortunately...) +Thanks to Thomas D. for reporting this problem. +--- + ChangeLog | 6 ++++++ + runtime/msg.c | 6 +++++- + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/ChangeLog b/ChangeLog +index 177387d..cb09b6c 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,4 +1,10 @@ + --------------------------------------------------------------------------- ++Version 8.4.1 [v8-stable] 2014-08-?? ++- bugfix: build failure on systems which don't have json_tokener_errors ++ Older versions of json-c need to use a different API (which don't exists ++ on newer versions, unfortunately...) ++ Thanks to Thomas D. for reporting this problem. ++--------------------------------------------------------------------------- + Version 8.4.0 [v8-stable] 2014-08-18 + - this is the new stable branch, which incorporates all enhancements of + rsyslog 8.3. +diff --git a/runtime/msg.c b/runtime/msg.c +index 66c3b7b..81b13f9 100644 +--- a/runtime/msg.c ++++ b/runtime/msg.c +@@ -4074,7 +4074,11 @@ MsgSetPropsViaJSON(msg_t *__restrict__ const pMsg, const uchar *__restrict__ con + + err = tokener->err; + if(err != json_tokener_continue) +- errMsg = json_tokener_errors[err]; ++# if HAVE_JSON_TOKENER_ERROR_DESC ++ errMsg = json_tokener_error_desc(err); ++# else ++ errMsg = json_tokener_errors[err]; ++# endif + else + errMsg = "Unterminated input"; + } else if(!json_object_is_type(json, json_type_object)) +-- +2.0.3 + diff -rupN old/app-admin/rsyslog/files/8-stable/30-rsyslog-imuxsock-shrink.patch new/app-admin/rsyslog/files/8-stable/30-rsyslog-imuxsock-shrink.patch --- old/app-admin/rsyslog/files/8-stable/30-rsyslog-imuxsock-shrink.patch 1970-01-01 01:00:00.000000000 +0100 +++ new/app-admin/rsyslog/files/8-stable/30-rsyslog-imuxsock-shrink.patch 2014-08-21 12:56:57.043528566 +0200 @@ -0,0 +1,55 @@ +From ef18451ff518c870575622be159e30561c90087a Mon Sep 17 00:00:00 2001 +From: Alex Deymo +Date: Fri, 6 Jun 2014 22:57:46 -0700 +Subject: [PATCH] plugins: Remove $(RSRT_LIBS) from imuxsock's LIBADD + +imuxsock.c plugin uses some functions from sd-daemon.h that are +compiled as part of librsyslog.a. Including $(RSRT_LIB) to the LIBADD +variable on these plugins means that we are linking librsyslog.a +statically into that plugin. Nevertheless, the rsyslogd binary +already includes most of the librsyslog.a and exposes its symbols. +Because of this, we can let those functions undefined in the plugin +.so file and let dlopen() link those undefined functions against the +global symbols from rsyslogd. + +This patch removes the static library from imuxsock.so and ensures +that all the objects from the librsyslog.a are included on rsyslogd. +--- + plugins/imuxsock/Makefile.am | 2 +- + tools/Makefile.am | 7 ++++--- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/plugins/imuxsock/Makefile.am b/plugins/imuxsock/Makefile.am +index 28f9f9e..f21d150 100644 +--- a/plugins/imuxsock/Makefile.am ++++ b/plugins/imuxsock/Makefile.am +@@ -3,4 +3,4 @@ pkglib_LTLIBRARIES = imuxsock.la + imuxsock_la_SOURCES = imuxsock.c + imuxsock_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) + imuxsock_la_LDFLAGS = -module -avoid-version +-imuxsock_la_LIBADD = $(RSRT_LIBS) ++imuxsock_la_LIBADD = +diff --git a/tools/Makefile.am b/tools/Makefile.am +index 253cd5f..8f34289 100644 +--- a/tools/Makefile.am ++++ b/tools/Makefile.am +@@ -39,12 +39,13 @@ rsyslogd_SOURCES = \ + pidfile.h \ + \ + ../dirty.h +-rsyslogd_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) ++rsyslogd_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) -DSD_EXPORT_SYMBOLS + # note: it looks like librsyslog.la must be explicitely given on LDDADD, +-# otherwise dependencies are not properly calculated (resulting in a ++# otherwise dependencies are not properly calculated (resulting in a + # potentially incomplete build, a problem we had several times...) + rsyslogd_LDADD = ../grammar/libgrammar.la ../runtime/librsyslog.la $(ZLIB_LIBS) $(PTHREADS_LIBS) $(RSRT_LIBS) $(SOL_LIBS) $(LIBUUID_LIBS) $(LIBLOGGING_STDLOG_LIBS) +-rsyslogd_LDFLAGS = -export-dynamic ++rsyslogd_LDFLAGS = -export-dynamic \ ++ -Wl,--whole-archive,$(top_builddir)/runtime/.libs/librsyslog.a,--no-whole-archive + + EXTRA_DIST = $(man_MANS) \ + rsgtutil.rst \ +-- +2.0.4 + diff -rupN old/app-admin/rsyslog/files/8-stable/40-rsyslog-fix-building-without-atomic-instructions.patch new/app-admin/rsyslog/files/8-stable/40-rsyslog-fix-building-without-atomic-instructions.patch --- old/app-admin/rsyslog/files/8-stable/40-rsyslog-fix-building-without-atomic-instructions.patch 1970-01-01 01:00:00.000000000 +0100 +++ new/app-admin/rsyslog/files/8-stable/40-rsyslog-fix-building-without-atomic-instructions.patch 2014-08-21 12:59:04.959579671 +0200 @@ -0,0 +1,26 @@ +From 09ce215f66ad32b97f279152343bda4dd855ee25 Mon Sep 17 00:00:00 2001 +From: Rainer Gerhards +Date: Tue, 19 Aug 2014 16:04:52 +0200 +Subject: [PATCH] fix build problem on platforms without atomic instructions + +Thanks to Michael Biebl for his very helpful analysis of the bug. +--- + runtime/atomic.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/runtime/atomic.h b/runtime/atomic.h +index 49c17d8..d59858a 100644 +--- a/runtime/atomic.h ++++ b/runtime/atomic.h +@@ -221,7 +221,7 @@ + return(val); + } + +-# define DEF_ATOMIC_HELPER_MUT64(x) pthread_mutex_t x ++# define DEF_ATOMIC_HELPER_MUT64(x) pthread_mutex_t x; + # define INIT_ATOMIC_HELPER_MUT64(x) pthread_mutex_init(&(x), NULL) + # define DESTROY_ATOMIC_HELPER_MUT64(x) pthread_mutex_destroy(&(x)) + #endif /* #ifdef HAVE_ATOMIC_BUILTINS64 */ +-- +2.0.4 + diff -rupN old/app-admin/rsyslog/files/8-stable/41-rsyslog-gcc-pedantic-fixes.patch new/app-admin/rsyslog/files/8-stable/41-rsyslog-gcc-pedantic-fixes.patch --- old/app-admin/rsyslog/files/8-stable/41-rsyslog-gcc-pedantic-fixes.patch 1970-01-01 01:00:00.000000000 +0100 +++ new/app-admin/rsyslog/files/8-stable/41-rsyslog-gcc-pedantic-fixes.patch 2014-08-21 13:04:18.851870908 +0200 @@ -0,0 +1,69 @@ +From bbd0f0143892045e48cbc49ef7dd9e3510750cb3 Mon Sep 17 00:00:00 2001 +From: Rainer Gerhards +Date: Tue, 19 Aug 2014 16:55:33 +0200 +Subject: [PATCH] remove a couple of gcc --pedantic messages + +--- + plugins/mmfields/mmfields.c | 2 +- + runtime/prop.h | 2 +- + runtime/wti.h | 2 +- + runtime/wtp.h | 4 ++-- + 4 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/plugins/mmfields/mmfields.c b/plugins/mmfields/mmfields.c +index c408a6c..cdce199 100644 +--- a/plugins/mmfields/mmfields.c ++++ b/plugins/mmfields/mmfields.c +@@ -43,7 +43,7 @@ MODULE_TYPE_NOKEEP + MODULE_CNFNAME("mmfields") + + +-DEFobjCurrIf(errmsg); ++DEFobjCurrIf(errmsg) + DEF_OMOD_STATIC_DATA + + /* config variables */ +diff --git a/runtime/prop.h b/runtime/prop.h +index 7cb2743..38d801d 100644 +--- a/runtime/prop.h ++++ b/runtime/prop.h +@@ -33,7 +33,7 @@ struct prop_s { + uchar sz[CONF_PROP_BUFSIZE]; + } szVal; + int len; /* we use int intentionally, otherwise we may get some troubles... */ +- DEF_ATOMIC_HELPER_MUT(mutRefCount); ++ DEF_ATOMIC_HELPER_MUT(mutRefCount) + }; + + /* interfaces */ +diff --git a/runtime/wti.h b/runtime/wti.h +index 487abb7..496ef23 100644 +--- a/runtime/wti.h ++++ b/runtime/wti.h +@@ -72,7 +72,7 @@ struct wti_s { + actWrkrInfo_t *actWrkrInfo; /* *array* of action wrkr infos for all actions + (sized for max nbr of actions in config!) */ + pthread_cond_t pcondBusy; /* condition to wake up the worker, protected by pmutUsr in wtp */ +- DEF_ATOMIC_HELPER_MUT(mutIsRunning); ++ DEF_ATOMIC_HELPER_MUT(mutIsRunning) + struct { + uint8_t bPrevWasSuspended; + uint8_t bDoAutoCommit; /* do a commit after each message +diff --git a/runtime/wtp.h b/runtime/wtp.h +index 4bc284c..531355f 100644 +--- a/runtime/wtp.h ++++ b/runtime/wtp.h +@@ -63,8 +63,8 @@ struct wtp_s { + rsRetVal (*pfDoWork)(void *pUsr, void *pWti); + /* end user objects */ + uchar *pszDbgHdr; /* header string for debug messages */ +- DEF_ATOMIC_HELPER_MUT(mutCurNumWrkThrd); +- DEF_ATOMIC_HELPER_MUT(mutWtpState); ++ DEF_ATOMIC_HELPER_MUT(mutCurNumWrkThrd) ++ DEF_ATOMIC_HELPER_MUT(mutWtpState) + }; + + /* some symbolic constants for easier reference */ +-- +2.0.4 + diff -rupN old/app-admin/rsyslog/files/8-stable/50-default.conf new/app-admin/rsyslog/files/8-stable/50-default.conf --- old/app-admin/rsyslog/files/8-stable/50-default.conf 1970-01-01 01:00:00.000000000 +0100 +++ new/app-admin/rsyslog/files/8-stable/50-default.conf 2014-05-22 13:15:49.000000000 +0200 @@ -0,0 +1,95 @@ +####################### +### DEFAULT ACTIONS ### +####################### + +auth,authpriv.* action( + type="omfile" + File="/var/log/auth.log" + FileCreateMode="0600" + FileOwner="root" + FileGroup="adm" + Sync="off" +) + +cron.* action( + type="omfile" + File="/var/log/cron.log" + FileOwner="root" + FileGroup="adm" +) + +daemon.* action( + type="omfile" + File="/var/log/daemon.log" + FileOwner="root" + FileGroup="adm" +) + +kern.* action( + type="omfile" + File="/var/log/kern.log" + FileOwner="root" + FileGroup="adm" +) + +lpr.* action( + type="omfile" + File="/var/log/lpr.log" + FileOwner="root" + FileGroup="adm" +) + +mail.* action( + type="omfile" + File="/var/log/mail.log" + FileOwner="root" + FileGroup="adm" +) + +news.* action( + type="omfile" + File="/var/log/news.log" + FileOwner="root" + FileGroup="adm" +) + +user.* action( + type="omfile" + File="/var/log/user.log" + FileOwner="root" + FileGroup="adm" +) + +*.=debug;auth,authpriv,news,mail.none action( + type="omfile" + File="/var/log/debug.log" + FileOwner="root" + FileGroup="adm" +) + +*.info;auth,authpriv,cron,daemon,lpr,mail,news.none action( + type="omfile" + File="/var/log/messages" + FileOwner="root" + FileGroup="adm" +) + +# Uncomment the following directive to re-enable the +# deprecated "/var/log/syslog" log file (don't forget to re-enable log +# rotation in "/etc/logrotate.d/rsyslog" if you do that!) +#*.*;auth,authpriv.none action( +# type="omfile" +# File="/var/log/syslog" +# FileOwner="root" +# FileGroup="adm" +#) + +*.emerg action( + type="omusrmsg" + Users="*" + action.execOnlyOnceEveryInterval="10" +) + +# Create an additional socket for the default chroot location +# (used by net-misc/openssh[hpn], see https://bugs.gentoo.org/490744) +input(type="imuxsock" Socket="/var/empty/dev/log") diff -rupN old/app-admin/rsyslog/files/8-stable/README.gentoo new/app-admin/rsyslog/files/8-stable/README.gentoo --- old/app-admin/rsyslog/files/8-stable/README.gentoo 1970-01-01 01:00:00.000000000 +0100 +++ new/app-admin/rsyslog/files/8-stable/README.gentoo 2014-05-22 13:15:49.000000000 +0200 @@ -0,0 +1,36 @@ +Introduction +============ + +Since rsyslog version 7.6 we are shipping a new default Gentoo +configuration. See bug #501982 to learn more about what we were trying to +achieve by rewriting the entire configuration. + + +Important changes +================= + +1. "/var/log/syslog" log file is now deprecated + + Beginning with rsyslog-7.6, the "/var/log/syslog" log file will no + longer being written per default. We are considering this file as + deprecated/obsolet for the typical user/system. + The content from this log file is still availble through other + (dedicated) log files, see + + - /var/log/cron.log + - /var/log/daemon.log + - /var/log/mail.log + - /var/log/messages + + If you really need the old "/var/log/syslog" log file, all you have to + do is uncommenting the corresponding configuration directive in + "/etc/rsyslog.d/50-default.conf". + + If you do so, don't forget to re-enable log rotation in + "/etc/logrotate.d/rsyslog", too. + + +2. An additional input socket in "/var/empty/dev/log" (default chroot + location) will be created per default + + See bug #490744 for further details. diff -rupN old/app-admin/rsyslog/files/8-stable/rsyslog.conf new/app-admin/rsyslog/files/8-stable/rsyslog.conf --- old/app-admin/rsyslog/files/8-stable/rsyslog.conf 1970-01-01 01:00:00.000000000 +0100 +++ new/app-admin/rsyslog/files/8-stable/rsyslog.conf 2014-05-22 13:15:49.000000000 +0200 @@ -0,0 +1,61 @@ +# /etc/rsyslog.conf +# +# This configuration is based on RainerScript, the new recommended syntax +# for RSYSLOG. See http://www.rsyslog.com/doc/rainerscript.html for further +# details. +# +# But if you don't want to learn something new at moment, don't worry: The +# legacy syntax is still supported. +# +# You may want to use the new RSYSLOG configuration builder to create your +# own more advanced configuration: http://www.rsyslog.com/rsyslog-configuration-builder/ + +# Check config syntax on startup and abort if unclean (default: off) +#$AbortOnUncleanConfig on + + +############### +### MODULES ### +############### + +# Read syslog messages from default Unix socket /dev/log (e.g. via logger command) +module(load="imuxsock") + +# Read messages from the kernel log and submits them to the syslog engine +module(load="imklog") + +# Inject "--MARK--" messages every $Interval (seconds) +#module(load="immark" Interval="600") + +# Read syslog messages from UDP +#module(load="imudp") +#input(type="imudp" port="514") + +# Read syslog messages from TCP +#module(load="imtcp") +#input(type="imtcp" port="514") + + +######################### +### GLOBAL DIRECTIVES ### +######################### + +# Where to place spool and state files +$WorkDirectory /var/spool/rsyslog + +# Reduce repeating messages (default: off) +#$RepeatedMsgReduction on + +# Set defaults for every output file +$Umask 0022 + +module( + load="builtin:omfile" + Template="RSYSLOG_TraditionalFileFormat" + FileCreateMode="0644" + DirCreateMode="0755" +) + + +# Include all conf files in /etc/rsyslog.d/ +$IncludeConfig /etc/rsyslog.d/*.conf diff -rupN old/app-admin/rsyslog/files/8-stable/rsyslog.confd new/app-admin/rsyslog/files/8-stable/rsyslog.confd --- old/app-admin/rsyslog/files/8-stable/rsyslog.confd 1970-01-01 01:00:00.000000000 +0100 +++ new/app-admin/rsyslog/files/8-stable/rsyslog.confd 2014-05-22 13:15:49.000000000 +0200 @@ -0,0 +1,30 @@ +# /etc/conf.d/rsyslog + +# Configuration file +RSYSLOG_CONFIGFILE="/etc/rsyslog.conf" + +# PID file +# If you should ever change this, remember to update +# "/etc/logrotate.d/rsyslog", too. +RSYSLOG_PIDFILE="/run/rsyslogd.pid" + +# You can use this configuration option to pass additional options to the +# start-stop-daemon, see start-stop-daemon(8) for more details. +# Per default we wait 1000ms after we have started the service to ensure +# that the daemon is really up and running. +RSYSLOG_SSDARGS="--wait 1000" + +# The termination timeout (start-stop-daemon parameter "retry") ensures +# that the service will be terminated within a given time (60 + 5 seconds +# per default) when you are stopping the service. +# You need to increase the value when you are working with a large queue. +# See http://www.rsyslog.com/doc/queues.html for further information. +RSYSLOG_TERMTIMEOUT="TERM/60/KILL/5" + + +# Options to rsyslogd +# See rsyslogd(8) for more details +# Notes: +# * Do not specify another PIDFILE but use the variable above to change the location +# * Do not specify another CONFIGFILE but use the variable above to change the location +RSYSLOG_OPTS="" diff -rupN old/app-admin/rsyslog/files/8-stable/rsyslog.initd new/app-admin/rsyslog/files/8-stable/rsyslog.initd --- old/app-admin/rsyslog/files/8-stable/rsyslog.initd 1970-01-01 01:00:00.000000000 +0100 +++ new/app-admin/rsyslog/files/8-stable/rsyslog.initd 2014-08-20 16:36:34.155661508 +0200 @@ -0,0 +1,69 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +RSYSLOG_CONFIGFILE=${RSYSLOG_CONFIGFILE:-"/etc/rsyslog.conf"} +RSYSLOG_PIDFILE=${RSYSLOG_PIDFILE:-"/run/rsyslogd.pid"} + +command="/usr/sbin/rsyslogd" +command_args="${RSYSLOG_OPTS} -f ${RSYSLOG_CONFIGFILE} -i ${RSYSLOG_PIDFILE}" +start_stop_daemon_args="${RSYSLOG_SSDARGS}" +pidfile="${RSYSLOG_PIDFILE}" +retry="${RSYSLOG_TERMTIMEOUT}" + +required_files="${RSYSLOG_CONFIGFILE}" + +description="RSYSLOG is the rocket-fast system for log processing (syslog replacement)." + +extra_commands="configtest" +extra_started_commands="rotate" + +description_configtest="Run rsyslogd's internal config check." + +description_rotate="Sends rsyslogd a signal to re-open its log files." + +depend() { + need clock hostname localmount + provide logger +} + +start_pre() { + if [ "${RC_CMD}" != "restart" ]; then + configtest || return 1 + fi +} + +stop_pre() { + if [ "${RC_CMD}" = "restart" ]; then + configtest || return 1 + fi +} + +stop_post() { + rm -f ${RSYSLOG_PIDFILE} +} + +configtest() { + # This will currently only detect fatal errors + # See https://github.com/rsyslog/rsyslog/issues/79 + + local _test_command="${command} -N 999 -f ${RSYSLOG_CONFIGFILE}" + local _retval=0 + + ebegin "Checking rsyslogd's configuration" + ${_test_command} >/dev/null 2>&1 + _retval=$? + + if [ ${_retval} -ne 0 ]; then + ${_test_command} + fi + + eend ${_retval} "failed, please correct errors above" +} + +rotate() { + ebegin "Re-opening rsyslogd logs" + start-stop-daemon --signal SIGHUP --pidfile "${RSYSLOG_PIDFILE}" + eend $? +} diff -rupN old/app-admin/rsyslog/files/8-stable/rsyslog.logrotate new/app-admin/rsyslog/files/8-stable/rsyslog.logrotate --- old/app-admin/rsyslog/files/8-stable/rsyslog.logrotate 1970-01-01 01:00:00.000000000 +0100 +++ new/app-admin/rsyslog/files/8-stable/rsyslog.logrotate 2014-05-22 13:15:49.000000000 +0200 @@ -0,0 +1,37 @@ +# Uncomment the following directive if you have re-enabled +# "/var/log/syslog" in "/etc/rsyslog.d/50-default.conf" +#/var/log/syslog +#{ +# rotate 7 +# daily +# missingok +# notifempty +# delaycompress +# compress +# postrotate +# test -r /run/rsyslogd.pid && kill -HUP $(cat /run/rsyslogd.pid) &>/dev/null +# endscript +#} + +/var/log/auth.log +/var/log/cron.log +/var/log/daemon.log +/var/log/kern.log +/var/log/lpr.log +/var/log/mail.log +/var/log/news.log +/var/log/user.log +/var/log/debug.log +/var/log/messages +{ + rotate 4 + weekly + missingok + notifempty + compress + delaycompress + sharedscripts + postrotate + test -r /run/rsyslogd.pid && kill -HUP $(cat /run/rsyslogd.pid) &>/dev/null + endscript +} diff -rupN old/app-admin/rsyslog/metadata.xml new/app-admin/rsyslog/metadata.xml --- old/app-admin/rsyslog/metadata.xml 2014-08-20 18:01:02.000000000 +0200 +++ new/app-admin/rsyslog/metadata.xml 2014-06-16 02:16:12.227887421 +0200 @@ -1,7 +1,6 @@ - proxy-maintainers ultrabug@gentoo.org Ultrabug @@ -17,6 +16,7 @@ Build the Elasticsearch output module (requires net-misc/curl) Add support for the UDP spoofing module (omudpspoof) using net-libs/libnet Add support for encrypted log files using dev-libs/libgcrypt + Use dev-libs/jemalloc for allocations. Build the GSSAPI input and output module (requires virtual/krb5) Build the MongoDB output module (requires dev-libs/libmongo-client) Build the MySQL databse output module (requires virtual/mysql) diff -rupN old/app-admin/rsyslog/rsyslog-8.4.0.ebuild new/app-admin/rsyslog/rsyslog-8.4.0.ebuild --- old/app-admin/rsyslog/rsyslog-8.4.0.ebuild 1970-01-01 01:00:00.000000000 +0100 +++ new/app-admin/rsyslog/rsyslog-8.4.0.ebuild 2014-08-21 13:06:19.522675851 +0200 @@ -0,0 +1,344 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=5 +AUTOTOOLS_AUTORECONF=1 + +inherit autotools-utils eutils systemd + +DESCRIPTION="An enhanced multi-threaded syslogd with database support and more" +HOMEPAGE="http://www.rsyslog.com/" +SRC_URI=" + http://www.rsyslog.com/files/download/${PN}/${P}.tar.gz + doc? ( http://www.rsyslog.com/files/download/${PN}/${PN}-doc-${PV}.tar.gz ) +" + +LICENSE="GPL-3 LGPL-3 Apache-2.0" +KEYWORDS="~amd64 ~arm ~hppa ~x86" +SLOT="0" +IUSE="dbi debug doc elasticsearch +gcrypt jemalloc kerberos mongodb mysql normalize omudpspoof oracle postgres rabbitmq redis relp rfc3195 rfc5424hmac snmp ssl systemd usertools zeromq" + +RDEPEND=" + >=dev-libs/json-c-0.11:= + >=dev-libs/libestr-0.1.9 + >=dev-libs/liblogging-1.0.1:=[stdlog] + >=sys-libs/zlib-1.2.5 + dbi? ( >=dev-db/libdbi-0.8.3 ) + elasticsearch? ( >=net-misc/curl-7.35.0 ) + gcrypt? ( >=dev-libs/libgcrypt-1.5.3:= ) + jemalloc? ( >=dev-libs/jemalloc-3.3.1 ) + kerberos? ( virtual/krb5 ) + mongodb? ( >=dev-libs/libmongo-client-0.1.4 ) + mysql? ( virtual/mysql ) + normalize? ( + >=dev-libs/libee-0.4.0 + >=dev-libs/liblognorm-1.0.0:= + ) + omudpspoof? ( >=net-libs/libnet-1.1.6 ) + oracle? ( >=dev-db/oracle-instantclient-basic-10.2 ) + postgres? ( >=dev-db/postgresql-base-8.4.20 ) + rabbitmq? ( >=net-libs/rabbitmq-c-0.3.0 ) + redis? ( >=dev-libs/hiredis-0.11.0 ) + relp? ( >=dev-libs/librelp-1.2.5 ) + rfc3195? ( >=dev-libs/liblogging-1.0.1:=[rfc3195] ) + rfc5424hmac? ( >=dev-libs/openssl-0.9.8y ) + snmp? ( >=net-analyzer/net-snmp-5.7.2 ) + ssl? ( >=net-libs/gnutls-2.12.23 ) + systemd? ( >=sys-apps/systemd-208 ) + zeromq? ( >=net-libs/czmq-1.2.0 )" +DEPEND="${RDEPEND} + virtual/pkgconfig" + +BRANCH="8-stable" + +# Test suite requires a special setup or will always fail +RESTRICT="test" + +# Maitainer note : open a bug to upstream +# showing that building in a separate dir fails +AUTOTOOLS_IN_SOURCE_BUILD=1 + +AUTOTOOLS_PRUNE_LIBTOOL_FILES="modules" + +DOCS=( + AUTHORS + ChangeLog + "${FILESDIR}"/${BRANCH}/README.gentoo +) + +src_unpack() { + unpack ${P}.tar.gz + + if use doc; then + local doc_tarball="${PN}-doc-${PV}.tar.gz" + + cd "${S}" || die "Cannot change dir into '$S'" + mkdir docs || die "Failed to create docs directory" + cd docs || die "Failed to change dir into '${S}/docs'" + unpack ${doc_tarball} + fi +} + +src_prepare() { + epatch "${FILESDIR}"/${BRANCH}/20-rsyslog-json_tokener_errors.patch + epatch "${FILESDIR}"/${BRANCH}/30-rsyslog-imuxsock-shrink.patch + epatch "${FILESDIR}"/${BRANCH}/40-rsyslog-fix-building-without-atomic-instructions.patch + epatch "${FILESDIR}"/${BRANCH}/41-rsyslog-gcc-pedantic-fixes.patch +} + +src_configure() { + # Maintainer notes: + # * Guardtime support is missing because libgt isn't yet available + # in portage. + # * Hadoop's HDFS file system output module is currently not + # supported in Gentoo because nobody is able to test it + # (JAVA dependency). + # * dev-libs/hiredis doesn't provide pkg-config (see #504614, + # upstream PR 129 and 136) so we need to export HIREDIS_* + # variables because rsyslog's build system depends on pkg-config. + + if use redis; then + export HIREDIS_LIBS="-L${EPREFIX}/usr/$(get_libdir) -lhiredis" + export HIREDIS_CFLAGS="-I${EPREFIX}/usr/include" + fi + + local myeconfargs=( + --disable-generate-man-pages + # Input Plugins without depedencies + --enable-imfile + --enable-impstats + --enable-imptcp + --enable-imttcp + # Message Modificiation Plugins without depedencies + --enable-mmanon + --enable-mmaudit + --enable-mmcount + --enable-mmfields + --enable-mmjsonparse + --enable-mmpstrucdata + --enable-mmsequence + --enable-mmutf8fix + # Output Modification Plugins without dependencies + --enable-mail + --enable-omprog + --enable-omruleset + --enable-omstdout + --enable-omuxsock + # Misc + --enable-pmaixforwardedfrom + --enable-pmciscoios + --enable-pmcisconames + --enable-pmlastmsg + --enable-pmrfc3164sd + --enable-pmsnare + # DB + $(use_enable dbi libdbi) + $(use_enable mongodb ommongodb) + $(use_enable mysql) + $(use_enable oracle) + $(use_enable postgres pgsql) + $(use_enable redis omhiredis) + # Debug + $(use_enable debug) + $(use_enable debug diagtools) + $(use_enable debug imdiag) + $(use_enable debug memcheck) + $(use_enable debug rtinst) + $(use_enable debug valgrind) + # Misc + $(use_enable elasticsearch) + $(use_enable gcrypt libgcrypt) + $(use_enable jemalloc) + $(use_enable kerberos gssapi-krb5) + $(use_enable normalize mmnormalize) + $(use_enable omudpspoof) + $(use_enable rabbitmq omrabbitmq) + $(use_enable relp) + $(use_enable rfc3195) + $(use_enable rfc5424hmac mmrfc5424addhmac) + $(use_enable snmp) + $(use_enable snmp mmsnmptrapd) + $(use_enable ssl gnutls) + $(use_enable systemd imjournal) + $(use_enable systemd omjournal) + $(use_enable usertools) + $(use_enable zeromq imzmq3) + $(use_enable zeromq omzmq3) + "$(systemd_with_unitdir)" + ) + + autotools-utils_src_configure +} + +src_install() { + use doc && HTML_DOCS=( "${S}/docs/build/" ) + autotools-utils_src_install + + newconfd "${FILESDIR}/${BRANCH}/${PN}.confd" ${PN} + newinitd "${FILESDIR}/${BRANCH}/${PN}.initd" ${PN} + + keepdir /var/empty/dev + keepdir /var/spool/${PN} + keepdir /etc/ssl/${PN} + keepdir /etc/${PN}.d + + insinto /etc + newins "${FILESDIR}/${BRANCH}/${PN}.conf" ${PN}.conf + + insinto /etc/rsyslog.d/ + doins "${FILESDIR}/${BRANCH}/50-default.conf" + + insinto /etc/logrotate.d/ + newins "${FILESDIR}/${BRANCH}/${PN}.logrotate" ${PN} + + if use mysql; then + insinto /usr/share/doc/${PF}/scripts/mysql + doins plugins/ommysql/{createDB.sql,contrib/delete_mysql} + fi + + if use postgres; then + insinto /usr/share/doc/${PF}/scripts/pgsql + doins plugins/ompgsql/createDB.sql + fi +} + +pkg_postinst() { + local advertise_readme=0 + + if [[ -z "${REPLACING_VERSIONS}" ]]; then + # This is a new installation + + advertise_readme=1 + + if use mysql || use postgres; then + echo + elog "Sample SQL scripts for MySQL & PostgreSQL have been installed to:" + elog " /usr/share/doc/${PF}/scripts" + fi + + if use ssl; then + echo + elog "To create a default CA and certificates for your server and clients, run:" + elog " emerge --config =${PF}" + elog "on your logging server. You can run it several times," + elog "once for each logging client. The client certificates will be signed" + elog "using the CA certificate generated during the first run." + fi + fi + + if [[ -z "${REPLACING_VERSIONS}" ]] || [[ ${REPLACING_VERSIONS} < 8.0 ]]; then + # Show this message until rsyslog-8.x + echo + elog "Since ${PN}-7.6.3 we no longer use the catch-all log target" + elog "\"/var/log/syslog\" due to its redundancy to the other log targets." + + advertise_readme=1 + fi + + if [[ ${advertise_readme} -gt 0 ]]; then + # We need to show the README file location + + echo "" + elog "Please read" + elog "" + elog " ${EPREFIX}/usr/share/doc/${PF}/README.gentoo*" + elog "" + elog "for more details." + fi +} + +pkg_config() { + if ! use ssl ; then + einfo "There is nothing to configure for rsyslog unless you" + einfo "used USE=ssl to build it." + return 0 + fi + + # Make sure the certificates directory exists + CERTDIR="${EROOT}/etc/ssl/${PN}" + if [ ! -d "${CERTDIR}" ]; then + mkdir "${CERTDIR}" || die + fi + einfo "Your certificates will be stored in ${CERTDIR}" + + # Create a default CA if needed + if [ ! -f "${CERTDIR}/${PN}_ca.cert.pem" ]; then + einfo "No CA key and certificate found in ${CERTDIR}, creating them for you..." + certtool --generate-privkey \ + --outfile "${CERTDIR}/${PN}_ca.privkey.pem" &>/dev/null + chmod 400 "${CERTDIR}/${PN}_ca.privkey.pem" + + cat > "${T}/${PF}.$$" <<- _EOF + cn = Portage automated CA + ca + cert_signing_key + expiration_days = 3650 + _EOF + + certtool --generate-self-signed \ + --load-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ + --outfile "${CERTDIR}/${PN}_ca.cert.pem" \ + --template "${T}/${PF}.$$" &>/dev/null + chmod 400 "${CERTDIR}/${PN}_ca.privkey.pem" + + # Create the server certificate + echo + einfon "Please type the Common Name of the SERVER you wish to create a certificate for: " + read -r CN + + einfo "Creating private key and certificate for server ${CN}..." + certtool --generate-privkey \ + --outfile "${CERTDIR}/${PN}_${CN}.key.pem" &>/dev/null + chmod 400 "${CERTDIR}/${PN}_${CN}.key.pem" + + cat > "${T}/${PF}.$$" <<- _EOF + cn = ${CN} + tls_www_server + dns_name = ${CN} + expiration_days = 3650 + _EOF + + certtool --generate-certificate \ + --outfile "${CERTDIR}/${PN}_${CN}.cert.pem" \ + --load-privkey "${CERTDIR}/${PN}_${CN}.key.pem" \ + --load-ca-certificate "${CERTDIR}/${PN}_ca.cert.pem" \ + --load-ca-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ + --template "${T}/${PF}.$$" &>/dev/null + chmod 400 "${CERTDIR}/${PN}_${CN}.cert.pem" + + else + einfo "Found existing ${CERTDIR}/${PN}_ca.cert.pem, skipping CA and SERVER creation." + fi + + # Create a client certificate + echo + einfon "Please type the Common Name of the CLIENT you wish to create a certificate for: " + read -r CN + + einfo "Creating private key and certificate for client ${CN}..." + certtool --generate-privkey \ + --outfile "${CERTDIR}/${PN}_${CN}.key.pem" &>/dev/null + chmod 400 "${CERTDIR}/${PN}_${CN}.key.pem" + + cat > "${T}/${PF}.$$" <<- _EOF + cn = ${CN} + tls_www_client + dns_name = ${CN} + expiration_days = 3650 + _EOF + + certtool --generate-certificate \ + --outfile "${CERTDIR}/${PN}_${CN}.cert.pem" \ + --load-privkey "${CERTDIR}/${PN}_${CN}.key.pem" \ + --load-ca-certificate "${CERTDIR}/${PN}_ca.cert.pem" \ + --load-ca-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ + --template "${T}/${PF}.$$" &>/dev/null + chmod 400 "${CERTDIR}/${PN}_${CN}.cert.pem" + + rm -f "${T}/${PF}.$$" + + echo + einfo "Here is the documentation on how to encrypt your log traffic:" + einfo " http://www.rsyslog.com/doc/rsyslog_tls.html" +}