Opened 10 years ago

Last modified 6 years ago

#215 new enhancement

Use LDAP to determine whether users receive mail

Reported by: mitchb Owned by:
Priority: normal Milestone:
Component: mail Keywords:
Cc:

Description (last modified by adehnert)

We presently queue mail for locker@… when a locker isn't signed up for the mail_scripts service because the only way to determine that is to check for existence of /mit/locker/mail_scripts/procmailrc, and we could mistakenly conclude that the file doesn't exist and drop users' mail during an AFS issue.

We should modify our LDAP schema to store a boolean for whether a user should receive mail. We should default this to "false" for new accounts, and set it to "true" when a user runs signup-mail. For existing users, we should set it to "true" for anyone with a procmailrc and "false" for everyone else (unless they're specially handled in /etc/aliases or something). We should then either get Postfix or procmail to check this value and discard mail immediately if it's false.

This will alleviate much of our mail queue growth issue.

See the following zlogs for more discussion:

  • /mit/sipbzlog/scripts-by-instance/mail (Jun 25 2011)
  • /mit/sipbzlog/scripts-by-instance/mailq[.d] (Jul 15 2011)
  • -c scripts -i mail_scripts (Oct 30 2012) (an -c scripts-root -i mail concurrently)

Change History (5)

comment:1 Changed 10 years ago by adehnert

  • Component changed from web to mail

comment:2 Changed 8 years ago by adehnert

  • Description modified (diff)

comment:3 Changed 8 years ago by adehnert

From zephyr (from adehnert, -c scripts -i mail_scripts Oct 31 2012):

re mailbox_command: http://www.postfix.org/local.8.html references sysexits.h for return values. http://man.cx/sysexits%283%29 suggests that if we return EX_NOUSER for "not signed up for mail_scripts" and EX_TEMPFAIL for "we can't access AFS", we should be happy. Maybe. We could either use a flag in LDAP, or assume that if the locker root exists and mail_scripts doesn't, that it's a permanent failure.

comment:4 Changed 8 years ago by adehnert

There is a sense that, yes, this does really need to be LDAP, and that the AFS cache manager permits arbitrarily weird mixtures of existence files and missing files in a volume.

The LDAP scheme is presumably something like:

  1. Add a field to the LDAP user record for "signed up for mail scripts" or so
  2. Loop over all current users, checking for mail_scripts existence and populated that field with true if mail_scripts exists
  3. Modify signup-mail or whatever to set that bit
  4. Make postfix or mailbox_command check the bit to determine delivery

comment:5 Changed 6 years ago by andersk

Ooh! We can configure mailbox_command_maps to tell Postfix to retrieve a per-recipient command from LDAP. Then we disable the global mailbox_command and, for users that sign up for mail_scripts, set their command in LDAP to /usr/bin/procmail -t -a "${EXTENSION}" ~/mail_scripts/procmailrc.

We could even allow users to further customize their command, in case they don’t want to use procmail—because who wants to use procmail.

Note: See TracTickets for help on using tickets.