rsyslog/rsyslog.spec

631 lines
17 KiB
RPMSpec

#
# spec file for package rsyslog
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: rsyslog
Summary: The enhanced syslogd for Linux and Unix
Version: 5.8.0
Release: 4
# for setting those bcond_with* configs see
# http://lizards.opensuse.org/2008/09/12/conditional-features-aka-use-flags/
%if 0%{?suse_version} >= 1140
%bcond_without dbi
%else
%bcond_with dbi
%endif
%if 0%{?suse_version} >= 1140
%bcond_without systemd
%else
%bcond_with systemd
%endif
%if 0%{?suse_version} >= 1130
%bcond_without relp
%else
%bcond_with relp
%endif
%bcond_without gssapi
%bcond_without gnutls
%bcond_without mysql
%bcond_without pgsql
%bcond_without snmp
%define upstream_version 5.8.0
%define _sbindir /sbin
%define rsyslogdocdir %{_docdir}/%{name}
%define additional_sockets %{_localstatedir}/run/rsyslog/additional-log-sockets.conf
%define _libdir /%_lib
%define rsyslog_module_dir_nodeps %{_libdir}/rsyslog/
%define rsyslog_module_dir_withdeps %{_prefix}/%{_lib}/rsyslog/
License: GPLv3+
Group: System/Daemons
Url: http://www.rsyslog.com/
AutoReqProv: on
Provides: syslog
PreReq: %insserv_prereq %fillup_prereq /sbin/klogd /etc/init.d/syslog /sbin/checkproc
BuildRequires: klogd
BuildRequires: dos2unix
BuildRequires: openssl-devel
BuildRequires: pcre-devel
BuildRequires: pkgconfig
BuildRequires: zlib-devel
#
%if %{with gssapi}
BuildRequires: krb5-devel
%endif
%if %{with mysql}
BuildRequires: mysql-devel
%endif
%if %{with snmp}
BuildRequires: net-snmp-devel
%endif
%if %{with pgsql}
BuildRequires: postgresql-devel
%endif
%if %{with gnutls}
BuildRequires: libgnutls-devel
%endif
%if %{with dbi}
BuildRequires: libdbi-devel
%endif
%if %{with relp}
# RELP support
BuildRequires: librelp-devel
%endif
# UDP spoof support
%if 0%{?suse_version} >= 1140
BuildRequires: libnet-devel
%else
BuildRequires: libnet
%endif
%if %{with systemd}
# The systemd package provides
# /usr/share/doc/packages/systemd/sd-daemon.[ch]
# files instead of a lib ... See also bug 656259.
BuildRequires: systemd
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#Source0: http://download.rsyslog.com/rsyslog/rsyslog-<upstream_version>.tar.gz
Source0: %{name}-%{upstream_version}.tar.bz2
Source1: rsyslog.sysconfig
Source2: rsyslog.conf.in
Source3: rsyslog.early.conf.in
Source4: rsyslog.d.remote.conf.in
# PATCH-FIX-UPSTREAM rsyslog-5.6.5-memcpy.patch idoenmez@suse.de -- Fix overflowing memcpy call
Patch1: rsyslog-5.8.0-memcpy.patch
%description
Rsyslog is an enhanced multi-threaded syslogd supporting, among others,
MySQL, syslog/tcp, RFC 3195, permitted sender lists, filtering on any
message part, and fine grain output format control. It is quite
compatible to stock sysklogd and can be used as a drop-in replacement.
Its advanced features make it suitable for enterprise-class, encryption
protected syslog relay chains while at the same time being very easy to
setup for the novice user.
%package doc
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: Additional documentation for rsyslog
%description doc
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This package provides additional documentation for rsyslog.
%package diag-tools
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: Diagnostic tools
%description diag-tools
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This package provides additional diagnostic tools (small helpers,
usually not needed).
%if %{with gssapi}
%package module-gssapi
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: GSS-API support module for rsyslog
%description module-gssapi
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This module provides the support to receive syslog messages from the
network protected via Kerberos 5 encryption and authentication.
%endif
%if %{with mysql}
%package module-mysql
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: MySQL support module for rsyslog
%description module-mysql
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This package provides a module with the support for logging into MySQL
databases.
%endif
%if %{with pgsql}
%package module-pgsql
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: PostgreSQL support module for rsyslog
%description module-pgsql
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This module provides the support for logging into PostgreSQL databases.
%endif
%if %{with dbi}
%package module-dbi
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: Database support via DBI
%description module-dbi
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This package provides a module with the support for logging into DBI
supported databases.
%endif
%if %{with snmp}
%package module-snmp
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: SNMP support module for rsyslog
%description module-snmp
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This module provides the ability to send syslog messages as an SNMPv1 &
v2c traps.
%endif
%if %{with gnutls}
%package module-gtls
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: TLS encryption support module for rsyslog
%description module-gtls
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This module provides the ability for TLS encrypted TCP logging (based
on current syslog-transport-tls internet drafts).
%endif
%if %{with relp}
%package module-relp
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: RELP protocol support module for syslog
%description module-relp
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This module provides Reliable Event Logging Protocol support.
%endif
%package module-udpspoof
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: UDP spoof support module for syslog
%description module-udpspoof
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This module provides a UDP forwarder that allows changing the sender address.
%prep
%setup -q -n %{name}-%{upstream_version}
%patch1
%if %{with systemd}
# Bug: https://bugzilla.novell.com/show_bug.cgi?id=656259
# install the files systemd provides rather than what we provide.
cp -a /usr/share/doc/packages/systemd/sd-daemon.[ch] runtime/
%endif
dos2unix doc/*.html
%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -W -Wall"
%if 0%{?suse_version} > 1000 && 0%{?suse_version} < 1030
export CFLAGS="$CFLAGS -fstack-protector"
%endif
# needs liblogging
# --enable-rfc3195 \
# needs java
# --enable-gui \
%configure \
--with-moddirs=%{rsyslog_module_dir_withdeps} \
--enable-option-checking \
--enable-largefile \
--enable-pthreads \
--enable-regexp \
--enable-zlib \
--enable-klog \
--enable-inet \
%if %{with gnutls}
--enable-gnutls \
%endif
--enable-rsyslogd \
%if %{with gssapi}
--enable-gssapi-krb5 \
%endif
%if %{with mysql}
--enable-mysql \
%endif
%if %{with pgsql}
--enable-pgsql \
%endif
%if %{with dbi}
--enable-libdbi \
%endif
%if %{with relp}
--enable-relp \
%endif
%if %{with snmp}
--enable-snmp \
%endif
--enable-mail \
--enable-imfile \
--enable-imptcp \
--enable-imtemplate \
--enable-omprog \
--enable-omuxsock \
--enable-omtemplate \
--enable-omudpspoof \
--enable-omstdout \
--enable-pmlastmsg \
--enable-diagtools \
--disable-static
make %{?_smp_mflags:%{_smp_mflags}} V=1
%install
make install DESTDIR="%{buildroot}" V=1
#
rm -f %{buildroot}%{rsyslog_module_dir_nodeps}/*.la
#
# move all modules linking libraries in /usr to /usr/lib[64]
# the user has to specify them with full path then...
install -d -m0755 %{buildroot}%{rsyslog_module_dir_withdeps}
for mod in \
%if %{with gssapi}
omgssapi.so imgssapi.so lmgssutil.so \
%endif
%if %{with mysql}
ommysql.so \
%endif
%if %{with pgsql}
ompgsql.so \
%endif
%if %{with snmp}
omsnmp.so \
%endif
%if %{with dbi}
omlibdbi.so \
%endif
%if %{with relp}
imrelp.so omrelp.so \
%endif
%if %{with gnutls}
lmnsd_gtls.so \
%endif
; do
mv -f %{buildroot}%{rsyslog_module_dir_nodeps}/$mod \
%{buildroot}%{rsyslog_module_dir_withdeps}
done
#
install -d -m0755 %{buildroot}%{_sysconfdir}/rsyslog.d
install -d -m0755 %{buildroot}%{_localstatedir}/run/rsyslog
install -d -m0755 %{buildroot}%{_localstatedir}/spool/rsyslog
for file in rsyslog.conf rsyslog.early.conf rsyslog.d.remote.conf ; do
sed \
%ifarch s390 s390x
-e 's;tty10;console;g' \
%endif
-e 's;ADDITIONAL_SOCKETS;%{additional_sockets};g' \
-e 's;ETC_RSYSLOG_D_DIR;%{_sysconfdir}/rsyslog.d;g' \
-e 's;ETC_RSYSLOG_D_GLOB;%{_sysconfdir}/rsyslog.d/*.conf;g' \
-e 's;RSYSLOG_SPOOL_DIR;%{_localstatedir}/spool/rsyslog;g' \
%{_sourcedir}/${file}.in > ${file}.$$
done
install -m0600 rsyslog.conf.$$ \
%{buildroot}%{_sysconfdir}/rsyslog.conf
install -m0600 rsyslog.early.conf.$$ \
%{buildroot}%{_sysconfdir}/rsyslog.early.conf
install -m0600 rsyslog.d.remote.conf.$$ \
%{buildroot}%{_sysconfdir}/rsyslog.d/remote.conf
#
install -d -m0755 %{buildroot}/var/adm/fillup-templates
# native version for the '-c <compat version>' parameter
rsyslogd_version=%{version}
rsyslogd_version=${rsyslogd_version//.*/}
sed -e "s/@RSYSLOGD_VERSION@/${rsyslogd_version}/g" \
< %{_sourcedir}/rsyslog.sysconfig > rsyslog.sysconfig
install -m0600 rsyslog.sysconfig \
%{buildroot}/var/adm/fillup-templates/sysconfig.syslog-rsyslog
#
rm -f doc/Makefile*
install -d -m0755 %{buildroot}%{rsyslogdocdir}/
find ChangeLog README AUTHORS COPYING COPYING.LESSER rsyslog.conf doc \
\( -type d -exec install -m755 -d %{buildroot}%{rsyslogdocdir}/\{\} \; \) \
-o \( -type f -exec install -m644 \{\} %{buildroot}%{rsyslogdocdir}/\{\} \; \)
%if %{with mysql}
install -m644 plugins/ommysql/createDB.sql \
%{buildroot}%{rsyslogdocdir}/mysql-createDB.sql
%endif
%if %{with pgsql}
install -m644 plugins/ompgsql/createDB.sql \
%{buildroot}%{rsyslogdocdir}/pgsql-createDB.sql
%endif
#
%if %{with systemd}
# TODO: https://features.opensuse.org/311316
rm -v %{buildroot}/lib/systemd/system/rsyslog.service
%endif
%clean
if [ -n "%{buildroot}" ] && [ "%{buildroot}" != "/" ] ; then
rm -rf "%{buildroot}"
fi
%post
#
# update linker caches
#
/sbin/ldconfig
#
# add syslog variables provided by klogd if needed
#
%{remove_and_set -n syslog RSYSLOGD_NATIVE_VERSION}
%{fillup_and_insserv -ny syslog syslog}
%{fillup_and_insserv -nY syslog earlysyslog}
#
# add RSYSLOGD_* variables if needed
#
%{fillup_only -ns syslog rsyslog}
#
# check if daemon configured in SYSLOG_DAEMON is installed
# and switch to ourself if it's missed
#
source etc/sysconfig/syslog
replace_syslog=no
if test "$SYSLOG_DAEMON" != "rsyslogd" ; then
if test -z "$SYSLOG_DAEMON" || \
test ! -x sbin/${SYSLOG_DAEMON} ; then
replace_syslog=yes
fi
fi
if test "$replace_syslog" = "yes" ; then
sed -i -e 's/^SYSLOG_DAEMON=.*/SYSLOG_DAEMON="rsyslogd"/g' \
etc/sysconfig/syslog
fi
#
# create dirs, touch log default files
#
mkdir -p var/log
touch var/log/messages; chmod 640 var/log/messages
touch var/log/boot.log; chmod 640 var/log/boot.log
touch var/log/mail; chmod 640 var/log/mail
touch var/log/mail.info; chmod 640 var/log/mail.info
touch var/log/mail.warn; chmod 640 var/log/mail.warn
touch var/log/mail.err; chmod 640 var/log/mail.err
test -f var/log/news && mv -f var/log/news var/log/news.bak
mkdir -p -m 0750 var/log/news
chown news:news var/log/news
touch var/log/news/news.crit; chmod 640 var/log/news/news.crit
chown news:news var/log/news/news.crit
touch var/log/news/news.err; chmod 640 var/log/news/news.err
chown news:news var/log/news/news.err
touch var/log/news/news.notice; chmod 640 var/log/news/news.notice
chown news:news var/log/news/news.notice
#
# touch the additional log files we are using
#
touch var/log/acpid; chmod 640 var/log/acpid
touch var/log/firewall; chmod 640 var/log/firewall
touch var/log/NetworkManager; chmod 640 var/log/NetworkManager
#
# touch the additional log sockets config file
#
additional_sockets="%{additional_sockets}"
mkdir -p -m750 ${additional_sockets%/*}
touch "${additional_sockets#/}"
chmod 640 "${additional_sockets#/}"
%preun
#
# stop the rsyslogd daemon when it is running
#
%{stop_on_removal syslog}
%postun
#
# update linker caches
#
/sbin/ldconfig
#
# reset SYSLOG_DAEMON variable
#
if test -f etc/sysconfig/syslog ; then
source etc/sysconfig/syslog
if test "$SYSLOG_DAEMON" == "rsyslogd" ; then
sed -i -e 's/^SYSLOG_DAEMON=.*/SYSLOG_DAEMON=""/g' \
etc/sysconfig/syslog
fi
fi
#
# stop the rsyslogd daemon when it is running
#
%{restart_on_update syslog}
#
# cleanup init scripts
#
%{insserv_cleanup}
%files
%defattr(-,root,root)
%dir %{_sysconfdir}/rsyslog.d
%config(noreplace) %attr(600,root,root) %{_sysconfdir}/rsyslog.conf
%config(noreplace) %attr(600,root,root) %{_sysconfdir}/rsyslog.early.conf
%config(noreplace) %attr(600,root,root) %{_sysconfdir}/rsyslog.d/remote.conf
%{_sbindir}/rsyslogd
%dir %{rsyslog_module_dir_nodeps}
%{rsyslog_module_dir_nodeps}/imfile.so
%{rsyslog_module_dir_nodeps}/imklog.so
%{rsyslog_module_dir_nodeps}/immark.so
%{rsyslog_module_dir_nodeps}/imtcp.so
%{rsyslog_module_dir_nodeps}/imtemplate.so
%{rsyslog_module_dir_nodeps}/imudp.so
%{rsyslog_module_dir_nodeps}/imuxsock.so
%{rsyslog_module_dir_nodeps}/lmnet.so
%{rsyslog_module_dir_nodeps}/lmnetstrms.so
%{rsyslog_module_dir_nodeps}/lmnsd_ptcp.so
%{rsyslog_module_dir_nodeps}/imptcp.so
%{rsyslog_module_dir_nodeps}/lmregexp.so
%{rsyslog_module_dir_nodeps}/lmstrmsrv.so
%{rsyslog_module_dir_nodeps}/lmtcpclt.so
%{rsyslog_module_dir_nodeps}/lmtcpsrv.so
%{rsyslog_module_dir_nodeps}/lmzlibw.so
%{rsyslog_module_dir_nodeps}/ommail.so
%{rsyslog_module_dir_nodeps}/omprog.so
%{rsyslog_module_dir_nodeps}/omruleset.so
%{rsyslog_module_dir_nodeps}/omstdout.so
%{rsyslog_module_dir_nodeps}/omtemplate.so
%{rsyslog_module_dir_nodeps}/omtesting.so
%{rsyslog_module_dir_nodeps}/omuxsock.so
%{rsyslog_module_dir_nodeps}/pmlastmsg.so
%dir %{rsyslog_module_dir_withdeps}
%{_mandir}/man5/rsyslog.conf.5*
%{_mandir}/man8/rsyslogd.8*
%dir %{rsyslogdocdir}
%doc %{rsyslogdocdir}/rsyslog.conf
%doc %{rsyslogdocdir}/ChangeLog
%doc %{rsyslogdocdir}/README
%doc %{rsyslogdocdir}/AUTHORS
%doc %{rsyslogdocdir}/COPYING
%doc %{rsyslogdocdir}/COPYING.LESSER
%dir %{_localstatedir}/spool/rsyslog
/var/adm/fillup-templates/sysconfig.syslog-rsyslog
%files doc
%defattr(-,root,root)
%dir %{rsyslogdocdir}
%doc %{rsyslogdocdir}/doc
%files diag-tools
%defattr(-,root,root)
%{_sbindir}/msggen
%{_sbindir}/rsyslog_diag_hostname
%{_sbindir}/zpipe
%if %{with gssapi}
%files module-gssapi
%defattr(-,root,root)
%{rsyslog_module_dir_withdeps}/omgssapi.so
%{rsyslog_module_dir_withdeps}/imgssapi.so
%{rsyslog_module_dir_withdeps}/lmgssutil.so
%endif
%if %{with mysql}
%files module-mysql
%defattr(-,root,root)
%doc %{rsyslogdocdir}/mysql-createDB.sql
%{rsyslog_module_dir_withdeps}/ommysql.so
%endif
%if %{with pgsql}
%files module-pgsql
%defattr(-,root,root)
%doc %{rsyslogdocdir}/pgsql-createDB.sql
%{rsyslog_module_dir_withdeps}/ompgsql.so
%endif
%if %{with dbi}
%files module-dbi
%defattr(-,root,root)
%{rsyslog_module_dir_withdeps}/omlibdbi.so
%endif
%if %{with snmp}
%files module-snmp
%defattr(-,root,root)
%{rsyslog_module_dir_withdeps}/omsnmp.so
%endif
%if %{with gnutls}
%files module-gtls
%defattr(-,root,root)
%{rsyslog_module_dir_withdeps}/lmnsd_gtls.so
%endif
%if %{with relp}
%files module-relp
%defattr(-,root,root)
%{rsyslog_module_dir_withdeps}/imrelp.so
%{rsyslog_module_dir_withdeps}/omrelp.so
%endif
%files module-udpspoof
%defattr(-,root,root)
%{rsyslog_module_dir_nodeps}/omudpspoof.so
%changelog