[Exim] Viral hooks

Góra strony
Delete this message
Reply to this message
Autor: Nigel Metheringham
Data:  
Dla: exim-users
Temat: [Exim] Viral hooks
I've been giving a little thought to ways of adding hooks for
operations such as virus scanning with the following contraints:-
- not intending to change mail (ie edit headers/bodies)
- reasonably general
- reasonably easy to implement
- understandable :-)


I've been wondering about having a filter operation *similar* to piping
but subtly different, used something like this:-

cmdprocess /path/to/cmd [args...]

This runs /path/to/cmd at the time that the filter processing is done
(unlike filter pipes which setup piped deliveries for later), with the
message on stdin (I would like an option for not having the msg on
stdin because in some cases it will unproductive) and a standard set of
environment variables *including* the spool file names (or probably the
spool file name without -H or -D) for programs that play fast and
loose. [The files would be locked whilst this is running so thats OK]

The return status is put into a numeric variable (could use an
existing, in which case add the variable name prior to the cmd path -
I've assumed a fixed $cmdret), and any generated text appears in
another variable - say $cmdtext.

I could use this something like:-

    if first_delivery then
    cmdprocess /usr/sbin/vscanner
    if $cmdret is above 1 then
        fail "Virus infested - $cmdtext"
    else if $cmdret is above 0 then
        freeze "Filter suspicious - $cmdtext"
         endif
    endif
    endif


This could even be used in user filter files, although with more
interesting effects :-)

    Nigel.
-- 
[ - Opinions expressed are personal and may not be shared by VData - ]
[ Nigel Metheringham                  Nigel.Metheringham@??? ]
[ Phone: +44 1423 850000                         Fax +44 1423 858866 ]