1.[root@westos-mail ~]# yum install dovecot-mysql.x86_64 -y#dovecot的插件,讓此軟體可以識别mysql###
2.[root@westos-mail ~]# 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.[root@westos-mail ~]# vim /etc/dovecot/dovecot-sql.conf.ext #修改配置
32 driver = mysql #資料庫類型
71 connect = host=localhost dbname=email user=postuser password=postuser #登入(連接配接查詢)的庫、使用者、密碼
<a href="https://s2.51cto.com/wyfs02/M01/97/78/wKiom1kuo-GArTAXAAAhE_Q0_4M846.png-wh_500x0-wm_3-wmp_4-s_3324022317.png" target="_blank"></a>
78 default_pass_scheme = PLAIN #預設認證方式為明文
108 SELECT username, domain, password \ #查詢密碼比對
109 FROM emailuser WHERE username = '%u' AND domain = '%d'
<a href="https://s5.51cto.com/wyfs02/M01/97/79/wKioL1kuo_ugmuAIAAA7lLWG6Nw035.png-wh_500x0-wm_3-wmp_4-s_1949055812.png" target="_blank"></a>
125 user_query = SELECT maildir, 666 AS uid, 666 AS gid FROM emailuser WHERE username = '%u' #查詢郵件内容
5.[root@westos-mail ~]# 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.[root@westos-mail ~]# systemctl restart dovecot.service
測試:
[root@westos-mail ~]# telnet 172.25.254.113 110
Trying 172.25.254.113...
Connected to 172.25.254.113.
Escape character is '^]'.
+OK [XCLIENT] Dovecot ready.
user [email protected]
+OK
pass lee
+OK Logged in.
quit
+OK Logging out.
Connection closed by foreign host
####空殼郵件####
空殼:
别人看見的是這台“假主機”,炮灰。
對外顯示與真實機相同,别人發送的郵件表象給它,實則是它轉給真是主機。
1.[root@mail ~]# vim /etc/postfix/main.cf
76 myhostname = qq-mail.qq.com #主機名
83 mydomain = qq.com #域名
99 myorigin = westos.com #真實伺服器所在的域
116 inet_interfaces = all
119 inet_protocols = all
164 mydestination = #不接受任何郵件
316 relayhost = 172.25.254.113 #轉發到真實的郵件伺服器
2.[root@mail ~]# systemctl restart postfix.service
發送端:
[root@qq-mail ~]# mail [email protected]
Subject: wq
521
,
.
EOT
[root@qq-mail ~]# mail
No mail for root
[root@qq-mail ~]# mailq
Mail queue is empty
真實的郵件伺服器端:
[root@westos-mail ~]# mail
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/root": 2 messages 1 new
1 [email protected] Mon May 22 05:52 19/573 "hah"
>N 2 root Wed May 31 05:15 22/724 "wq"
& 2
Message 2:
From [email protected] Wed May 31 05:15:45 2017
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Date: Wed, 31 May 2017 05:15:45 -0400
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
From: [email protected] (root)
Status: R
& q
Held 2 messages in /var/spool/mail/root
You have mail in /var/spool/mail/root
[root@westos-mail ~]#
本文轉自 AELY木 51CTO部落格,原文連結:http://blog.51cto.com/12768057/1931086,如需轉載請自行聯系原作者