bdea17a
%define confdir %{_sysconfdir}/postfix
bdea17a
bdea17a
Summary: Postfix Greylisting Policy Server
bdea17a
Name: postgrey
Matthias Saou ba10f11
Version: 1.34
23dccba
Release: 6%{?dist}
5fc9e95
# File headers only state "GNU GPL", but the LICENSE sections state v2 and "any
5fc9e95
# later version"
5fc9e95
License: GPLv2+
bdea17a
Group: System Environment/Daemons
8757676
URL: http://postgrey.schweikert.ch/
8757676
Source0: http://postgrey.schweikert.ch/pub/postgrey-%{version}.tar.gz
497f8ed
Source1: postgrey.service
bdea17a
Source2: README-rpm
497f8ed
Source3: postgrey.sysconfig
8757676
Patch0: postgrey-1.28-group.patch
bdea17a
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
bdea17a
# We require postfix for its directories and gid
bdea17a
Requires: postfix
bdea17a
Requires(pre): /usr/sbin/useradd
497f8ed
#Requires(post): /sbin/chkconfig
497f8ed
#Requires(preun): /sbin/service, /sbin/chkconfig
497f8ed
#Requires(postun): /sbin/service
497f8ed
Requires(post): systemd-units
497f8ed
Requires(preun): systemd-units
497f8ed
Requires(postun): systemd-units
bdea17a
BuildArch: noarch
bdea17a
bdea17a
%description
bdea17a
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 /
bdea17a
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
bdea17a
%prep
bdea17a
%setup -q
bdea17a
%patch0 -p1 -b .group
bdea17a
%{__install} -p -m 0644 %{SOURCE2} README-rpm
bdea17a
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
bdea17a
%install
bdea17a
%{__rm} -rf %{buildroot}
bdea17a
bdea17a
# Configuration files
bdea17a
%{__mkdir_p} %{buildroot}%{confdir}
bdea17a
%{__install} -p -m 0644 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
bdea17a
%{__install} -D -p -m 0755 postgrey %{buildroot}%{_sbindir}/postgrey
bdea17a
bdea17a
# Spool directory
bdea17a
%{__mkdir_p} %{buildroot}%{_var}/spool/postfix/postgrey
bdea17a
bdea17a
# Init script
497f8ed
%{__install} -D -p -m 0644 %{SOURCE1} \
497f8ed
    %{buildroot}%{_unitdir}/postgrey.service
497f8ed
497f8ed
# Sysconfig
497f8ed
%{__install} -D -p -m 0644 %{SOURCE3} \
497f8ed
    %{buildroot}%{_sysconfdir}/sysconfig/postgrey
bdea17a
bdea17a
# Man page
bdea17a
%{__install} -D -p -m 0644 postgrey.8 \
bdea17a
    %{buildroot}%{_mandir}/man8/postgrey.8
bdea17a
bdea17a
# Optional report script
bdea17a
%{__install} -D -p -m 0755 contrib/postgreyreport \
bdea17a
    %{buildroot}%{_sbindir}/postgreyreport
bdea17a
bdea17a
bdea17a
%clean
bdea17a
%{__rm} -rf %{buildroot}
bdea17a
bdea17a
bdea17a
%pre
bdea17a
/usr/sbin/useradd -d %{_var}/spool/postfix/postgrey -s /sbin/nologin \
bdea17a
    -M -r postgrey &>/dev/null || :
bdea17a
bdea17a
%post
497f8ed
#/sbin/chkconfig --add postgrey
497f8ed
if [ $1 -eq 1 ] ; then 
497f8ed
    # Initial installation 
497f8ed
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
497f8ed
fi
bdea17a
bdea17a
%preun
497f8ed
#if [ $1 -eq 0 ]; then
497f8ed
#    /sbin/service postgrey stop &>/dev/null || :
497f8ed
#    /sbin/chkconfig --del postgrey
497f8ed
#fi
497f8ed
if [ $1 -eq 0 ] ; then
497f8ed
    # Package removal, not upgrade
497f8ed
    /bin/systemctl --no-reload disable postgrey.service > /dev/null 2>&1 || :
497f8ed
    /bin/systemctl stop postgrey.service > /dev/null 2>&1 || :
bdea17a
fi
bdea17a
bdea17a
%postun
497f8ed
#if [ $1 -ge 1 ]; then
497f8ed
#    /sbin/service postgrey condrestart &>/dev/null || :
497f8ed
#fi
497f8ed
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
497f8ed
if [ $1 -ge 1 ] ; then
497f8ed
    # Package upgrade, not uninstall
497f8ed
    /bin/systemctl try-restart postgrey.service >/dev/null 2>&1 || :
bdea17a
fi
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
8757676
%defattr(-,root,root,-)
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*
8757676
%dir %attr(0751,postgrey,postfix) %{_var}/spool/postfix/postgrey/
bdea17a
bdea17a
bdea17a
%changelog
23dccba
* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 1.34-6
23dccba
- Perl 5.18 rebuild
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