Main trunk update from the "lace" branch.
authorshort <>
Sun, 20 Feb 2005 10:52:06 +0000 (10:52 +0000)
committershort <>
Sun, 20 Feb 2005 10:52:06 +0000 (10:52 +0000)
PerlMail/Config.pm

index 9735762..56c28cb 100644 (file)
@@ -31,6 +31,7 @@ use vars qw(@ISA @EXPORT);
                $HOME
                $Mail @ValidUsers $IdleMax $MaxBodySMS @SMSwebRcpt $SMSwebRcpt_username
                $Lock_pathname $PeerAddr $Socket_timeout $DB_table $DBI_database $DBI_user $DBI_pwd
+               $clamscan_waitpid_timeout
                $sendmail_orig @addr_addon &FromAddress @h_rcpt @h_from
                %audit_profile @sms_squeezes @alternates_host @dnsbl_whitelist
 
@@ -43,7 +44,7 @@ require Mail::Alias;
 
 BEGIN {
        for (qw(headerhas store headeris did dnsbl store_muttrc_alternates Received_for parts_linear mime_type
-                       body_first mimehead spamassassin header_remap)) {
+                       body_first mimehead spamassassin clamscan header_remap lmtp_deliver)) {
                eval 'sub '.$_.' { return ::'.$_.'(@_); }';
                }
        }
@@ -69,6 +70,18 @@ our $MaxBodySMS=0x1000;
 our @SMSwebRcpt=qw(123 456 789123);
 # Some WWW::SMS modules require username:
 our $SMSwebRcpt_username="SMSUSERNAME";
+our $lmtp_admin="cyrus";
+our $lmtp_pwd;
+{
+       local *F;
+       open F,"$HOME/priv/lmtp.${lmtp_admin}.pwd" or die;
+       $lmtp_pwd=<F>;
+       chomp $lmtp_pwd;
+       close F or die;
+       }
+our $lmtp_user_from="USERNAME";
+our $lmtp_user_to="CYRUSUSERNAME";
+our $clamscan_waitpid_timeout=3;
 
 
 # perlmail-submit
@@ -154,7 +167,7 @@ our @sms_squeezes=(
                { "SqueezeControl"=>"max"   ,"SQZ_OPTIMIZE_LEVEL"=>0 },
                { "SqueezeControl"=>"max"   ,"SQZ_OPTIMIZE_LEVEL"=>1 },
                );
-# Hostnames where we had old/alternate e-mail addresses:
+# Hostnames where we had alternate e-mail addresses:
 our @alternates_host=(
                );
 # Override DNS blacklists:
@@ -187,17 +200,17 @@ sub audit
 
        # spam honeypots
        return if did sub {
-               local $_;
                # Do not local $store_file as it is our-imported
-               $store_profile="silent";
-               store "=spam"         if headeris "From",'<ghandchi@hotmail.com>';
-               store "=spam"         if headeris "From",'<mailcontests@lists.servitall.com>';
-               {
-                       # weak detection: files with text/html w/o text/plain are usually a spam
-                       my @types_linear=map({ mime_type($_); } parts_linear());
-                       store "=spam"       if grep({ $_ eq "text/html"; } @types_linear) && !grep({ $_ eq "text/plain"; } @types_linear);
-                       }
-               store "=spam"         if ($_=mimehead(body_first())->mime_attr("Content-Type.charset")) && /^big5/i;
+               $store_profile="log";
+               local $_;
+               store "=spam".";virus=$_"            if $_=clamscan();
+               store "=spam".";spamassassin".($_ eq 1 ? "" : "=$_") if $_=spamassassin();
+               store "=spam".";$_"                  if $_=dnsbl '.relays.ordb.org.' ,1;        # all hosts
+               store "=spam".";$_"                  if $_=dnsbl '.blackholes.mail-abuse.org.' ,1;      # all hosts
+               # we don't check all hosts as they can be "dialup" category, FIXME: check for it
+#              store "=spam".";$_"                  if $_=dnsbl '.blackholes.five-ten-sg.com.',0; # just first
+               # I don't send viruses but viruses propagate mails of mine
+               store "=spam".";ravmd"               if headeris "X-Mailer",'ravmd/8.3.2';
                };
        $store_profile=undef();
 
@@ -248,9 +261,16 @@ sub audit
        # lists
        store "=LIST","log"          if headeris "List-Id"  ,'<SOME.ID.OF.THE.LIST>';
 
+       if (($isFROM_MAILER && !did) || !did) {
+               lmtp_deliver $lmtp_admin,$lmtp_pwd,$lmtp_user_from,$lmtp_user_to;
+               }
+
        store "=errm","bell"         if $isFROM_MAILER && !did();
 
-       store "==","sms"             if !did;
+       if (!did) {
+               store "==","sms";
+               spamassassin "$HOME/bin/sa-learn --ham";
+               }
 }
 
 sub audit_sms_address