[Mimedefang] Run MIMEDefang in a Debug Mode to test SpamAassassin

Steffen Kaiser skmimedefang at smail.inf.fh-bonn-rhein-sieg.de
Fri Feb 22 03:02:37 EST 2008

Hash: SHA1

On Thu, 21 Feb 2008, Stephen Gurnick wrote:

> I discovered that if I take a piece of spam that got through and run it 
> through SpamAssassin manually using the command: "spamassassin -t < 
> spamemail" it will get marked appropriately as spam.

Most people forget that MIMEDefang runs as "the defang user", whatever 
you've configured it to and use another "local.cf", Kayne Kruse already 
pointed out.

> Is there a way to manually run MIMEDefang against a spam email in some kind 
> of a debug mode?  I am able to do this with SpamAssassin and verify that it

Yes. I've posted it some time ago, now I put it onto a page:

Actually I grew up hacking C, instead of Pascal or Modula, and lived the 
idea posted on http://www.eptacom.net/pubblicazioni/pub_eng/wirth.html 
almost at the end of the page:
  "But Tony, what is your answer if we frankly confess that we dearly love 
debugging? You want us to abandon our most cherished enjoyment?"

You can use the Perl debugger to examine your MIMEDefang filter.

There are timing considerations etc., but basically you can verify the 
program path manually, by carefully crafting the parameters for 
senderok/recipok or preparing the COMMANDS/INPUTMSG files. This has much 
more advantages over putting syslog's into the code and watch the myriads 
of lines. Of course, the timing is totally different. Because MIMEDefang 
does not support to pass information from pre-DATA- to DATA-phase 
functions in-filter, e.g. filter_sender => filter_begin, you can even 
simulate a complete SMTP dialogue by preparing the Work directory, then 
call dbgMimedefang with senderok, recipok, and finally without args.


- -- 
Steffen Kaiser
Version: GnuPG v1.4.6 (GNU/Linux)


More information about the MIMEDefang mailing list