relaydelay: wave goodbye
The article discusses a specific option for puremagic's greylisting. - It tells users to install mysql40-server and perl5.16; neither of which exist any more. - The last edit was 2015, by me, to switch from `pkg_add` to `pkg`. - It encourages users to download code from a third-party website, without validation, via HTTP (not even HTTPS). - The code itself has to be patched to compile and more generally the FreeBSD project is not in the business of teaching end users how to run an anti-spam mail server. Discussed with: allanjude
This commit is contained in:
parent
869a32c40a
commit
d6dd221c5a
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=51293
9 changed files with 0 additions and 545 deletions
|
@ -31,7 +31,6 @@ SUBDIR+= port-mentor-guidelines
|
||||||
SUBDIR+= pr-guidelines
|
SUBDIR+= pr-guidelines
|
||||||
SUBDIR+= problem-reports
|
SUBDIR+= problem-reports
|
||||||
SUBDIR+= rc-scripting
|
SUBDIR+= rc-scripting
|
||||||
SUBDIR+= relaydelay
|
|
||||||
SUBDIR+= releng
|
SUBDIR+= releng
|
||||||
SUBDIR+= remote-install
|
SUBDIR+= remote-install
|
||||||
SUBDIR+= serial-uart
|
SUBDIR+= serial-uart
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
#
|
|
||||||
# $FreeBSD$
|
|
||||||
#
|
|
||||||
# Article: Using greylisting with FreeBSD
|
|
||||||
|
|
||||||
DOC?= article
|
|
||||||
|
|
||||||
FORMATS?= html
|
|
||||||
|
|
||||||
INSTALL_COMPRESSED?=gz
|
|
||||||
INSTALL_ONLY_COMPRESSED?=
|
|
||||||
|
|
||||||
SRCS= article.xml
|
|
||||||
|
|
||||||
DOC_PREFIX?= ${.CURDIR}/../../..
|
|
||||||
.include "${DOC_PREFIX}/share/mk/doc.project.mk"
|
|
|
@ -1,246 +0,0 @@
|
||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
||||||
<!DOCTYPE article PUBLIC "-//FreeBSD//DTD DocBook XML V5.0-Based Extension//EN"
|
|
||||||
"http://www.FreeBSD.org/XML/share/xml/freebsd50.dtd">
|
|
||||||
<!--
|
|
||||||
$FreeBSD$
|
|
||||||
-->
|
|
||||||
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en">
|
|
||||||
<info><title>Using Greylist with &os;</title>
|
|
||||||
|
|
||||||
|
|
||||||
<author><personname><firstname>Tom</firstname><surname>Rhodes</surname></personname><affiliation>
|
|
||||||
<address><email>trhodes@FreeBSD.org</email></address>
|
|
||||||
</affiliation></author>
|
|
||||||
|
|
||||||
<copyright>
|
|
||||||
<year>2004</year>
|
|
||||||
<holder>The &os; Documentation Project</holder>
|
|
||||||
</copyright>
|
|
||||||
|
|
||||||
<pubdate>$FreeBSD$</pubdate>
|
|
||||||
|
|
||||||
<releaseinfo>$FreeBSD$</releaseinfo>
|
|
||||||
|
|
||||||
<abstract>
|
|
||||||
<para>An article written for the sole purpose of explaining
|
|
||||||
the relaydelay system on a &os; mail server. A relaydelay
|
|
||||||
or greylisting server cuts down on spam simply by issuing
|
|
||||||
a <errorname>TEMPFAIL</errorname> error message to
|
|
||||||
every incoming email. The purpose behind this idea
|
|
||||||
is that most spammers use their personal computers with
|
|
||||||
software to do their spamming. A real mail server should
|
|
||||||
queue the message and try to send it later. Thus the
|
|
||||||
spammer most likely moves on to the next host in place
|
|
||||||
of trying to send the email again. This is an excellent
|
|
||||||
idea; at least until the spammers begin to use software
|
|
||||||
that offers to try again. But how does this work exactly?
|
|
||||||
Well, when an email is received the message
|
|
||||||
<acronym>ID</acronym> is stored in a database and the
|
|
||||||
<errorname>TEMPFAIL</errorname> is returned along with the
|
|
||||||
email. If the email is resent, the message
|
|
||||||
<acronym>ID</acronym> will be checked against the message
|
|
||||||
<acronym>ID</acronym>s currently stored in the database.
|
|
||||||
If it exists in the database then the email is permitted to reach its
|
|
||||||
intended recipient. Otherwise, the <acronym>ID</acronym>
|
|
||||||
will be stored and a <errorname>TEMPFAIL</errorname> will
|
|
||||||
be issued. This cycle will repeat with every email which
|
|
||||||
comes into the server. From my personal experience, this
|
|
||||||
really does cut out 90% of the spam.</para>
|
|
||||||
</abstract>
|
|
||||||
</info>
|
|
||||||
|
|
||||||
<sect1>
|
|
||||||
<title>Basic Configuration</title>
|
|
||||||
|
|
||||||
<para>Install perl using
|
|
||||||
<screen>&prompt.root; <userinput>pkg install lang/perl5.16</userinput></screen>
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>Now for the database server;
|
|
||||||
<application>MySQL</application> is perfect for this
|
|
||||||
sort of work. Install the
|
|
||||||
<package>databases/mysql40-server</package>
|
|
||||||
along with
|
|
||||||
<package>databases/p5-DBD-mysql40</package>.
|
|
||||||
The previous port should imply the installation of
|
|
||||||
<package>databases/p5-DBI-137</package>
|
|
||||||
so that knocks off another step.</para>
|
|
||||||
|
|
||||||
<para>Install the <command>perl</command> based portable
|
|
||||||
server plugin, <package>net/p5-Net-Daemon</package>
|
|
||||||
port. Most of these port installations should have
|
|
||||||
been straight forward. The next step will be more
|
|
||||||
involved.</para>
|
|
||||||
|
|
||||||
<para>Now install the
|
|
||||||
<package>mail/p5-Sendmail-Milter</package>
|
|
||||||
port. As of this writing the <filename>Makefile</filename>
|
|
||||||
contains a line beginning with <varname>BROKEN</varname>,
|
|
||||||
just remove it or comment it out. It is only marked
|
|
||||||
this way because &os; neither has nor installs
|
|
||||||
a threaded <command>perl</command> package by default. Once that
|
|
||||||
line is removed it should build and install perfectly
|
|
||||||
fine.</para>
|
|
||||||
|
|
||||||
<para>Create a directory to hold temporary configuration
|
|
||||||
files:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>mkdir /tmp/relaydelay</userinput>
|
|
||||||
&prompt.root; <userinput>cd /tmp/relaydelay</userinput></screen>
|
|
||||||
|
|
||||||
<para>Now that we have a temporary directory to work in, the
|
|
||||||
following <acronym>URL</acronym>s should be sent to the
|
|
||||||
<command>fetch</command> command:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>fetch http://projects.puremagic.com/greylisting/releases/relaydelay-0.04.tgz</userinput>
|
|
||||||
&prompt.root; <userinput>fetch http://lists.puremagic.com/pipermail/greylist-users/attachments/20030904/b8dafed9/relaydelay-0.04.bin</userinput></screen>
|
|
||||||
|
|
||||||
<!-- NOTE TO TOM RHODES: HAVING THE SOFTWARE LINKED HERE IS A BAD IDEA IN
|
|
||||||
CASE SOME ASSHOLE UPDATES IT. I SHOULD PROBABLY ARCHIVE THE OTHER URL
|
|
||||||
SCRIPTS AND OTHER SHIT AS WELL. -->
|
|
||||||
|
|
||||||
<para>The source code should now be unpacked:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>gunzip -c relaydelay-0.04.tgz | tar xvf -</userinput></screen>
|
|
||||||
|
|
||||||
<para>There should now be several files into the temporary directory
|
|
||||||
by this point. The appropriate information can now be passed to
|
|
||||||
the database server by importing it from the
|
|
||||||
<filename>mysql.sql</filename> file:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>mysql < relaydelay-0.04/mysql.sql</userinput></screen>
|
|
||||||
|
|
||||||
<para>And patch the other files with the
|
|
||||||
<filename>relaydelay.bin</filename> by running:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>patch -d /tmp/relaydelay/relaydelay-0.04 < relaydelay.bin</userinput></screen>
|
|
||||||
|
|
||||||
<para>Edit the <filename>relaydelay.conf</filename> and the
|
|
||||||
<filename>db_maintenance.pl</filename> file to append the
|
|
||||||
correct username and password for the
|
|
||||||
<application>MySQL</application> database. If the database was
|
|
||||||
built and installed like the above then no users or passwords
|
|
||||||
exist. This should be altered before putting this into
|
|
||||||
production, that is covered in the database documentation and
|
|
||||||
is beyond the scope of this document.</para>
|
|
||||||
|
|
||||||
<para>Change the working directory to the
|
|
||||||
<filename>relaydelay-0.04</filename>
|
|
||||||
directory:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>cd relaydelay-0.04</userinput></screen>
|
|
||||||
|
|
||||||
<para>Copy or move the configuration files to their respective
|
|
||||||
directories:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>mv db_maintenance.pl relaydelay.pl /usr/local/sbin</userinput>
|
|
||||||
&prompt.root; <userinput>mv relaydelay.conf /etc/mail</userinput>
|
|
||||||
&prompt.root; <userinput>mv relaydelay.sh /usr/local/etc/rc.d/</userinput></screen>
|
|
||||||
|
|
||||||
<para>Test the current configuration by running:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>sh /usr/local/etc/rc.d/relaydelay.sh start</userinput></screen>
|
|
||||||
|
|
||||||
<note>
|
|
||||||
<para>This file will not exist if the previous &man.mv.1; commands
|
|
||||||
were neglected.</para>
|
|
||||||
</note>
|
|
||||||
|
|
||||||
<para>If everything worked correctly a new file,
|
|
||||||
<filename>relaydelay.log</filename>, should exist in
|
|
||||||
<filename>/var/log</filename>. It should
|
|
||||||
contain something similar to the following text:</para>
|
|
||||||
|
|
||||||
<programlisting>Loaded Config File: /etc/mail/relaydelay.conf
|
|
||||||
Using connection 'local:/var/run/relaydelay.sock' for filter relaydelay
|
|
||||||
DBI Connecting to DBI:mysql:database=relaydelay:host=localhost:port=3306
|
|
||||||
Spawned relaydelay daemon process 38277.
|
|
||||||
Starting Sendmail::Milter 0.18 engine.</programlisting>
|
|
||||||
|
|
||||||
<para>If this does not appear then something went wrong, review
|
|
||||||
the screen output or look for anything new in the
|
|
||||||
<filename>messages</filename> log file.</para>
|
|
||||||
|
|
||||||
<para>Glue everything together by adding the following line to
|
|
||||||
<filename>/etc/mail/sendmail.mc</filename> or the customized
|
|
||||||
site specific <filename>mc</filename> file:</para>
|
|
||||||
|
|
||||||
<programlisting>INPUT_MAIL_FILTER(`relaydelay', `S=local:/var/run/relaydelay.sock, T=S:1m;R:2m;E:3m')dnl</programlisting>
|
|
||||||
|
|
||||||
<para>Rebuild and reinstall the files in the
|
|
||||||
<filename>/etc/mail</filename> directory and restart
|
|
||||||
<command>sendmail</command>. A quick <command>make</command>
|
|
||||||
<buildtarget>restart</buildtarget> should do the trick.</para>
|
|
||||||
|
|
||||||
<para>Obtain the <command>perl</command> script located at
|
|
||||||
<link xlink:href="http://lists.puremagic.com/pipermail/greylist-users/2003-November/000327.html">
|
|
||||||
http://lists.puremagic.com/pipermail/greylist-users/2003-November/000327.html</link>
|
|
||||||
and save it in the
|
|
||||||
<filename>relaydelay-0.04</filename>
|
|
||||||
directory. In the following examples this script is
|
|
||||||
referred to as <filename>addlist.pl</filename>.</para>
|
|
||||||
|
|
||||||
<para>Edit the <filename>whitelist_ip.txt</filename> file and
|
|
||||||
modify it to include <acronym>IP</acronym> addresses of servers
|
|
||||||
which should have the explicit abilities to bypass the
|
|
||||||
<application>relaydelay</application> filters. i.e., domains
|
|
||||||
from which email will not be issued a
|
|
||||||
<errorname>TEMPFAIL</errorname> when received.</para>
|
|
||||||
|
|
||||||
<para>Some examples could include:</para>
|
|
||||||
|
|
||||||
<programlisting>192.168. # My internal network.
|
|
||||||
66.218.66 # Yahoo groups has unique senders.</programlisting>
|
|
||||||
|
|
||||||
<para>The <filename>blacklist_ip.txt</filename> file should
|
|
||||||
be treated similarly but with reversed rules. List within
|
|
||||||
this file <acronym>IP</acronym>s which should be denied without
|
|
||||||
being issued a <errorname>TEMPFAIL</errorname>. This list of
|
|
||||||
domains will never have the opportunity to prove that they are
|
|
||||||
legitimate email servers.</para>
|
|
||||||
|
|
||||||
<para>These files should now be imported into the database with
|
|
||||||
the <filename>addlist.pl</filename> script obtained a few
|
|
||||||
lines ago:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>perl addlist.pl -whitelist 9999-12-31 23:59:59 < whitelist_ip.txt</userinput>
|
|
||||||
&prompt.root; <userinput>perl addlist.pl -blacklist 9999-12-31 23:59:59 < blacklist_ip.txt</userinput></screen>
|
|
||||||
|
|
||||||
<para>To have <application>relaydelay</application> start with
|
|
||||||
every system boot, add the
|
|
||||||
<option>relaydelay_enable="YES"</option> to the
|
|
||||||
<filename>/etc/rc.conf</filename> file.</para>
|
|
||||||
|
|
||||||
<para>The <filename>/var/log/relaydelay.log</filename> log file
|
|
||||||
should slowly fill up with success stories. Lines like the
|
|
||||||
following should appear after a short time, depending on how
|
|
||||||
busy the mail server is.</para>
|
|
||||||
|
|
||||||
<programlisting>=== 2004-05-24 21:03:22 ===
|
|
||||||
Stored Sender: <someasshole@flawed-example.com>
|
|
||||||
Passed Recipient: <local_user@pittgoth.com>
|
|
||||||
Relay: example.net [XXX.XX.XXX.XX] - If_Addr: MY_IP_ADDRESS
|
|
||||||
RelayIP: XX.XX.XX.XX - RelayName: example.net - RelayIdent: - PossiblyForged: 0
|
|
||||||
From: someasshole@flawed-example.com - To: local_user
|
|
||||||
InMailer: esmtp - OutMailer: local - QueueID: i4P13Lo6000701111
|
|
||||||
Email is known but block has not expired. Issuing a tempfail. rowid: 51
|
|
||||||
IN ABORT CALLBACK - PrivData: 0<someasshole@flawed-example.com></programlisting>
|
|
||||||
|
|
||||||
<para>The following line may now be added to
|
|
||||||
<filename>/etc/newsyslog.conf</filename> to cause for
|
|
||||||
<filename>relaydelay.log</filename> rotation at every
|
|
||||||
100 <acronym>Kb</acronym>:</para>
|
|
||||||
|
|
||||||
<screen>/var/log/relaydelay.log 644 3 100 * Z</screen>
|
|
||||||
|
|
||||||
<!-- XXX What text does this note belong with? -->
|
|
||||||
<note>
|
|
||||||
<para>At some point there was an error about improper
|
|
||||||
<command>perl</command> variables in the
|
|
||||||
<filename>/etc/mail/relaydelay.conf</filename>. If those
|
|
||||||
two variables are commented out then configuration may
|
|
||||||
proceed as normal. Just remember to uncomment them before
|
|
||||||
starting the <command>relaydelay</command> process.</para>
|
|
||||||
</note>
|
|
||||||
</sect1>
|
|
||||||
</article>
|
|
|
@ -232,12 +232,6 @@
|
||||||
A guide to writing new rc.d scripts and understanding those
|
A guide to writing new rc.d scripts and understanding those
|
||||||
already written.</p>
|
already written.</p>
|
||||||
|
|
||||||
<p><a href="&url.articles;/relaydelay/index.html">FreeBSD as a
|
|
||||||
greylist mail server</a> (relaydelay)<br/>
|
|
||||||
Implementing a greylist mail server on FreeBSD using Sendmail,
|
|
||||||
MySQL, Perl and the relaydelay software. This is an excellent
|
|
||||||
method to use in the fight against spam.</p>
|
|
||||||
|
|
||||||
<p><a href="&url.articles;/releng/index.html">FreeBSD Release
|
<p><a href="&url.articles;/releng/index.html">FreeBSD Release
|
||||||
Engineering</a> (releng)<br/>
|
Engineering</a> (releng)<br/>
|
||||||
Describes the approach used by the FreeBSD release engineering
|
Describes the approach used by the FreeBSD release engineering
|
||||||
|
|
|
@ -31,7 +31,6 @@ SUBDIR+= leap-seconds
|
||||||
#SUBDIR+= pr-guidelines
|
#SUBDIR+= pr-guidelines
|
||||||
SUBDIR+= problem-reports
|
SUBDIR+= problem-reports
|
||||||
#SUBDIR+= rc-scripting
|
#SUBDIR+= rc-scripting
|
||||||
#SUBDIR+= relaydelay
|
|
||||||
#SUBDIR+= releng
|
#SUBDIR+= releng
|
||||||
#SUBDIR+= remote-install
|
#SUBDIR+= remote-install
|
||||||
#SUBDIR+= serial-uart
|
#SUBDIR+= serial-uart
|
||||||
|
|
|
@ -25,7 +25,6 @@ SUBDIR+= new-users
|
||||||
SUBDIR+= pam
|
SUBDIR+= pam
|
||||||
SUBDIR+= pr-guidelines
|
SUBDIR+= pr-guidelines
|
||||||
SUBDIR+= problem-reports
|
SUBDIR+= problem-reports
|
||||||
SUBDIR+= relaydelay
|
|
||||||
SUBDIR+= releng
|
SUBDIR+= releng
|
||||||
#SUBDIR+= serial-uart
|
#SUBDIR+= serial-uart
|
||||||
SUBDIR+= solid-state
|
SUBDIR+= solid-state
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
#
|
|
||||||
# The FreeBSD Russian Documentation Project
|
|
||||||
#
|
|
||||||
# $FreeBSD$
|
|
||||||
# $FreeBSDru: frdp/doc/ru_RU.KOI8-R/articles/relaydelay/Makefile,v 1.1 2005/06/16 17:50:42 andy Exp $
|
|
||||||
#
|
|
||||||
# Original revision: r39631
|
|
||||||
#
|
|
||||||
# Article: Using greylisting with FreeBSD
|
|
||||||
|
|
||||||
DOC?= article
|
|
||||||
|
|
||||||
FORMATS?= html
|
|
||||||
|
|
||||||
INSTALL_COMPRESSED?=gz
|
|
||||||
INSTALL_ONLY_COMPRESSED?=
|
|
||||||
|
|
||||||
SRCS= article.xml
|
|
||||||
|
|
||||||
DOC_PREFIX?= ${.CURDIR}/../../..
|
|
||||||
.include "${DOC_PREFIX}/share/mk/doc.project.mk"
|
|
|
@ -1,251 +0,0 @@
|
||||||
<?xml version="1.0" encoding="koi8-r"?>
|
|
||||||
<!DOCTYPE article PUBLIC "-//FreeBSD//DTD DocBook XML V5.0-Based Extension//EN"
|
|
||||||
"http://www.FreeBSD.org/XML/share/xml/freebsd50.dtd">
|
|
||||||
<!--
|
|
||||||
The FreeBSD Russian Documentation Project
|
|
||||||
|
|
||||||
$FreeBSD$
|
|
||||||
$FreeBSDru: frdp/doc/ru_RU.KOI8-R/articles/relaydelay/article.xml,v 1.2 2007/05/15 19:31:54 gad Exp $
|
|
||||||
|
|
||||||
Original revision: r43184
|
|
||||||
-->
|
|
||||||
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:lang="ru">
|
|
||||||
<info><title>Использование технологии серых списков во &os;</title>
|
|
||||||
|
|
||||||
|
|
||||||
<author><personname><firstname>Том</firstname><surname>Родес</surname></personname><affiliation>
|
|
||||||
<address><email>trhodes@FreeBSD.org</email></address>
|
|
||||||
</affiliation></author>
|
|
||||||
|
|
||||||
<copyright>
|
|
||||||
<year>2004</year>
|
|
||||||
|
|
||||||
<holder>The &os; Documentation Project</holder>
|
|
||||||
</copyright>
|
|
||||||
|
|
||||||
<pubdate>$FreeBSD$</pubdate>
|
|
||||||
|
|
||||||
<releaseinfo>$FreeBSD$</releaseinfo>
|
|
||||||
|
|
||||||
<abstract>
|
|
||||||
<para>Эта статья создана исключительно для описания технологии задержки
|
|
||||||
передачи сообщений на почтовом сервере &os;. Сервер с технологией
|
|
||||||
задержки передачи (relaydelay) или попаданием в серый список
|
|
||||||
(greylisting) снижает уровень спама просто за счёт выдачи
|
|
||||||
диагностического сообщения <errorname>TEMPFAIL</errorname> на каждое
|
|
||||||
входящее почтовое сообщение. Смысл этой технологии заключается в том,
|
|
||||||
что большинство спамеров для выполнения своей работы используют
|
|
||||||
собственные персональные компьютеры и специализированное программное
|
|
||||||
обеспечение. Настоящий почтовый сервер должен помещать сообщения в
|
|
||||||
очередь и пытаться доставить его позже. Таким образом, скорее всего,
|
|
||||||
спамер перейдёт к следующему хосту вместо того, чтобы попытаться снова
|
|
||||||
послать электронное послание. Это прекрасная идея; по крайней мере,
|
|
||||||
до тех пор, пока спамеры не начнут использовать программное
|
|
||||||
обеспечение, которое будет обеспечивать повтор передачи. Но как именно
|
|
||||||
это работает? Итак, в процессе приёма сообщения электронной почты
|
|
||||||
<acronym>ID</acronym> сообщения сохраняется в базе данных, а в качестве
|
|
||||||
результата возвращается <errorname>TEMPFAIL</errorname> вместе с
|
|
||||||
электронной почтой. Если сообщение электронной почты посылается
|
|
||||||
повторно, то <acronym>ID</acronym> сообщения будет сверяться с
|
|
||||||
<acronym>ID</acronym> сообщений, сохранёнными в базе данных. Если в
|
|
||||||
базе данных оно существует, то посланию электронной почты разрешается
|
|
||||||
доставка по назначению. В противном случае <acronym>ID</acronym>
|
|
||||||
сохраняется, а в качестве результата возвратится
|
|
||||||
<errorname>TEMPFAIL</errorname>. Этот цикл будет повторяться для
|
|
||||||
каждого сообщения, поступающего на сервер. По моему личному опыту,
|
|
||||||
это действительно отсекает 90% спама.</para>
|
|
||||||
</abstract>
|
|
||||||
</info>
|
|
||||||
|
|
||||||
<sect1>
|
|
||||||
<title>Базовая настройка</title>
|
|
||||||
|
|
||||||
<para>Нам потребуется <command>perl</command> с поддержкой многопоточного
|
|
||||||
выполнения. Установите <package>lang/perl5.8</package>
|
|
||||||
с установленной переменной <varname>USE_THREADS=yes</varname>. Сначала
|
|
||||||
может потребоваться удалить текущую версию <command>perl</command>; на
|
|
||||||
необходимость сделать это укажут ошибки в процессе установки.</para>
|
|
||||||
|
|
||||||
<note>
|
|
||||||
<para>При этом потребуется, чтобы все порты, которым нужен
|
|
||||||
<command>perl</command>, были перестроены и переустановлены;
|
|
||||||
<package>ports-mgmt/portupgrade</package> хорошо для
|
|
||||||
этого подходит. По крайней мере, он укажет, какие порты были удалены и
|
|
||||||
какие необходимо переустановить.</para>
|
|
||||||
</note>
|
|
||||||
|
|
||||||
<para>Теперь что касается сервера базы данных;
|
|
||||||
<application>MySQL</application> прекрасно подходит для такого типа
|
|
||||||
работы. Установите <package>databases/mysql40-server</package> вместе с <package>databases/p5-DBD-mysql40</package>. Предыдущий порт
|
|
||||||
должен подразумевать установку <package>databases/p5-DBI-137</package>, так что один шаг будет
|
|
||||||
пропущен.</para>
|
|
||||||
|
|
||||||
<para>Установите переносимый подключаемый серверный модуль на базе
|
|
||||||
<command>perl</command>, порт <package>net/p5-Net-Daemon</package>. Большинство установок этих
|
|
||||||
портов должны проходить без проблем. Следующий шаг будет более
|
|
||||||
трудоёмким.</para>
|
|
||||||
|
|
||||||
<para>Теперь установите порт <package>mail/p5-Sendmail-Milter</package>. На момент написания
|
|
||||||
этого документа в файле <filename>Makefile</filename> имелась строка,
|
|
||||||
начинающаяся с <varname>BROKEN</varname>, просто уберите или
|
|
||||||
закомментируйте её. Она помечена так лишь потому, что в &os; по
|
|
||||||
умолчанию не включался и не устанавливался пакет <command>perl</command>
|
|
||||||
с поддержкой многопоточного выполнения. После удаления этой строки он
|
|
||||||
должен строиться и устанавливаться без ошибок.</para>
|
|
||||||
|
|
||||||
<para>Создайте каталог для размещения временных конфигурационных
|
|
||||||
файлов:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>mkdir /tmp/relaydelay</userinput>
|
|
||||||
&prompt.root; <userinput>cd /tmp/relaydelay</userinput></screen>
|
|
||||||
|
|
||||||
<para>Теперь, когда у нас имеется временный каталог для работы, команде
|
|
||||||
<command>fetch</command> нужно передать следующие
|
|
||||||
<acronym>URL</acronym>-адреса:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>fetch http://projects.puremagic.com/greylisting/releases/relaydelay-0.04.tgz</userinput>
|
|
||||||
&prompt.root; <userinput>fetch http://lists.puremagic.com/pipermail/greylist-users/attachments/20030904/b8dafed9/relaydelay-0.04.bin</userinput></screen>
|
|
||||||
|
|
||||||
<!-- ЗАМЕЧАНИЕ ДЛЯ ТОМА РОДЕСА: РАЗМЕЩАТЬ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ЗДЕСЬ
|
|
||||||
ЯВЛЯЕТСЯ ПЛОХОЙ ИДЕЕЙ НА ТОТ СЛУЧАЙ, ЕСЛИ КАКОЙ-НИБУДЬ МУДАК ЗАМЕНИТ
|
|
||||||
ЕГО. НАВЕРНОЕ, Я ДОЛЖЕН ЗААРХИВИРОВАТЬ СКРИПТЫ И ОСТАЛЬНУЮ ШНЯГУ. -->
|
|
||||||
|
|
||||||
<para>Теперь необходимо распаковать исходный код:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>gunzip -c relaydelay-0.04.tgz | tar xvf -</userinput></screen>
|
|
||||||
|
|
||||||
<para>На этот момент во временном каталоге должно оказаться несколько
|
|
||||||
файлов. Теперь необходимая информация может передаваться серверу базы
|
|
||||||
данных импортированием её из файла <filename>mysql.sql</filename>:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>mysql < relaydelay-0.04/mysql.sql</userinput></screen>
|
|
||||||
|
|
||||||
<para>Установите патч <filename>relaydelay.bin</filename> для остальных
|
|
||||||
файлов, запустив такую команду:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>patch -d /tmp/relaydelay/relaydelay-0.04 < relaydelay.bin</userinput></screen>
|
|
||||||
|
|
||||||
<para>Отредактируйте файлы <filename>relaydelay.conf</filename> и
|
|
||||||
<filename>db_maintenance.pl</filename>, добавив в них корректное имя
|
|
||||||
пользователя и пароль для СУБД <application>MySQL</application>. Если
|
|
||||||
СУБД была построена и установлена так, как описано выше, то в ней
|
|
||||||
отсутствуют пользователи и пароли. Эта ситуация должна быть исправлена
|
|
||||||
до перевода системы в промышленную эксплуатацию, что описано в
|
|
||||||
документации к СУБД и выходит за рамки данной статьи.</para>
|
|
||||||
|
|
||||||
<para>Смените рабочий каталог на <filename>relaydelay-0.04</filename>:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>cd relaydelay-0.04</userinput></screen>
|
|
||||||
|
|
||||||
<para>Скопируйте или переместите конфигурационные файлы в соответствующие
|
|
||||||
каталоги:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>mv db_maintenance.pl relaydelay.pl /usr/local/sbin</userinput>
|
|
||||||
&prompt.root; <userinput>mv relaydelay.conf /etc/mail</userinput>
|
|
||||||
&prompt.root; <userinput>mv relaydelay.sh /usr/local/etc/rc.d/</userinput></screen>
|
|
||||||
|
|
||||||
<para>Протестируйте получившуюся конфигурацию, выполнив такую
|
|
||||||
команду:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>sh /usr/local/etc/rc.d/relaydelay.sh start</userinput></screen>
|
|
||||||
|
|
||||||
<note>
|
|
||||||
<para>Этот файл не будет существовать, если предыдущие команды &man.mv.1;
|
|
||||||
не были выполнены.</para>
|
|
||||||
</note>
|
|
||||||
|
|
||||||
<para>Если всё отработало корректно, то в каталоге <filename>/var/log</filename> должен появиться новый файл,
|
|
||||||
<filename>relaydelay.log</filename>. В нём должен находиться текст,
|
|
||||||
подобный следующему:</para>
|
|
||||||
|
|
||||||
<programlisting>Loaded Config File: /etc/mail/relaydelay.conf
|
|
||||||
Using connection 'local:/var/run/relaydelay.sock' for filter relaydelay
|
|
||||||
DBI Connecting to DBI:mysql:database=relaydelay:host=localhost:port=3306
|
|
||||||
Spawned relaydelay daemon process 38277.
|
|
||||||
Starting Sendmail::Milter 0.18 engine.</programlisting>
|
|
||||||
|
|
||||||
<para>Если файл не появился, то что-то сработало неправильно, пересмотрите
|
|
||||||
экранную диагностику или просмотрите журнальный файл
|
|
||||||
<filename>messages</filename> на предмет появления новой
|
|
||||||
информации.</para>
|
|
||||||
|
|
||||||
<para>Объедините всё вместе, добавив следующую строку в файл
|
|
||||||
<filename>/etc/mail/sendmail.mc</filename> или специфичный для вашей
|
|
||||||
системы <filename>mc</filename>-файл:</para>
|
|
||||||
|
|
||||||
<programlisting>INPUT_MAIL_FILTER(`relaydelay', `S=local:/var/run/relaydelay.sock, T=S:1m;R:2m;E:3m')dnl</programlisting>
|
|
||||||
|
|
||||||
<para>Перестройте и переустановите файлы в каталоге
|
|
||||||
<filename>/etc/mail</filename> и перезапустите
|
|
||||||
<command>sendmail</command>. Короткая команда <command>make</command>
|
|
||||||
<buildtarget>restart</buildtarget> должна сделать всё необходимое.</para>
|
|
||||||
|
|
||||||
<para>Сгрузите скрипт на языке <command>perl</command>, размещённый по
|
|
||||||
адресу <link xlink:href="http://lists.puremagic.com/pipermail/greylist-users/2003-November/000327.html">http://lists.puremagic.com/pipermail/greylist-users/2003-November/000327.html</link>
|
|
||||||
и сохраните его в каталог <filename>relaydelay-0.04</filename>. В следующем примере этот
|
|
||||||
скрипт обозначается как <filename>addlist.pl</filename>.</para>
|
|
||||||
|
|
||||||
<para>Отредактируйте файл <filename>whitelist_ip.txt</filename>,
|
|
||||||
модифицировав его так, чтобы в него были включены
|
|
||||||
<acronym>IP</acronym>-адреса серверов, которые должны иметь возможность
|
|
||||||
игнорировать фильтры <application>relaydelay</application>. То есть это
|
|
||||||
домены, при получении электронной почты от которых диагностическое
|
|
||||||
сообщение <errorname>TEMPFAIL</errorname> выдаваться не будет.</para>
|
|
||||||
|
|
||||||
<para>Как пример можно привести:</para>
|
|
||||||
|
|
||||||
<programlisting>192.168. # My internal network.
|
|
||||||
66.218.66 # Yahoo groups has unique senders.</programlisting>
|
|
||||||
|
|
||||||
<para>Файл <filename>blacklist_ip.txt</filename> должен иметь похожее
|
|
||||||
назначение, но с обратными правилами. Укажите в этом файле
|
|
||||||
<acronym>IP</acronym>-адреса, которые должны отвергаться без выдачи
|
|
||||||
диагностического сообщения <errorname>TEMPFAIL</errorname>. Этот
|
|
||||||
перечень доменов никогда не получит даже возможность сообщить о том, что
|
|
||||||
они являются реально существующими почтовыми серверами.</para>
|
|
||||||
|
|
||||||
<para>Эти файлы теперь должны быть импортированы в базу данных посредством
|
|
||||||
скрипта <filename>addlist.pl</filename>, который был получен несколькими
|
|
||||||
строками выше:</para>
|
|
||||||
|
|
||||||
<screen>&prompt.root; <userinput>perl addlist.pl -whitelist 9999-12-31 23:59:59 < whitelist_ip.txt</userinput>
|
|
||||||
&prompt.root; <userinput>perl addlist.pl -blacklist 9999-12-31 23:59:59 < blacklist_ip.txt</userinput></screen>
|
|
||||||
|
|
||||||
<para>Для включения технологии <application>relaydelay</application> при
|
|
||||||
каждой загрузке системы, добавьте строчку
|
|
||||||
<option>relaydelay_enable="YES"</option> в файл
|
|
||||||
<filename>/etc/rc.conf</filename>.</para>
|
|
||||||
|
|
||||||
<para>Журнальный файл <filename>/var/log/relaydelay.log</filename> должен
|
|
||||||
постепенно пополняться удачными прохождениями. В зависимости от загрузки
|
|
||||||
вашего почтового сервера, вскоре должны появиться строчки, подобные
|
|
||||||
следующим.</para>
|
|
||||||
|
|
||||||
<programlisting>=== 2004-05-24 21:03:22 ===
|
|
||||||
Stored Sender: <someasshole@flawed-example.com>
|
|
||||||
Passed Recipient: <local_user@pittgoth.com>
|
|
||||||
Relay: example.net [XXX.XX.XXX.XX] - If_Addr: MY_IP_ADDRESS
|
|
||||||
RelayIP: XX.XX.XX.XX - RelayName: example.net - RelayIdent: - PossiblyForged: 0
|
|
||||||
From: someasshole@flawed-example.com - To: local_user
|
|
||||||
InMailer: esmtp - OutMailer: local - QueueID: i4P13Lo6000701111
|
|
||||||
Email is known but block has not expired. Issuing a tempfail. rowid: 51
|
|
||||||
IN ABORT CALLBACK - PrivData: 0<someasshole@flawed-example.com></programlisting>
|
|
||||||
|
|
||||||
<para>В файл <filename>/etc/newsyslog.conf</filename> теперь можно добавить
|
|
||||||
следующую строку, которая обеспечивает ротацию журналов
|
|
||||||
<filename>relaydelay.log</filename> при достижении размера в 100
|
|
||||||
<acronym>Кбайт</acronym>:</para>
|
|
||||||
|
|
||||||
<screen>/var/log/relaydelay.log 644 3 100 * Z</screen>
|
|
||||||
|
|
||||||
<!-- XXX К какому тексту относится это замечание? -->
|
|
||||||
<note>
|
|
||||||
<para>В какой-то момент появлялась ошибка о неполном определении
|
|
||||||
переменных <command>perl</command> в файле
|
|
||||||
<filename>/etc/mail/relaydelay.conf</filename>. Если те две переменные
|
|
||||||
раскомментированы, то конфигурационный файл может быть обработан
|
|
||||||
нормально. Просто не забудьте убрать их из комментариев до того, как
|
|
||||||
начать работу с технологией <command>relaydelay</command>.</para>
|
|
||||||
</note>
|
|
||||||
</sect1>
|
|
||||||
</article>
|
|
|
@ -103,8 +103,6 @@
|
||||||
<!ENTITY url.articles.pxe.en "&url.doc.langbase.en;/articles/pxe">
|
<!ENTITY url.articles.pxe.en "&url.doc.langbase.en;/articles/pxe">
|
||||||
<!ENTITY url.articles.rc-scripting "&url.doc.langbase;/articles/rc-scripting">
|
<!ENTITY url.articles.rc-scripting "&url.doc.langbase;/articles/rc-scripting">
|
||||||
<!ENTITY url.articles.rc-scripting.en "&url.doc.langbase.en;/articles/rc-scripting">
|
<!ENTITY url.articles.rc-scripting.en "&url.doc.langbase.en;/articles/rc-scripting">
|
||||||
<!ENTITY url.articles.relaydelay "&url.doc.langbase;/articles/relaydelay">
|
|
||||||
<!ENTITY url.articles.relaydelay.en "&url.doc.langbase.en;/articles/relaydelay">
|
|
||||||
<!ENTITY url.articles.releng "&url.doc.langbase;/articles/releng">
|
<!ENTITY url.articles.releng "&url.doc.langbase;/articles/releng">
|
||||||
<!ENTITY url.articles.releng.en "&url.doc.langbase.en;/articles/releng">
|
<!ENTITY url.articles.releng.en "&url.doc.langbase.en;/articles/releng">
|
||||||
<!ENTITY url.articles.releng-packages "&url.doc.langbase;/articles/releng-packages">
|
<!ENTITY url.articles.releng-packages "&url.doc.langbase;/articles/releng-packages">
|
||||||
|
|
Loading…
Reference in a new issue