Loading ...
Sorry, an error occurred while loading the content.

the automatic directory creation problem when using maildrop LDA

Expand Messages
  • Daniel Bromberg
    Hi all, I m puzzling over the various discussions on using Courier s maildrop as the local agent with Postfix. It plays well enough, but not...great. First its
    Message 1 of 5 , Jan 31, 2011
    • 0 Attachment
      Hi all,

      I'm puzzling over the various discussions on using Courier's maildrop as
      the local agent with Postfix. It plays well enough, but not...great.
      First its error messages are less than precise but you can get used to
      what they mean after a while. (I need it for SpamAssassin
      auto-directory-sorting.)

      But the basic problem is that with virtual users, the mail delivery
      directories are not automatically created on first use/need, as they are
      with
      Postfix's elegant but less featured 'virtual' delivery agent.

      I've been researching this on the web for two hours and can find only
      this as the best resource:
      http://anothersysadmin.wordpress.com/2007/11/29/maildrop-and-the-automatic-maildirmake-problem/

      It recommends inserting a shell script in the maildrop delivery pipeline
      that kicks in the directories if need be. Seems like there must be a
      better, less hacky way for such a common problem? Or is this life with a
      non-Postfix agent?

      The virtual users are created with Horde/PHP, so it's awkward and feels
      wrong to have PHP call a shell script to create mail directories
      whenever a new user is created through the Horde admin page. I feel like
      Horde should live entirely in MySQL and only needs to communicate with
      mail via its built-in IMAP client.

      Thoughts?

      -Daniel
    • Victor Duchovni
      ... E-Mail Account provisioning for a virtual user requires a variety of steps to be taken, to create authentication records, mail-store location records, ...
      Message 2 of 5 , Jan 31, 2011
      • 0 Attachment
        On Mon, Jan 31, 2011 at 07:58:30PM -0500, Daniel Bromberg wrote:

        > I'm puzzling over the various discussions on using Courier's maildrop as
        > the local agent with Postfix. It plays well enough, but not...great. First
        > its error messages are less than precise but you can get used to what they
        > mean after a while. (I need it for SpamAssassin auto-directory-sorting.)

        E-Mail Account provisioning for a virtual user requires a variety of
        steps to be taken, to create authentication records, mail-store location
        records, ... One of those steps should be the creation of the mailstore
        directory. If you create the directory when you create the account, you
        don't run into hassles trying to create on the fly.

        > The virtual users are created with Horde/PHP, so it's awkward and feels
        > wrong to have PHP call a shell script to create mail directories whenever a
        > new user is created through the Horde admin page. I feel like Horde should
        > live entirely in MySQL and only needs to communicate with mail via its
        > built-in IMAP client.

        Provisioning the email directory can be an IPC request to a directory
        provisioning service, ideally the IMAP server supports an operation
        to create the store for a user whose meta-data is present in the database.

        --
        Viktor.
      • Daniel Bromberg
        ... Good point. ... You know, as I rethought my last sentence just after sending, I was fuzzily starting to conclude that. It seems that Dovecot creates the
        Message 3 of 5 , Jan 31, 2011
        • 0 Attachment
          On 1/31/2011 8:06 PM, Victor Duchovni wrote:
          > On Mon, Jan 31, 2011 at 07:58:30PM -0500, Daniel Bromberg wrote:
          >
          >> I'm puzzling over the various discussions on using Courier's maildrop as
          >> the local agent with Postfix. It plays well enough, but not...great. First
          >> its error messages are less than precise but you can get used to what they
          >> mean after a while. (I need it for SpamAssassin auto-directory-sorting.)
          > E-Mail Account provisioning for a virtual user requires a variety of
          > steps to be taken, to create authentication records, mail-store location
          > records, ... One of those steps should be the creation of the mailstore
          > directory. If you create the directory when you create the account, you
          > don't run into hassles trying to create on the fly.
          Good point.
          >> The virtual users are created with Horde/PHP, so it's awkward and feels
          >> wrong to have PHP call a shell script to create mail directories whenever a
          >> new user is created through the Horde admin page. I feel like Horde should
          >> live entirely in MySQL and only needs to communicate with mail via its
          >> built-in IMAP client.
          > Provisioning the email directory can be an IPC request to a directory
          > provisioning service, ideally the IMAP server supports an operation
          > to create the store for a user whose meta-data is present in the database.
          >
          You know, as I rethought my last sentence just after sending, I was
          fuzzily starting to conclude that. It seems that Dovecot creates the
          minimum full structure upon login (it consults the same MySQL DB for
          credentials of course so that part is not a problem). Hence the Horde
          script should proxy as the first-time user connection with a simple
          imap_open() and imap_close(). Then with future spam arrival, maildrop
          is dynamic enough to handle this case directly in the rc file:

          if ( /^X-Spam-Status: Yes/ )
          {
          `test -d $HOME/Maildir/.Junk\ E-mail`
          if ( $RETURNCODE != 0 )
          {
          `logger -i -p mail.info "maildroprc: creating .Junk E-mail in
          $HOME"`
          `maildirmake $HOME/Maildir/.Junk\ E-mail`
          `echo "Junk E-mail" >> $HOME/Maildir/subscriptions`
          `chown vmail:mail $HOME/Maildir/subscriptions`
          `chmod 700 $HOME/Maildir/subscriptions`
          }
          to "Maildir/.Junk E-mail"
          }

          Daniel
        • mouss
          ... instead of `test ...`, use exceptions: if (/^X-Spam-Flag: s*YES/) { exception { to $_JUNK_DEST ; } `maildirmake ... && chmod .... && chmod ... & echo
          Message 4 of 5 , Feb 1, 2011
          • 0 Attachment
            Le 01/02/2011 02:37, Daniel Bromberg a écrit :
            > [snip]
            > if ( /^X-Spam-Status: Yes/ )
            > {
            > `test -d $HOME/Maildir/.Junk\ E-mail`
            > if ( $RETURNCODE != 0 )
            > {
            > `logger -i -p mail.info "maildroprc: creating .Junk E-mail in
            > $HOME"`
            > `maildirmake $HOME/Maildir/.Junk\ E-mail`
            > `echo "Junk E-mail" >> $HOME/Maildir/subscriptions`
            > `chown vmail:mail $HOME/Maildir/subscriptions`
            > `chmod 700 $HOME/Maildir/subscriptions`
            > }
            > to "Maildir/.Junk E-mail"
            > }


            instead of `test ...`, use exceptions:

            if (/^X-Spam-Flag:\s*YES/)
            {
            exception {
            to "$_JUNK_DEST";
            }
            `maildirmake ... && chmod .... && chmod ... & echo ...`
            to "$_JUNK_DEST";
            }

            this way, once the user has received a spam that caused the creation of
            the maildir, the 'test' is no more performed.

            you seem to use dovecot. then why use maildrop? can't you just use
            dovecot-lda with sieve? (dovecot can auto-create maildirs).
          • Daniel Bromberg
            ... Yes, thanks. I glanced at exceptions but was just glad to have something working. ... Finally, the right piece. I looked for a while for tools to work with
            Message 5 of 5 , Feb 1, 2011
            • 0 Attachment
              > instead of `test ...`, use exceptions:
              >
              > if (/^X-Spam-Flag:\s*YES/)
              > {
              > exception {
              > to "$_JUNK_DEST";
              > }
              > `maildirmake ...&& chmod ....&& chmod ...& echo ...`
              > to "$_JUNK_DEST";
              > }
              >
              > this way, once the user has received a spam that caused the creation of
              > the maildir, the 'test' is no more performed.

              Yes, thanks. I glanced at exceptions but was just glad to have something
              working.

              > you seem to use dovecot. then why use maildrop? can't you just use
              > dovecot-lda with sieve? (dovecot can auto-create maildirs).
              Finally, the right piece. I looked for a while for tools to work with
              Spamassassin and only found procmail and maildrop. I didn't think to
              explore Dovecot's secondary tools because conceptually, I had it boxed
              in as an IMAP service only, and not the final link in the SMTP chain.

              It felt wrong to have to run the Cyrus authentication daemon and a
              conceptually duplicate SQL config file just to help maildrop talk to my
              database.

              -Daniel
            Your message has been successfully submitted and would be delivered to recipients shortly.