Sendmail v8.13.1 + libSPF v1.0 HOWTO
Description: This HOWTO isn't guaranteed to get you all setup, but it should be a good document to follow whilst trying to integrate libSPF into Sendmail v8.13.1. This HOWTO is quite backwards compatible with other versions, feel free to report success!
Keywords: sendmail spf libspf

Sendmail v8.13.1 + libSPF v1.0-RC5 HOWTO

by James Couzens <jcouzens@codeshare.ca>

Updated: August 5, 2004

james@code3 $ wget http://libspf.org/files/src/libspf-1.0.0-RC5.tar.bz2

james@code3 $ tar jxvf libspf-1.0.0-RC5.tar.bz2
james@code3 $ cd libspf-1_0_0-RC5
james@code3 $ ./configure –enable-debug

checking for a BSD-compatible install... /bin/install -c

checking whether build environment is sane... yes

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking for gcc... gcc

checking for C compiler default output file name... a.out

checking whether the C compiler works... yes

checking whether we are cross compiling... no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ANSI C... none needed

checking for style of include used by make... GNU

!SNIP! no need to paste all of the 'configure' output!

configure: creating ./config.status

config.status: creating Makefile

config.status: creating src/Makefile

config.status: creating src/libspf/Makefile

config.status: creating src/spfqtool/Makefile

config.status: creating src/libspf/spf.h

config.status: creating config.h

config.status: config.h is unchanged

config.status: executing depfiles commands

configure: creating ./config.status

config.status: creating Makefile

config.status: creating src/Makefile

config.status: creating src/libspf/Makefile

config.status: creating src/spfqtool/Makefile

config.status: creating src/libspf/spf.h

config.status: creating src/spfmilter/Makefile

config.status: creating config.h

config.status: config.h is unchanged

config.status: executing depfiles commands

--------------------------------------------------------------------------------

libspf 1.0.0-RC5

An ANSI C Implementation of the Sender Policy Framework

--------------------------------------------------------------------------------

./CHANGELOG ............ List of documented changed between versions

./Docs ................. Excellent API and integration Documentation

./Examples ............. Examples of how to implement

./FAQ .................. Frequently Asked Questions (and Answers :-) )

./LICENSE .............. Terms under which libSPF is licensed

./README ............... A Quick and Excellent rundown of basic information

./TODO ................. Things planned for future releases that are 'To Do'

./VERSION .............. Version of thie release

./bin .................. Static & Dyn. versions of the libSPF Query Tool

./libspf.kateproject ... KDE's excellent IDE 'kate' Project File

./patches .............. MTA Patches

./src .................. Its not the Swartz, but it will have to do ;)

--------------------------------------------------------------------------------

There are complete HOWTOs (or walkthru) documents within the 'Docs' dir for

the MTA's this library supports.

Commercial developers looking to integrate libSPF, there is no cost! If you

require assistance (free) please contact <developers@codeshare.ca>

Website ................................ http://libSPF.org

Forums ................................. http://forums.6o4.ca

Contact ................................ jcouzens@codeshare.ca

--------------------------------------------------------------------------------

Enable Debugging .................... OFF

Disable build of SPF Query Tool ..... OFF

Enable use of libresolv resolver..... ON

Enable use of spfmilter ............. OFF

Enable use of libbind resolver....... OFF

libSPF Query tool binaries are in the new 'bin' dir in the libSPF root

libSPF libraries are in the new 'lib' dir in the libSPF root
--------------------------------------------------------------------------------

root@antitrust ~/code/dev/c/libspf-1.0.0-RC5 # make

cd . && /bin/sh ./config.status config.h

config.status: creating config.h

config.status: config.h is unchanged

make all-recursive

make[1]: Entering directory `./libspf-1.0.0-RC5'

Making all in src

make[2]: Entering directory `./libspf-1.0.0-RC5/src'

Making all in libspf

make[3]: Entering directory `./libspf-1.0.0-RC5/src/libspf'

source='main.c' object='main.lo' libtool=yes \

depfile='.deps/main.Plo' tmpdepfile='.deps/main.TPlo' \

depmode=gcc3 /bin/sh ../../build_tools/depcomp \

/bin/sh ../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../..

-Wall -O2 -g -O2 -c -o main.lo `test -f 'main.c' || echo './'`main.c

gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -Wall -O2 -g -O2 -c main.c -MT main.lo

-MD -MP -MF .deps/main.TPlo -fPIC -DPIC -o .libs/main.o

gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -Wall -O2 -g -O2 -c main.c -MT main.lo

-MD -MP -MF .deps/main.TPlo -o main.o >/dev/null 2>&1

source='dns.c' object='dns.lo' libtool=yes \

depfile='.deps/dns.Plo' tmpdepfile='.deps/dns.TPlo' \

depmode=gcc3 /bin/sh ../../build_tools/depcomp \

/bin/sh ../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../..

-Wall -O2 -g -O2 -c -o dns.lo `test -f 'dns.c' || echo './'`dns.c

gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -Wall -O2 -g -O2 -c dns.c -MT dns.lo

-MD -MP -MF .deps/dns.TPlo -fPIC -DPIC -o .libs/dns.o

gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -Wall -O2 -g -O2 -c dns.c -MT dns.lo

-MD -MP -MF .deps/dns.TPlo -o dns.o >/dev/null 2>&1

source='macro.c' object='macro.lo' libtool=yes \

depfile='.deps/macro.Plo' tmpdepfile='.deps/macro.TPlo' \

depmode=gcc3 /bin/sh ../../build_tools/depcomp \

/bin/sh ../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../..

-Wall -O2 -g -O2 -c -o macro.lo `test -f 'macro.c' || echo './'`macro.c

gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -Wall -O2 -g -O2 -c macro.c -MT

macro.lo -MD -MP -MF .deps/macro.TPlo -fPIC -DPIC -o .libs/macro.o

gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -Wall -O2 -g -O2 -c macro.c -MT

macro.lo -MD -MP -MF .deps/macro.TPlo -o macro.o >/dev/null 2>&1

source='util.c' object='util.lo' libtool=yes \

depfile='.deps/util.Plo' tmpdepfile='.deps/util.TPlo' \

depmode=gcc3 /bin/sh ../../build_tools/depcomp \

/bin/sh ../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../..

-I../.. -Wall -O2 -g -O2 -c -o util.lo `test -f 'util.c' || echo './'`util.c

gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -Wall -O2 -g -O2 -c util.c

-MT util.lo -MD -MP -MF .deps/util.TPlo -fPIC -DPIC -o .libs/util.o

gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -Wall -O2 -g -O2 -c util.c

-MT util.lo -MD -MP -MF .deps/util.TPlo -o util.o >/dev/null 2>&1

/bin/sh ../../libtool --mode=link gcc -Wall -O2 -g -O2 -o libspf.la -

rpath /usr/local/lib -version-info "0:5:0" -release 1.0 main.lo dns.lo macro.lo

util.lo -lresolv -lresolv -lresolv -lnsl -lc

gcc -shared .libs/main.o .libs/dns.o .libs/macro.o .libs/util.o -lresolv

-lnsl -lc -Wl,-soname -Wl,libspf-1.0.so.0 -o .libs/libspf-1.0.so.0.0.5

(cd .libs && rm -f libspf-1.0.so.0 && ln -s libspf-1.0.so.0.0.5 libspf-1.0.so.0)

(cd .libs && rm -f libspf.so && ln -s libspf-1.0.so.0.0.5 libspf.so)

ar cru .libs/libspf.a main.o dns.o macro.o util.o

ranlib .libs/libspf.a

creating libspf.la

(cd .libs && rm -f libspf.la && ln -s ../libspf.la libspf.la)

make DESTDIR= libdir=`pwd`/../../lib install-exec

make[4]: Entering directory `./libspf-1.0.0-RC5/src/libspf'

/bin/sh ../../build_tools/mkinstalldirs ./libspf-1.0.0-RC5/src/libspf/../../lib

/bin/sh ../../libtool --mode=install /bin/install -c

libspf.la ./libspf-1.0.0-RC5/src/libspf/../../lib/libspf.la

/bin/install -c

.libs/libspf-1.0.so.0.0.5 ./libspf-1.0.0-RC5/src/libspf/../../lib/libspf-1.0.so.0.0.5

400. ./libspf-1.0.0-RC5/src/libspf/../../lib && rm -f libspf-1.0.so.0 &&

401. ln -s libspf-1.0.so.0.0.5 libspf-1.0.so.0)

400. ./libspf-1.0.0-RC5/src/libspf/../../lib && rm -f libspf.so &&

401. ln -s libspf-1.0.so.0.0.5 libspf.so)

/bin/install -c .libs/libspf.lai ./libspf-1.0.0-RC5/src/libspf/../../lib/libspf.la

/bin/install -c .libs/libspf.a ./libspf-1.0.0-RC5/src/libspf/../../lib/libspf.a

ranlib ./libspf-1.0.0-RC5/src/libspf/../../lib/libspf.a

chmod 644 ./libspf-1.0.0-RC5/src/libspf/../../lib/libspf.a

libtool: install: warning: remember to run `libtool --finish /usr/local/lib'

make[4]: Leaving directory `./libspf-1.0.0-RC5/src/libspf'

make[3]: Leaving directory `./libspf-1.0.0-RC5/src/libspf'

Making all in spfqtool

make[3]: Entering directory `./libspf-1.0.0-RC5/src/spfqtool'

source='spfqtool.c' object='spfqtool.o' libtool=no \

depfile='.deps/spfqtool.Po' tmpdepfile='.deps/spfqtool.TPo' \

depmode=gcc3 /bin/sh ../../build_tools/depcomp \

gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../libspf/.libs -I../libspf

-Wall -ggdb3 -D_GNU_SOURCE -D_BSD_SOURCE -Wall -O2 -g -O2 -c `test -f 'spfqtool.c' || echo './'`spfqtool.c

/bin/sh ../../libtool --mode=link gcc -Wall -ggdb3 -D_GNU_SOURCE

-D_BSD_SOURCE -Wall -O2 -g -O2 -o spfqtool spfqtool.o ../libspf/libspf.la -lresolv -lresolv -lnsl -lc

gcc -Wall -ggdb3 -D_GNU_SOURCE -D_BSD_SOURCE -Wall -O2 -g -O2

-o .libs/spfqtool spfqtool.o ../libspf/.libs/libspf.so -lresolv -lnsl -lc -Wl,--rpath -Wl,/usr/local/lib

creating spfqtool

/bin/sh ../../libtool --mode=link gcc -Wall -ggdb3 -D_GNU_SOURCE

-D_BSD_SOURCE -Wall -O2 -g -O2 -o spfqtool_static -static

-lresolv spfqtool.o ../libspf/.libs/libspf.a -lresolv -lresolv -lnsl -lc

gcc -Wall -ggdb3 -D_GNU_SOURCE -D_BSD_SOURCE -Wall -O2 -g -O2

-o spfqtool_static spfqtool.o ../libspf/.libs/libspf.a -lresolv -lnsl -lc

make DESTDIR= bindir=`pwd`/../../bin install-exec

make[4]: Entering directory `./libspf-1.0.0-RC5/src/spfqtool'

/bin/sh ../../build_tools/mkinstalldirs ./libspf-1.0.0-RC5/src/spfqtool/../../bin

/bin/sh ../../libtool --mode=install /bin/install -c spfqtool ./libspf-1.0.0-RC5/src/spfqtool/../../bin/spfqtool

/bin/install -c .libs/spfqtool ./libspf-1.0.0-RC5/src/spfqtool/../../bin/spfqtool

/bin/sh ../../libtool --mode=install /bin/install -c spfqtool_static ./libspf-1.0.0-RC5/src/spfqtool/../../bin/spfqtool_static

/bin/install -c spfqtool_static ./libspf-1.0.0-RC5/src/spfqtool/../../bin/spfqtool_static

make[4]: Leaving directory `./libspf-1.0.0-RC5/src/spfqtool'

make[3]: Leaving directory `./libspf-1.0.0-RC5/src/spfqtool'

make[3]: Entering directory `./libspf-1.0.0-RC5/src'

make[3]: Nothing to be done for `all-am'.

make[3]: Leaving directory `./libspf-1.0.0-RC5/src'

make[2]: Leaving directory `./libspf-1.0.0-RC5/src'

make[2]: Entering directory `./libspf-1.0.0-RC5'

cd . && /bin/sh ./config.status config.h

config.status: creating config.h

config.status: config.h is unchanged

make[2]: Leaving directory `./libspf-1.0.0-RC5'

make[1]: Leaving directory `./libspf-1.0.0-RC5'

james@code3 # make install

Making install in src

make[1]: Entering directory `./libspf-1.0.0-RC5/src'

Making install in libspf

make[2]: Entering directory `./libspf-1.0.0-RC5/src/libspf'

make DESTDIR= libdir=`pwd`/../../lib install-exec

make[3]: Entering directory `./libspf-1.0.0-RC5/src/libspf'

/bin/sh ../../build_tools/mkinstalldirs ./libspf-1.0.0-RC5/src/libspf/../../lib

/bin/sh ../../libtool --mode=install /bin/install -c libspf.la ./libspf-1.0.0-RC5/src/libspf/../../lib/libspf.la

/bin/install -c .libs/libspf-1.0.so.0.0.5 ./libspf-1.0.0-RC5/src/libspf/../../lib/libspf-1.0.so.0.0.5

(cd ./libspf-1.0.0-RC5/src/libspf/../../lib && rm -f libspf-1.0.so.0 && ln -s libspf-1.0.so.0.0.5 libspf-1.0.so.0)

(cd ./libspf-1.0.0-RC5/src/libspf/../../lib && rm -f libspf.so && ln -s libspf-1.0.so.0.0.5 libspf.so)

/bin/install -c .libs/libspf.lai ./libspf-1.0.0-RC5/src/libspf/../../lib/libspf.la

/bin/install -c .libs/libspf.a ./libspf-1.0.0-RC5/src/libspf/../../lib/libspf.a

ranlib ./libspf-1.0.0-RC5/src/libspf/../../lib/libspf.a

chmod 644 ./libspf-1.0.0-RC5/src/libspf/../../lib/libspf.a

libtool: install: warning: remember to run `libtool --finish /usr/local/lib'

make[3]: Leaving directory `./libspf-1.0.0-RC5/src/libspf'

make[3]: Entering directory `./libspf-1.0.0-RC5/src/libspf'

/bin/sh ../../build_tools/mkinstalldirs /usr/local/lib

/bin/sh ../../libtool --mode=install /bin/install -c libspf.la /usr/local/lib/libspf.la

/bin/install -c .libs/libspf-1.0.so.0.0.5 /usr/local/lib/libspf-1.0.so.0.0.5

(cd /usr/local/lib && rm -f libspf-1.0.so.0 && ln -s libspf-1.0.so.0.0.5 libspf-1.0.so.0)

(cd /usr/local/lib && rm -f libspf.so && ln -s libspf-1.0.so.0.0.5 libspf.so)

/bin/install -c .libs/libspf.lai /usr/local/lib/libspf.la

/bin/install -c .libs/libspf.a /usr/local/lib/libspf.a

ranlib /usr/local/lib/libspf.a

chmod 644 /usr/local/lib/libspf.a

PATH="$PATH:/sbin" ldconfig -n /usr/local/lib

----------------------------------------------------------------------

Libraries have been installed in:

/usr/local/lib

If you ever happen to want to link against installed libraries

in a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the `-LLIBDIR'

flag during linking and do at least one of the following:

- add LIBDIR to the `LD_LIBRARY_PATH' environment variable

during execution

- add LIBDIR to the `LD_RUN_PATH' environment variable

during linking

- use the `-Wl,--rpath -Wl,LIBDIR' linker flag

- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

----------------------------------------------------------------------

/bin/sh ../../build_tools/mkinstalldirs /usr/local/include

/bin/install -c -m 644 spf.h /usr/local/include/spf.h

make[3]: Leaving directory `./libspf-1.0.0-RC5/src/libspf'

make[2]: Leaving directory `./libspf-1.0.0-RC5/src/libspf'

Making install in spfqtool

make[2]: Entering directory `./libspf-1.0.0-RC5/src/spfqtool'

make DESTDIR= bindir=`pwd`/../../bin install-exec

make[3]: Entering directory `./libspf-1.0.0-RC5/src/spfqtool'

/bin/sh ../../build_tools/mkinstalldirs ./libspf-1.0.0-RC5/src/spfqtool/../../bin

/bin/sh ../../libtool --mode=install /bin/install -c spfqtool ./libspf-1.0.0-RC5/src/spfqtool/../../bin/spfqtool

/bin/install -c .libs/spfqtool ./libspf-1.0.0-RC5/src/spfqtool/../../bin/spfqtool

/bin/sh ../../libtool --mode=install /bin/install -c spfqtool_static ./libspf-1.0.0-RC5/src/spfqtool/../../bin/spfqtool_static

/bin/install -c spfqtool_static ./libspf-1.0.0-RC5/src/spfqtool/../../bin/spfqtool_static

make[3]: Leaving directory `./libspf-1.0.0-RC5/src/spfqtool'

make[3]: Entering directory `./libspf-1.0.0-RC5/src/spfqtool'

/bin/sh ../../build_tools/mkinstalldirs /usr/local/bin

/bin/sh ../../libtool --mode=install /bin/install -c spfqtool /usr/local/bin/spfqtool

/bin/install -c .libs/spfqtool /usr/local/bin/spfqtool

/bin/sh ../../libtool --mode=install /bin/install -c spfqtool_static /usr/local/bin/spfqtool_static

/bin/install -c spfqtool_static /usr/local/bin/spfqtool_static

make[3]: Nothing to be done for `install-data-am'.

make[3]: Leaving directory `./libspf-1.0.0-RC5/src/spfqtool'

make[2]: Leaving directory `./libspf-1.0.0-RC5/src/spfqtool'

make[2]: Entering directory `./libspf-1.0.0-RC5/src'

make[3]: Entering directory `./libspf-1.0.0-RC5/src'

make[3]: Nothing to be done for `install-exec-am'.

make[3]: Nothing to be done for `install-data-am'.

make[3]: Leaving directory `./libspf-1.0.0-RC5/src'

make[2]: Leaving directory `./libspf-1.0.0-RC5/src'

make[1]: Leaving directory `./libspf-1.0.0-RC5/src'

make[1]: Entering directory `./libspf-1.0.0-RC5'

cd . && /bin/sh ./config.status config.h

config.status: creating config.h

config.status: config.h is unchanged

make[2]: Entering directory `./libspf-1.0.0-RC5'

make[2]: Nothing to be done for `install-exec-am'.

make[2]: Nothing to be done for `install-data-am'.

make[2]: Leaving directory `./libspf-1.0.0-RC5'

make[1]: Leaving directory `./libspf-1.0.0-RC5'

james@code3 # ldconfig
james@code3 # ldconfig -p | grep spf

libspf.so.1 (libc6) => /usr/local/lib/libspf.so.1

james@code3 $ cd ../sendmail-8.13.1
james@code3 $ patch -p0 < ../libspf-1_0_0-RC5/patches/sendmail/sendmail-8.13.1-libspf-1.0-RC5.diff

patching file sendmail/readcf.c
patching file sendmail/Makefile.m4
patching file sendmail/sendmail.h
patching file cf/feature/spf.m4
patching file cf/m4/proto.m4
patching file sendmail/srvrsmtp.c

james@code3 $ cd cf/cf
james@code3 $ cp generic-linux.mc sendmail.mc
james@code3 $ vi sendmail.mc
I appended the following line:

FEATURE(spf)dnl

If you want to reject all email that receives SPF_FAIL you would do:

FEATURE(spf, 2)dnl
FEATURE(`delay_checks')dnl

If you are not rejecting, you do not need the 'delay_checks' line.
DO NOT DO THE FOLLOWING (even tho the HOWTO included says you can, its wrong, because its broken):

FEATURE(spf, `SPFAction', `SPFHeaderState', `SPFBestGuessState', `SPFTrustedForwarderState', `SPFExplainState', `SPFBestGuess', `SPFTrustedForwarder', `SPFExplain')dnl

Although the idea is GREAT it doesn't work, so don't do it until Teddy has a chance
(or someone else who can understand m4) to fix it, just apply the single feature.
For the record I tried a few variations for example by putting each FEATURE on
its own line with actual arguments and I almost had it working properly,
but not quite, so this is why I say don't do it. Try if you are feel dangerous, and submit any positive results.
james@code3 $ cat sendmail.mc

divert(-1)

#

# Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.

# All rights reserved.

# Copyright (c) 1983 Eric P. Allman. All rights reserved.

# Copyright (c) 1988, 1993

# The Regents of the University of California. All rights reserved.

#

# By using this file, you agree to the terms and conditions set

# forth in the LICENSE file which can be found at the top level of

# the sendmail distribution.

#

#

#

# This is a generic configuration file for Linux.

# It has support for local and SMTP mail only. If you want to

# customize it, copy it to a name appropriate for your environment

# and do the modifications there.

#

divert(0)dnl

VERSIONID(`$Id: generic-linux.mc,v 8.1 1999/09/24 22:48:05 gshapiro Exp $')

OSTYPE(linux)dnl

DOMAIN(generic)dnl

FEATURE(`spf', 2)dnl

FEATURE(`delay_checks')dnl

MAILER(local)

james@code3 $ sh Build sendmail.cf

Using M4=/usr/bin/m4

rm -f sendmail.cf

/usr/bin/m4 ../m4/cf.m4 sendmail.mc > sendmail.cf || ( rm -f sendmail.cf && exit 1 )

echo "### sendmail.mc ###" >>sendmail.cf

sed -e 's/^/# /' sendmail.mc >>sendmail.cf

chmod 444 sendmail.cf

james@code3 # sh Build install-cf

Using M4=/usr/bin/m4

../../devtools/bin/install.sh -c -o root -g bin -m 0444 sendmail.cf /etc/mail/sendmail.cf

rm -f submit.cf

/usr/bin/m4 ../m4/cf.m4 submit.mc > submit.cf || ( rm -f submit.cf && exit 1 )

echo "### submit.mc ###" >>submit.cf

sed -e 's/^/# /' submit.mc >>submit.cf

chmod 444 submit.cf

../../devtools/bin/install.sh -c -o root -g bin -m 0444 submit.cf /etc/mail/submit.cf

james@code3 # sh Build install

Making all in:

/home/james/code/dev/c/sendmail-8.13.1.spf/libsm

Configuration: pfx=, os=Linux, rel=2.6.7, rbase=2, rroot=2.6, arch=i686, sfx=, variant=optimized

Using M4=/usr/bin/m4

Creating /home/james/code/dev/c/sendmail-8.13.1.spf/obj.Linux.2.6.7.i686/libsm using /home/james/code/dev/c/sendmail-8.13.1.spf/devtools/OS/Linux

Making dependencies in /home/james/code/dev/c/sendmail-8.13.1.spf/obj.Linux.2.6.7.i686/libsm

make[1]: Entering directory `/home/james/code/dev/c/sendmail-8.13.1.spf/obj.Linux.2.6.7.i686/libsm'

rm -f sm_os.h

ln -f -s ../../include/sm/os/sm_os_linux.h sm_os.h

cc -M -I. -I../../include -DNEWDB assert.c debug.c errstring.c exc.c heap.c match.c rpool.c strdup.c strerror.c strl.c clrerr.c fclose.c feof.c ferror.c fflush.c fget.c fpos.c findfp.c flags.c fopen.c fprintf.c fpurge.c fput.c fread.c fscanf.c fseek.c fvwrite.c fwalk.c fwrite.c get.c makebuf.c put.c refill.c rewind.c setvbuf.c smstdio.c snprintf.c sscanf.c stdio.c strio.c ungetc.c vasprintf.c vfprintf.c vfscanf.c vprintf.c vsnprintf.c vsscanf.c wbuf.c wsetup.c string.c stringf.c xtrap.c strto.c test.c path.c strcasecmp.c strrevcmp.c signal.c clock.c config.c shm.c mbdb.c strexit.c cf.c ldap.c niprop.c mpeix.c t-event.c t-exc.c t-rpool.c t-string.c t-smstdio.c t-match.c t-strio.c t-heap.c t-fopen.c t-strl.c t-strrevcmp.c t-types.c t-path.c t-float.c t-scanf.c t-shm.c t-cf.c b-strcmp.c >> Makefile

make[1]: Leaving directory `/home/james/code/dev/c/sendmail-8.13.1.spf/obj.Linux.2.6.7.i686/libsm'

Making in /home/james/code/dev/c/sendmail-8.13.1.spf/obj.Linux.2.6.7.i686/libsm

make[1]: Entering directory `/home/james/code/dev/c/sendmail-8.13.1.spf/obj.Linux.2.6.7.i686/libsm'

SNIP! We don't need to see all of this, skipping to relevant SPF..

ln -f -s ../../include/sm/os/sm_os_linux.h sm_os.h

cc -M -I. -I../../include -DNEWDB -DLIBSPF main.c alias.c arpadate.c bf.c collect.c conf.c control.c convtime.c daemon.c deliver.c domain.c envelope.c err.c headers.c macro.c map.c mci.c milter.c mime.c parseaddr.c queue.c ratectrl.c readcf.c recipient.c sasl.c savemail.c sfsasl.c shmticklib.c sm_resolve.c srvrsmtp.c stab.c stats.c sysexits.c timers.c tls.c trace.c udb.c usersmtp.c util.c version.c >> Makefile

make[1]: Leaving directory `/home/james/code/dev/c/sendmail-8.13.1.spf/obj.Linux.2.6.7.i686/sendmail'

Making in /home/james/code/dev/c/sendmail-8.13.1.spf/obj.Linux.2.6.7.i686/sendmail

make[1]: Entering directory `/home/james/code/dev/c/sendmail-8.13.1.spf/obj.Linux.2.6.7.i686/sendmail'

if [ ! -d /etc/mail ]; then mkdir -p /etc/mail; else :; fi

install -c -o bin -g bin -m 444 helpfile /etc/mail/helpfile

cp /dev/null statistics

if [ ! -d /etc/mail ]; then mkdir -p /etc/mail; else :; fi

install -c -o root -g bin -m 0600 statistics /etc/mail/statistics

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o main.o main.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o alias.o alias.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o arpadate.o arpadate.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o bf.o bf.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o collect.o collect.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o conf.o conf.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o control.o control.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o convtime.o convtime.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o daemon.o daemon.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o deliver.o deliver.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o domain.o domain.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o envelope.o envelope.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o err.o err.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o headers.o headers.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o macro.o macro.c

cc -O2 -I. -I../../include -DNEWDB -DLIBSPF -c -o map.o map.c

!SNIP!

This next portion, the line numbers are only relevant if you have patched a fresh

Sendmail 8.13.1 install with only the libSPF patch, otherwise your line numbers

may very well be substantially different.

james@code3 $ vi /etc/mail/sendmail.cf
Looking at line 519 I can see the newly added SPF directives:

# SPFAction
O SPFAction=1
# SPFHeaderState
O SPFHeaderState=True
# SPFBestGuessState
O SPFBestGuessState=0
# SPFTrustedForwarderState
O SPFTrustedForwarderState=0
# SPFExplainState
O SPFExplainState=True
# SPFBestGuess
O SPFBestGuess=v=spf1 a/24 mx/24 ptr
# SPFTrustedForwarder
O SPFTrustedForwarder=v=spf1 include:spf.trusted-forwarder.org
# SPFExplain
O SPFExplain=See http://spf.pobox.com/why.html?sender=%{S}&...&receiver=%{xR}

This is what you see if you DON'T listen to my advice as listed up above:

# SPFAction
O SPFAction=SPFAction
# SPFHeaderState
O SPFHeaderState=SPFHeaderState
# SPFBestGuessState
O SPFBestGuessState=SPFBestGuessState
# SPFTrustedForwarderState
O SPFTrustedForwarderState=SPFTrustedForwarderState
# SPFExplainState
O SPFExplainState=SPFExplainState
# SPFBestGuess
O SPFBestGuess=SPFBestGuess
# SPFTrustedForwarder
O SPFTrustedForwarder=SPFTrustedForwarder
# SPFExplain
O SPFExplain=SPFExplain

Down at line 593 you see the new header:

H?P?Return-Path: <$g>
HReceived-SPF: ${spfheader}
HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
$.$?{auth_type}(authenticated$?{auth_ssf} bits=${auth_ssf}$.)
$.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
(version=${tls_version} cipher=${cipher} bits=${cipher_bits} verify=${verify})$.$?u
for $u; $|;
$.$b
H?D?Resent-Date: $a
H?D?Date: $a
H?F?Resent-From: $?x$x <$g>$|$g$.
H?F?From: $?x$x <$g>$|$g$.
H?x?Full-Name: $x
# HPosted-Date: $a
# H?l?Received-Date: $b
H?M?Resent-Message-Id: <$t.$i@$j>
H?M?Message-Id: <$t.$i@$j>

Moving on down to line 1025:

# Checks the SPF records of sending domain
R$* $: $1 $| <?>$&{spfreject}<?>
R$* $| <?>1<?> $#error $@ 5.7.1 $: "550 Mail from [" $&{client_addr} "] Rejected. " $&{spfexplain}
R$* $| <?>$* $: $1
# Checks the SPF records of sending domain
R$* $: $1 $| <?>$&{spfreject}<?>
R$* $| <?>1<?> $#error $@ 5.7.1 $: "550 Mail from [" $&{client_addr} "] Rejected. " $&{spfexplain}
R$* $| <?>$* $: $1

james@code3 # /etc/init.d/sendmail start
james@code3 $ telnet localhost 25

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 code3.codeshare.ca ESMTP Sendmail 8.13.0/8.13.0-SPF; Wed, 30 Jun 2004 05:35:15 -0700
MAIL FROM: james@widgets.org
250 2.1.0 james@widgets.org... Sender ok
RCPT TO: jcouzens@codeshare.ca
250 2.1.5 jcouzens@codeshare.ca... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
From: James Couzens
To: James Couzens
Subject: Sendmail Test
Date: June 30, 2004
testing
.
250 2.0.0 i5UCZFSV017746 Message accepted for delivery
quit
221 2.0.0 code3.codeshare.ca closing connection
Connection closed by foreign host.

I then check my mail...

Return-Path: <james@widgets.org>
Delivered-To: codeshare.ca-jcouzens@codeshare.ca
Received: (qmail 27438 invoked by uid 1006); 30 Jun 2004 12:35:43 -0000
Received: from unknown (HELO code3.codeshare.ca) (24.81.185.71) by data.codeshare.ca with SMTP; 30 Jun 2004 12:35:43 -0000
Received-SPF: neutral (data.codeshare.ca: domain of james@widgets.org is neutral about designating 24.81.185.71 as permitted sender)
Received-SPF: pass (code3.codeshare.ca: domain of james@widgets.org designates 127.0.0.1 as permitted sender) receiver=code3.codeshare.ca; client_ip=127.0.0.1; envelope-from=james@widgets.org;
Received: from localhost (localhost [127.0.0.1]) by code3.codeshare.ca (8.13.0/8.13.0-SPF) with SMTP id i5UCZFSV017746 for jcouzens@codeshare.ca; Wed, 30 Jun 2004 05:35:54 -0700
Message-Id: <200406301235.i5UCZFSV017746@code3.codeshare.ca>
X-Authentication-Warning: code3.codeshare.ca: localhost [127.0.0.1] didn't use HELO protocol
From: James.Couzens@code3.codeshare.ca
To: James@code3.codeshare.ca, Couzens@code3.codeshare.ca
Subject: Sendmail Test
Date: June 30, 2004
X-Spam-Flag: YES
X-Spam-Checker-Version: SpamAssassin 2.62 (2004-01-11) on data.codeshare.ca
X-Spam-Report: * 0.3 NO_REAL_NAME From: does not include a real name * 0.3 MY_HELO Sender did not HELO * 1.1 NO_DNS_FOR_FROM Domain in From header has no MX or A DNS records * 2.0 RCVD_IN_SORBS RBL: SORBS: sender is listed in SORBS * [24.81.185.71 listed in dnsbl.sorbs.net] * 2.5 RCVD_IN_DYNABLOCK RBL: Sent directly from dynamic IP address * [24.81.185.71 listed in dnsbl.sorbs.net]
X-Spam-Status: Yes, hits=6.2 required=4.5 tests=MY_HELO,NO_DNS_FOR_FROM, NO_REAL_NAME,RCVD_IN_DYNABLOCK,RCVD_IN_SORBS autolearn=no version=2.62
X-Spam-Level: ******
X-Evolution-Source: pop://jcouzens%40codeshare.ca@mail.uhfco.net/
Mime-Version: 1.0

Questions? Bugs?

E-Mail James Couzens <jcouzens@codeshare.ca>

Visit the libSPF developer forums @ http://forums.6o4.ca/

Subscribe to the libSPF Mailinglist by sending an E-Mail to:

libspf-subscribe@codeshare.ca

© 2004 James Couzens <jcouzens@codeshare.ca>