postgrey

Michal 'lipek' Lipka lipek w lipek.pl
Pią, 12 Sty 2007, 00:59:31 CET


Witam
jeśli ktoś używa postgreya i auto-whitelistingu pewnie nie raz nie dwa chciał 
się dowiedzieć jakie serwery już są zaufane. niestety to co jest dostarczane z 
"naszym" postgreyem za pomocą poldka czy z cvsu nie zawiera żadnego takiego 
narzędzia chociaż w sieci jest. nazywa się postgrey_clients_dump. ciuteńkę 
przerobiłem ten skrypt aby pasował do Naszej struktury katalogów oraz aby 
wyświetlał ciut więcej informacji.
przerobiłem też speca do postgreya (w załączeniu)
paczka się robi (przynajmniej u mnie), zaznaczam że to pierwsza przeróbka 
jakiej się podjąłem i dlatego jest taka skromniutka, ale mam nadzieję że 
pożyteczna. będę wdzięczny za uwagi i mam nadzieję że szybko się znajdzie w 
naszym repo
Michał 'lipek' Lipka
-------------- następna część ---------
# $Revision: 1.17 $, $Date: 2007/01/11 16:09:12 $
%include	/usr/lib/rpm/macros.perl
Summary:	Postfix Greylisting Policy Server
Summary(pl):	Serwer do polityki "szarych list" dla Postfiksa
Name:		postgrey
Version:	1.27
Release:	2
License:	GPL v2
Group:		Daemons
Source0:	http://isg.ee.ethz.ch/tools/postgrey/pub/%{name}-%{version}.tar.gz
# Source0-md5:	df3a8b4a0c6ab7e8e5bb5be0de096c47
Source1:	%{name}.init
Source2:	%{name}.sysconfig
Source3:	http://www.lipek.pl/postgrey_clients_dump
Patch0:		%{name}-group.patch
Patch1:		%{name}-postfix_dir.patch
URL:		http://isg.ee.ethz.ch/tools/postgrey/
BuildRequires:	rpm-perlprov
BuildRequires:	rpmbuild(macros) >= 1.268
Requires:	perl-IO-Multiplex
Requires:	postfix
BuildArch:	noarch
BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)

%define		_sysconfdir /etc/mail

%description
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.

Edit your configuration files:
%{_sysconfdir}/main.cf:
  smtpd_recipient_restrictions = ...
    check_policy_service unix:postgrey/socket, ...
or if you like to use inet sockets (modify the IP if needed):
/etc/sysconfig/postgrey:
  OPTIONS="--inet=127.0.0.1:10023"
%{_sysconfdir}/main.cf:
  smtpd_recipient_restrictions = ...
    check_policy_service inet:127.0.0.1:10023, ...

%description -l pl
Postgrey to serwer polityki dla Postfiksa implementujący "szare
listy". Kiedy Postfix otrzymuje po SMTP żądanie dostarczenia poczty,
tworzony jest triplet IP_KLIENTA / NADAWCA / ADRESAT. Jeśli dany
triplet jest widziany po raz pierwszy lub był widziany po raz pierwszy
mniej niż 5 minut temu, poczta jest odrzucana z tymczasowym błędem.
Można mieć nadzieję, że spamerzy i wirusy nie będą próbować ponownie,
co jest jednak wymagane przez RFC.

Aby użyć tego programu należy zmodyfikować pliki konfiguracyjne:
%{_sysconfdir}/main.cf:
  smtpd_recipient_restrictions = ...
    check_policy_service unix:postgrey/socket, ...
lub jeśli chcemy używać gniazd inet (w razie potrzeby zmienić IP):
/etc/sysconfig/postgrey:
  OPTIONS="--inet=127.0.0.1:10023"
%{_sysconfdir}/main.cf:
  smtpd_recipient_restrictions = ...
    check_policy_service inet:127.0.0.1:10023, ...

%prep
%setup -q
%patch0 -p1
%patch1 -p0

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig},%{_sysconfdir},%{_sbindir}} \
	$RPM_BUILD_ROOT%{_var}/spool/postfix/%{name}

# init script:
install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
install %{SOURCE3} $RPM_BUILD_ROOT%{_sbindir}

install postgrey_whitelist_clients $RPM_BUILD_ROOT%{_sysconfdir}
install postgrey_whitelist_recipients $RPM_BUILD_ROOT%{_sysconfdir}
touch $RPM_BUILD_ROOT%{_sysconfdir}/postgrey_whitelist_clients.local

install postgrey $RPM_BUILD_ROOT%{_sbindir}
install contrib/postgreyreport $RPM_BUILD_ROOT%{_sbindir}

%clean
rm -rf $RPM_BUILD_ROOT

%pre
%groupadd -g 155 postgrey
%useradd -u 155 -d %{_var}/spool/postfix/%{name} -s /sbin/false -c "Postfix Greylisting Policy" -g postgrey postgrey

%post
/sbin/chkconfig --add %{name}
%service %{name} restart

%preun
if [ "$1" = 0 ]; then
	%service %{name} stop
	/sbin/chkconfig --del %{name}
fi

%postun
if [ "$1" = 0 ]; then
	%userremove postgrey
	%groupremove postgrey
	# should be done?:
	rm -rf %{_var}/spool/postfix/%{name}
fi

%files
%defattr(644,root,root,755)
%doc README Changes
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postgrey_whitelist_clients
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postgrey_whitelist_recipients
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postgrey_whitelist_clients.local
%attr(640,root,postgrey) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
%attr(754,root,root) /etc/rc.d/init.d/%{name}
%attr(755,root,root) %{_sbindir}/postgrey*
%dir %attr(711,postgrey,postgrey) %{_var}/spool/postfix/%{name}

%define date    %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
%changelog
* %{date} PLD Team <feedback w pld-linux.org>
All persons listed below can be reached at <cvs_login>@pld-linux.org

$Log: postgrey.spec,v $
Revision 1.17  2007/01/11 16:09:12  lipek
- Added postgrey_clients_dump

Revision 1.16  2006/07/25 07:55:12  glen
- RPM_SKIP_AUTO_RESTART=yes dropped; rel 2

Revision 1.15  2006/07/25 04:41:36  glen
- update to 1.27
- cosmetics
- restart postgrey in %post, if sysadmin disables RPM_SKIP_AUTO_RESTART=yes (remove that restriction if uneccessary)

Revision 1.14  2006/04/20 17:18:09  glen
- use %service, adapter

Revision 1.13  2006/01/22 18:52:30  hawk
- updated to 1.24

Revision 1.12  2005/12/01 21:38:28  hawk
- updated to 1.23

Revision 1.11  2005/11/14 09:04:25  hawk
- updated to 1.22

Revision 1.10  2005/11/01 18:11:45  blues
- there is source2 (was not listed in spec)

Revision 1.9  2005/11/01 11:27:40  gotar
- R: perl-IO-Multiplex (via perl-Net-Server),
- there's no SOURCE2, create it.

Revision 1.8  2005/09/05 18:11:10  qboosh
- pl, fixed paths in desc

Revision 1.7  2005/09/05 13:51:25  blues
- release 1 - works

Revision 1.6  2005/09/05 13:30:29  blues
-

Revision 1.5  2005/09/05 13:26:50  glen
- adapterized

Revision 1.4  2005/09/05 13:23:22  blues
- autogenerate deps, postfix_dir patch added

Revision 1.3  2005/09/05 13:05:23  blues
- license, perl-deps should be autogenerated

Revision 1.2  2005/09/05 12:58:31  blues
- more humanization...

Revision 1.1  2005/09/05 12:42:38  blues
- raw, a bit PLD-dized. NFY


Więcej informacji o liście dyskusyjnej pld-devel-pl