summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas D <whissi@whissi.de>2016-03-12 03:51:55 +0100
committerIan Delaney <idella4@gentoo.org>2016-03-12 12:31:31 +0800
commit968a7ec803b82b4018724e268bc2a475e4c98a4c (patch)
tree5c31f38efc42ecb03594f147032760232820bd3e /app-admin
parentdev-libs/expat: 2.1.1 (diff)
downloadgentoo-968a7ec803b82b4018724e268bc2a475e4c98a4c.tar.gz
gentoo-968a7ec803b82b4018724e268bc2a475e4c98a4c.tar.bz2
gentoo-968a7ec803b82b4018724e268bc2a475e4c98a4c.zip
app-admin/rsyslog: Rev bump to fix a leap year issue
Bug: https://github.com/rsyslog/rsyslog/issues/830 Package-Manager: portage-2.2.28 Closes: https://github.com/gentoo/gentoo/pull/1034
Diffstat (limited to 'app-admin')
-rw-r--r--app-admin/rsyslog/files/8-stable/50-rsyslog-8.16.0-fix-leap-year-handling.patch86
-rw-r--r--app-admin/rsyslog/rsyslog-8.16.0-r1.ebuild433
2 files changed, 519 insertions, 0 deletions
diff --git a/app-admin/rsyslog/files/8-stable/50-rsyslog-8.16.0-fix-leap-year-handling.patch b/app-admin/rsyslog/files/8-stable/50-rsyslog-8.16.0-fix-leap-year-handling.patch
new file mode 100644
index 000000000000..6cf8fa667f3f
--- /dev/null
+++ b/app-admin/rsyslog/files/8-stable/50-rsyslog-8.16.0-fix-leap-year-handling.patch
@@ -0,0 +1,86 @@
+From ffb321f1698a971e0acda48cafa97bb344cf0829 Mon Sep 17 00:00:00 2001
+From: Rainer Gerhards <rgerhards@adiscon.com>
+Date: Wed, 2 Mar 2016 11:43:09 +0100
+Subject: [PATCH] bugfix: unixtimestamp was incorrectly computed
+
+The problem happened in leap year from March til then end
+of year and healed itself at the begining of the next year.
+During the problem period, the timestamp was 24 hours too
+low.
+
+This is primarily a simple fix that can also be applied to
+older rsyslog versions. However, we will see if we can
+refactor the code to make use of mktime(). Originally, that
+was not done for some issues seen, which may no longer
+apply.
+
+fixes https://github.com/rsyslog/rsyslog/issues/830
+---
+ runtime/datetime.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/runtime/datetime.c b/runtime/datetime.c
+index efb4c81..a07c1b7 100644
+--- a/runtime/datetime.c
++++ b/runtime/datetime.c
+@@ -1054,6 +1054,11 @@ time_t syslogTime2time_t(struct syslogTime *ts)
+ MonthInDays = 0; /* any value fits ;) */
+ break;
+ }
++ /* adjust for leap years */
++ if((ts->year % 100 != 0 && ts->year % 4 == 0) || (ts->year == 2000)) {
++ if(ts->month > 2)
++ MonthInDays++;
++ }
+
+
+ /* 1) Counting how many Years have passed since 1970
+@@ -1064,7 +1069,7 @@ time_t syslogTime2time_t(struct syslogTime *ts)
+
+ NumberOfYears = ts->year - yearInSec_startYear - 1;
+ NumberOfDays = MonthInDays + ts->day - 1;
+- TimeInUnixFormat = yearInSecs[NumberOfYears] + NumberOfDays * 86400;
++ TimeInUnixFormat = (yearInSecs[NumberOfYears] + 1) + NumberOfDays * 86400;
+
+ /*Add Hours, minutes and seconds */
+ TimeInUnixFormat += ts->hour*60*60;
+From 5cb41f748329986d5e2aa8d5e87f224bb9cb8234 Mon Sep 17 00:00:00 2001
+From: Rainer Gerhards <rgerhards@adiscon.com>
+Date: Wed, 2 Mar 2016 15:58:18 +0100
+Subject: [PATCH] timestamp handling: guard against invalid dates
+
+We do not permit dates outside of the year 1970..2100
+interval. Note that network-receivers do already guard
+against this, so the new guard only guards against invalid
+system time. Still good to have (especially when things are
+extended...)
+---
+ runtime/datetime.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/runtime/datetime.c b/runtime/datetime.c
+index 9641363..87290c9 100644
+--- a/runtime/datetime.c
++++ b/runtime/datetime.c
+@@ -1023,6 +1023,13 @@ time_t syslogTime2time_t(struct syslogTime *ts)
+ int utcOffset;
+ time_t TimeInUnixFormat;
+
++ if(ts->year < 1970 || ts->year > 2100) {
++ TimeInUnixFormat = 0;
++ errmsg.LogError(0, RS_RET_ERR, "syslogTime2time_t: invalid year %d "
++ "in timestamp - returning 1970-01-01 instead", ts->year);
++ goto done;
++ }
++
+ /* Counting how many Days have passed since the 01.01 of the
+ * selected Year (Month level), according to the selected Month*/
+
+@@ -1096,6 +1103,7 @@ time_t syslogTime2time_t(struct syslogTime *ts)
+ if(ts->OffsetMode == '+')
+ utcOffset *= -1; /* if timestamp is ahead, we need to "go back" to UTC */
+ TimeInUnixFormat += utcOffset;
++done:
+ return TimeInUnixFormat;
+ }
+
diff --git a/app-admin/rsyslog/rsyslog-8.16.0-r1.ebuild b/app-admin/rsyslog/rsyslog-8.16.0-r1.ebuild
new file mode 100644
index 000000000000..607fecf740c2
--- /dev/null
+++ b/app-admin/rsyslog/rsyslog-8.16.0-r1.ebuild
@@ -0,0 +1,433 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit autotools eutils systemd
+
+DESCRIPTION="An enhanced multi-threaded syslogd with database support and more"
+HOMEPAGE="http://www.rsyslog.com/"
+
+BRANCH="8-stable"
+
+PATCHES=(
+ "${FILESDIR}"/8-stable/50-rsyslog-8.15.0-imtcp-tls-basic-vg-test-workaround.patch
+ "${FILESDIR}"/8-stable/50-rsyslog-8.15.0-imfile-readmode2-vg-test-workaround.patch
+ "${FILESDIR}"/8-stable/50-rsyslog-8.16.0-fix-queue-engine-issue-262.patch
+ "${FILESDIR}"/8-stable/50-rsyslog-8.16.0-fix-leap-year-handling.patch
+)
+
+if [[ ${PV} == "9999" ]]; then
+ EGIT_REPO_URI="
+ git://github.com/rsyslog/${PN}.git
+ https://github.com/rsyslog/${PN}.git
+ "
+
+ DOC_REPO_URI="
+ git://github.com/rsyslog/${PN}-doc.git
+ https://github.com/rsyslog/${PN}-doc.git
+ "
+
+ inherit git-r3
+else
+ 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 )
+ "
+ KEYWORDS="~amd64 ~arm ~hppa ~x86"
+fi
+
+LICENSE="GPL-3 LGPL-3 Apache-2.0"
+SLOT="0"
+IUSE="dbi debug doc elasticsearch +gcrypt jemalloc kerberos libressl mongodb mysql normalize omudpspoof"
+IUSE+=" postgres rabbitmq redis relp rfc3195 rfc5424hmac snmp ssl systemd test 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.1.2:=
+ )
+ omudpspoof? ( >=net-libs/libnet-1.1.6 )
+ postgres? ( >=dev-db/postgresql-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? (
+ !libressl? ( >=dev-libs/openssl-0.9.8y:0= )
+ libressl? ( dev-libs/libressl:= )
+ )
+ snmp? ( >=net-analyzer/net-snmp-5.7.2 )
+ ssl? ( >=net-libs/gnutls-2.12.23:0= )
+ systemd? ( >=sys-apps/systemd-208 )
+ zeromq? ( >=net-libs/czmq-1.2.0 )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+if [[ ${PV} == "9999" ]]; then
+ DEPEND+=" doc? ( >=dev-python/sphinx-1.1.3-r7 )"
+ DEPEND+=" >=sys-devel/flex-2.5.39-r1"
+ DEPEND+=" >=sys-devel/bison-2.4.3"
+ DEPEND+=" >=dev-python/docutils-0.12"
+fi
+
+# 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() {
+ if [[ ${PV} == "9999" ]]; then
+ git-r3_fetch
+ git-r3_checkout
+ else
+ unpack ${P}.tar.gz
+ fi
+
+ if use doc; then
+ if [[ ${PV} == "9999" ]]; then
+ local _EGIT_BRANCH=
+ if [ -n "${EGIT_BRANCH}" ]; then
+ # Cannot use rsyslog commits/branches for documentation repository
+ _EGIT_BRANCH=${EGIT_BRANCH}
+ unset EGIT_BRANCH
+ fi
+
+ git-r3_fetch "${DOC_REPO_URI}"
+ git-r3_checkout "${DOC_REPO_URI}" "${S}"/docs
+
+ if [ -n "${_EGIT_BRANCH}" ]; then
+ # Restore previous EGIT_BRANCH information
+ EGIT_BRANCH=${_EGIT_BRANCH}
+ fi
+ else
+ 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
+ fi
+}
+
+src_prepare() {
+ default
+
+ eautoreconf
+ elibtoolize --patch-only
+}
+
+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-debug-symbols
+ --disable-generate-man-pages
+ --without-valgrind-testbench
+ $(use_enable test testbench)
+ # Input Plugins without depedencies
+ --enable-imdiag
+ --enable-imfile
+ --enable-impstats
+ --enable-imptcp
+ # Message Modificiation Plugins without depedencies
+ --enable-mmanon
+ --enable-mmaudit
+ --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
+ --disable-omkafka
+ --enable-pmaixforwardedfrom
+ --enable-pmciscoios
+ --enable-pmcisconames
+ --enable-pmlastmsg
+ --enable-pmsnare
+ --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
+ # DB
+ $(use_enable dbi libdbi)
+ $(use_enable mongodb ommongodb)
+ $(use_enable mysql)
+ $(use_enable postgres pgsql)
+ $(use_enable redis omhiredis)
+ # Debug
+ $(use_enable debug)
+ $(use_enable debug diagtools)
+ $(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)
+ )
+
+ econf ${myeconfargs[@]}
+}
+
+src_compile() {
+ default
+
+ if use doc && [[ "${PV}" == "9999" ]]; then
+ einfo "Building documentation ..."
+ local doc_dir="${S}/docs"
+ cd "${doc_dir}" || die "Cannot chdir into \"${doc_dir}\"!"
+ sphinx-build -b html source build || die "Building documentation failed!"
+ fi
+}
+
+src_test() {
+ local _has_increased_ulimit=
+
+ # When adding new tests via patches we have to make them executable
+ einfo "Adjusting permissions of test scripts ..."
+ find "${S}"/tests -type f -name '*.sh' \! -perm -111 -exec chmod a+x '{}' \; || \
+ die "Failed to adjust test scripts permission"
+
+ if ulimit -n 3072; then
+ _has_increased_ulimit="true"
+ fi
+
+ if ! emake --jobs 1 check; then
+ eerror "Test suite failed! :("
+
+ if [ -z "${_has_increased_ulimit}" ]; then
+ eerror "Probably because open file limit couldn't be set to 3072."
+ fi
+
+ if has userpriv $FEATURES; then
+ eerror "Please try to reproduce the test suite failure with FEATURES=-userpriv " \
+ "before you submit a bug report."
+ fi
+
+ fi
+}
+
+src_install() {
+ default
+
+ newconfd "${FILESDIR}/${BRANCH}/${PN}.confd-r1" ${PN}
+ newinitd "${FILESDIR}/${BRANCH}/${PN}.initd-r1" ${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
+ fi
+
+ if use postgres; then
+ insinto /usr/share/doc/${PF}/scripts/pgsql
+ doins plugins/ompgsql/createDB.sql
+ fi
+
+ use doc && dohtml -r "${S}/docs/build/"
+}
+
+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"
+}