⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 基于freebsd和postfix的邮件系统与邮件列表的web mail安装 linuxsir_org.htm

📁 linuxSir 网站的精华文章
💻 HTM
📖 第 1 页 / 共 5 页
字号:
      there<BR>user webmaster@toping.net<BR>+OK Password required<BR>pass 
      000000<BR>+OK logged in<BR>list<BR>+OK POP3 clients that break here, they 
      violate STD53<BR>1 2217<BR>retr 1 //返回第一封信的全部内容<BR>+OK 2217 octets 
      follow.<BR>Return-Path: &lt;webmaster@toping.net&gt;<BR>X-Original-To: 
      webmaster@toping.net<BR>Delivered-To: webmaster@toping.net<BR>Received: 
      from mail (localhost.toping.net [127.0.0.1])<BR>&nbsp;&nbsp;&nbsp;&nbsp;by 
      mail.toping.net (Postfix) with ESMTP id 
      58DC71D5<BR>&nbsp;&nbsp;&nbsp;&nbsp;for &lt;webmaster@toping.net&gt;; Mon, 
      9 Aug 2004 21:11:20 +0800 (CST)<BR>SUBJECT:test<BR>Message-Id: 
      &lt;20040809131120.58DC71D5@mail.toping.net&gt;<BR>Date: Mon, 9 Aug 2004 
      21:11:20 +0800 (CST)<BR>From: webmaster@toping.net<BR>To: 
      undisclosed-recipients:;<BR>test<BR>.<BR>dele 1 //删除<BR>+OK 
      Deleted<BR>quit<BR>+OK Bye-bye<BR>Connection closed by foreign 
      host</CODE></DIV>
      <P></P>
      <P>也可以使用任何其它的邮件客户端程序来测试,如foxmail、Outlook Express等等。 </P>
      <P><FONT id=5 size=4><B><BR>5、防病毒与防垃圾邮件<BR></B></FONT></P>
      <P>本章介绍病毒与垃圾邮件的防范。 </P>
      <P><FONT id=5.1 size=3><B><BR>5.1 安装Clamav<BR></B></FONT></P>
      <P>
      <DIV class=codeblock><CODE>mail# cd /usr/ports/security/clamav<BR>mail# 
      make install clean</CODE></DIV>
      <P></P>
      <P>我的选择:</P>
      <P>
      <DIV class=codeblock><CODE>[X] MILTER Compile the milter interface<BR>[X] 
      CURL Support URL downloading<BR>[X] LIBUNRAR Support for external Unrar 
      library</CODE></DIV>
      <P></P>
      <P>要想clamav能自动的启动请在/etc/rc.conf中加入:</P>
      <P>
      <DIV 
      class=codeblock><CODE>clamav_clamd_enable="YES"<BR>clamav_freshclam_enable="YES"</CODE></DIV>
      <P></P>
      <P>重启服务器</P>
      <P>测试杀毒</P>
      <P>
      <DIV class=codeblock><CODE>mail# clamscan -r -i 
      /usr/local/www/data<BR>----------- SCAN SUMMARY -----------<BR>Known 
      viruses: 41293<BR>Engine version: 0.87.1<BR>Scanned directories: 
      53<BR>Scanned files: 602<BR>Infected files: 0<BR>Data scanned: 41.51 
      MB<BR>Time: 18.294 sec (0 m 18 s)</CODE></DIV>
      <P></P>
      <P>升级病毒库<BR>
      <DIV class=codeblock><CODE>mail# freshclam<BR>ClamAV update process 
      started at Sun Dec 4 01:10:02 2005<BR>main.cvd is up to date (version: 34, 
      sigs: 39625, f-level: 5, builder: tkojm)<BR>daily.cvd is up to date 
      (version: 1200, sigs: 1669, f-level: 6, builder: tomek)</CODE></DIV>
      <P></P>
      <P><FONT id=5.2 size=3><B><BR>5.2 安装MailScanner<BR></B></FONT></P>
      <P>
      <DIV class=codeblock><CODE>mail# cd /usr/ports/mail/mailscanner<BR>mail# 
      make install</CODE></DIV>
      <P></P>
      <P>第一次执行安装因此需执行make initial-config以建立基本配置文件 </P>
      <P>
      <DIV class=codeblock><CODE>mail# make initial-config<BR>mail# make 
      clean</CODE></DIV>
      <P></P>
      <P><FONT id=5.3 size=3><B><BR>5.3 安装SpamAssassin<BR></B></FONT></P>
      <P>
      <DIV class=codeblock><CODE>mail# cd 
      /usr/ports/mail/p5-Mail-SpamAssassin<BR>mail# make install 
      clean</CODE></DIV>
      <P></P>
      <P>我的选择:</P>
      <P>
      <DIV class=codeblock><CODE>[X] AS_ROOT Run spamd as root 
      (recommended)<BR>[X] DOMAINKEYS DomainKeys support<BR>[X] SSL Build with 
      SSL support for spamd/spamc<BR>[X] MYSQL Add MySQL support<BR>[X] RAZOR 
      Add Vipul's Razor support<BR>[X] SPF_QUERY Add SPF query support<BR>[X] 
      RELAY_COUNTRY Relay country support<BR>[X] TOOLS Install SpamAssassin 
      tools</CODE></DIV>
      <P></P>
      <P><FONT id=5.4 size=3><B><BR>5.4 修改Postfix设定档main.cf<BR></B></FONT></P>
      <P>
      <DIV class=codeblock><CODE>mail# ee 
      /usr/local/etc/postfix/main.cf</CODE></DIV>
      <P></P>
      <P>
      <DIV class=codeblock><CODE>#header_checks = 
      regexp:/usr/local/etc/postfix/header_checks //默认值<BR>header_checks = 
      regexp:/usr/local/etc/postfix/header_checks //把注释去掉</CODE></DIV>
      <P></P>
      <P>编辑/usr/local/etc/postfix/header_checks</P>
      <P>
      <DIV class=codeblock><CODE>mail# ee 
      /usr/local/etc/postfix/header_checks</CODE></DIV>
      <P></P>
      <P>
      <DIV class=codeblock><CODE>/^Received:/ HOLD //新加入</CODE></DIV><BR><FONT 
      id=5.5 size=3><B><BR>5.5 修改mailscanner.conf<BR></B></FONT>
      <P></P>
      <P>
      <DIV class=codeblock><CODE>mail# ee 
      /usr/local/etc/MailScanner/MailScanner.conf</CODE></DIV>
      <P></P>
      <P>
      <DIV class=codeblock><CODE>#Run As User = //默认值<BR>Run As User = postfix 
      //修改后<BR>#Run As Group = //默认值<BR>Run As Group = postfix 
      //修改后<BR>#Incoming Queue Dir = /var/spool/mqueue.in //默认值<BR>Incoming 
      Queue Dir = /var/spool/postfix/hold //修改后<BR>#Outgoing Queue Dir = 
      /var/spool/mqueue //默认值<BR>Outgoing Queue Dir = 
      /var/spool/postfix/incoming //修改后<BR>#MTA = sendmail //默认值<BR>MTA = 
      postfix //修改后<BR>#Virus Scanners = none //默认值<BR>Virus Scanners = clamav 
      //修改后<BR>#Use SpamAssassin = no //默认值<BR>Use SpamAssassin = yes 
      //修改后</CODE></DIV>
      <P></P>
      <P><FONT id=5.6 size=3><B><BR>5.6 新增MailScanner所要用到的资料夹<BR></B></FONT></P>
      <P>
      <DIV class=codeblock><CODE>mail# mkdir /var/spool/MailScanner<BR>mail# 
      mkdir /var/spool/MailScanner/incoming<BR>mail# mkdir 
      /var/spool/MailScanner/quarantine<BR>mail# chown postfix:postfix 
      /var/spool/MailScanner/incoming<BR>mail# chown postfix:postfix 
      /var/spool/MailScanner/quarantine<BR>mail# touch 
      /usr/local/etc/MailScanner/rules/bounce.rules //新建一个空白文件,要不然会出错。<BR>mail# 
      chmod –R 777 /var/spool/postfix<BR>mail#cp 
      /usr/local/etc/MailScanner/mcp/10_example.cf.sample 
      /usr/local/etc/MailScanner/mcp/10_example.cf<BR>mail#cp 
      /usr/local/etc/MailScanner/mcp/mcp.spam.assassin.prefs.conf.sample 
      /usr/local/etc/MailScanner/mcp/mcp.spam.assassin.prefs.conf</CODE></DIV>
      <P></P>
      <P><B>注:</B>这里的倒数一、二行实际操作中为一行</P>
      <P>重新启动服务器</P>
      <P>测试病毒过滤:</P>
      <P>
      <DIV class=codeblock><CODE>mail# telnet localhost 25<BR>Trying 
      ::1...<BR>telnet: connect to address ::1: Connection refused<BR>Trying 
      127.0.0.1...<BR>Connected to localhost.<BR>Escape character is 
      '^]'.<BR>220 mail.toping.net ESMTP Postfix<BR>mail 
      from:webmaster@toping.net<BR>250 Ok<BR>rcpt to:webmaster@toping.net<BR>250 
      Ok<BR>data<BR>354 End data with 
      &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;<BR>Subject:Virus 
      test<BR>X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*<BR>.<BR>250 
      Ok: queued as F0C221CC20 //出现F0C221CC20这行表示mailscanner运行成功了<BR>quit<BR>221 
      Bye<BR>Connection closed by foreign host.</CODE></DIV>
      <P></P>
      <P><FONT id=5.7 size=3><B><BR>5.7把病毒提示信息改为中文<BR></B></FONT></P>
      <P>预设系统提示信息为英文,可以下载我修改的中文包。</P>
      <P>http://mail.toping.net/mailscanner/cn.rar</P>
      <P><B>注:</B>把下载下来的文件解压后放到/usr/local/share/MailScanner/reports/cn下面去</P>
      <P>
      <DIV class=codeblock><CODE>mail# ee 
      /usr/local/etc/MailScanner/MailScanner.conf</CODE></DIV>
      <P></P>
      <P>
      <DIV class=codeblock><CODE>#%report-dir% = 
      /usr/local/share/MailScanner/reports/en //默认值(加载英文)<BR>%report-dir% = 
      /usr/local/share/MailScanner/reports/cn //修改后为读取中文</CODE></DIV>
      <P></P>
      <P><FONT id=5.8 size=3><B><BR>5.8 用MailScanner来监管进出邮件<BR></B></FONT></P>
      <P>
      <DIV class=codeblock><CODE>mail# ee MailScanner.conf</CODE></DIV>
      <P></P>
      <P>
      <DIV class=codeblock><CODE>Archive Mail = 
      %rules-dir%/archive.rules</CODE></DIV>
      <P></P>
      <P>
      <DIV class=codeblock><CODE>mail# ee archive.rules</CODE></DIV>
      <P></P>
      <P><B>方法一:</B>互相备份, 以上这样并不会造成 loop </P>
      <P>
      <DIV class=codeblock><CODE>FromOrTo: a@toping.net yes forward 
      b@toping.net<BR>FromOrTo: b@toping.net yes forward 
      a@toping.net</CODE></DIV>
      <P></P>
      <P><B>方法二:</B>可以 forward 到复数信箱 </P>
      <P>
      <DIV class=codeblock><CODE>FromOrTo: a@toping.net yes forward b@toping.net 
      c@toping.net d@toping.net</CODE></DIV>
      <P></P>
      <P><B>方法三:</B>同时备份到一个或多个档案及一个或多个信箱</P>
      <P>
      <DIV class=codeblock><CODE>FromOrTo: a@toping.net yes forward 
      /var/spool/MailScanner/archive/a_user_backup.mbx 
      /var/spool/MailScanner/archive/a_user_backup.mbx b@toping.net 
      scyz2@163.com</CODE></DIV>
      <P></P>
      <P><B>注:</B>以上为一行,该档案要先建立且确定该档案拥有者与 MailScanner.conf 的 Run As User = 
      XXXXXXX 相同 </P>
      <P><B>方法四:</B>备份到数据夹及多个信箱或档案</P>
      <P>
      <DIV class=codeblock><CODE>FromOrTo: a@toping.net yes forward 
      /var/spool/MailScanner/archive/ b@toping.net scyz2@163.com 
      /var/spool/MailScanner/archive/a_user_backup.mbx</CODE></DIV>
      <P></P>
      <P><B>注:</B>以上为一行,权限同SAMPLE3;注意事项, 他会依日期再分数据夹, 日期数据夹内的文件名称 mail queue ID, 
      格式为 postfix mail queue 格式</P>
      <P>更详细的mailscanner.cf的参数请看论坛:<BR>
      <DIV 
      class=codeblock><CODE>http://www.toping.net/bbs/htm_data/7/0509/533.html</CODE></DIV>
      <P></P>
      <P><FONT id=5.9 size=3><B><BR>5.9.安装MailScanner-mrtg<BR></B></FONT></P>
      <P>
      <DIV class=codeblock><CODE>mail# cd /usr/ports/mail/ 
      mailscanner-mrtg<BR>mail# make install clean</CODE></DIV>
      <P></P>
      <P>mailscanner-mrtg相关设置</P>
      <P>
      <DIV class=codeblock><CODE>mail# cd /usr/local/etc/mailscanner-mrtg 
      //切换至mailscanner-mrtg 目录<BR>mail# cp mailscanner-mrtg.conf.sample 
      mailscanner-mrtg.conf<BR>mail# cp mailscanner-mrtg.cfg.sample 
      mailscanner-mrtg.cfg<BR>mail# chmod 644 mailscanner-mrtg.conf 
      //更改权限为可修改<BR>mail# chmod 644 mailscanner-mrtg.cfg //更改权限为可修改<BR>mail# ee 
      mailscanner-mrtg.conf //修改mailscanner-mrtg.conf内容如下</CODE></DIV>
      <P></P>
      <P>
      <DIV class=codeblock><CODE>#MTA = sendmail //默认值<BR>MTA = postfix 
      //修改后<BR>#Where the MTA puts mail before MailScanner gets it<BR>#Incoming 
      Queue Dir = /var/spool/postfix.in/deferred/ # Postfix<BR>#Incoming Queue 
      Dir = /var/spool/exim.in/input/ # Exim<BR>Incoming Queue Dir = 
      /var/spool/mqueue.in/ # Sendmail //默认值<BR>Incoming Queue Dir = 
      /var/spool/postfix/hold # Postfix //修改后<BR>#Where MailScanner puts your 
      mail after it is scanned<BR>#Outgoing Queue Dir = 
      /var/spool/postfix/incoming/ # Postfix<BR>#Outgoing Queue Dir = 
      /var/spool/exim/input # Exim (?)<BR>Outgoing Queue Dir = 
      /var/spool/mqueue/ # Sendmail //默认值<BR>Outgoing Queue Dir = 
      /var/spool/postfix/incoming/ # Postfix //修改后(把#拿掉)<BR>#Which interfaces to 
      monitor (comma separated list)<BR>Interfaces to Monitor = fxp0 
      //默认值<BR>Interfaces to Monitor = vr0 //修改后(改成您的网卡吧)</CODE></DIV>
      <P></P>
      <P>
      <DIV class=codeblock><CODE>mail# ee /usr/local/etc/apache/httpd.conf 
      //修改apache配置以便读取mailscanner-mrtg数据</CODE></DIV>
      <P></P>
      <P>内容如下:</P>
      <P>
      <DIV class=codeblock><CODE>#MailScanner Setting<BR>Alias 
      /mailscanner-mrtg/ "/usr/local/www/mailscanner-mrtg/"</CODE></DIV>
      <P></P>
      <P>Step5 产生MailScanner-Mrtg流量图</P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -