File ulogd.spec of Package ulogd

# spec file for package ulogd (Version 1.24)
# Copyright (c) 2009 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

# norootforbuild

Name:           ulogd
%if 0%{?suse_version} >= 1100
BuildRequires:  libmysqlclient-devel sqlite3-devel
BuildRequires:  mysql-devel sqlite-devel
BuildRequires:  libpcap-devel postgresql-devel
%define ulogd_user ulogd
%define ulogd_group ulogd
%define apparmor_policy_dir %{_sysconfdir}/apparmor.d
Version:        1.24
Release:        138
License:        GPL v2 or later
Summary:        Netfilter ULOG target log daemon
Group:          System/Daemons
AutoReqProv:    on
Requires:       logrotate
Source2:        ulogd.a4.pdf
Source3:        ulogd.init
Source4:        ulogd.logrotate
Source5:        ulogd.apparmor
Patch1:         %{name}-%{version}-build.dif
Patch2:         %{name}-%{version}-config.dif
Patch3:         %{name}-%{version}-mysql-table.dif
Patch4:         %{name}-%{version}-pgsql-table.dif
Patch5:         %{name}-%{version}-sqlite3-table.dif
Patch6:         %{name}-%{version}-fixes-base.dif
Patch7:         %{name}-%{version}-fixes-mysql.dif
Patch8:         %{name}-%{version}-fixes-pgsql.dif
Patch9:         %{name}-%{version}-fixes-sqlite3.dif
Patch10:        %{name}-%{version}-fixes-pcap.dif
Patch11:        %{name}-%{version}-user-option.dif
Patch12:        %{name}-%{version}-bnc420313.dif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         %insserv_prereq %fillup_prereq /usr/sbin/useradd /usr/sbin/groupadd /usr/sbin/usermod

%package sqlite
License:        GPL v2 or later
Summary:        SQLite output plugin for ulogd
Requires:       ulogd
Group:          System/Daemons

%package mysql
License:        GPL v2 or later
Summary:        MySQL output plugin for ulogd
Requires:       ulogd
Group:          System/Daemons

%package pgsql
License:        GPL v2 or later
Summary:        PostgreSQL output plugin for ulogd
Requires:       ulogd
Group:          System/Daemons

%package pcap
License:        GPL v2 or later
Summary:        PCAP output plugin for ulogd
Requires:       ulogd
Group:          System/Daemons

%package -n libipulog-devel
License:        GPL v2 or later
Summary:        Netfilter ULOG target library
Group:          Development/Libraries/Other

Ulogd is an universal logging daemon for the ULOG target of netfilter,
the Linux 2.4/2.6 firewalling subsystem. Ulogd is able to log packets
in various formats to different targets (text files, databases, etc..).
It has an easy-to-use plugin interface to add new protocols and new
output targets.

    Harald Welte <>

%description sqlite
ulogd-sqlite is a output plugin for ulogd. It enables logging of
firewall information into a SQLite database.

    Harald Welte <>

%description mysql
ulogd-mysql is a output plugin for ulogd. It enables logging of
firewall information into a MySQL database.

    Harald Welte <>

%description pgsql
Ulogd-pgsql is a output plugin for ulogd. It enables logging of
firewall information into a PostgreSQL database.

    Harald Welte <>

%description pcap
Ulogd-pcap is a output plugin for ulogd. It enables logging of firewall
information to pcap-style files (like tcpdump).

    Harald Welte <>

%description -n libipulog-devel
Libipulog is a little library which provides a convenient way to
receive netfilter ULOG target log messages.

    Harald Welte <>

%setup -q
cp -a doc/pgsql.table   doc/pgsql.table.ipaddr-as-string
cp -a doc/sqlite3.table doc/sqlite3.table.ipaddr-as-string
%patch1 -p0
%patch2 -p0
%patch3 -p0
%patch4 -p0
%patch5 -p0
%patch6 -p0
%patch7 -p0
%patch8 -p0
%patch9 -p0
%patch10 -p0
%patch11 -p0
%patch12 -p0

%configure \
	--with-sqlite3=%{_prefix} \
	--with-mysql=%{_prefix} \
	--with-pgsql=%{_prefix} \
	--with-mysql-log-ip-as-string \
	--with-pgsql-log-ip-as-string \
rm -f ulogd
export LDFLAGS="-pie"
make ulogd

install -d -m0755 %{buildroot}/%{_sysconfdir}/logrotate.d
install -d -m0755 %{buildroot}/%{_sysconfdir}/init.d
install -d -m0755 %{buildroot}/%{_includedir}/libipulog
install -d -m0755 %{buildroot}/%{_sbindir}/sbin
install -d -m0755 %{buildroot}/%{_libdir}/ulogd
install -d -m0755 %{buildroot}/%{_localstatedir}/lib/ulogd
install -d -m0755 %{buildroot}/%{_localstatedir}/log/ulogd
install -d -m0755 %{buildroot}/%{apparmor_policy_dir}
make DESTDIR=%{buildroot} install
install -m0754 $RPM_SOURCE_DIR/ulogd.init \
ln -sf         %{_sysconfdir}/init.d/ulogd \
install -m0644 $RPM_SOURCE_DIR/ulogd.logrotate \
install -m0644 libipulog/include/libipulog/libipulog.h \
install -m0644 libipulog/libipulog.a \
install -m0644 $RPM_SOURCE_DIR/ulogd.apparmor \

rm -rf %{buildroot}

%if %{?ulogd_group:1}0
/usr/sbin/groupadd -r %{ulogd_group} 2> /dev/null || :
%if %{?ulogd_user:1}0
/usr/sbin/useradd -r %{?ulogd_group:-g %ulogd_group}%{!?ulogd_group:-g nogroup} -s /bin/false -c "ulog daemon" -d /var/lib/ulog %ulogd_user 2> /dev/null ||:
/usr/sbin/usermod -s /bin/false -d /var/lib/ulog %ulogd_user 2> /dev/null ||:

%{fillup_and_insserv -f ulogd}

%stop_on_removal ulogd

%restart_on_update ulogd

%attr(0755,root,root) %{_sbindir}/ulogd
%attr(0755,root,root) %{_sbindir}/rculogd
%if %{?ulogd_user:1}0
%if %{?ulogd_group:1}0
%attr(0640,root,%ulogd_group) %config(noreplace) %{_sysconfdir}/ulogd.conf
%attr(0640,%ulogd_user,root) %config(noreplace) %{_sysconfdir}/ulogd.conf
%attr(0640,root,root) %config(noreplace) %{_sysconfdir}/ulogd.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/ulogd
%dir %{apparmor_policy_dir}
%config(noreplace) %{apparmor_policy_dir}/usr.sbin.ulogd
%dir %{_libdir}/ulogd
%dir %{_localstatedir}/lib/ulogd
%if %{?ulogd_user:1}0
%attr(0750,%{ulogd_user},%{?ulogd_group}%{!?ulogd_group:root}) %dir %{_localstatedir}/log/ulogd
%dir %{_localstatedir}/log/ulogd
%doc doc/ulogd.txt $RPM_SOURCE_DIR/ulogd.a4.pdf doc/ulogd.html
%doc doc/sqlite3.table
%doc doc/mysql.table
%doc doc/pgsql.table
%doc doc/sqlite3.table.ipaddr-as-string
%doc doc/mysql.table.ipaddr-as-string
%doc doc/pgsql.table.ipaddr-as-string

%files sqlite

%files mysql

%files pgsql

%files pcap

%files -n libipulog-devel
%doc libipulog/ulog_test.c

* Tue Jan 27 2009
- Fixed log file owner/group in logrotate file (bnc#468419).
* Tue Aug 26 2008
- Added -L,-l filter as workaround to db lib lists (bnc#420313).
- Added logrotate to rpm requires for ulogd [rpmlint]
- Added $remote_fs to Required-Start/Stop in init script [rpmlint]
- Updated Copyright/License statements in spec and init script
- Adopted BuildRequires to use current db devel package names
- Removed explicit db requires from plugin packages; rpm is able
  to find the dependencies itself [rpmlint]
- Renamed libipulog package to libipulog-devel - it provides a
  static library only [rpmlint].
* Thu Jul 26 2007
- changed libpcap to libpcap-devel in BuildRequires
* Sun Jun 10 2007
- remove requires for mysql-shared from ulogd-mysql
  (requirement for library is done automatically anyway)
* Fri Jun 01 2007
- Fixed to use -pie for ulogd only, not for plugins
* Thu May 31 2007
- Updated to ulogd 1.24, providing several bugfixes, like and
  off-by-one-column fix in sqlite3 plugin, pcap header fix for
  some architectures, memory leak fix for postgresql plugin,
  reconnect support for mysql plugin, ...
- Merged build related changes from into ulogd-1.24-build.dif.
  Obsolete patches: ulogd-1.23.dif, ulogd-1.23-lib64.dif
  New patch file: ulogd-1.24-build.dif
- Splitted ulogd-1.23-strfix.dif into separate files.
  New patches: ulogd-1.24-fixes-{base,mysql,pgsql,sqlite3}.dif,
- Added sync option fix for the pcap plugin.
  New patch: ulogd-1.24-fixes-pcap.dif
- Changed to compile with --with-*-log-ip-as-string, implemented
  fallback support for old db formats. Prepared the psql,sqlite3
  sql scripts. New patches: ulogd-1.24-{pgsql,sqlite3}-table.dif
- Fixed mysql.table.ipaddr-as-string sql script; no default value
  for id is allowed when also auto_increment is set.
  New patch file: ulogd-1.24-mysql-table.dif
- Implemented an global "user" option allowing to set the user
  to run as in the config file. Adopted spec, config and logrotate
  file to run as ulogd user and store log in /var/log/ulogd/.
  New patch file: ulogd-1.24-user-option.dif
- Added apparmor policy for ulogd - enabled by default.
* Wed Jan 10 2007
- Bug #229970: fixed several string length calculations
  New patch file: ulogd-1.23-strfix.dif
- Fixed _init / _fini functions to reset the dbh pointer on
  initialization failures, added checks if stmt/dbh pointer
  are initialized in output functions. Changed to run _fini
  functions before the log file is closed, because they may
  log (eg. the sqlite3 plugin).
  New patch file: ulogd-1.23-cleanup.dif
- Changed to use more usefull default path in
  New patch file: ulogd-1.23-config.dif
* Thu Jun 22 2006
- remove selfprovides
* Tue May 02 2006
- Bug #155647: fixed ip column format in doc/pgsql.table
  to match the compiled in type.
  New patch file: ulogd-1.23-pgsql-table.dif
* Wed Jan 25 2006
- converted neededforbuild to BuildRequires
* Wed Jul 27 2005
- updated to ulogd-1.23, adopted patches
- added logrotate file, fixed init script
- added sqlite (sqlite3) plugin sub-package
* Fri Apr 29 2005
- updated to ulogd-1.21, adopted patches
* Tue Aug 31 2004
- added directory to filelist
* Tue Aug 31 2004
- fix lib64 issue in configure
* Thu May 27 2004
- initial package
openSUSE Build Service is sponsored by