以Procmail-Gateway过滤寄出信件病毒

1、简介说明

  在安装Procmail及Sanitizer后,系统都只能处理寄进服务器内的信件,无法处理利用邮件服务器来寄出病毒信,因此在安装Procmail-Gateway修改sendmail.cf后可以在服务器寄信前拦截掉病毒信,减轻网络的负荷。

  2、确定procmail已安装

  检查sendmail.cf中有下面的语句:
  Mlocal, P=/usr/bin/procmail, F=lsDFMAw5:/|@qSPfhn9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
  T=DNS/RFC822/X-Unix,
  A=procmail -t -Y -a $h -d $u

  3、确定毒药文件路径及档案存在

  /etc/procmail/poisoned-files

  4、确定陷阱文件路径及档案存在

  /etc/procmail/html-trap.procmail

  5、编写系统回信警告通知文件

  vi /etc/procmail/policy.txt

  内容范例:

  这封信是系统自动发出的讯息。

  您的信件可能中毒,系统已加以隔离处理,请尽速扫毒后再重新寄此封信。

  vi /etc/procmail/quarantined.txt

  有人寄病毒信给您,系统已加以拦截,信件相关讯息如下。

6、确定档案权限

  touch /var/log/procmail.log <--档案不存在时才touch
  chmod 644 /var/log/procmail.log
  touch /var/spool/mail/quarantine <--档案不存在时才touch
  chmod 644 /var/spool/mail/quarantine
  touch /var/log/scores <--档案不存在时才touch
  chmod 644 /var/log/scores 

  7、修改procmailrc

  vi /etc/procmailrc
  范例文件如下:
  MAILDIR=/var/mail
  VERBOSE=off
  PATH="/usr/bin:$PATH:/usr/local/bin"

  #Nimda Virus
  :0 Bh
  * ^Content-Type: audio/x-wav;
  * name="readme.exe"
  /dev/null

  SHELL=/bin/sh
  POISONED_EXECUTABLES=/etc/procmail/poisoned-files
  #寄信通知系统管理者,若需更多人请在postmaster后加逗点再输入email即可
  SECURITY_NOTIFY="postmaster"
  #系统通知讯息发布人
  SECURITY_NOTIFY_VERBOSE="postmaster"
  #寄信通知寄件人
  SECURITY_NOTIFY_SENDER=YES
  #寄信通知寄件人讯息内容
  SECURITY_NOTIFY_SENDER="/etc/procmail/policy.txt"
  #寄信通知给收件人的讯息内容
  SECURITY_NOTIFY_RECIPIENT="/etc/procmail/quarantined.txt"
  #可放20字长度以下字符随机数值,增加安全性
  SECRET="sfd9734965q34o2ldgbl"
  #检疫隔离信件文件位置
  SECURITY_QUARANTINE=/var/spool/mail/quarantine
  #宏病毒扫描积分门坎,一般而言,中毒信件得分通常都会超过100分
  POISONED_SCORE=100
  #宏病毒扫描日志文件位置
  SCORE_HISTORY=/var/log/scores
  LOGFILE=/var/log/procmail.log
  INCLUDERC=/etc/procmail/html-trap.procmail 

8、修改sendmail.cf

  vi /etc/sendmail.cf
  在档案最后加上以下的内容:
  注意:复制/贴上以下内容有时会因为html tag的问题造成sendmail服务无法重新启动,此时可下载完整sendmail.cf范例文件 (右键/另存目标)至本机再复制/贴上至服务器或上传至服务器。
  #在M
  ##### @(#)procmail.m4 8.11 (Berkeley) 5/19/1998 #####
  Mprocmail, P=/usr/bin/procmail, F=DFMSPhnu9, S=11/31, R=21/31, T=DNS/RFC822/X-Unix,
  A=procmail -f- -Y -m $h $f $u
  # (空此行一定要先空tab)

  # 在my name for error messages设定的后面加上下面两行
  # Avoid host map lookups if address has this pseudo-domain on it CPprocmail

  # 在Ruleset 98后面加上下面设定
  # Filter all mail through procmail
  #
  # Strip the pseudo-domain and continue (already gone through the filter)
  R$*<@$+.procmail>$* $@ $1<@$2.>$3
  R$*<@$+.procmail.>$* $@ $1<@$2.>$3
  #
  # No pseudo-domain, send to filtering mailer
  R$*<@$+.>$* $#procmail $@/etc/procmail/filter.rc $:$1<@$2.procmail>$3
  R$*<@$+>$* $#procmail $@/etc/procmail/filter.rc $:$1<@$2.procmail>$3

  9、建立过滤档filter.rc

  vi /etc/procmail/filter.rc
  范例文件内容如下:
  LOGFILE=/var/log/procmail.log
  NL="
  "
  LOGABSTRACT=no

  POISONED_EXECUTABLES=/etc/procmail/poisoned-files
  INCLUDERC=/etc/procmail/html-trap.procmail

  :0 # re-send the message
  ! -oi -f "$@"


300*300
  • 没有相关文章
  • 没有评论
 文章首页关于迷茫时代关于我写意人生
版权所有:迷茫时代 All rights reserved   
执行时间:0.00426 秒