File rsyslog.spec of Package rsyslog.import5099

#
# 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.6.5
Release:        1.<RELEASE5>
%define         upstream_version            5.6.5
%define         with_dbi                    0%{?suse_version} >= 1140 || 0%{?build_with_relp:1}
%define         with_relp                   0%{?suse_version} >= 1130 || 0%{?build_with_relp:1}
%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 openssl-devel pcre-devel pkgconfig zlib-devel
BuildRequires:  krb5-devel mysql-devel net-snmp-devel postgresql-devel
BuildRequires:  libgnutls-devel
%if 0%{?with_dbi}
BuildRequires:  libdbi-devel
%endif
%if 0%{?with_relp}
# RELP support
BuildRequires:  librelp-devel
%endif
# UDP spoof support
%if 0%{?suse_version} >= 1140
BuildRequires:  libnet-devel
# The systemd package provides
#   /usr/share/doc/packages/systemd/sd-daemon.[ch]
# files instead of a lib ...
BuildRequires:  systemd
%else
BuildRequires:  libnet
%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
%if 0%{?suse_version} >= 1140
Patch1:         rsyslog-systemd-integration.bnc656104.diff
%endif
Patch2:         rsyslog-5.x-memcpy-overflow.patch
Patch3:         rsyslog-CVE-2011-3200.bnc714658.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).

%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.

%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.

%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.

%if 0%{?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

%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.

%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).

%if 0%{?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}
%if 0%{?suse_version} >= 1140
%patch1 -p1
# install the files systemd provides rather than what we provide.
cp -a /usr/share/doc/packages/systemd/sd-daemon.[ch] runtime/
%endif
%patch2 -p1
%patch3 -p1
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		\
	--enable-gnutls		\
	--enable-rsyslogd	\
	--enable-gssapi-krb5	\
	--enable-mysql		\
	--enable-pgsql		\
%if 0%{?with_dbi}
	--enable-libdbi		\
%endif
%if 0%{?with_relp}
	--enable-relp		\
%endif
	--enable-snmp		\
	--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 omgssapi.so imgssapi.so lmgssutil.so ommysql.so \
           ompgsql.so omsnmp.so lmnsd_gtls.so \
%if 0%{?with_dbi}
	   omlibdbi.so \
%endif
%if 0%{?with_relp}
	   imrelp.so omrelp.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}/\{\} \; \)
install -m644 plugins/ommysql/createDB.sql \
	%{buildroot}%{rsyslogdocdir}/mysql-createDB.sql
install -m644 plugins/ompgsql/createDB.sql \
	%{buildroot}%{rsyslogdocdir}/pgsql-createDB.sql
#

%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

%files module-gssapi
%defattr(-,root,root)
%{rsyslog_module_dir_withdeps}/omgssapi.so
%{rsyslog_module_dir_withdeps}/imgssapi.so
%{rsyslog_module_dir_withdeps}/lmgssutil.so

%files module-mysql
%defattr(-,root,root)
%doc %{rsyslogdocdir}/mysql-createDB.sql
%{rsyslog_module_dir_withdeps}/ommysql.so

%files module-pgsql
%defattr(-,root,root)
%doc %{rsyslogdocdir}/pgsql-createDB.sql
%{rsyslog_module_dir_withdeps}/ompgsql.so

%if 0%{?with_dbi}

%files module-dbi
%defattr(-,root,root)
%{rsyslog_module_dir_withdeps}/omlibdbi.so
%endif

%files module-snmp
%defattr(-,root,root)
%{rsyslog_module_dir_withdeps}/omsnmp.so

%files module-gtls
%defattr(-,root,root)
%{rsyslog_module_dir_withdeps}/lmnsd_gtls.so

%if 0%{?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
openSUSE Build Service is sponsored by