procmail
[Top] [All Lists]

/etc/procmailrc sets sets root ownership?

2004-10-19 22:25:59
Hi,

A few weeks back I asked about setting up a global /etc/procmailrc to
manage spam/virus filtering prior to individual users ~/.procmailrc
configurations being run. It is working fine except that when it puts
mail in the user's home directories, it sets the ownership to
root:mail, which breaks many user email clients (e.g. Thunderbird,
Sylpheed, Sylpheed-Claws, and Kmail). 

Is there a way to have the global promailrc rules - when called by
default by a user's procmail - set the ownership of mail it moves to
that of the user? I've included the /etc/procmailrc file I'm using
below. Note that any mail moved by these rules shows up properly in
the mail directory where it's supposed to, but the ownership:group is
root:mail rather than <some>:users 

Thanks,

--Jeff



MAILDIR=${HOME}/.maildir
DEFAULT=${MAILDIR}/
ADMINFOLDER=${MAILDIR}/.admin/          # for bounced mail, mail from root, etc.
BULKFOLDER=${MAILDIR}/.bulk/
LINEBUF=4096                            # keeps procmail from choking on long 
recipes
LOGFILE=${HOME}/procmail.log
VERBOSE=on
LOCKEXT=.lock
## Note: courier-imap requires folders to start with '.'

## This is a debug backup
:0c
${HOME}/.backup-mail/

## Are we retraining spam filters? If so, lets take care of that before
## anything else and quit. In this case, postfix should have been
## called 
## with $1 set to "retrain"
ARG1=$1
:0
* ARG1 ?? retrain
{
    ## First strip any spam filter markup tags
    :0f
    | sed -e '/^X-Bogosity:/d' \
          -e '/^X-Filtered/d' \
          -e '/^X-RenAttach-Info:/d' \
          -e '/^X-SpamProbe:/d'
    ## Retrain spamprobe and put a copy into missed directory for stats
    :0
    SCORE=| spamprobe spam
    :0c
    .spam.missed-by-probe/
    ## Retrain bogofilter and move it into missed directory for stats
    :0
    SCORE=| bogofilter -Ns
    :0
    .spam.missed-by-bogo/
}

##  "remove" : removes ham from database all together
:0
* ARG1 ?? remove
{
    ## First strip any spam filter markup tags
    :0f
    | sed -e '/^X-Bogosity:/d' \
          -e '/^X-Filtered/d' \
          -e '/^X-RenAttach-Info:/d' \
          -e '/^X-SpamProbe:/d'
    ## Remove words from spamprobe 
    :0
    SCORE=| spamprobe remove
    :0c
    .ham.removed/
    ## Retrain bogofilter and move it into missed directory for stats
    :0
    SCORE=| bogofilter -S
    :0
    /dev/null
}

## Regenerate "From" lines to make sure they are valid
## Note: this is equivalent to calling procmail with -f- flag
## But not all my mail comes through procmail, so I still do it.
#:0 fhw
#| /usr/bin/formail -I "From " -a "From "

##
## Make a backup of all email below
:0c
.backup/

:0
* ^Subject:.*[Cc]ron
.crons/

## Run through renattach to remove dangerous attachments
##
:0fw
| renattach 
:0
*^X-Filtered-0:.*PLEASE NOTE
.virus.renattach/

##
## Run spamprobe on it here
## In 'receive' mode, it updates its database based on classification
## To only update 'difficult' classifications, use 'train' mode.
:0
SCORE=| spamprobe -h -H all -M -o suspicious-tags -X receive 
:0 wf
| formail -I "X-SpamProbe: $SCORE"
:0 a:
*^X-SpamProbe: SPAM
.spam.probe-caught/

## 
## Run bogofilter on what passes through spamprobe
## Update its database with its own results. Errors will have to be 
## corrected later by running them through again with appropriate
## correction flags. 
:0fw
| bogofilter -u -e -p
# if bogofilter failed, return the mail to the queue, the MTA will
# retry to deliver it later
# 75 is the value for EX_TEMPFAIL in /usr/include/sysexits.h
:0e
{ EXITCODE=75 HOST }
:0
* ^X-Bogosity: Yes
.spam.bogo-caught/

## The  following example preconverts all plain-text mail arriving in cer-
## tain encoded MIME formats into a more compact 8-bit format which can be
## used and displayed more easily by most programs.  The mimencode(1) pro-
## gram is part of Nathaniel Borenstein's metamail package.
:0
* ^Content-Type: *text/plain
{
 :0 fbw
 * ^Content-Transfer-Encoding: *quoted-printable
 | mimencode -u -q

 :0 Afhw
 | formail -I "Content-Transfer-Encoding: 8bit"

 :0 fbw
 * ^Content-Transfer-Encoding: *base64
 | mimencode -u -b

 :0 Afhw
 | formail -I "Content-Transfer-Encoding: 8bit"
}




____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail