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

安装

# 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. UML核心元素--用例

    定义:用例定义了一组用例实例,其中每个实例都是系统所执行的一些列操作,这些操作生成特定主角可以观测的值.一个完整的用例定义由参与者.前置条件.场景.后置条件构成. 1.理解用例:用例就是参与者希望通过 ...

  2. AlteraFPGA使用通用SPIFlash - 张亚群的技术专栏 - 博客频道 - CSDN.NET

    AlteraFPGA使用通用SPIFlash - 张亚群的技术专栏 - 博客频道 - CSDN.NET Altera器件有EPCS系列配置器件,其实,这些配置器件就是我们平时通用的SPIFlash,据 ...

  3. chef语法和案例

    1. 添加用户 $ vim create_user.rb -----------------------------------> user 'charlie' do //创建一个uid为88的 ...

  4. MD5算法的c++实现

    需要注意的几点: (1)md5存取的数据长度仅为64位,位于数据的最前端,大于令其自然溢出. (2)update函数和final函数处理得很繁琐,需要仔细分析. (3)16位md5码取32位md5码的 ...

  5. mysql更改时区

    set global time_zone = '+8:00'; ##修改mysql全局时区为北京时间,即我们所在的东8区 set time_zone = '+8:00'; ##修改当前会话时区 flu ...

  6. oracle 新增字段

    alter table shop_procategory add (category_ORDER_FIELD number(10) default '0' not null);comment on c ...

  7. 9、samtool view

    参考:https://www.sogou.com/link?url=DOb0bgH2eKh1ibpaMGjuy6YnbQPc3cuKbWqIy1k6SBFomuBEhdSpHkUUZED5fr2OTk ...

  8. sklearn实现聚类

    import numpy as np from sklearn import datasets from sklearn.cross_validation import train_test_spli ...

  9. Vue 学习文档

    Vue 学习文档 vue 起步 引包 启动 new Vue(options) options: el 目的地(可以用类名.标签名等,也可以直接用mod元素) #elementId .elementCl ...

  10. Thinkphp通过phpqrcode实现网址验证码

    第一步: phpqrcode下载第三方扩展包,http://phpqrcode.sourceforge.net/ 第二步: 将扩展包放到/ThinkPHP/Library/Vendor/下的Phpqr ...