Centos7下postfix+Dovecot+cyrus-sasl搭建个人局域网邮件服务器(测试使用)

1、环境准备,Centos 7 机器一台(选择vsphere环境下的一台虚拟机),虚拟机进行环境配置:

     a):IP配置,最后能够访问Inetnet,主要能够访问yum源,也可配置可访问的局域网源;

     b):配置防火墙规则,由于是测试使用,所以直接关闭firewalld服务

2、修改虚拟机的hostname和domain(测试过程中发现没啥用,大概了解下就可以)

3、安装、配置、启用postfix     yum install postfix(一般OS都已经自带)

[root@linuxprobe ~]# vi /etc/postfix/main.cf
# line 75: uncomment and specify hostname

myhostname = linuxprobe.srv.world
# line 83: uncomment and specify domain name

mydomain = srv.world
# line 99: uncomment

myorigin = $mydomain
# line 116: change

inet_interfaces = all
# line 164: add

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# line 264: uncomment and specify your local network

mynetworks = 127.0.0.0/8, 10.0.0.0/24
# line 419: uncomment (use mailboxdir)

home_mailbox = mailbox/
# line 574: add

smtpd_banner = $myhostname ESMTP
# add follows to the end

# limit an email size for 10M

message_size_limit = 10485760

# limit a mailbox for 1G

mailbox_size_limit = 1073741824
# for SMTP-Auth

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject

[root@linuxprobe ~]# systemctl restart postfix
[root@linuxprobe ~]# systemctl enable postfix
4、安装配置启动dovecot      yum install dovecot

[root@linuxprobe ~]# vi /etc/dovecot/dovecot.conf
# line 24: uncomment
protocols = imap pop3 lmtp
# line 30: uncomment and change ( if not use IPv6 )
listen = *
[root@linuxprobe ~]# vi /etc/dovecot/conf.d/10-auth.conf
# line 10: uncomment and change ( allow plain text auth )
disable_plaintext_auth = no
# line 100: add
auth_mechanisms = plain login
[root@linuxprobe ~]# vi /etc/dovecot/conf.d/10-mail.conf
# line 30: uncomment and add
mail_location = maildir:~/Maildir
[root@linuxprobe ~]# vi /etc/dovecot/conf.d/10-master.conf
# line 96-98: uncomment and add like follows
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
    mode = 0666
    user = postfix
    group = postfix
}
[root@linuxprobe ~]# vi /etc/dovecot/conf.d/10-ssl.conf
# line 8: change (not require SSL)
ssl = no

[root@linuxprobe ~]# systemctl start dovecot
[root@linuxprobe ~]# systemctl enable dovecot


5、安装配置启动sasl

yum install cyrus-sasl-*

vim /etc/sysconfig/saslauthd

MECH=shadow  #指定以本地系统用户名认证

vim /usr/lib64/sas12/smtpd.conf //64位系统

vim /usr/lib/sas12/smtpd.conf //32位系统

smtpd.conf配置文件默认是没有的,vim编辑的同时创建

pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
log_level:3


6、验证,创建管理员账号和测试用户账号。添加到mailfox互相发邮件测试。注意在添加过程中,由于局域网没有域名等信息,所以直接填写的服务器IP地址(发现很多教程中,设置域名和MX那些太繁琐)


7、邮件信息统计pflogsumm

 yum -y install postfix-perl-scripts

[root@linuxserver ~]# perl /usr/sbin/pflogsumm -d today /var/log/maillog
Postfix log summaries for Oct 11

Grand Totals
------------
messages

      2   received
      2   delivered
      0   forwarded
      0   deferred
      0   bounced
      0   rejected (0%)
      0   reject warnings
      0   held
      0   discarded (0%)

   1928   bytes received
   1928   bytes delivered
      1   senders
      1   sending hosts/domains
      1   recipients
      1   recipient hosts/domains


Per-Hour Traffic Summary
------------------------
    time          received  delivered   deferred    bounced     rejected
    --------------------------------------------------------------------
    0000-0100           0          0          0          0          0
    0100-0200           0          0          0          0          0
    0200-0300           0          0          0          0          0
    0300-0400           0          0          0          0          0
    0400-0500           0          0          0          0          0
    0500-0600           0          0          0          0          0
    0600-0700           0          0          0          0          0
    0700-0800           0          0          0          0          0
    0800-0900           0          0          0          0          0
    0900-1000           0          0          0          0          0
    1000-1100           0          0          0          0          0
    1100-1200           0          0          0          0          0
    1200-1300           0          0          0          0          0
    1300-1400           0          0          0          0          0
    1400-1500           0          0          0          0          0
    1500-1600           0          0          0          0          0
    1600-1700           0          0          0          0          0
    1700-1800           0          0          0          0          0
    1800-1900           0          0          0          0          0
    1900-2000           2          2          0          0          0
    2000-2100           0          0          0          0          0
    2100-2200           0          0          0          0          0
    2200-2300           0          0          0          0          0
    2300-2400           0          0          0          0          0

Host/Domain Summary: Message Delivery
--------------------------------------
 sent cnt  bytes   defers   avg dly max dly host/domain
 -------- -------  -------  ------- ------- -----------
      2     1928        0     0.1 s    0.1 s  zuo.com

Host/Domain Summary: Messages Received
---------------------------------------
 msg cnt   bytes   host/domain
 -------- -------  -----------
      2     1928   zuo.com

Senders by message count
------------------------
      2   admin@zuo.com

Recipients by message count
---------------------------
      2   zuoqiang@zuo.com

Senders by message size
-----------------------
   1928   admin@zuo.com

Recipients by message size
--------------------------
   1928   zuoqiang@zuo.com

message deferral detail: none

message bounce detail (by relay): none

message reject detail: none

message reject warning detail: none

message hold detail: none

message discard detail: none

smtp delivery failures: none

Warnings
--------
  smtpd (total: 3)
         1   unknown[10.165.12.13]: SASL LOGIN authentication failed: UGFzc3...
         1   hostname bogon does not resolve to address 10.165.12.13: Name o...
         1   hostname bogon does not resolve to address 10.166.15.214: Name ...

Fatal Errors
------------
  postfix-script (total: 1)
         1   usage: postfix start (or stop, reload, abort, flush, check, sta...

Panics: none

Master daemon messages
----------------------
      2   daemon started -- version 2.10.1, configuration /etc/postfix
      1   terminating on signal 15
[root@linuxserver ~]#




  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值