## This package accepts the following switches:
## --with spf ... enable SPF support
## Fedora Extras specific customization below...
%bcond_without fedora
%bcond_without noarch
%bcond_with sysv
%bcond_without upstart
%bcond_without systemd
%bcond_with spf
%bcond_with libbind
%bcond_without tmpfiles
##
%{?with_noarch:%global noarch BuildArch: noarch}
%global username grmilter
%global vardir %_var/lib/%name
%global dbdir %vardir/db
%global rundir %_var/run/%name
%global __chkconfig /sbin/chkconfig
%{!?_unitdir:%global _unitdir /lib/systemd/system}
%{!?release_func:%global release_func() %%{?prerelease:0.}%1%%{?prerelease:.%%prerelease}%%{?dist}}
%{!?apply:%global apply(p:n:b:) %patch%%{-n:%%{-n*}} %%{-p:-p %%{-p*}} %%{-b:-b %%{-b*}} \
%nil}
Summary: Milter for greylisting, the next step in the spam control war
Name: milter-greylist
Version: 4.2.6
Release: %release_func 1502
License: BSD with advertising
Group: System Environment/Daemons
URL: http://hcpnet.free.fr/milter-greylist/
Source0: ftp://ftp.espci.fr/pub/milter-greylist/%name-%version%{?beta}.tgz
Source1: README.fedora
Patch0: milter-greylist-2.0.2-sysv.patch
Patch4: ai_addrconfig.patch
Patch7: milter-greylist-dkim-reentrant.patch
# http://tech.groups.yahoo.com/group/milter-greylist/message/5551
Patch8: cloexec.patch
# http://tech.groups.yahoo.com/group/milter-greylist/message/5564
Patch9: spamd-null.patch
Patch10: p0f-srcport.patch
BuildRoot: %_tmppath/%name-%version-%release-root
Requires: init(%name)
Provides: user(%username) = 7
Provides: group(%username) = 7
BuildRequires: bison flex m4
BuildRequires: sendmail-devel %{?with_spf:libspf-devel}
BuildRequires: fedora-usermgmt-devel
BuildRequires: curl-devel GeoIP-devel
%{?with_libbind:BuildRequires: %_libdir/libbind.so}
%{?FE_USERADD_REQ}
# Remove me after EOL of RHEL5
%package sysvinit
Summary: Sysv initscripts for %name
Group: System Environment/Daemons
Provides: init(%name) = sysvinit
Requires(preun): %name = %version-%release
Requires(postun): %name = %version-%release
Requires(preun): initscripts
Requires(postun): initscripts
Requires(post): %__chkconfig
Requires(preun): %__chkconfig
%{?noarch}
# Remove me after F17
Provides: %name-sysv = %version-%release
Obsoletes: %name-sysv < %version-%release
%package upstart
Summary: upstart initscripts for %name
Group: System Environment/Daemons
Source10: %name.upstart
Provides: init(%name) = upstart
Requires: %name = %version-%release
Requires(pre): /etc/init
Requires(post): /usr/bin/killall
Requires(postun): /sbin/initctl
%{?noarch}
%package systemd
Summary: Systemd initscripts for %name
Group: System Environment/Daemons
Provides: init(%name) = systemd
Source20: %name.systemd.service
Requires(post): /bin/systemctl
Requires(preun): /bin/systemctl
Requires(postun): /bin/systemctl
%{?noarch}
# Remove me after F17
%if 0%{!?with_sysv:1}
Provides: %name-sysvinit = %version-%release
Obsoletes: %name-sysvinit < %version-%release
Provides: %name-sysv = %version-%release
Obsoletes: %name-sysv < %version-%release
%endif
%description
Greylisting is a new method of blocking significant amounts of spam at
the mailserver level, but without resorting to heavyweight statistical
analysis or other heuristical (and error-prone) approaches. Consequently,
implementations are fairly lightweight, and may even decrease network
traffic and processor load on your mailserver.
This package provides a greylist filter for sendmail's milter API.
%description sysvinit
Greylisting is a new method of blocking significant amounts of spam at
the mailserver level, but without resorting to heavyweight statistical
analysis or other heuristical (and error-prone) approaches. Consequently,
implementations are fairly lightweight, and may even decrease network
traffic and processor load on your mailserver.
This package provides the SysV initscripts for the %name package.
%description upstart
Greylisting is a new method of blocking significant amounts of spam at
the mailserver level, but without resorting to heavyweight statistical
analysis or other heuristical (and error-prone) approaches. Consequently,
implementations are fairly lightweight, and may even decrease network
traffic and processor load on your mailserver.
This package provides the upstart initscripts for the %name package.
%description systemd
Greylisting is a new method of blocking significant amounts of spam at
the mailserver level, but without resorting to heavyweight statistical
analysis or other heuristical (and error-prone) approaches. Consequently,
implementations are fairly lightweight, and may even decrease network
traffic and processor load on your mailserver.
This package provides the systemd initscripts for the %name package.
%prep
%setup -q %{?beta:-n %name-%version%beta}
%patch0 -p1 -b .sysv
%apply -n4 -p1
%apply -n7 -p1
%apply -n8 -p1
%apply -n9 -p1
%apply -n10 -p1
install -p -m0644 %SOURCE1 .
sed -i -e 's!/libresolv.a!/../../../no-such-lib.a!g' configure
sed -i -e 's!^\#\?user .*!user "%username"!;
s!^\#socket !socket !;
s!^pidfile .*!\#\0!;
/^dumpfile/a\' \
-e 'geoipdb "%_datadir/GeoIP/GeoIP.dat"' greylist.conf
for i in `find -type f`; do
sed -e 's!/var/milter-greylist/milter-greylist.sock!%rundir/milter-greylist.sock!g;
s!/var/milter-greylist/greylist.db!%dbdir/greylist.db!g;
s!/var/milter-greylist/milter-greylist.pid!%_var/run/milter-greylist.pid!g;
' "$i" >"$i.tmp"
cmp -s "$i" "$i.tmp" || cat "$i.tmp" >"$i"
rm -f "$i".tmp
done
%global makeflags TEST=false BINDIR=%_sbindir
%build
_comps="%{?with_libbind:libbind} libcurl"
export CPPFLAGS="-DUSE_CURL -DUSE_GEOIP -D_GNU_SOURCE -D_REENTRANT $(pkg-config --cflags-only-I $_comps)"
export LDFLAGS="-Wl,--as-needed $(pkg-config --libs $_comps) -lGeoIP"
%configure \
--disable-rpath \
--with-user=%username \
--enable-dnsrbl \
--enable-spamassassin \
--enable-p0f \
--disable-drac \
--with-drac-db=%vardir/drac/drac.db \
%{?with_spf:--with-libspf=/usr}
## is not SMP safe :(
%__make %makeflags
%install
rm -rf $RPM_BUILD_ROOT
%__install -d -m755 $RPM_BUILD_ROOT{%rundir,%dbdir,%_var/run,%_sysconfdir/tmpfiles.d}
%__make DESTDIR=$RPM_BUILD_ROOT install %makeflags USER="$(id -u)"
install -D -p -m 0755 rc-redhat.sh $RPM_BUILD_ROOT%_initrddir/%name
install -D -p -m 0644 %SOURCE10 $RPM_BUILD_ROOT%_sysconfdir/init/milter-greylist.conf
install -D -p -m 0644 %SOURCE20 $RPM_BUILD_ROOT%_unitdir/%name.service
cat << EOF > $RPM_BUILD_ROOT%_sysconfdir/tmpfiles.d/%name.conf
d %rundir 0710 %username mail
EOF
# create temporary files
touch $RPM_BUILD_ROOT%rundir/milter-greylist.sock
touch $RPM_BUILD_ROOT%_var/run/milter-greylist.pid
## Remove the unwanted init-methods
%{!?with_sysv: rm -rf $RPM_BUILD_ROOT%_initrddir}
%{!?with_sysv: rm -rf $RPM_BUILD_ROOT%_var/run/milter-greylist.pid}
%{!?with_upstart: rm -rf $RPM_BUILD_ROOT%_sysconfdir/init}
%{!?with_systemd: rm -rf $RPM_BUILD_ROOT%_unitdir}
%{!?with_tmpfiles: rm -rf $RPM_BUILD_ROOT%_sysconfdir/tmpfiles.d}
%pre
%__fe_groupadd 7 -r %username &>/dev/null || :
%__fe_useradd 7 -r -s /sbin/nologin -M -d %vardir \
-c 'Greylist-milter user' -g %username %username &>/dev/null || :
%postun
%__fe_userdel %username &>/dev/null || :
%__fe_groupdel %username &>/dev/null || :
%post sysvinit
%__chkconfig --add %name
%preun sysvinit
test "$1" != 0 || %__chkconfig --del %name
test "$1" != 0 || %_initrddir/%name stop >/dev/null || :
%postun sysvinit
test "$1" = 0 || %_initrddir/%name condrestart >/dev/null || :
%post upstart
/usr/bin/killall -u %username milter-greylist 2>/dev/null || :
%preun upstart
test "$1" != "0" || /sbin/initctl -q stop milter-greylist || :
%post systemd
test "$1" -ne 1 || /bin/systemctl daemon-reload >/dev/null 2>&1 || :
%preun systemd
test "$1" -ne 1 || /bin/systemctl disable %name.service > /dev/null 2>&1 || :
test "$1" -ne 1 || /bin/systemctl stop %name.service > /dev/null 2>&1 || :
%postun systemd
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
test "$1" -eq 1 || /bin/systemctl try-restart %name.service >/dev/null 2>&1 || :
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc ChangeLog README README.fedora
%_mandir/man*/*
%attr(0640,root,%username) %verify(not mtime) %config(noreplace) %_sysconfdir/mail/greylist.conf
%dir %attr(0751,%username,%username) %vardir
%dir %attr(0770,root,%username) %dbdir
%_sbindir/*
%if 0%{?with_tmpfiles:1}
%_sysconfdir/tmpfiles.d/%name.conf
%ghost %dir %attr(0710,%username,mail) %rundir
%endif
%if 0%{!?with_tmpfiles:1}
%dir %attr(0710,%username,mail) %rundir
%endif
%ghost %rundir/milter-greylist.sock
%if 0%{?with_sysv:1}
%files sysvinit
%defattr(-,root,root,-)
%config %_initrddir/*
%ghost %_var/run/milter-greylist.pid
%endif
%if 0%{?with_upstart:1}
%files upstart
%defattr(-,root,root,-)
%config(noreplace) %_sysconfdir/init/*
%endif
%if 0%{?with_systemd:1}
%files systemd
%defattr(-,root,root,-)
%_unitdir/%name.service
%endif
%changelog
* Sat Apr 23 2011 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2.6-1502
- fixed tmpfiles syntax (#698961)
- fixed byte order of src port in p0f check
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.2.6-1501
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Fri Dec 10 2010 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2.6-1401
- added systemd initscripts and obsolete the old sysvinit ones
* Wed Jul 14 2010 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2.6-1400
- updated to 4.2.6
* Fri Jul 9 2010 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2.5-1401
- added spamd-null patch
* Wed Jun 9 2010 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2.5-1400
- updated to 4.2.5
- added cloexec patch
- rediffed patches
* Sun Apr 18 2010 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2.4-1400
- updated to 4.2.4
- removed patches which have been applied upstream
* Sat Feb 20 2010 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2.3-1400
- added patches to fix races in dkim, geoip and p0f modules
- conditionalized -upstart subpackage
- added conditional to build it with libbind (required for RHEL5)
* Sun Dec 6 2009 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2.3-1300
- updated -upstart to upstart 0.6.3
* Wed Aug 19 2009 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2.3-2
- moved pre-2007 %%changelog entries into ChangeLog.rpm
- do not link against libbind anymore; recent glibc seems to have
fixed its resolver API so that -lresolv can be used by dnsrbl. Old
-lbind conflicts with this library in a subtly way causing segfaults
(#518274).
* Wed Aug 19 2009 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2.3-1
- updated to 4.2.3
- use conditionalized %%noarch macro to mark noarch subpackages
- simplified upstart initscript because #501155 is solved
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.2.2-1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Sat Apr 11 2009 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2.2-0.
- updated to 4.2.2
- removed patches which where applied upstream
* Mon Mar 09 2009 Adam Tkac <atkac redhat com> - 4.2-0.5.b1
- libbind has been moved to separate package, rebuild
* Sat Mar 7 2009 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2-0.4.b1
- added -upstart subpackage
- renamed -sysv to -sysvinit to let -upstart win the default depresolving
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.2-0.3.b1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Sat Feb 14 2009 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.2-0.1.b1
- updated to 4.2b1
- enabled spamassassin + p0f support
- set path to GeoIP database in sample configuration (#439087)
- changed /var/run/milter-greylist to be owned by the mail group and
made it group-accessibly; this should allow usage with postfix when
setting a 0666 socket mode (#210765)
- added README.fedora
* Fri Aug 8 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 4.1.1-2
- fix license tag
* Sat Jun 21 2008 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.1.1-1
- updated to 4.1.1
* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 4.0-2
- Autorebuild for GCC 4.3
* Sat Nov 10 2007 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.0-1
- updated to final 4.0
- fixed conflicts between libbind and libresolv by linking them manually
* Mon Oct 29 2007 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.0-0.3.rc2
- updated to 4.0rc2
* Sun Oct 14 2007 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 4.0-0.2.rc1
- updated to 4.0rc1
- built with curl and GeoIP support
* Wed Apr 25 2007 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 3.0-2
- fixed user name in config file (bz #237737)
- commented out pidfile entry; it is to be set by the init methods
* Tue Apr 17 2007 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 3.0-1
- updated to 3.0
- enabled dnsrbl
- removed -initng subpackage
* Tue Jan 30 2007 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 2.1.12-3
- removed -minit subpackage