procmail
[Top] [All Lists]

Re: Verbose Logging Changed?

2010-07-24 07:36:18
I apologize for not placing the entire recipe.  I was trying to be
succinct.  I have placed it below.  I have also placed "VERBOSE=YES"
in the recipe and it delivered the mail but kicked back an error
message.  See below:

# $Id: .procmailrc.anti-gifspam 2006-Nov-18 15:11 $

  SHELLMETAS                    #  unset, for better error messages
  SHELL       = '/bin/sh'
  VERBOSE=YES

  LINEBUF     = 4096
  LOGABSTRACT = 'all'
  MAILDIR     = '/home/USER/mail/DOMAIN/siteadmin'
  DEFAULT     = 'new'

# disable next line to get procmail's logging on stderr
  LOGFILE     = "$_.log"

  LOG         = '~
'

  GIFBOX                = '.spam/'      #  IMAP-oriented, see delivery
  THBILLS               = '.thbills/'
  BILLS                 = '.bills/'
  BLACKLIST             = '.spam/'
  CTGUY                 = '.ctguy/'
  HCDMCT                = '.hcdm-ct/'
  FLYERS                = '.flyers/'
  NEWSLETTERS           = '.news/'
  SCHOOL                = '.school/'
  SPAMASSASSIN          = '.spam/'
  SPAMASSASSINBAD       = '.spambad/'


#------------------------------------------------------------
# set some globals
#------------------------------------------------------------

  t = ' '                       #  only a TAB, like "\t"
  b = "[ $t]"                   #  [[:blank:]]
  n  = '
'                               #  only an LF, like "\n"

  a  = '[0-9A-Za-z]'            #  [[:alnum:]]
  a2 = "$a$a"    a3  = "$a2$a"
  a4 = "$a2$a2"  a6  = "$a4$a2"
  a8 = "$a4$a4"  a12 = "$a8$a4"

  x  = '[0-9A-Fa-f]'            #  [[:xdigit:]]
  x2 = "$x$x"    x3  = "$x2$x"
  x4 = "$x2$x2"  x6  = "$x4$x2"
  x8 = "$x4$x4"  x12 = "$x8$x4"


#------------------------------------------------------------
#  Dump Mail with Word Sexually
#------------------------------------------------------------

  :0
  * ^Subject: .*SEXUALLY.*
  /dev/null


#------------------------------------------------------------
#  Save All Raw Data to a Folder
#------------------------------------------------------------

  :0c
  .raw/


#------------------------------------------------------------
#  dump all blacklisted to addresses
#------------------------------------------------------------

  :0
  * ?       [ -s $HOME/.procmailrecipes/siteadmin/siteadmin-blacklist.txt ]
  * ? fgrep -iqf $HOME/.procmailrecipes/siteadmin/siteadmin-blacklist.txt
  /dev/null


#------------------------------------------------------------
#  collect some message parameters
#------------------------------------------------------------
  :0
  *  ^^(From |Return-Path: <)[^ @]+(_at_)\/[^ >]+
  { ENV_DOMAIN = $MATCH }       #  domain part of the Envelope-From

  :0
  * 1^1 ^Received:
  { } N_RCVD = $=               #  number of Received header fields

  :0
  * ^Received: from \/[^ ]+
  { R1_HOST = $MATCH }

  :0
  * ^Content-Type: multipart/related;.*\
           boundary=(\")?\/[^\"]+
  { H_CTB = $MATCH }  #  primary MIME boundary

  :0
  *  ^Message-ID:.*\/[^ <@]+(_at_)[^>]+
  { H_MID = $MATCH
    :0
    *  H_MID ?? ^^\/[^(_at_)]+
    {  MID1 = $MATCH }          #  volatile part of the Message-ID
    :0
    *  H_MID ?? @\/.+
    {  MID2 = $MATCH }          #  FQDN part of the Message-ID
  }
  LOG = "<${H_MID}> ${N_RCVD}$n"

#------------------------------------------------------------
#  catch gifspam
#------------------------------------------------------------
  :0

# if the number of Received header fields is 1 or 2
  *  N_RCVD ?? ^^(1|2)^^

# and it is a multipart message
  *  ^MIME-Version: 1\.0\
     ^Content-Type: multipart/

# and the MIME boundary matches some regex
  *$ H_CTB  ?? ^^----=_NextPart_000_${x4}_${x8}\.${a8}^^

  {
    :0

  # if the FQDN part of the Message-ID does not contain a dot
  # or ends in the domain part of the Envelope-From
    *$ MID2 ?? (^^[^.]+|$\ENV_DOMAIN)^^

  # and part of the message body matches some regex
    *$ B ?? ^--$\H_CTB\
            ^Content-Type: image/(gif|jpe?g|png);\
            ^${b}+name=\"[^\"]+\.(gif|jpg|png)\"\
           (^Content-Transfer-Encoding: base64)?\
           (^Content-Description:.*)?\
            ^Content-ID: <\
             (${a12}([$]|${a})${a8}([$]|${a})${a8}(_at_)$\MID2\
             |${a12}[$]${a8}[$]${a}+(_at_)${a}+\
             |[^ >(_dot_)(_at_)]+\(_dot_)(gif|jpg|png)@${x8}\.${a8}\
             )>$

  # then deliver
    ${GIFBOX}/

  #----------------------------------------------------------
  # Procmail stops at delivery, so only if the previous
  # recipe did not deliver, then processing continues here.
  #----------------------------------------------------------

    :0

  # if the FQDN part of the Message-ID is equal to the HELO
    *$ MID2 ?? ^^$\R1_HOST^^

  # and there are 10 (or more) gif-attachments
    * -9^0
    *$ 1^1 B ?? ^--$\H_CTB\
                ^Content-Type: image/(gif|jpe?g|png);\
                ^${b}+name=\"[0-9]+\.(gif|jpg|png)\"$

  # then deliver
    ${GIFBOX}/
  }

#------------------------------------------------------------
  :0

# if the number of Received header fields is 2 or 3
  *  N_RCVD ?? ^^(2|3)^^

# and the MIME boundary matches /[[:xdigit:]]+/
  *$ H_CTB  ?? ^^${x}+^^

# and the FQDN part of the Message-ID ends in the domain part
# of the Envelope-From
  *$ MID2   ?? ()$\ENV_DOMAIN^^

# and the From: header field has an unquoted name, followed
# by <user-part(_at_)domain-part-of-the-Envelope-From>
  *$ ^From: [^\"<]+ <[^(_at_)]+@$\ENV_DOMAIN>$

# and part of the message body matches some regex
  *$ B ?? ^--$\H_CTB\
          ^Content-Type: image/(gif|jpe?g|png);\
          ^${b}+name=\"[^\"]+\.(gif|jpg|png)\"\
         (^Content-Transfer-Encoding: base64)?\
         (^Content-Description:.*)?\
          ^Content-ID: <${x}+(_at_)$\ENV_DOMAIN>$

# then deliver
  ${GIFBOX}/

#------------------------------------------------------------
#  Spam Assassin Review and Toss
#------------------------------------------------------------

  :0 fw
  * < 256000
  | spamassassin

  :0
  * ^X-Spam-Level: \*\*\*\*\*
  $SPAMASSASSINBAD

  :0
  * ^X-Spam-Level: \*\*
  $SPAMASSASSIN


#------------------------------------------------------------
#  Send Newsletters to SiteAdmin/News
#------------------------------------------------------------

  :0
  * ?       [ -s $HOME/.procmailrecipes/siteadmin/siteadmin-newsletters.txt ]
  * ? fgrep -iqf $HOME/.procmailrecipes/siteadmin/siteadmin-newsletters.txt
  $NEWSLETTERS


#------------------------------------------------------------
#  Send Flyers to SiteAdmin/Flyers
#------------------------------------------------------------

  :0
  * ?       [ -s $HOME/.procmailrecipes/siteadmin/siteadmin-flyers.txt ]
  * ? fgrep -iqf $HOME/.procmailrecipes/siteadmin/siteadmin-flyers.txt
  $FLYERS


#------------------------------------------------------------
#  Send School to SiteAdmin/School
#------------------------------------------------------------

  :0
  * ?       [ -s $HOME/.procmailrecipes/siteadmin/siteadmin-school.txt ]
  * ? fgrep -iqf $HOME/.procmailrecipes/siteadmin/siteadmin-school.txt
  $SCHOOL


#------------------------------------------------------------
#  Move websites.DOMAIN.com and ctguy--at--DOMAIN.com
#------------------------------------------------------------

  MATCH   # clear the var
  :0 fw hi
  * ^(Received|To):(_dot_)*(_at_)websites\(_dot_)DOMAIN\(_dot_)com
  * ^Subject:\/.*
  | formail -i "Subject: [CT]$MATCH"

  :0 A
  $CTGUY

  MATCH   # clear the var
  :0 fw hi
  * ^(Received|To):(_dot_)*ctguy(_at_)DOMAIN\(_dot_)com
  * ^Subject:\/.*
  | formail -i "Subject: [CT]$MATCH"

  :0 A
  $CTGUY

#------------------------------------------------------------
#  Move sites.hcdm.us
#------------------------------------------------------------

  MATCH   # clear the var
  :0 fw hi
  * ^(Received|To):(_dot_)*(_at_)sites\(_dot_)DOMAIN3\(_dot_)us
  * ^Subject:\/.*
  | formail -i "Subject: [HCDM-CT]$MATCH"

  :0 A
  $HCDMCT

#------------------------------------------------------------
#  Move DOMAIN2.us
#------------------------------------------------------------

  MATCH   # clear the var
  :0 fw hi
  * ^(Received|To):(_dot_)*(_at_)DOMAIN2\(_dot_)us
  * ^Subject:\/.*
  | formail -i "Subject: [JH.US]$MATCH"

  :0 A
  $CTGUY

#------------------------------------------------------------
#  Move eos.com and eos.com
#------------------------------------------------------------

  MATCH   # clear the var
  :0 fw hi
  * ^To:(_dot_)*(_at_)DOMAIN4\(_dot_)com
  * ^Subject:\/.*
  | formail -i "Subject: [EOS]$MATCH"

  :0 A
  $CTGUY

  MATCH   # clear the var
  :0 fw hi
  * ^To:(_dot_)*(_at_)DOMAIN5\(_dot_)com
  * ^Subject:\/.*
  | formail -i "Subject: [EOS]$MATCH"

  :0 A
  $CTGUY

#------------------------------------------------------------
#  Bills Move
#------------------------------------------------------------

  MATCH   # clear the var
  :0 fw hi
  * ^Received:(_dot_)*(_at_)bills\(_dot_)DOMAIN2\(_dot_)us
  * ^Subject:\/.*
  | formail -i "Subject: [BILLS]$MATCH"

  :0 A
  $BILLS


  MATCH   # clear the var
  :0 fw hi
  * ^Received:(_dot_)*(_at_)bills\(_dot_)DOMAIN\(_dot_)com
  * ^Subject:\/.*
  | formail -i "Subject: [THBILLS]$MATCH"

  :0 A
  $THBILLS


#------------------------------------------------------------
#  SEWebManager
#------------------------------------------------------------

  MATCH   # clear the var
  :0 fw hi
  * ^Received:(_dot_)*sewebmanager(_at_)DOMAIN\(_dot_)com
  * ^Subject:\/.*
  | formail -i "Subject: [SEWeb]$MATCH"

  :0 A
  $CTGUY





I usually uncomment the SHELLMETAS line and I get a boatload of reporting
in my procmail.log.

SHELLMETAS has nothing to do with logging.  It has to do with determining
what characters would necessitate launching a shell process to interpret the
command string to execute, rather than invoking the command directly - more
or less to differentiate between a simple command and something like a shell
pipeline.
SNIP
As to the log verbosity, I see nothing like:

       VERBOSE=YES

in your collection of settings.  Perhaps you should set it.

____________________________________________________________
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

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