# systemd-rpm-macros split out from systemd at Fedora 30 %if (0%{?fedora} && 0%{?fedora} <= 29) || 0%{?rhel} %global systemd_rpm_macros systemd %else %global systemd_rpm_macros systemd-rpm-macros %endif # Milter header files package name %if 0%{?fedora} > 25 || 0%{?rhel} > 7 %global milter_devel_package sendmail-milter-devel %else %global milter_devel_package sendmail-devel %endif # Do a hardened build where possible %global _hardened_build 1 Summary: Mail filter for Sender Policy Framework verification Name: smf-spf Version: 2.5.1 Release: 1%{?dist} License: GPL-2.0-or-later URL: https://github.com/jcbf/smf-spf/ Source0: https://github.com/jcbf/smf-spf/archive/refs/tags/v%{version}.tar.gz Source2: smf-spf.service Source3: smfs.conf Source4: README.rpm Patch0: smf-spf-2.5.1-Makefile.patch Patch1: smf-spf-2.5.1-version-revert.patch Patch2: smf-spf-2.5.1-conf.patch Patch5: smf-spf-2.5.1-rundir.patch Patch100: https://github.com/jcbf/smf-spf/commit/f60db814.patch Patch101: https://github.com/jcbf/smf-spf/commit/5fc6163f.patch Patch102: https://github.com/jcbf/smf-spf/commit/c9ba2d59.patch BuildRequires: coreutils BuildRequires: gcc BuildRequires: make BuildRequires: libspf2-devel >= 1.2.5 BuildRequires: %milter_devel_package >= 8.12 BuildRequires: systemd BuildRequires: %systemd_rpm_macros Requires: sendmail >= 8.12 %{?systemd_requires} Requires(pre): glibc-common Requires(pre): shadow-utils # Need systemd for ownership of /usr/lib/tmpfiles.d directory Requires: systemd %description smf-spf is a lightweight, fast and reliable Sendmail milter that implements the Sender Policy Framework technology with the help of the libspf2 library. It checks SPF records to make sure that e-mail messages are authorized by the domain that it is coming from. It's an alternative for the spfmilter, spf-milter, and milter-spiff milters. %prep %setup -q # Temporarily bump the version so the next patches apply cleanly %patch -P 100 -p1 # Insert AuthRes header as first header (GH#96) %patch -P 101 -p1 # Don't point to defunct URL in rejection message (GH#93) %patch -P 102 -p1 # Revert the earlier version bump: this is not 2.5.2 %patch -P 1 # Copy in additional sources cp -a %{SOURCE2} %{SOURCE3} %{SOURCE4} . # Use the distribution optimization flags and don't strip the binary, # so we get usable debuginfo %patch -P 0 -p1 # Tag failing messages by default rather than rejecting them %patch -P 2 -p1 # Use /run rather than /var/run with systemd %patch -P 5 %build make %{?_smp_mflags} OPTFLAGS="%{optflags}" LDFLAGS="$LDFLAGS -lmilter -lpthread -lspf2" %install install -d -m 711 %{buildroot}/run/smfs install -Dp -m 755 smf-spf %{buildroot}%{_sbindir}/smf-spf install -Dp -m 644 smf-spf.conf %{buildroot}%{_sysconfdir}/mail/smfs/smf-spf.conf # Install systemd unit file and tmpfiles.d configuration for /run/smfs install -Dp -m 644 smf-spf.service %{buildroot}%{_unitdir}/smf-spf.service install -Dp -m 644 smfs.conf %{buildroot}%{_prefix}/lib/tmpfiles.d/smfs.conf # Create dummy socket for %%ghost-ing : > %{buildroot}/run/smfs/smf-spf.sock %pre getent group smfs >/dev/null || groupadd -r smfs getent passwd smfs >/dev/null || \ useradd -r -g smfs -d %{_localstatedir}/lib/smfs \ -s /sbin/nologin -c "Smart Sendmail Filters" smfs exit 0 %post %systemd_post smf-spf.service %preun %systemd_preun smf-spf.service %postun %systemd_postun_with_restart smf-spf.service %files %license COPYING %doc readme README.md README.rpm %{_sbindir}/smf-spf %dir %{_sysconfdir}/mail/smfs/ %config(noreplace) %{_sysconfdir}/mail/smfs/smf-spf.conf %attr(0711,smfs,smfs) %dir /run/smfs/ %ghost %attr(0600,smfs,smfs) /run/smfs/smf-spf.sock %{_prefix}/lib/tmpfiles.d/smfs.conf %{_unitdir}/smf-spf.service %changelog * Sat Jul 22 2023 Paul Howarth - 2.5.1-1 - Switch upstream to https://github.com/jcbf/smf-spf/ - Update to 2.5.1 (see README.md for details) - Don't package ChangeLog, which refers to original unmaintained version * Wed Feb 8 2023 Paul Howarth - 2.0.2-10 - Support only systemd init - Use SPDX-format license tag - Use %%license unconditionally - Do a hardened build where possible * Sun Mar 24 2019 Paul Howarth - 2.0.2-9 - Fix permissions of /run/smfs so that dac_read_search capability is not needed during milter start-up * Tue Mar 13 2018 Paul Howarth - 2.0.2-8 - Improve readability of scriptlets by removing full command paths - systemd-units merged into systemd at Fedora 17 - Drop support for EOL distributions prior to F-13 - Drop BuildRoot: and Group: tags - Drop explicit buildroot cleaning in %%install section - Drop explicit %%clean section - %%{_initddir} macro always available * Fri Aug 5 2016 Paul Howarth - 2.0.2-7 - sendmail-devel renamed to sendmail-milter-devel from Fedora 26 - Specify all build requirements - Drop %%defattr, redundant since rpm 4.4 - Use %%license where possible * Sun Jul 28 2013 Paul Howarth - 2.0.2-6 - Systemd detection was broken in F-19 so hardcode it instead * Tue Jul 3 2012 Paul Howarth - 2.0.2-5 - Move tmpfiles.d config from %%{_sysconfdir} to %%{_prefix}/lib - Delay start-up until after network * Thu Sep 29 2011 Paul Howarth - 2.0.2-4 - Use presence of /run/lock to determine if init is systemd * Wed Jul 13 2011 Paul Howarth - 2.0.2-3 - Switch to systemd configuration where appropriate - Nobody else likes macros for commands * Wed Jul 28 2010 Paul Howarth - 2.0.2-2 - Modernize initscript and scriptlets - Add dist tag * Thu Jan 11 2007 Paul Howarth - 2.0.2-1 - Update to 2.0.2 - Failing mails now tagged [SPF:fail] by default instead of [SPF-FAIL] * Fri Sep 22 2006 Paul Howarth - 2.0.1-1 - Update to 2.0.1 * Thu Sep 21 2006 Paul Howarth - 2.0.0-1 - Initial RPM build