Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37734522
en ru br
ALT Linux repositórios
S:8.16-alt1
5.0: 5.0.90-alt0.20090320.3
4.1: 5.0.90-alt0.20090320.0.M41.3
4.0: 4.0-alt2.M40.2

Group :: Sistema/Servidores
RPM: mailfromd

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

/* This file is part of mailfrom filter 
Copyright (C) 2005, 2006 Sergey Poznyakoff

This file is default configuration for mailfrom in Alt Linux.
It written by Sergey Afonin.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA */

require 'status'

require 'dns'
require 'match_cidr'

#pragma regex +extended +icase

set mailfrom_address ""

set graylistactive 0

set msg_header ""
set msg_header_last_received "Received: from "

set infected_received_from ""

set mail_from ""
set rcpt_to ""
set queue_id ""
set helo_from_remote ""

set virusmaster ""
set massallocated_chk_exclude ""
set explain_msg ""

#include_once </etc/mailfromd/localconf.mf>

prog helo
do
set queue_id $i

# Save the host name for further use
set helo_from_remote $1
set msg_header_last_received msg_header_last_received . $1 . " ("
echo "%queue_id: helo=" . helo_from_remote . " client_addr=" . ${client_addr}
done

prog envfrom
do

set msg_header_last_received msg_header_last_received
. ${client_ptr} . " [" . ${client_addr} . "])\r\n\t"
set msg_header_last_received msg_header_last_received
. "by " . ehlo_domain . " (" . %__package__ . "/" . %__version__ . ") id " . $i . ";\r\n\t"
set msg_header_last_received msg_header_last_received
. strftime('%a, %d %b %Y %T %z (%Z)', time())

set infected_received_from ${client_ptr} . " [" . ${client_addr} . "]"

set mail_from "<" . $f . ">"

done

prog envrcpt
do
set rcpt_to rcpt_to . $1 . "\r\n"
done

func log_header_line(string hdr_line)
do
set idx index(hdr_line, "\n")-1
if idx < -1
set idx -1
fi
set str1 substring(hdr_line, 0, idx)
if index(hdr_line, "\n") = -1
echo "%queue_id: " . str1
else
echo "%queue_id: " . str1
set str2 substring(hdr_line, index(hdr_line, "\n")+1, -1)
log_header_line(str2)
fi
done

prog header
do
set msg_header msg_header . $1 . ": " . $2 . "\r\n"
set full_header_line $1 . ": " . $2
log_header_line(full_header_line)

/*
catch failure
do
echo "%queue_id: error decoding string of header, caught exception: $2"
# reject 554 5.7.0 "error decoding string of header; $2"
continue
done

if message_header_decode($2, "KOI8-R") matches "ò A ó ó ù ì ï þ ë é"
reject 554 5.7.0 "Spam messages rejected"
fi
*/
done

prog eom
do

catch failure
do
echo "%queue_id: ERROR: mailfromd can not access to clamd, caught exception: $2"
tempfail 451 4.3.0 "mailfromd can not access to clamd; please try again later"
done

if clamav(current_message(),clamd_port)
set message <<- EOT
Subject: Virus intercepted
To: <%virusmaster>
From: <MAILER-DAEMON@%ehlo_domain>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Agent: %__package__ (%__version__)
X-Infected-Received-From: %infected_received_from

The message %queue_id that sent from %mail_from to

%rcpt_to
contained a virus "%clamav_virus_name"
and has not been delivered.

Message tested by ClamAV: http://www.clamav.net

----- The original (infected) message headers here:

%msg_header_last_received
%msg_header
EOT

echo "%queue_id: Virus founded: %clamav_virus_name from ${client_addr}"

catch *
do
echo "%queue_id: WARNING: message from daemon was not been sent to administrator, caught exception: $2"
reject 554 5.7.0 "virus %clamav_virus_name detected by ClamAV - http://www.clamav.net"
done

send_mail(message, virusmaster)
reject 554 5.7.0 "virus %clamav_virus_name detected by ClamAV - http://www.clamav.net"
fi
done
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009