Attached are my procmail rc file and my postfix master config file.  "proccyrus"
is the transport I use.  Hope it helps.

C

dman wrote:

d> On Wed, May 29, 2002 at 10:34:50AM -0700, Paul Bauer wrote:
d> | I am currently trying to hand mail from
d> | postfix->procmail->SA->cyrus.
d>
d> A better diagram would be :
d>
d> postfix->procmail ->cyrus.
d>            |^
d>            ||
d>            v|
d>            SA
d>
d> | For the most part I have the first steps working fine.  Once the
d> | mail is tagged as spam though I cannot seem to get the mail
d> | delivered.
d>
d> I don't use cyrus (or procmail), but if you set it up this way then
d> you can submit the SA-tagged message to cyrus the way you usually do
d> (from procmail).

#################################################
# procmailrc
# you must explicitly set a path if you're gong to be spawing programs
PATH=/usr/cyrus/bin:/bin:/usr/bin:/usr/local/bin
SHELL=/bin/bash
LOGFILE=/tmp/cyrus.$CYRUSER.log
DELIVERMAIL=/usr/cyrus/bin/deliver
HOME=/home/$CYRUSER

###############################
# If users want to be able to define their own private recipes
# and put them in their home .procmailrc files, comment out
# the next definition.
#
# These recipes will be processed BEFORE the user-specific
# recipes that are kept in the /home/cyrus directory
#
#INCLUDERC=/home/$CYRUSER/.procmailrc

EXITCODE=

#Virus scanning stuff
TEMPORARY=/tmp/pmail.$$

:0c
$TEMPORARY

# First check if there is a virus
:0
* ? /usr/local/bin/f-prot -silent -ai -packed -archive ${TEMPORARY}
{
  VIRSCAN=`echo $?;rm -f $TEMPORARY`
}

# Now if *not* result was zero then re-run and extract virus data
:0E
{
   VIRSCAN=`/usr/local/bin/f-prot -ai -packed -archive $TEMPORARY | sed -n -e 
"s/^.*Infection:\(.*$\)/\1/p"`
   :0fw
   |formail -f -i "`<$TEMPORARY formail -X Subject | sed -e "s/^\(subject:[     
]*\)/\1***VIRUS***/i"`";rm -f $TEMPORARY
}

:0fw
|formail -f -I "X-Virus-Found: $VIRSCAN"

#End virus scanning stuff

# apply spam assassin
:0fw
| /usr/bin/spamc -f -u $CYRUSER

# Now try delivery
:0w
| $DELIVERMAIL -e -q $CYRUSER

# If at first you don't succeed...
:0 ew
| $DELIVERMAIL -e -q $CYRUSER

# Otherwise return the error code
:0 e
{
        EXITCODE=$?
}
#
# Postfix master process configuration file.  Each line describes how
# a mailer component program should be run. The fields that make up
# each line are described below. A "-" field value requests that a
# default value be used for that field.
#
# Service: any name that is valid for the specified transport type
# (the next field).  With INET transports, a service is specified as
# host:port.  The host part (and colon) may be omitted. Either host
# or port may be given in symbolic form or in numeric form. Examples
# for the SMTP server:  localhost:smtp receives mail via the loopback
# interface only; 10025 receives mail on port 10025.
#
# Transport type: "inet" for Internet sockets, "unix" for UNIX-domain
# sockets, "fifo" for named pipes.
#
# Private: whether or not access is restricted to the mail system.
# Default is private service.  Internet (inet) sockets can't be private.
#
# Unprivileged: whether the service runs with root privileges or as
# the owner of the Postfix system (the owner name is controlled by the
# mail_owner configuration variable in the main.cf file).
#
# Chroot: whether or not the service runs chrooted to the mail queue
# directory (pathname is controlled by the queue_directory configuration
# variable in the main.cf file). Presently, all Postfix daemons can run
# chrooted, except for the pipe and local daemons. The files in the
# examples/chroot-setup subdirectory describe how to set up a Postfix
# chroot environment for your type of machine.
#
# Wakeup time: automatically wake up the named service after the
# specified number of seconds. A ? at the end of the wakeup time
# field requests that wake up events be sent only to services that
# are actually being used.  Specify 0 for no wakeup. Presently, only
# the pickup, queue manager and flush daemons need a wakeup timer.
#
# Max procs: the maximum number of processes that may execute this
# service simultaneously. Default is to use a globally configurable
# limit (the default_process_limit configuration parameter in main.cf).
# Specify 0 for no process count limit.
#
# Command + args: the command to be executed. The command name is
# relative to the Postfix program directory (pathname is controlled by
# the program_directory configuration variable). Adding one or more
# -v options turns on verbose logging for that service; adding a -D
# option enables symbolic debugging (see the debugger_command variable
# in the main.cf configuration file). See individual command man pages
# for specific command-line options, if any.
#
# In order to use the "uucp" message tranport below, set up entries
# in the transport table.
#
# In order to use the "cyrus" message transport below, configure it
# in main.cf as the mailbox_transport.
#
# SPECIFY ONLY PROGRAMS THAT ARE WRITTEN TO RUN AS POSTFIX DAEMONS.
# ALL DAEMONS SPECIFIED HERE MUST SPEAK A POSTFIX-INTERNAL PROTOCOL.
#
# DO NOT CHANGE THE ZERO PROCESS LIMIT FOR CLEANUP/BOUNCE/DEFER OR
# POSTFIX WILL BECOME STUCK UP UNDER HEAVY LOAD
#
# DO NOT CHANGE THE ONE PROCESS LIMIT FOR PICKUP/QMGR OR POSTFIX WILL
# DELIVER MAIL MULTIPLE TIMES.
#
# DO NOT SHARE THE POSTFIX QUEUE BETWEEN MULTIPLE POSTFIX INSTANCES.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (50)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
#smtps     inet  n       -       y       -       -       smtpd -o 
smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#submission inet n       -       y       -       -       smtpd -o 
smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
pickup    fifo  n       n       n       60      1       pickup
cleanup   unix  -       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       n       300     1       nqmgr
tlsmgr    fifo  -      -        n       300     1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
flush     unix  -       -       n       1000?   0       flush
smtp      unix  -       -       n       -       -       smtp
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
cyrus     unix  -       n       n       -       -       pipe
    flags=R user=cyrus argv=/usr/cyrus/bin/deliver -e -m ${extension} ${user}
proccyrus   unix        -       n       n       -       -       pipe
    flags=R user=cyrus argv=/usr/bin/procmail -p /etc/procmailrc.cyrus CYRUSER=${user} 
EXTENSION=${extension}
uucp      unix  -       n       n       -       -       pipe
    flags=F user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail    unix  -       n       n       -       -       pipe
    flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
    flags=F. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient

Reply via email to