Sendmail + SPF milter howto

Controllo che sendmail > 8.11 e compilato con il supporto MILTER:

sendmail -d0.1 -bt < /dev/null | grep MILTER

wget http://www.libspf2.org/spf/libspf2-1.2.5.tar.gz
wget http://dfn.dl.sourceforge.net/sourceforge/smfs/smf-spf-2.0.2.tar.gz

tar -zxvf libspf2-1.2.5.tar.gz
cd libspf2-1.2.5
./configure
make && make check
make install
ldconfig

Quando si lancia make check si ottengono questi errori, cmq poi tutto funziona correttamente

—————————————————————————————
make[3]: Entering directory
`/root/Ordine/software/SPF_milter/libspf2-1.2.5/tests’

Running single tests on the parser…
Running tests from test_parser.txt (with args ”)…
All regression tests passed
PASS: run_single_parser

Running single tests using adoption roll data…
Running tests from test_adopt_roll.txt (with args ”)…
Error: 101 tests failed
FAIL: run_single_adopt_roll

Running single tests using data from the RFC examples…
Running tests from test_rfc_examples.txt (with args ”)…
Error: 46 tests failed
FAIL: run_single_rfc_examples

Running single tests using static test dns zone file…

Running piped tests using live data…
Running tests from test_live.txt (with args ‘-pipe -test-opt=-dns=test
–todo=121=FIXME –todo=135.result=FIXME –todo=136.result=FIXME
–todo=137.result=FIXME –todo=139=Persistent_data_error?
–todo=140=Persistent_data_error? –todo=142=Persistent_data_error?
–todo=145=Persistent_data_error? –todo=146=Persistent_data_error?
–todo=149=Persistent_data_error? –todo=154=Persistent_data_error?
–todo=155=Persistent_data_error? –todo=156=Persistent_data_error?
–todo=157=Persistent_data_error? –todo=158=Persistent_data_error?
–todo=159=Persistent_data_error? –todo=160=Persistent_data_error?
–todo=161=Persistent_data_error? –todo=162=Persistent_data_error?
–todo=163=Persistent_data_error? –todo=164=Persistent_data_error?
–todo=165=Persistent_data_error? –todo=166=Persistent_data_error?
–todo=167=Persistent_data_error? –todo=168=FIXME –todo=169=FIXME’)…
Error: 569 tests failed
FAIL: run_single_tdns

Running piped tests using static test dns zone file…

Running single tests using live data…
Running tests from test_live.txt (with args ‘–todo=121=FIXME
–todo=135.result=FIXME –todo=136.result=FIXME –todo=137.result=FIXME
–todo=168=FIXME –todo=169=FIXME’)…
Error: 215 tests failed
FAIL: run_many_tdns

Running single tests using live data…
Running tests from test_live.txt (with args ‘–todo=121=FIXME
–todo=135.result=FIXME –todo=136.result=FIXME –todo=137.result=FIXME
–todo=168=FIXME –todo=169=FIXME’)…
Error: 215 tests failed
FAIL: run_single_live

Running piped tests using live data…
Running tests from test_live.txt (with args ‘-pipe –todo=121=FIXME
–todo=135.result=FIXME –todo=136.result=FIXME –todo=137.result=FIXME
–todo=139=Persistent_data_error? –todo=140=Persistent_data_error?
–todo=142=Persistent_data_error? –todo=145=Persistent_data_error?
–todo=146=Persistent_data_error? –todo=149=Persistent_data_error?
–todo=154=Persistent_data_error? –todo=155=Persistent_data_error?
–todo=156=Persistent_data_error? –todo=157=Persistent_data_error?
–todo=158=Persistent_data_error? –todo=159=Persistent_data_error?
–todo=160=Persistent_data_error? –todo=161=Persistent_data_error?
–todo=162=Persistent_data_error? –todo=163=Persistent_data_error?
–todo=164=Persistent_data_error? –todo=165=Persistent_data_error?
–todo=166=Persistent_data_error? –todo=167=Persistent_data_error?
–todo=168=FIXME –todo=169=FIXME’)…
Error: 569 tests failed
FAIL: run_many_live
=======================================
6 of 7 tests failed
Please report to libspf2@rt.anarres.org
=======================================
make[3]: *** [check-TESTS] Error 1
make[3]: Leaving directory
`/root/Ordine/software/SPF_milter/libspf2-1.2.5/tests’
make[2]: *** [check-am] Error 2
make[2]: Leaving directory
`/root/Ordine/software/SPF_milter/libspf2-1.2.5/tests’
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory
`/root/Ordine/software/SPF_milter/libspf2-1.2.5/tests’
make: *** [check-recursive] Error 1
root@proxy2:~/Ordine/software/SPF_milter/libspf2-1.2.5#

—————————————————————————————

cd ..

cd smf-spf-2.0.2
make
make install

vi /etc/mail/smfs/smf-spf.conf

/usr/local/sbin/smf-spf -c /etc/mail/smfs/smf-spf.conf

Add these lines to your Sendmail configuration file (usually sendmail.mc):

define(`confMILTER_MACROS_HELO’, confMILTER_MACROS_HELO`, {verify}’)dnl
INPUT_MAIL_FILTER(`smf-spf’, `S=unix:/var/run/smfs/smf-spf.sock,
T=S:30s;R:1m’)dnl

IMPORTANT: make sure that libmilter is compiled with
BROKEN_PTHREAD_SLEEP defined.
If this symbol is not defined, libmilter will use sleep() in
signal-handler thread,
which may cause various program misbehaviors, including coredumps.
To rebuild Sendmail with this symbol defined, add the following line to your
Sendmail/devtools/Site/site.config.m4:

APPENDDEF(`confENVDEF’, `-DBROKEN_PTHREAD_SLEEP’)

vi /usr/share/sendmail/cf/m4/cf.m4

[La necessità di inserire il parametro sopra-descritto mi è ignota, ma quando ho provato a
aggiungerlo sendmail non partiva]

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

A questo punto possiamo riavviare sendmail e controllare su /var/log/maillog
se il controllo SPF funziona.
(e a me FUNZIONA 🙂 )

.