485605b
%global confdir %{_sysconfdir}/postfix
bdea17a
485605b
Name:              postgrey
485605b
Version:           1.34
0f06bbc
Release:           9%{?dist}
5fc9e95
# File headers only state "GNU GPL", but the LICENSE sections state v2 and "any
5fc9e95
# later version"
485605b
Summary:           Postfix Greylisting Policy Server
485605b
License:           GPLv2+
485605b
URL:               http://postgrey.schweikert.ch/
485605b
Source0:           http://postgrey.schweikert.ch/pub/postgrey-%{version}.tar.gz
485605b
Source1:           postgrey.service
485605b
Source2:           README-rpm
485605b
Source3:           postgrey.sysconfig
485605b
Patch0:            postgrey-1.28-group.patch
485605b
Patch1:            postgrey-1.34-perl-5.18.patch
485605b
BuildArch:         noarch
485605b
BuildRequires:     systemd
485605b
Requires:          perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
0f06bbc
# We require postfix for its directories and gid
485605b
Requires:          postfix
485605b
Requires(pre):     shadow-utils
485605b
Requires(post):    systemd
485605b
Requires(preun):   systemd
485605b
Requires(postun):  systemd
bdea17a
bdea17a
%description
0f06bbc
Postgrey is a Postfix policy server implementing greylisting. When a request
bdea17a
for delivery of a mail is received by Postfix via SMTP, the triplet CLIENT_IP /
0f06bbc
SENDER / RECIPIENT is built. If it is the first time that this triplet is
bdea17a
seen, or if the triplet was first seen less than 5 minutes, then the mail gets
bdea17a
rejected with a temporary error. Hopefully spammers or viruses will not try
bdea17a
again later, as it is however required per RFC.
bdea17a
bdea17a
%prep
bdea17a
%setup -q
bdea17a
%patch0 -p1 -b .group
988dc76
%patch1 -p1 -b .perl-5.18
485605b
install -pm0644 %{SOURCE2} README-rpm
bdea17a
bdea17a
%build
bdea17a
# We only have perl scripts, so just "build" the man page
bdea17a
pod2man \
bdea17a
    --center="Postgrey Policy Server for Postfix" \
bdea17a
    --section="8" \
bdea17a
    postgrey > postgrey.8
bdea17a
bdea17a
%install
bdea17a
# Configuration files
485605b
mkdir -p %{buildroot}%{confdir}
c051211
install -pm0644 postgrey_whitelist_{clients,recipients} \
bdea17a
    %{buildroot}%{confdir}/
bdea17a
# Local whitelist file
bdea17a
echo "# Clients that should not be greylisted.  See postgrey(8)." \
bdea17a
    > %{buildroot}%{confdir}/postgrey_whitelist_clients.local
bdea17a
bdea17a
# Main script
485605b
install -pDm0755 postgrey %{buildroot}%{_sbindir}/postgrey
bdea17a
bdea17a
# Spool directory
485605b
mkdir -p %{buildroot}%{_localstatedir}/spool/postfix/postgrey
bdea17a
bdea17a
# Init script
485605b
install -pDm0644 %{SOURCE1} \
497f8ed
    %{buildroot}%{_unitdir}/postgrey.service
497f8ed
497f8ed
# Sysconfig
485605b
install -pDm0644 %{SOURCE3} \
497f8ed
    %{buildroot}%{_sysconfdir}/sysconfig/postgrey
bdea17a
bdea17a
# Man page
485605b
install -pDm0644 postgrey.8 \
bdea17a
    %{buildroot}%{_mandir}/man8/postgrey.8
bdea17a
bdea17a
# Optional report script
485605b
install -pDm0755 contrib/postgreyreport \
bdea17a
    %{buildroot}%{_sbindir}/postgreyreport
bdea17a
bdea17a
%pre
0f06bbc
getent group postgrey >/dev/null || groupadd -r postgrey
0f06bbc
getent passwd postgrey >/dev/null || \
0f06bbc
    useradd -r -g postgrey -d %{_localstatedir}/spool/postfix/postgrey -s /sbin/nologin \
0f06bbc
    -c "Postfix Greylisting Service" postgrey
0f06bbc
exit 0
bdea17a
bdea17a
%post
485605b
%systemd_post postgrey.service
bdea17a
bdea17a
%preun
485605b
%systemd_preun postgrey.service
bdea17a
bdea17a
%postun
485605b
%systemd_postun postgrey.service
bdea17a
497f8ed
%triggerun -- postgrey < 1.34-3
497f8ed
# Save the current service runlevel info
497f8ed
# User must manually run systemd-sysv-convert --apply postgrey
497f8ed
# to migrate them to systemd targets
497f8ed
/usr/bin/systemd-sysv-convert --save postgrey >/dev/null 2>&1 ||:
497f8ed
497f8ed
# Run these because the SysV package being removed won't do them
497f8ed
/sbin/chkconfig --del postgrey >/dev/null 2>&1 || :
497f8ed
/bin/systemctl try-restart postgrey.service >/dev/null 2>&1 || :
bdea17a
bdea17a
%files
bdea17a
%doc Changes COPYING README README-rpm
497f8ed
%{_unitdir}/postgrey.service
497f8ed
%{_sysconfdir}/sysconfig/postgrey
bdea17a
%config(noreplace) %{confdir}/postgrey_whitelist_clients
bdea17a
%config(noreplace) %{confdir}/postgrey_whitelist_recipients
bdea17a
%config(noreplace) %{confdir}/postgrey_whitelist_clients.local
bdea17a
%{_sbindir}/postgrey
bdea17a
%{_sbindir}/postgreyreport
bdea17a
%{_mandir}/man8/postgrey.8*
485605b
%dir %attr(0751,postgrey,postfix) %{_localstatedir}/spool/postfix/postgrey/
bdea17a
bdea17a
%changelog
0f06bbc
* Sat Jan 11 2014 Christopher Meng <rpm@cicku.me> - 1.34-9
0f06bbc
- Update systemd service unit to be more powerful.
0f06bbc
- SPEC cleanup(BZ#850279).
0f06bbc
988dc76
* Wed Jan 01 2014 Nils Philippsen <nils@redhat.com> - 1.34-8
988dc76
- make postgrey work with perl 5.18 (#1039551)
988dc76
48ced5b
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.34-7
48ced5b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
48ced5b
23dccba
* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 1.34-6
23dccba
- Perl 5.18 rebuild
6fdee00
- Build-require systemd-units
23dccba
2ccdaf2
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.34-5
2ccdaf2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
2ccdaf2
0c374a1
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.34-4
0c374a1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
0c374a1
497f8ed
* Tue Mar 20 2012 Jon Ciesla <limburgher@gmail.com> - 1.34-3
497f8ed
- Migrate to systemd, BZ 714430.
497f8ed
5eda692
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.34-2
5eda692
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
5eda692
Matthias Saou ba10f11
* Tue Jun  7 2011 Matthias Saou <http://freshrpms.net/> 1.34-1
Matthias Saou ba10f11
- Update to 1.34.
Matthias Saou ba10f11
998bf37
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.32-3
998bf37
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
998bf37
8fce753
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.32-2
8fce753
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
8fce753
418b70b
* Sun Apr 12 2009 Matthias Saou <http://freshrpms.net/> 1.32-1
418b70b
- Update to 1.32.
418b70b
- Update init script to the new style.
418b70b
- Slightly update README-rpm instructions.
418b70b
418b70b
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org>
be27b50
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
be27b50
28d1c5e
* Thu May 22 2008 Matthias Saou <http://freshrpms.net/> 1.31-1
28d1c5e
- Update to 1.31.
28d1c5e
5fc9e95
* Mon Aug  6 2007 Matthias Saou <http://freshrpms.net/> 1.30-1
5fc9e95
- Update to 1.30.
5fc9e95
- Update License field.
5fc9e95
8757676
* Fri Jun 22 2007 Matthias Saou <http://freshrpms.net/> 1.28-1
8757676
- Update to 1.28.
8757676
- Update URL to the new homepage.
8757676
bdea17a
* Mon Feb 12 2007 Matthias Saou <http://freshrpms.net/> 1.27-4
bdea17a
- Silence %%setup.
bdea17a
- Fix init script mode in the srpm.
bdea17a
- Remove explicit perl(IO::Multiplex) requirement, not needed on FC6 (but
bdea17a
  probably still on RHEL4).
bdea17a
- Add a comment line to the empty local whitelist file.
bdea17a
bdea17a
* Mon Dec  4 2006 Matthias Saou <http://freshrpms.net/> 1.27-3
bdea17a
- Add man page generation (Mike Wohlgemuth).
bdea17a
bdea17a
* Fri Dec  1 2006 Matthias Saou <http://freshrpms.net/> 1.27-2
bdea17a
- Include postgreyreport script.
bdea17a
bdea17a
* Mon Nov  6 2006 Matthias Saou <http://freshrpms.net/> 1.27-1
bdea17a
- Spec file cleanup.
bdea17a
bdea17a
* Wed Jan 18 2006 Levente Farkas <lfarkas@lfarkas.org> 1.24
bdea17a
- some minor changes thanks to Peter Bieringer <pb@bieringer.de>
bdea17a
bdea17a
* Mon Jan 16 2006 Levente Farkas <lfarkas@lfarkas.org> 1.24
bdea17a
- upgrade to 1.24
bdea17a
bdea17a
* Sun Nov 13 2005 Levente Farkas <lfarkas@lfarkas.org> 1.22
bdea17a
- upgrade to 1.22
bdea17a
bdea17a
* Mon Aug 22 2005 Levente Farkas <lfarkas@lfarkas.org> 1.21
bdea17a
- spec file update from Luigi Iotti <luigi@iotti.biz>
bdea17a
bdea17a
* Thu Apr 28 2005 Levente Farkas <lfarkas@lfarkas.org> 1.21
bdea17a
- update to 1.21
bdea17a
bdea17a
* Tue Mar  8 2005 Levente Farkas <lfarkas@lfarkas.org> 1.18
bdea17a
- update to 1.18
bdea17a
bdea17a
* Tue Dec 14 2004 Levente Farkas <lfarkas@lfarkas.org> 1.17
bdea17a
- update to 1.17
bdea17a
bdea17a
* Wed Jul 14 2004 Levente Farkas <lfarkas@lfarkas.org> 1.14
bdea17a
- guard the pre and post scripts
bdea17a
bdea17a
* Wed Jul  7 2004 Levente Farkas <lfarkas@lfarkas.org> 1.13
bdea17a
- initial release 1.13
bdea17a