[Dovecot] qmail-secretary plugin for dovecot deliver

Rajkumar S rajkumars at gmail.com
Tue Mar 16 08:37:41 EET 2010


I have a rough draft of group mail plugin. It's working here but
requires lot's more polishing work. I would be happy if this can be a
part of dovecot after all problems are ironed out.

The plugin uses the algorithm of qmail-secretary as mentioned in my
initial mail. To create a group qmailGroup object class has to be
present along with other object classes in ldap. Once qmailGroup
object class is present, the plugin will check for sender confirm,
members only, rfc822member,  rfc822moderator and rfc822sender

if it's a members only list, the envolop sender is checked to see if
it's not in rfc822sender or in moderator attributes, then the mail is
rejected with an error.

For sender confirmation and moderation requests a unique hash created
which is used to identify sender confirmations and moderator requests
mails when they come back.

else if sender confirmation is present a confirm mail is sent with the
format groupid-confirm-hash at domain.com as reply to address to the
envelope sender for confirmation. The original mail is saved in the
home directory with the name hash_c in group's home directory.

I had a problem when a reply from such a mail arrives. Since a mail
address in this format is not present in ldap, this mail is dropped.
So I patched userdb-ldap.c to remove the hash and action part before
lookup and restore it after ldap look up if the mail id format is like
groupid-action-hash at domain.com.

For example:
"auth_request->user" contains the mail-id which is to be looked up in
ldap. If the mail-id to be looked up is
group01-confirm-1234567890 at demo.com "auth_request->user" is cut short
to group01 at demo.com. After lookup the original mail-id is restored.
i.e auth_request->user" is set back to
group01-confirm-1234567890 at demo.com .

When a sender confirmation request arrives if the group is moderated a
moderator request mail is sent to all moderators with same format as
sender confirmation mails with action name as moderate, and the mail
in home directory is renamed from hash_c to hash_m.

When moderator reply also comes back the mail is sent to all members
of the list and is removed from group home directory.

Now the ugly (?) parts are:

I could not find out a way to read ldap credentials from conf file, so
right now it's hard coded in to the sources :( I am also doing a
direct ldap lookup from plugin, I am not sure if that is appropriate.
I would like to be able to use dovecot mechanisms to read conf and
values from conf file in a backend neutral way.

Also is it okay to create files like hash_c and hash_m to save
temporary mails in home directory? Any "proper"/"better" way to save a
file in mail box with a particular file name. (the file name is
important for retrieving the corresponding mail when a confirmation
arrives) The file also needs to be removed later if a confirmation
does not arrive in a specified time.

with regards,


On Thu, Feb 25, 2010 at 9:32 PM, Rajkumar S <rajkumars at gmail.com> wrote:
> Hi,
> I have been using qmail-ldap for quite some time and now moved to
> postfix/dovecot. One feature that I miss is that provided by
> qmail-secretary. qmail-secretary basically is a mail list manager with
> following features:
>  1 no limit, just explode to all members
>  2 members only, as the name says; only members are allowed (based
>     on envelope sender, so not very secure, everybody can fake that)
>  3 sender confirm, sender has to confirm submission and return address
>     like DJBs qmail-secretary
>  4 moderated, moderator(s) have to accept every message; there are
>     DN and RFC822 moderators
> All configuration (name, members, moderated etc...)  are taken from LDAP.
> I had gone through the code and from what I understand for each 4
> delivery types it works as follows:
> 1. Just deliver to all recipients (say, inject it via sendmail).
> 2. verify if envelope sender is in allowed list and proceed as above.
> 3. 1. create a random hash
>    2. save the mail in new/ with hash as filename
>    3. create a new mail with listname-confirm-hash at domain.com and send
>    4. If that mail comes back, deliver the mail to all recipients.
> 4. 1. as above but using listname-approve-hash and list-name-reject-hash
>    2. move the msg to cur/
>    3. if appropriate reply comes retrieve the mail from cur/ and send
> to all recipient.
> qmail-secretary is invoked by qmail-local and thus this is a nice
> candidate for a deliver plugin. Before I start coding I just want to
> check if  there is any gotchas that I am missing? I assume all these
> operations can be performed as a deliver plugin and that deliver
> plugin is the correct place for such functionality.
> It goes without saying that I would be contributing this plugin back
> to dovecot.
> with regards,
> raj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dovecot-group.tar.gz
Type: application/x-gzip
Size: 11313 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20100316/06aa5d2b/attachment-0001.gz 

More information about the dovecot mailing list