File opendkim.spec of Package opendkim
#
# spec file for package opendkim
#
# Copyright (c) 2021 SUSE LLC
#
# 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.
%define full_version 2.11.0-Beta2
%define upname OpenDKIM
%define ver_odkim 2.11.0
%define ver_mt 1.6.0
%define sover_odkim 11
%define sover_rbl 1
%define sover_repute 1
%define sover_ut 1
%define sover_rrd 1
%define sover_vbr 2
%bcond_without systemd
Name: opendkim
Version: %{ver_odkim}
Release: 0
Summary: Milter based implementation of DKIM
License: BSD-3-Clause AND Sendmail
Group: Productivity/Networking/Email/Servers
URL: http://www.opendkim.org/
Source0: https://github.com/trusteddomainproject/OpenDKIM/archive/%{full_version}.tar.gz
Source2: %{name}.keyring
Source3: opendkim.service
Source4: opendkim.tmpfiles.d
Source5: opendkim.init
# PATCH-FIX-UPSTREAM fix compiler warnings
Patch0: opendkim-2.9.2_compiler_warnings.patch
# PATCH-FIX-OPENSUSE set default values in installed configuration file
Patch1: %{name}-default_config.patch
# PATCH-FIX-UPSTREAM LIBOPENDKIM: Confirm that the value of "d=" is properly formed.
Patch2: cve-2020-12272.patch
# PATCH-FIX-UPSTREAM Plug memory leak in Unbound callback function https://github.com/trusteddomainproject/OpenDKIM/pull/57/commits/0010ca7150b09c3c259c17bdd9431a8bfe39e299
Patch3: unbound-fix.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: curl-devel
BuildRequires: cyrus-sasl-devel
BuildRequires: db-devel
BuildRequires: libbsd-devel
BuildRequires: libevent-devel
BuildRequires: libtool
BuildRequires: lua51-devel
BuildRequires: pkgconfig
BuildRequires: postgresql-devel
BuildRequires: sendmail-devel
BuildRequires: tre-devel
Requires(pre): %{_sbindir}/groupadd
Requires(pre): %{_sbindir}/useradd
Requires: /usr/bin/openssl
BuildRequires: libopenssl-devel
%if %{with systemd}
BuildRequires: pkgconfig(systemd)
%{?systemd_ordering}
%else
# FIXME: use proper Requires(pre/post/preun/...)
PreReq: %fillup_prereq
PreReq: %insserv_prereq
%endif
%description
DomainKeys Identified Mail (DKIM) lets an organization take responsibility for
a message that is in transit. The organization is a handler of the message,
either as its originator or as an intermediary. Their reputation is the basis
for evaluating whether to trust the message for further handling, such as
delivery. Technically DKIM provides a method for validating a domain name
identity that is associated with a message through cryptographic
authentication.
%package -n miltertest
Version: %{ver_mt}
Release: 0
Summary: Milter unit test utility
License: BSD-3-Clause
Group: Productivity/Networking/Diagnostic
%description -n miltertest
Simulates the MTA side of an MTA-milter interaction for testing a milter-aware
filter application. It takes as input a script using the Lua language,
and by exporting some utility functions, makes it possible for users to
write scripts that exercise a filter.
%package -n libopendkim%{sover_odkim}
Summary: Library for performing DKIM signing and verification
License: BSD-3-Clause AND Sendmail
Group: System/Libraries
%description -n libopendkim%{sover_odkim}
This package provides the shared library libopendkim which
performs DKIM signing and verification.
%package devel
Summary: Development files to develop with opendkim
License: BSD-3-Clause AND Sendmail
Group: Development/Libraries/C and C++
Requires: %{name} = %{ver_odkim}
Requires: libopendkim%{sover_odkim} = %{ver_odkim}
%description devel
DomainKeys Identified Mail (DKIM) lets an organization take responsibility for
a message that is in transit. The organization is a handler of the message,
either as its originator or as an intermediary. Their reputation is the basis
for evaluating whether to trust the message for further handling, such as
delivery. Technically DKIM provides a method for validating a domain name
identity that is associated with a message through cryptographic
authentication.
This package holds the development files.
%prep
%setup -q -n %{upname}-%{full_version}
%patch0 -p1
%patch1
%patch2 -p1
%patch3 -p0
%build
autoreconf -iv
%configure \
--includedir=%{_includedir}/%{name} \
--disable-static \
--disable-silent-rules \
--disable-live-testing \
--enable-atps \
--enable-db_handle_pools \
--enable-diffheaders \
--enable-identity_header \
--enable-ldap_caching \
--enable-postgresql_reconnect_hack \
--enable-rate_limit \
--enable-replace_rules \
--disable-reprrd \
--disable-reputation \
--enable-resign \
--enable-sender_macro \
--enable-socketdb \
--enable-stats \
--enable-statsext \
--disable-rbl \
--disable-vbr \
--enable-default_sender \
--enable-query_cache \
--with-tre \
--with-lua \
--with-sasl \
--with-domain="example.com"
make %{?_smp_mflags}
%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print
# install the init script
%if %{with systemd}
install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
install -D -m 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf
ln -s -f %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
%else
install -D -m 0755 %{SOURCE5} %{buildroot}%{_sysconfdir}/%{name}/init.d/%{name}
ln -s -f %{_sysconfdir}/%{name}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
%endif
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}
install -D -m 0640 opendkim/opendkim.conf.sample %{buildroot}%{_sysconfdir}/%{name}/opendkim.conf
install -d -m 0750 %{buildroot}%{_sysconfdir}/%{name}/keys
%if "%{_datadir}/doc" != "%{_docdir}"
mkdir -p %{buildroot}%{_docdir}
mv %{buildroot}%{_datadir}/doc/%{name} %{buildroot}%{_docdir}/%{name}
%endif
%pre
getent group %{name} >/dev/null || %{_sbindir}/groupadd -r %{name}
getent passwd %{name} >/dev/null || %{_sbindir}/useradd -r -g %{name} -d %{_localstatedir}/lib/%{name} -s /sbin/nologin -c "User for opendkim" %{name}
%if %{with systemd}
%service_add_pre %{name}.service
%endif
%preun
%if %{with systemd}
%service_del_preun %{name}.service
%else
%stop_on_removal %{name}
%endif
%post
# enable opendkim to read TrustAnchorFile
# %{_sbindir}/usermod -a -G unbound %{name}
# enable postfix to write to opendkim.sock
getent passwd postfix && %{_sbindir}/usermod -a -G %{name} postfix
%if %{with systemd}
systemd-tmpfiles --create %{_tmpfilesdir}/%{name}.conf || true
%service_add_post %{name}.service
%endif
%postun
%if %{with systemd}
%service_del_postun %{name}.service
%else
%restart_on_update %{name}
%insserv_cleanup
%endif
%post -n libopendkim%{sover_odkim} -p /sbin/ldconfig
%postun -n libopendkim%{sover_odkim} -p /sbin/ldconfig
%files -n miltertest
%license LICENSE
%{_bindir}/miltertest
%{_mandir}/man8/miltertest.8%{?ext_man}
%files -n libopendkim%{sover_odkim}
%{_libdir}/libopendkim.so.*
%files
%doc %{_docdir}/%{name}
#
%config(noreplace) %attr(-,root,%{name}) %{_sysconfdir}/%{name}
%dir %attr(750,%{name},%{name}) %{_sysconfdir}/%{name}/keys
%{_sbindir}/rc%{name}
%if %{with systemd}
%{_unitdir}/%{name}.service
%{_tmpfilesdir}/%{name}.conf
%ghost /run/opendkim
%else
%{_sysconfdir}/%{name}/init.d/%{name}
%endif
%dir %attr(750,%{name},%{name}) %{_localstatedir}/lib/%{name}
#
%{_sbindir}/opendkim
%{_sbindir}/opendkim-atpszone
%{_sbindir}/opendkim-expire
%{_sbindir}/opendkim-gengraphs
%{_sbindir}/opendkim-genkey
%{_sbindir}/opendkim-genstats
%{_sbindir}/opendkim-genzone
%{_sbindir}/opendkim-reportstats
%{_sbindir}/opendkim-stats
%{_sbindir}/opendkim-testkey
%{_sbindir}/opendkim-testmsg
%{_mandir}/man3/opendkim-lua.3%{?ext_man}
%{_mandir}/man5/opendkim.conf.5%{?ext_man}
%{_mandir}/man8/opendkim-atpszone.8%{?ext_man}
%{_mandir}/man8/opendkim-expire.8%{?ext_man}
%{_mandir}/man8/opendkim-gengraphs.8%{?ext_man}
%{_mandir}/man8/opendkim-genkey.8%{?ext_man}
%{_mandir}/man8/opendkim-genstats.8%{?ext_man}
%{_mandir}/man8/opendkim-genzone.8%{?ext_man}
%{_mandir}/man8/opendkim-stats.8%{?ext_man}
%{_mandir}/man8/opendkim-testkey.8%{?ext_man}
%{_mandir}/man8/opendkim-testmsg.8%{?ext_man}
%{_mandir}/man8/opendkim.8%{?ext_man}
%files devel
%{_includedir}/opendkim/
%{_libdir}/libopendkim.so
%{_libdir}/pkgconfig/opendkim.pc
%changelog