dovecot+mysql

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了dovecot+mysql相关的知识,希望对你有一定的参考价值。

##############dovecot+mysql############
1.
  yum install dovecotdovecot-mysql.x86_64 -y
 ####dovecot dovecot-mysql 软件的安装,dovecot-mysql dovecot 软件的插件,让此软件可以识别mysql

技术分享

2.配置文件
 (1)vim /etc/dovecot/dovecot.conf
    24 protocols = imap pop3 lmtp ###支持收件协议
    48 login_trusted_networks =0.0.0.0/0##信任网络
    49 disable_plaintext_auth = no ###开启明文认证
 (2)vim /etc/dovecot/conf.d/10-auth.conf
     123 include auth-sql.conf.ext ##开启mysql的认证方式
 (3)##生成dovecot读取mysql的配置
   cp/usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext/etc/dovecot/dovecot-sql.conf.ext  ###复制配置文件模版

   vim/etc/dovecot/dovecot-sql.conf.ext
     32 driver = mysql  ###数据库类型
     71 connect = host=localhostdbname=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, 666AS uid, 666 AS gid FROM emailuser WHERE username = ‘%u‘ ###查询邮件内容
 (4) vim /etc/dovecot/conf.d/10-mail.conf
 30 mail_location=maildir:/home/vmail/%d/%n  ##指定邮件位置
168 first_valid_uid = 666              ###邮件文件查询用户身份
175 first_valid_gid = 666
 (5)systemctl restart dovecot
3.测试
(1)telnet 172.25.254.144 110

技术分享

(2)雷鸟
技术分享

技术分享

  172 yum install dovecot -y
  173 yum install dovecot-mysql -y
  174 vim /etc/dovecot/dovecot.conf
     24 protocols = imap pop3 lmtp
     48 login_trusted_networks=0.0.0.0/0
     49 disable_plaintext_auth = no
  175 vim /etc/dovecot/conf.d/10-auth.conf
    123 include auth-sql.conf.ext
  176  cp /usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext/etc/dovecot/dovecot-sql.conf.ext
  177 vim /etc/dovecot/dovecot-sql.conf.ext
     32 driver = mysql  ###数据库类型
     71 connect = host=localhostdbname=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, 666AS uid, 666 AS gid FROM emailuser WHERE username = ‘%u‘ ###查询邮件内容
  178 vim /etc/dovecot/conf.d/10-mail.conf
      30 mail_location=maildir:/home/vmail/%d/%n  ##指定邮件位置
     168 first_valid_uid = 666               ###邮件文件查询用户身份
     175 first_valid_gid = 666
  179 systemctl restart dovecot

技术分享

技术分享

技术分享

技术分享

########空壳邮件########
重置一台主机,配置网络。修改主机名称。

技术分享

server:
    1 hostnamectl set-hostname nullmail.example.com
    2 hostname
    3 logout
    4 vim /etc/postfix/main.cf
75 myhostname = nullmail.example.com
83 mydomain = example.com
99 myorigin = westos.com
112 inet_interfaces = all
163 mydestination =
316 relayhost = 172.25.254.144 

技术分享

    5 systemctl restart postfix.service
测试:
    6 mail root
    7 mailq
    8 mail

技术分享

desktop:  176  mail
技术分享

配置DNS:

[[email protected] ~]#  vim/etc/named.conf

技术分享 
[[email protected] ~]#  vim/etc/named.rfc1912.zones

技术分享

[[email protected] ~]# cd /var/named/
[[email protected] named]# ls
data              named.ca         named.loopback  slaves
dynamic           named.empty      qq.com.zone     westos.com.zone
example.com.zone  named.localhost  sb.com.zone
[[email protected] named]# vim example.com.zone

技术分享

[[email protected] named]# systemctl restart named
[[email protected] ~]# vim /etc/resolv.conf 

技术分享

[[email protected] ~]# dig dns.example.com
[[email protected] ~]# dig -t mx example.com
技术分享

技术分享

技术分享

技术分享


以上是关于dovecot+mysql的主要内容,如果未能解决你的问题,请参考以下文章

dovecot+mysql

dovecot+mysql

邮件 dovecot

dovecot+mysql

dovecot+mysql 收件服务 和 空壳邮件

dovecot+mysql 收件服务空壳邮件