1. 程式人生 > >dovecot+mysql

dovecot+mysql

dovecot+mysql

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

測試

[[email protected] 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 [email protected]

+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 測試:

空殼郵件服務器:

[[email protected] ~]# mail [email protected]

Subject: dskjaf

skdja

.

EOT

[[email protected] ~]# mailq

Mail queue is empty

[[email protected] ~]# mail

No mail for root

真實的郵件服務器###

[[email protected] ~]# 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 [email protected] Sat May 27 23:24:11 2017

Return-Path: <[email protected]>

X-Original-To: [email protected]

Delivered-To: [email protected]

Date: Sat, 27 May 2017 23:24:08 -0400

To: [email protected]

Subject: dskjaf

User-Agent: Heirloom mailx 12.5 7/5/10

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

From: [email protected] (root)

Status: R

skdja

& q

Held 3 messages in /var/spool/mail/root


dovecot+mysql