On 2011-03-10 22:41:03 -0500, Chris Lewis wrote:
> On 3/10/2011 12:43 PM, Ask Bjørn Hansen wrote:
>>
>> On Mar 10, 2011, at 6:49, Matt Sergeant wrote:
>>
>>> Should we have plugins/qmail and plugins/postfix dirs?
>>
>> I like that idea.
>
> I think we'd be better served by coming up with, for example, a "qpsmtpd  
> way" of doing this sort of thing.

I've been thinking about this recently again (mainly because I have a
need to get recipient addresses from several sources) and I came up with
this:

There are 3 basic kinds of plugins which hook into the rcpt hook:

1) Plugins which determine whether the recipient is valid.
   This can be as simple as marking everything as valid if relayclient
   is set, or it can lookup the address in a file, a database, LDAP,
   whatever. 
   These plugins stick an address note onto $recipient to mark the
   address as valid. In addition, they may stick lots of other address
   notes on $recipient to indicate per-recipient configuration (e.g.,
   expansion of aliases, spam-filters, ...)
   They always return DECLINED.

2) Filters which can work in a rcpt hook, e.g., RBLs, greylisting, etc.
   These usually get their config from the address notes added by the
   type 1 plugins.
   They may return OK/REJECT, or they may just add/modify the address
   notes to record their findings and return DECLINED.

3) Finally, there is a simple plugin which only checks if the the
   recipient has been marked as valid and returns OK or REJECT.


This is similar to the scheme I am currently (still) using and which I
described before (a few years ago). The main difference is that in the
old scheme each plugin could only restrict the recipients by returning
REJECT (so there could really only be one type1 plugin), while in the
new scheme it can expand them by setting the "valid" note (so there can
be several type 1 plugins).

What needs to be done to make this generally useful is determine a few
generally useful address notes so that plugins written by different
people can work together.

I suggest:

 deliver_to:
   A string with a comma-separated list of addresses
   (or maybe an arrayref of Qpsmtpd::Address objects).
   If this is not set or empty then the recipient is not valid.
   If it is set, it should be expanded shortly before queuing.
 valid:
   True if the recipient is valid. (This is a bit redundant
   if we have deliver_to. It avoids conflating the concepts of validity
   and alias expansion, though, so maybe having both is cleaner)
 whitelisted:
   Skip all spam filters. (Personally I think this is too broad a brush,
   but several plugin authors seem to like a general whitelisting switch
   so I'm including it)

        hp

-- 
   _  | Peter J. Holzer    | Web 2.0 könnte man also auch übersetzen als
|_|_) | Sysadmin WSR       | "Netz der kleinen Geister".
| |   | h...@hjp.at         | 
__/   | http://www.hjp.at/ |  -- Oliver Cromm in desd

Attachment: signature.asc
Description: Digital signature

Reply via email to