File policyd-weight.spec of Package policyd-weight
#
# spec file for package policyd-weight
#
# Copyright (c) 2008 Heinlein Professional Linux Support GmbH
#
# 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/
%if 0%{?suse_version} >= 1230
%bcond_without systemd
%else
%bcond_with systemd
%endif
Name: policyd-weight
Version: 0.1.15b3
Release: 0
License: GPL-2.0+
Summary: Postfix policy server
Url: http://www.policyd-weight.org/
Group: Productivity/Networking/Email/Utilities
Source0: %{name}-0.1.15dev3.tar.bz2
Source1: policyd-weight
Source2: %{name}.service
Source3: %{name}.tmpfiles
Source100: %{name}-rpmlintrc
# PATCH-FIX-OPENSUSE: use /var/run/policyd-weight as path for locks
Patch0: policyd-weight-change_lockpath.patch
# PATCH-FIX-UPSTREAM: replace Net::DNS::Packet::dn_expand with Net::DNS::DomainName::decode
Patch1: policyd-weight-replace_net_dns_dn_expand.patch
# PATCH-FIX-UPSTREAM: cleanup list of DNS Blacklist servers
Patch2: policyd-weight-remove_dns_bl_servers.patch
# PATCH-FIX-UPSTREAM: introduces new config option $IGNORE_RFC1918_A. If enabled A records with RFC1918 addresses
# aren't treated as bogus addresses by policyd-weight and therefore bogus_mx_score isn't added.
Patch3: policyd-weight-ignore_rfc1918_a_records_config_option.patch
PreReq: %fillup_prereq
PreReq: /usr/sbin/groupadd
PreReq: /usr/sbin/useradd
Requires: perl >= 5.6.0
Requires: perl(Net::DNS)
Requires: perl(Net::Server)
Requires: perl(Unix::Syslog)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%if %{with systemd}
BuildRequires: systemd
%{?systemd_requires}
%else
PreReq: %insserv_prereq
%endif
%define polw_user polw
%define polw_group polw
%description
policyd-weight is a Perl policy daemon for the Postfix MTA (2.1 and later)
intended to eliminate forged envelope senders and HELOs (i.e. in bogus mails).
It allows you to score DNSBLs (RBL/RHSBL), HELO, MAIL FROM and client IP
addresses before any queuing is done. It allows you to REJECT messages which
have a score higher than allowed, providing improved blocking of spam and virus
mails.
policyd-weight caches the most frequent client/sender combinations (SPAM as
well as HAM) to reduce the number of DNS queries.
It works good against botnets and other faking mass-mailer. policyd-weight is
a good partner for a greylisting-daemon like postgrey.
Add a "check_policy_service inet:127.0.0.1:12525" to your
smtpd_recipient_restriction, which is defined in your main.cf of Postfix.
See http://www.policyd-weight.org for more details.
%prep
%setup -q -n %{name}-0.1.15dev3
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
sed -i "s|/usr/bin/env perl|%{_bindir}/perl|g" usr/sbin/policyd-weight
%build
%install
cp -a etc usr %{buildroot}/
rm %{buildroot}/%{_sysconfdir}/init.d/%{name}
mkdir -p %{buildroot}%{_var}/run/%{name}
# init-script
%if %{with systemd}
install -D -m0644 %{SOURCE2} %{buildroot}/%{_unitdir}/%{name}.service
install -D -m0644 %{SOURCE3} %{buildroot}/%{_prefix}/lib/tmpfiles.d/%{name}.conf
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
%else
install -D -m 0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/%{name}
ln -sf ../../etc/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
%endif
%pre
if [ "$1" == "1" ]; then
%{_sbindir}/groupadd --system %{polw_group} 2>/dev/null || :
%{_sbindir}/useradd -r -g %{polw_group} -s /bin/false -c "policyd-weight daemon" %{polw_user} 2>/dev/null || :
fi
%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
%if %{with systemd}
%service_add_post %{name}.service
systemd-tmpfiles --create %{_prefix}/lib/tmpfiles.d/%{name}.conf
%fillup_only
%else
%{fillup_and_insserv %{name}}
%endif
%postun
%if %{with systemd}
%service_del_postun %{name}.service
%else
%restart_on_update %{name}
%{insserv_cleanup}
%endif
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%doc COPYING *.txt LICENSE policyd-weight.conf.sample
%config(noreplace) %{_sysconfdir}/policyd-weight.conf
%{_sbindir}/%{name}
%{_sbindir}/rc%{name}
%{_mandir}/man5/policyd-weight.conf*
%{_mandir}/man8/policyd-weight.8*
%if %{with systemd}
%{_unitdir}/%{name}.service
%{_prefix}/lib/tmpfiles.d/%{name}.conf
%ghost %dir %attr(-,%{polw_user},%{polw_group}) %{_var}/run/%{name}
%else
%config %attr(0755,root,root) %{_sysconfdir}/init.d/%{name}
%dir %attr(-,%{polw_user},%{polw_group}) %{_var}/run/%{name}
%endif
%changelog