[SA-exim] INSTALLing this way and that

Marilyn Davis marilyn at deliberate.com
Tue Jul 1 14:21:30 PDT 2003


OK!  I did the build method #2 and made a little coding change and it
works and it *is* a great way to modify quickly and easily.

I have a few suggestions for the INSTALL document:

> CONFIGURING SPAMASSASSIN
> ------------------------
> For all this to work correctly, your global spamassassin config should have:
> 
> # Put report in the headers
> report_header                   1

report_header causes a complaint if you run spamd -D (which keeps
spamd in the forground and outputs debug messages).  It doesn't hurt
anything but doesn't do anything either -- as far as I can tell.

> 
> BUILDING
> --------
> The code can be compiled in two ways:
> 
> 1) Unpack exim 4.11 or better, and overwrite src/local_scan.c with 

sa-exim.c.

Edit your src/local_scan.c, which is now a copy of sa-exim.c:

#define SPAMASSASSIN_CONF "path/to/your/config-file-for-sa-exim"

Rebuild exim, and you're done.

However, if you ever want to modify or update the local_scan function,
you will be glad you instead built a dynamically loaded library for
your local_scan so you don't have to keep compiling exim.  Build method
#2 tells you how.

2) In the directory where you run make for exim, do this:

patch -p1 < path-to-sa-exim-localscan_dlopen.patch-in-this-directory

This patches exim's src/EDITME, amongst other things.

Now fix up the patched src/EDITME to be your Local/Makefile for exim,
making all the modifications you need for exim.

Rebuild exim.

In this sa-exim directory, fix up sa-exim's Makefile so that EXIM_SRC
points to exim's src directory; so that SACONF points to your
configuration file for sa-exim; and so that SPAMC points to your spamc
executable.

Run make here to build your sa-exim library.

Copy the resulting sa-exim-x.x.so file someplace convenient, maybe
/usr/lib/exim4/local_scan/sa-exim-x.x.so

And in your exim configuration file, make local_scan_path point
to your copied sa-exim-x.x.so, for example:

local_scan_path = /usr/lib/exim4/local_scan/sa-exim-x.x.so

kill SIGHUP your exim pid and you're set.

When you modify your local_scan function (in sa-exim.c), just run make
here and copy the sa-exim-x.x.so to your local_scan_path.  And that is
all, you are running your new code.  You don't even need to SIGHUP
your exim daemon.

-----

Hope this helps.

Thank you again.

Marilyn




>    sa-exim-x.y.c. Rebuild exim, and you're done.
>    Note that if you do this, you are responsible for modifying variables
>    in sa-exim.c that would normally have been modified by the Makefile.
> 
> 2) The better solution is to patch exim with localscan_dlopen.patch originally
>    from David Woodhouse (provided in this archive), and rebuild exim.
>    After that you can edit EXIM_SRC in the Makefile and build sa-exim-x.y.so
>    I have however modified the build environment so that you can now build
>    sa-exim without having the exim sources. 
> 
>    You can look in eximinc/version to see which source I included. While this
>    should work for the forseable future, the exim local_scan API might change
>    one day and not building against the current exim sources could cause issues
>    (hopefully, at worst it will prevent sa-exim from using better functions in
>    newer versions of the local_scan API).
>    To be really safe, I modified the localscan_dlopen patch to include a
>    minor and major version number for the API. Philip has agreed to including
>    the piece of the patch that says which version of the API exim is using,
>    so it will be obvious in the future whether exim become potentially
>    incompatible with an older version of sa-exim. Note that when Philip adds
>    this small portion of the patch, you will have a resulting conflict if
>    you try to apply it again. This is obviously normal, just remove it :-)
> 
>    Once you're done building, you can copy sa-exim-x.y.so and optionally the
>    dummy/test accept.so in /usr/lib/exim4/local_scan/, and add this to your
>    exim4.conf:
>    #local_scan_path = /usr/lib/exim4/local_scan/accept.so
>    local_scan_path = /usr/lib/exim4/local_scan/sa-exim.so
> 
>    If you are a package builder, note too that you don't actually have
>    to edit the values in the Makefile, you can override them as such:
>    make SACONF=/etc/mail/sa-exim.conf LDFLAGS="-shared -fPIC"
> 
> 
> The following is mostly obsolete, but left here for info purposes
> -----------------------------------------------------------------
> I would also recommend to edit exim/src/config.h.defaults as such:
> #define STRING_SPRINTF_BUFFER_SIZE 32768
> The default value is a bit too small for some of the strings that we need to
> expand from SA.
> That said, I found out that exim then complaints that the headers
> it tries to add are too big even after I set "uschar buffer[32768];" in
> src/header.c.
> As a result, I haven't quite found out how to deal with more than 8KB worth
> of SpamAssassin headers, but it may not be a huge deal, 8KB headers are too
> long anyway. 
> I asked the SA guys not to output such huge headers and I wrote a patch
> to disable one of the "features" that outputs such huge headers.
> See: http://bugzilla.spamassassin.org/showattachment.cgi?attach_id=195
> This is included and turned on by default in Spamassassin 2.40 and later.
> 
> 
> INSTALL
> -------
> Copy spamassassin.conf to /etc/exim4 (or whatever you set SACONF to),
> and make sure to read it and edit the values to suit your environment.
> So that you don't make any mistakes, SAEximRunCond is turned off by default.
> This should force you to scan the docs before potentially shooting yourself
> in the foot :)
> 
> See README for options
> 
> 





More information about the SA-Exim mailing list