procmail
[Top] [All Lists]

Re: procmail delievering mail

2000-04-07 13:17:03
"Riser" <dzarm(_at_)iini(_dot_)net> writes:
I was looking at a bunch of faqs and all over procmails site and couldnt
find how to make procmail deliever to user home directories and not to
/var/mail/$LOGIN. Im guessing its something in the /etc/procmailrc but i
cant find a list of commands for the file. If anyone knows a good procmail
site or a good how to id like to know.  Thanks for any info you can give.

Brian

You can  make use of the procmailrc file.It needed to be created by
youself, and generally its location is /etc directory.If you want to
deliever mail to user home directory instead of /var/mail/$LOGIN,you
can add this in your procmailrc file:
 MAILDIR=$HOME
 DEFAULT=$MAILDIR/mbox
 ORGMAIL=$MAILDIR/mbox
 LOCKFILE=$HOME/.lockmail

There's a fundamental problem with the above recommendation: you have
lied to procmail.  When you compiled procmail you told it that
mailspools could be found under /var/mail.  Before it even opens the
/etc/procmailrc file, procmail makes several security and permission
checks on what _it_ thinks the mailspool file for the given user is.
You have therefore *lost* those security benefits.  You'll probably also
notice that /var/mail contains a zero length file for each user, and
that they are recreated if you remove.  If you lie to the system, it
will get its revenge.

Also, procmail does not always read the /etc/procmailrc file, depending
on the flags it was invoked with.

The correct way to change procmail's idea of the mailspool location is
to adjust the #defines MAILSPOOLHOME, MAILSPOOLHASH, and/or
MAILSPOOLDIR.  In this case, setting MAILSPOOLHOME to "/mbox", either in
the config.h or at the top of the src/authenticate.c file is
sufficient.  Then recompile, reinstall, and remove the /etc/procmailrc
file.


I'll note that the MAILDIR assignment in the above is the default
anyway, while the LOCKFILE assignment mainly has the effect of slowing
down mail delivery and increasing the load on the mail server for no
reason I can see.


Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>