dovecot+mysql
一 配置
1 yum install dovecot-mysql.x86_64 -y###dovecot的插件,让此软件可以识别mysql###
2 vim /etc/dovecot/conf.d/10-auth.conf ###编辑认证文件###
内容:
123 !include auth-sql.conf.ext###支持mysql认证###
3 cp /usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext###生成dovecot读取mysql的配置###
4 vim /etc/dovecot/dovecot-sql.conf.ext
内容:
32 driver = mysql###数据库类型###
71 connect = host=localhost dbname=email user=postuser password=postuser###连接查询时用到的库,用户,密码###
78 default_pass_scheme = PLAIN###默认认证方式为明文###
107 password_query = \###查询密码匹配###
108 SELECT username, domain, password \
109 FROM emailuser WHERE username = ‘%u‘ AND domain = ‘%d‘
125 user_query = SELECT maildir, 666 AS uid, 666 AS gid FROM emailuser WHERE username = ‘%u‘###查询邮件内容###
5 vim /etc/dovecot/conf.d/10-mail.conf
内容:
168 first_valid_uid = 666###邮件文件查询用户身份###
175 first_valid_gid = 666
30 mail_location = maildir:/home/vmail/%d/%n###指定邮件位置###
6 systemctl restart dovecot.service
测试:
[root@foundation78 Desktop]# telnet 172.25.254.112 110
Trying 172.25.254.112...
Connected to 172.25.254.112.
Escape character is ‘^]‘.
+OK [XCLIENT] Dovecot ready.
user lee@lee.com
+OK
pass lee
+OK Logged in.
quit
+OK Logging out.
Connection closed by foreign host.
在thunderbird中可以直接测试:
二 空壳邮件
1 )null客户端
1 vim /etc/postfix/main.cf
内容:
mydomain = example.com###域名###
myorigin = westos.com###伪装为真实邮件服务器的所在域###
myhostname = mail.example.com###主机名###
mydestination =###为空,不接受邮件###
relayhost = 172.25.254.112###转发给真实的邮件服务器###
2 systemctl restart postfix.service
3 测试:
空壳邮件服务器:
[root@mail ~]# mail root@example.com
Subject: dskjaf
skdja
.
EOT
[root@mail ~]# mailq
Mail queue is empty
[root@mail ~]# mail
No mail for root
真实的邮件服务器###
[root@westos-mail ~]# mail
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/root": 3 messages 3 new
>N 1 root Sat May 27 23:23 21/753 "hfue"
N 2 root Sat May 27 23:23 21/757 "hjk"
N 3 root Sat May 27 23:24 21/752 "dskjaf"
& 3
Message 3:
From root@mail.example.com Sat May 27 23:24:11 2017
Return-Path: <root@mail.example.com>
X-Original-To: root@example.com
Delivered-To: root@example.com
Date: Sat, 27 May 2017 23:24:08 -0400
To: root@example.com
Subject: dskjaf
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
From: root@mail.example.com (root)
Status: R
skdja
& q
Held 3 messages in /var/spool/mail/root
原文地址:http://12774272.blog.51cto.com/12764272/1930771