File postgrey.spec of Package postgrey

# spec file for package postgrey
# 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

# norootforbuild

Name:           postgrey
Requires:       perl >= 5.6.0, perl-BerkeleyDB perl-IO-Multiplex perl-Net-Server
BuildRequires:  postfix
%if 0%{?suse_version} >= 1000
Suggests:       cron
PreReq:         %insserv_prereq, %fillup_prereq /usr/sbin/useradd
License:        GPLv2+
Group:          Productivity/Networking/Email/Utilities
Summary:        Postfix greylisting policy server
Version:        1.33
Release:        1
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source1:        %{name}.init
Source2:        %{name}.sysconfig
Source3:        %{name}.README.SUSE
Source4:        %{name}_daily_greylist.crontab
Patch0:         %{name}-1.33-config.patch
Patch1:         %{name}-1.31-goupid.patch
Patch2:         postgrey_clients_dump.patch

Postgrey is a Postfix policy server implementing greylisting. When a
request for delivery of a mail is received by Postfix via SMTP, the
triplet CLIENT_IP / SENDER / RECIPIENT is built. If it is the first
time that this triplet is seen, or if the triplet was first seen less
than 5 minutes, then the mail gets rejected with a temporary error.
Hopefully spammers or viruses will not try again later, as it is
however required per RFC.

The following features compared with from Postfix 2.1.1 are
new: Safe database, automatic maintenance, whitelists, lookup by
subnet, auto-whitelisting of clients, only Berkeley DB and no large
mysql nor postgresql DB needed.

    David Schweikert <>

%setup -q
mkdir examples
cp %{SOURCE5} examples

pod2man -s 8 postgrey > postgrey.8
pod2man -s 8 contrib/postgreyreport > postgreyreport.8

# the binaries
install -d %{buildroot}/%{_sbindir}
install -m 0755 postgrey %{buildroot}/%{_sbindir}/%{name}
install -m 0755 contrib/postgreyreport %{buildroot}/%{_sbindir}/postgreyreport
# manual
install -d %{buildroot}/%{_mandir}/man8
install -m 0644 %{name}.8 %{buildroot}%{_mandir}/man8/%{name}.8
install -m 0644 postgreyreport.8 %{buildroot}%{_mandir}/man8/postgreyreport.8
# configuration
install -d %{buildroot}/%{_sysconfdir}/%{name}
install -m 0644 postgrey_whitelist_clients %{buildroot}/%{_sysconfdir}/%{name}/whitelist_clients
install -m 0644 postgrey_whitelist_recipients %{buildroot}/%{_sysconfdir}/%{name}/whitelist_recipients
touch whitelist_clients.local
install -m 0644 whitelist_clients.local %{buildroot}/%{_sysconfdir}/%{name}
# init file and configuration
install -D %{SOURCE1} $RPM_BUILD_ROOT/etc/init.d/%{name}
ln -sf /etc/init.d/%{name} $RPM_BUILD_ROOT/usr/sbin/rc%{name}
install -D -m 644 %{SOURCE2} %{buildroot}/var/adm/fillup-templates/sysconfig.%{name}
# queue directory
install -d %{buildroot}/%{_var}/lib/%{name}
# directory for socket
install -d -m 0775 %{buildroot}/%{_var}/spool/postfix/%{name}
# some helper tools
install -m 0644 %{SOURCE4} .

/usr/sbin/useradd --system -g nogroup -s /bin/false -c "Postgrey Daemon" -d /var/lib/%{name} %{name} 2> /dev/null || :

%stop_on_removal %{name}

%{fillup_and_insserv %{name}}

%restart_on_update %{name}

%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/whitelist_recipients
%config(noreplace) %{_sysconfdir}/%{name}/whitelist_clients
%config(noreplace) %{_sysconfdir}/%{name}/whitelist_clients.local
%config %attr(0755,root,root) /etc/init.d/%{name}
%dir %attr(0755,postgrey,postfix) %{_var}/lib/%{name}
%dir %attr(0770,postgrey,postfix) %{_var}/spool/postfix/%{name}
%doc %{_mandir}/man?/*
%doc Changes COPYING README README.SUSE examples %{name}_daily_greylist.crontab

openSUSE Build Service is sponsored by