A question about Milters and Thread Safety

From: Ronald F. Guilmette (no email)
Date: Mon Sep 03 2007 - 14:17:19 EDT

  • Next message: Wietse Venema: "Re: smtpd(8) stress behaviour, disconnect on 5XX ???"

    Greetings again friends,

    Not long ago, I completed a rather simple sort of rate-limiting
    external policy server for Postfix. I would have preferred to
    create this as a "milter" type program, but I was substantially
    put off by the assertion, on the Sendmail-related page describing
    the milter interface, that milter programs had to be thread-safe.
    (Writing thread-safe code is not my strong suit, and I've been
    afraid that it would be quite difficult... especially for something
    like my rate-limiter, which needs to access an external database,
    and so forth.)

    Anyway, recently I got to wondering: Do milter programs that are
    only going to be used in conjunction with Postfix (and _not_ any
    other kind of mail server, e.g. Sendmail) really need to be thread-
    safe?

    I suspect that the answer is "no" simply because from what little
    I know about Postfix I have inferred that it actually doesn't use
    threads... preferring instead to just pre-fork multiple/numerous
    smtpd _processes_ as and when needed, rather like Apache.

    If I can develop milters for use with Postfix _without_ having to
    worry about making them thread safe, then that would simplify the
    task quite a lot, I think. (And I have more that just a rate-limiter
    in mind here. I also have a pretty nice spam filter of my own design
    that's currently set up to be invoked at mail delivery time, e.g.
    via a ~/.forward file. But if I could turn that into a milter easily
    also, then quite obviously, that would be terrifically useful, because
    spam could then be rejected much sooner, i.e. at reception time,
    rather than being delayed until delivery time.)

    Regards,
    rfg


  • Next message: Wietse Venema: "Re: smtpd(8) stress behaviour, disconnect on 5XX ???"





    Hosted Email Solutions

    Invaluement Anti-Spam DNSBLs



    Powered By FreeBSD   Powered By FreeBSD