本章——发送接收邮件的工具为雷鸟

安装

# yum install dovecot-mysql.x86_64 dovecot.x86_64 -y

编辑文件

vim 10-mail.conf

mail_location = maildir:/home/vmail/%d/%n/Maildir/ first_valid_uid = 800

开启

!include auth-sql.conf.ext

# vim auth-sql.conf.ext

文件提示让找 args = /etc/dovecot/dovecot-sql.conf.ext  但/etc/dovecot目录下没有这个文件。

提示可以参考模板: # Path for SQL configuration file, see example-config/dovecot-sql.conf.ext

/usr/share/doc/dovecot-2.0.9/example-config cp dovecot-sql.conf.ext /etc/dovecot/

# vim dovecot-sql.conf.ext  //主要修改以下几行

driver = mysql

connect = host=localhost dbname=extmail user=extmail password=extmail

default_pass_scheme = PLAIN

password_query = \   SELECT username, domain, password \   FROM mailbox WHERE username = '%u'

user_query = SELECT maildir, 800 AS uid, 800 AS gid FROM mailbox WHERE username = '%u'

重启dovecot服务 测试豆腐块是否成功:

# telnet localhost 110

user redhat@extmail.org pass redhat

豆腐块SASL认证

首先查看下帮助文档,怎么安装豆腐块的SASl认证库。

cd /usr/share/doc/postfix-2.6.6/README_FILES

# less SASL_README

查看postfix的参数信息 postconf -d | grep smtpd_sasl

将其写入main.cf postfix的主配置文件

postconf -e smtpd_sasl_auth_enable=yes

postconf -e smtpd_sasl_authenticated_header=yes

查看SASL加密那些认证。

postconf -d | grep smtpd_recipient

postconf -e "smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, permit_sasl_authenticated"

smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, permit_sasl_authenticated

开启SASL认证/认证头。

smtpd_sasl_auth_enable = yes

smtpd_sasl_authenticated_header = yes

系统默认的帮助文档做的不怎么好,自己找个包看。

postfix-2.10.2.tar.gz

tar zxf postfix-2.10.2.tar.gz cd postfix-2.10.2

less SASL_README

vim /etc/sasl2/smtpd.conf

pwcheck_method: auxprop

auxprop_plugin: sql

mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM

sql_engine: mysql

sql_hostnames: 127.0.0.1

sql_user: extmail

sql_passwd: extmail

sql_database: extmail sql_select: SELECT

password FROM mailbox WHERE username = '%u@%r'

yum list cyrus-sasl*

rpm -ivh cyrus-sasl-sql-2.1.23-13.el6_3.1.x86_64.rpm

yum install cyrus-sasl-md5.x86_64 cyrus-sasl-devel.x86_64  cyrus-sasl-plain.x86_64 -y

认证

postconf -d | grep smtpd_tls  //查找下tls认证的项,写入postfix主文件

postconf -e smtpd_tls_security_level=encrypt cd /etc/pki/tls/certs/ make postfix.pem

postconf -e smtpd_tls_cert_file=/etc/pki/tls/certs/postfix.pem

postconf -e smtpd_tls_received_header=yes

postconf -e "smtpd_tls_session_cache_database=btree:/var/lib/postfix/smtpd_scache"

postconf -e smtpd_tls_auth_only=yes /etc/init.d/postfix restart /etc/init.d/clamd start

邮件的反垃圾反病毒

yum install spamassassin -y cd /usr/share/spamassassin/

yum localinstall clam* -y

下载病毒库

# rm -rf virusdb/ # chown clamav.clamav *

# yum install -y rpm-build

# ./install.sh

# vim MailScanner.conf  //下面的为这个库要修改的选项参数

Incoming Queue Dir = /var/spool/postfix/hold

Outgoing Queue Dir = /var/spool/postfix/incoming Run As User = postfix Run As Group = postfix MTA = postfix

Incoming Work Group = clamav

Incoming Work Permissions = 0640

Virus Scanners = clamd

Monitors for ClamAV Updates = /var/clamav/*.cld /var/clamav/*.cvd

# rpm -ql clamd

# cd /var/run/clamav/ clamd.pid clamd.sock

Clamd Socket = /var/run/clamav/clamd.sock

Always Include SpamAssassin Report = yes

SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin

Spam Actions = delete High Scoring Spam Actions = delete

[root@vm1 MailScanner]# mkdir spamassassin

# chown -R postfix.clamav .

# cd /etc/postfix/

# vim main.cf

把下面的#去掉

header_checks = regexp:/etc/postfix/header_checks

# vim header_checks  低行下入 /^Received:/    HOLD

下面是检测语法时 的报错,和解决方案

MailScanner –lint

报错解决方案:

ERROR: The "envelope_sender_header" in your spam.assassin.prefs.conf ERROR: is not correct, it should match X-yoursite-MailScanner-From

# cd /etc/MailScanner/

envelope_sender_header X-yoursite-MailScanner-From

报错: config: failed to parse line, skipping, in "/etc/mail/spamassassin/mailscanner.cf": use_auto_whitelist 0

注释掉此行 #use_auto_whitelist 0

报错: Unrar is not installed, it should be in /usr/bin/unrar. This is required for RAR archives to be read to check filenames and filetypes. Virus scanning is not affected.

安装软件包 unrar-4.2.4-1.el6.x86_64.rpm

[root@vm1 MailScanner]# /etc/init.d/postfix status master is stopped

[root@vm1 MailScanner]# /etc/init.d/MailScanner start

Starting MailScanner daemons:          incoming postfix:                                 [  OK  ]          outgoing postfix:                                 [  OK  ]          MailScanner:                                      [  OK  ]

[root@vm1 MailScanner]# /etc/init.d/postfix

status master (pid  10891) is running...

<邮件的反垃圾反病毒>的更多相关文章

  1. 简单物联网:外网访问内网路由器下树莓派Flask服务器

    最近做一个小东西,大概过程就是想在教室,宿舍控制实验室的一些设备. 已经在树莓上搭了一个轻量的flask服务器,在实验室的路由器下,任何设备都是可以访问的:但是有一些限制条件,比如我想在宿舍控制我种花 ...

  2. 利用ssh反向代理以及autossh实现从外网连接内网服务器

    前言 最近遇到这样一个问题,我在实验室架设了一台服务器,给师弟或者小伙伴练习Linux用,然后平时在实验室这边直接连接是没有问题的,都是内网嘛.但是回到宿舍问题出来了,使用校园网的童鞋还是能连接上,使 ...

  3. 外网访问内网Docker容器

    外网访问内网Docker容器 本地安装了Docker容器,只能在局域网内访问,怎样从外网也能访问本地Docker容器? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动Docker容器 ...

  4. 外网访问内网SpringBoot

    外网访问内网SpringBoot 本地安装了SpringBoot,只能在局域网内访问,怎样从外网也能访问本地SpringBoot? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装Java 1 ...

  5. 外网访问内网Elasticsearch WEB

    外网访问内网Elasticsearch WEB 本地安装了Elasticsearch,只能在局域网内访问其WEB,怎样从外网也能访问本地Elasticsearch? 本文将介绍具体的实现步骤. 1. ...

  6. 怎样从外网访问内网Rails

    外网访问内网Rails 本地安装了Rails,只能在局域网内访问,怎样从外网也能访问本地Rails? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动Rails 默认安装的Rails端口 ...

  7. 怎样从外网访问内网Memcached数据库

    外网访问内网Memcached数据库 本地安装了Memcached数据库,只能在局域网内访问,怎样从外网也能访问本地Memcached数据库? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装 ...

  8. 怎样从外网访问内网CouchDB数据库

    外网访问内网CouchDB数据库 本地安装了CouchDB数据库,只能在局域网内访问,怎样从外网也能访问本地CouchDB数据库? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动Cou ...

  9. 怎样从外网访问内网DB2数据库

    外网访问内网DB2数据库 本地安装了DB2数据库,只能在局域网内访问,怎样从外网也能访问本地DB2数据库? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动DB2数据库 默认安装的DB2 ...

  10. 怎样从外网访问内网OpenLDAP数据库

    外网访问内网OpenLDAP数据库 本地安装了OpenLDAP数据库,只能在局域网内访问,怎样从外网也能访问本地OpenLDAP数据库? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动 ...

随机推荐

  1. C#读写.ini文件

    转载来源: http://blog.csdn.net/source0573/article/details/49668079 https://www.cnblogs.com/wang726zq/arc ...

  2. 局域网中使用的IP地址有哪些?

    当我们建设一个局域网的时候,需要为网络中的每台计算机分配一个IP地址.那么都有哪些IP地址可以使用在局域网中呢?局域网中的IP地址有什么规定呢? 在局域网中,我们是不能使用如202.106.45.11 ...

  3. SpringCloud01 服务提供者和消费者

    说明:服务消费者直接利用RestTemplate调用服务提供者,这种使用方式只是适用于微服务数量比较少的项目,如果微服务的数量比较多建议使用SpringCloud提供的Eureaka组件. 注意:实现 ...

  4. hadoop集群监控工具Apache Ambari安装配置教程

    ambari 1.2.4 下载地址:http://www.apache.org/dist/incubator/ambari/ambari-1.2.4/ambari-1.2.4-incubating.t ...

  5. 32、Differential Gene Expression using RNA-Seq (Workflow)

    转载: https://github.com/twbattaglia/RNAseq-workflow Introduction RNAseq is becoming the one of the mo ...

  6. 由count(sno)和count(cno)引发的思考

    最近在练习sql语句,在一个select查询语句上有理解性偏差,现整理汇总下相关知识点. 首先,说下这个问题吧. 问题是:查询选课人数大于等于2人的课程编号以及选课的人数 具体的表结构信息: 我自己的 ...

  7. ubuntu-12.04.5安装cacti笔记

    坑啊,磨磨蹭蹭按了一个星期.按了3个版本. 第一次:cacti-0.8.7e.tar.gz 安装完之后,Host: Localhost->Memory Usage...四张图始终出不了.点击进去 ...

  8. unity3d AssetStore 下载的资源位置

    Win7,8和Win10系统下: 进入C:\Users\“用户名”目录,然后打开文件夹选项的显示隐藏文件选项 再进入AppData\Roaming\Unity/Asset Store-5.x下找到 M ...

  9. MySQL主从配置实战笔记

    其实网上已经有关于MySQL主从复制的很丰富全面的资料了,这里写点东西主要是为了给自己加深印象. 复制原理 MySQL主从复制是内建的非常强大的功能,主要应用于数据备份,负载均衡等方面.因为配置相对比 ...

  10. 机房重构——泛型和“DataTable”

    前言 我们都知道在机房重构的时候,大多数都在用七层进行重构,每一层都依赖实体.所以不管怎么调用,返回的应该是实体参数,这样才符合大多数的逻辑,这样我们试想一下,如果我们要求在U层返回多个实体值,怎么办 ...