I want to focus a bit on mod_smtpd design, in particular the protocol 
module (which accepts connections and does the E/SMTP talking). I've seen 
various ideas thrown around on what exactly the module should do. It would 
be nice if we could come up with at least the high level design specs for 
this, just so we're all on the same page about what the module will do and 
what facilities it will offer to external module users.

Talking with bfrance on IRC gave me a better sense of what other developers 
are hoping the smtp module can provide. The competing technology seems to 
be Sendmail's milter interface which allows developers to hook their custom 
filters into various stages of SMTP transactions. Anyone using mod_smtpd 
for filtering purposes will want to hook into various stages of the SMTP 
transaction - anywhere between start and end, or specific middle commands.

So let me throw this out there as a starting point because I don't think 
this has been documented yet?

The mod_smtpd protocol module accepts client connections and speaks E/SMTP, 
with default processing for all commands. e.g. it has a default greeting 
upon connection, a default response to EHLO/HELO, default accepts any 
envelop sender in MAIL FROM, default rejects any recipient in RCPT TO to 
prevent open relay configuration, etc.

However the module should provide several hooks to allow another module to 
use smtp. Off the top of my head, we need at least these hooks:

- upon connection from some client
        User might introduce delay, lookup IP for RBL, customize greeting
- upon receiving HELO/EHLO from client
- upon receiving MAIL FROM
- upon receiving RCPT TO
etc
- upon receiving other command like VRFY, RESET, NOOP
- upon receiving invalid command

I think this granularity is required. But I'm not sure about how the DATA 
hook would work? Among the two people who already have some code for smtp, 
are you coding something along these lines?


Reply via email to