procmail
[Top] [All Lists]

Re: Procmail "Renaming bogus 'x' into 'x'" option

1999-02-28 20:54:30
Andrew_Mak(_at_)nag(_dot_)national(_dot_)com(_dot_)au writes:
We are using procmail v3.11pre7 to replace the mail.local that comes with
Solaris 2.5.1. The main reason for this is our /var/mail/ directory is a
NFS and we want the local root mail be sent to /Mail/mbox instead of the
default /var/mail/root. Procmail does this beautifully.

However, a side effect is that when a mail is sent to root, procmail rename
the /var/mail/root to /var/mail/BOGUS.???, this causes a major problem
because the root for the NFS server are still having mail send to this file
and this server is not look after by us.

Therefore, could anyone please send me some info. on how to disable this
feature of procmail? Being not an expert on sendmail/procmail, I would much
appreciate if the answer could be precise in syntax. I can be reach on
amak(_at_)nag(_dot_)national(_dot_)com(_dot_)au

Actually, my first suggestion is to add an alias for root pointing to
some other account, and _never_ read email as root.  Good sysadmin
practice is to do as little as root as possible.  Reading email is
generally considered too much.

However, the security and maintainability of your system is your problem,
not mine, so you can do whatever you want.

Anyway, the correct way to handle things like this is to actually
change procmail's idea of where root's mailspool is.  To do this, edit
src/authenticate.c and put in an exception for root.  For example, you
could change the beginning of auth_mailboxname() to read:

const char*auth_mailboxname(pass)auth_identity*const pass;
{ if(!pass->mbox)
#ifdef MAILSPOOLHOME
   { static const char mailfile[]=MAILSPOOLHOME;size_t i;
     if(!(pass->mbox=malloc((i=strlen(pass->pw->pw_dir))+STRLEN(mailfile)+1)))
        return "";
     strcpy(pass->mbox,pass->pw->pw_dir);
     strcpy(pass->mbox+i,mailfile);
#else
   { static const char mailspooldir[]=MAILSPOOLDIR;
     if(!strcmp(pass->pw->pw_name,"root"))                            /* new */
      { static const char rootspool[]="/Mail/mbox";                   /* new */
        if(!(pass->mbox=malloc(STRLEN(rootspool))))                   /* new */
           return "";                                                 /* new */
        return strcpy(pass->mbox,rootspool);                          /* new */
      }                                                               /* new */
     if(!(pass->mbox=malloc(
      STRLEN(mailspooldir)+MAILSPOOLHASH*2+strlen(pass->pw->pw_name)+1)))
        return "";
    .....etc

Compile, install, then zorch the assignment to DEFAULT in root's
.procmailrc


Philip Guenther

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