安装spam

spam(SpamAssassin)利用perl来进行文字分析,他会检测邮件的标题、内容、送信人,这样就可以过滤出垃圾邮件

1、安装spam。由于spam的依赖太多,用户一定要使用yum源来安装,这样减少不必要的麻烦

[root@localhost ~]# rpm -qa | grep spamassassin

[root@localhost openwebmail]# yum install -y spamassassin

Complete!

2、配置postfix使用spam功能,修改配置文件“/etc/postfix/master.cf”

[root@localhost ~]# gedit /etc/postfix/master.cf

smtp      inet  n      -       n       -      -       smtpd  -o content_filter=spamassassin

spamassassin unix - n n  - - pipe user=nobody argv=/usr/bin/spamc -f /usr/sbin/sendmail -oi -f $(sender) -- $(recipient)  //追加到最后一行

3、重启postfix

[root@localhost openwebmail]# service postfix restart

关闭postfix                                            [确定]

启动postfix                                            [确定]

[root@localhost openwebmail]#

4、启动spam服务

[root@localhost ~]# service spamassassin start

启动spamassassin                                            [确定]

[root@localhost ~]#

5、测试垃圾邮件。

1)spamassassin为我们提供了一个垃圾邮件的模板“sample-spam.txt”,我们可以使用此模板的内容来发送

[root@localhost openwebmail]# cat /usr/share/doc/spamassassin-3.3.1/sample-spam.txt 

Subject: Test spam mail (GTUBE)

Message-ID: <GTUBE1.1010101@example.net>

Date: Wed, 23 Jul 2003 23:30:00 +0200

From: Sender <sender@example.net>

To: Recipient <recipient@example.net>

Precedence: junk

MIME-Version: 1.0

Content-Type: text/plain; charset=us-ascii

Content-Transfer-Encoding: 7bit

 

This is the GTUBE, the

    Generic

    Test for

    Unsolicited

    Bulk

    Email

If your spam filter supports it, the GTUBE provides a test by which you

can verify that the filter is installed correctly and is detecting incoming

spam. You can send yourself a test mail containing the following string of

characters (in upper case and with no white spaces and line breaks):

 

XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X      //这就是垃圾邮件的内容

 

You should send this test mail from an account outside of your network.

2)使用openwebmail发信

3)查看邮箱的日志文件。Spam采用积分制,默认超过5分就是垃圾邮件,而我们看到下面识别出的邮件是999分,很明显是垃圾邮件

[root@localhost openwebmail]# cat /var/log/maillog

Aug 21 08:44:14 localhost spamd[6401]: spamd: failed to create readable default_prefs: //.spamassassin/user_prefs

Aug 21 08:44:14 localhost spamd[6401]: spamd: processing message <20180821004332.M42441@mailsrv.david.cn> for nobody:99

Aug 21 08:44:26 localhost spamd[6401]: spamd: identified spam (999.0/5.0) for nobody:99 in 12.5 seconds, 603 bytes.

Aug 21 08:44:26 localhost spamd[6401]: spamd: 

result: Y 999 – 

ALL_TRUSTED,GTUBE,TVD_SPACE_RATIO scantime=12.5,size=603,user=nobody,uid=99,required_score=5.0,rhost=localhost,raddr=127.0.0.1,

rport=33149,mid=<20180821004332.M42441@mailsrv.david.cn>,autolearn=no

Aug 21 08:44:26 localhost postfix/pipe[6443]: 3F2FD14141A: to=<david@mailsrv.david.cn>,

relay=spamassassin, delay=13, delays=0.06/0.03/0/12, dsn=2.0.0, status=sent (delivered via spamassassin service)

Aug 21 08:44:26 localhost postfix/qmgr[6368]: 3F2FD14141A: removed

Aug 21 08:44:26 localhost spamd[6399]: prefork: child states: II

Linux服务器---邮件服务spam的更多相关文章

  1. Linux服务器---邮件服务postfix安装

    安装postfix postfix是一个快速.易于管理.安全性高的邮件发送服务,可以配合dovecot实现一个完美的邮箱服务器. 1.安装postfix [root@localhost ~]# rpm ...

  2. Linux服务器---邮件服务openwebmail配置

    配置openwebmail 通过修改配置文件openwebmail.conf,实现个性化邮箱定制.用户可以自由的更改邮箱logo.域名.容量 .签名等信息. 1.重定向index,快速打开邮箱.将下面 ...

  3. Linux服务器---邮件服务openwebmail安装

    安装openwebmail  openwebmail提供了可视化的邮件管理系统,它运行在Apache环境下. 1.安装必备软件 [root@localhost ~]# yum install –y p ...

  4. Linux服务器,服务管理--systemctl命令详解,设置开机自启动

    Linux服务器,服务管理--systemctl命令详解,设置开机自启动 syetemclt就是service和chkconfig这两个命令的整合,在CentOS 7就开始被使用了. 摘要: syst ...

  5. netcore一键部署到linux服务器以服务方式后台运行

    @font-face { font-family: octicons-link; src: url("data:font/woff;charset=utf-8;base64,d09GRgAB ...

  6. Linux服务器---邮件服务器dovecot

    安装dovecot Dovecot是CentOS系统中著名的POP3/IMAP服务器实现.POP3/IMAP是从邮件服务器中读取邮件时使用的协议,POP3将邮件全部从服务器中拖取下来:IMAP则每次从 ...

  7. linux服务器重启服务命令说明文档

    (前提是电脑上面已经安装好了ssh软件~!)输入ip,用户名,端口(默认22) 输入密码,登陆成功之后, 转入到/usr/local/tomcat/bin 目录,输入命令行: [root@yangch ...

  8. Linux服务器---设置服务启动

    设置服务开关 用户可以设置某项服务开机启动或者关闭,有图形界面和命令两种方式 1.图形界面 1)在终端输入命令setup,在弹出的界面选择“系统服务” 2)也可以直接在终端输入命令“ntsysv”,得 ...

  9. Linux服务器SMB服务挂载目录

    挂载方法 mount -o username=账号,password=密码 //SMB服务器IP/共享目录 /挂载点 smbclient链接 smbclient //SMB服务器IP/共享目录/ -U ...

随机推荐

  1. 43.1-CAN通讯

    43-CAN通讯 1.CAN 协议简介 CAN是控制器局域网络(Controller Area Network)的简称,它是由研发和生产汽车电子 产品著称的德国 BOSCH 公司开发的,并最终成为国际 ...

  2. SQL优化之踩过的坑【一】

    正看资料看的过瘾,突然收到报警,说服务器负载太高,好吧,登录服务器看看,我擦嘞,还能不能愉快的玩耍了?下面是当时的负载情况 看见mysql使用cpu已经到了2000,io没有等待.说明应该没有大的临时 ...

  3. PXE安装操作系统

    TFTP服务 用PXE安装操作系统依赖于DHCP服务和TFTP服务 网卡一般都内置的TFTP客户端的程序 systemctl enable tftp     systemctl enable  dhc ...

  4. 快学Scala 2

    控制结构和函数 1.在Scala中,几乎所有构造出来的语法结构都有值.这个特性是为了使得程序更加精简,也更易读. (1)if表达式有值 (2)块也有值——是它最后一个表达式的值 (3)Scala的fo ...

  5. python-->(set /dict)交集 差集 并集 补集(功能用来做交差并补的)

    # ### 集合 作用:交集 差集 并集 补集(功能用来做交差并补的) '''特征:自动去重 无序''' #定义一个空集合 setvar = set() #set()强制转换成一个空集合的数据类型 p ...

  6. 万恶之源 - Python迭代器

    函数名的使用以及第一类对象 函数名的运用 函数名是一个变量, 但它是一个特殊的变量, 与括号配合可以执行函数的变量 1.函数名的内存地址 def func(): print("呵呵" ...

  7. one-hot句子向量 对比度增强

    one-hot映射时,如何选取TOPN作为每一个词承载的word2vec的信息? 我们已经知道,对于这种例子: 怎么绑定手机号? 怎么关联手机号? 他们的相似度取决于绑定和关联这两个词如何相似. #取 ...

  8. [Java in NetBeans] Lesson 12. Arrays

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. Array: container that holds a fixed number of values of the sam ...

  9. golang配置

    配置使用yaml,使用了github上一个configor的库.理由如下: 1. 支持多种格式 2. ORM,自动给变量赋值,不用写太多的代码 3. 但是他支持shell env配置,我怕与运行的环境 ...

  10. js模拟栈---汉诺塔

    var Stack = (function(){ var items = new WeakMap(); //先入后出,后入先出 class Stack{ constructor(){ items.se ...