启用用户认证收发实验
一、编辑相关配置文件
# 安装相关软件
[root@kittod ~]# dnf install cyrus-sasl dovecot *sasl* -y
# postfix主配置文件追加如下内容
[root@kittod ~]# vim /etc/postfix/main.cf
#启用SASL对客户端进行认证
broken_sasl_auth_clients = yes
#启用SASL认证
smtpd_sasl_auth_enable = yes
#禁用匿名用户
smtpd_sasl_security_options = noanonymous
#定义收件人限定
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
# 修改dovecot配置文件
[root@kittod ~]# vim /etc/dovecot/dovecot.conf
1、
24 #protocols = imap pop3 lmtp submission
25 protocols = imap pop3 lmtp
26 # A comma separated list of IPs or hosts where to listen in for connections.
2、
48 #login_trusted_networks =
49 login_trusted_networks = 192,168.254.0/24
50 # Space separated list of login access check sockets (e.g. tcpwrap)
[root@kittod ~]# vim /etc/dovecot/conf.d/10-mail.conf
1、
#mail_location =
mail_location = mbox:~/mail:INBOX=/var/mail/%u
# If you need to set multiple mailbox locations or want to change default
# 重启以下服务
[root@kittod ~]# systemctl restart postfix
[root@kittod ~]# systemctl restart dovecot
[root@kittod ~]# systemctl restart saslauthd
# 查看服务状态
[root@kittod ~]# systemctl status postfix
[root@kittod ~]# systemctl status dovecot
[root@kittod ~]# systemctl status saslauthd
二、安装foxmail客户端
下载链接 https://www.foxmail.com/
启动foxmail客户端,出现如下窗口
选择【其他邮箱】添加邮箱,接下来的如下图所示:
点击【手动设置】,出现以下提示:
添加账号成功会有如下提示:
点击【完成】按钮之后会进入foxmail主界面,如下图所示:
同时,三个账号会同步收件箱,可以看到三个账号下的收件箱存在之前收到的邮件。
至此,这个实验完成。