下面我们做一些邮件客户端的配置
1.邮件客户端的访问控制
1.限制远程发送
在westos-mail主机上
[root@westos-mail ~]# postconf -d | grep client
[root@westos-mail ~]# postconf -e "smtpd_client_restrictions = check_client_access hash:/etc/postfix/access"
[root@westos-mail ~]# vim /etc/postfix/access
172.25.254.48 REJECT
[root@westos-mail ~]# vim /etc/postfix/main.cf
smtpd_client_restrictions = check_client_access hash:/etc/postfix/access #查看是否变色
[root@westos-mail ~]# postmap /etc/postfix/access 对文件加密
[root@westos-mail ~]# cd /etc/postfix/
[root@westos-mail postfix]# ls
access canonical header_checks master.cf relocated virtual
access.db generic main.cf moreuser transport ##.db文件为真正的加密文件
[root@westos-mail ~]# systemctl restart postfix.service
测试:
[root@foundation48 ~]# telnet 172.25.254.10 25
Trying 172.25.254.10...
Connected to 172.25.254.10.
Escape character is '^]'.
220 westos-mail.westos.com ESMTP Postfix
mail from:root@westos.com
250 2.1.0 Ok
rcpt to:root@qq.com
554 5.7.1 <unknown[172.25.254.48]>: Client host rejected: Access denied ##主机拒绝接收
2.限制用户发送
[root@westos-mail postfix]# postconf -d | grep sender
[root@westos-mail postfix]# postconf -e "smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender"
[root@westos-mail postfix]# vim /etc/postfix/sender
student@westos.com REJECT
[root@westos-mail postfix]# postmap /etc/postfix/sender
[root@westos-mail postfix]# cd /etc/postfix/
[root@westos-mail postfix]# ls
access canonical header_checks master.cf relocated sender.db virtual
access.db generic main.cf moreuser sender transport
[root@westos-mail postfix]# systemctl restart postfix.service
测试:
[root@foundation48 ~]# telnet 172.25.254.10 25
Trying 172.25.254.10...
Connected to 172.25.254.10.
Escape character is '^]'.
220 westos-mail.westos.com ESMTP Postfix
mail from:student@westos.com
250 2.1.0 Ok
rcpt to:root@westos.com
554 5.7.1 <student@westos.com>: Sender address rejected: Access denied
3.限制用户接收
[root@westos-mail postfix]# postconf -d | grep rec
[root@westos-mail postfix]# postconf -e "smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recip"
[root@westos-mail postfix]# vim /etc/postfix/recip
westos@westos.com REJECT
[root@westos-mail postfix]# postmap /etc/postfix/recip
[root@westos-mail postfix]# cd /etc/postfix/
[root@westos-mail postfix]# ls
access generic master.cf recip.db sender.db
access.db header_checks moreuser relocated transport
canonical main.cf recip sender virtual
[root@westos-mail postfix]# systemctl restart postfix.service
测试:
[root@foundation48 ~]# telnet 172.25.254.10 25
Trying 172.25.254.10...
Connected to 172.25.254.10.
Escape character is '^]'.
220 westos-mail.westos.com ESMTP Postfix
mail from:westos@westos.com
250 2.1.0 Ok
rcpt to:westos@westos.com
554 5.7.1 <westos@westos.com>: Recipient address rejected: Access denied
出战地址伪装
dns mx记录解析先做好
[root@westos-mail postfix]# postconf -d | grep generic
[root@westos-mail postfix]# postconf -e "virtual_alias_maps = hash:/etc/postfix/generic"
[root@westos-mail postfix]# vim /etc/postfix/generic
westos@westos.com hello@name.com
[root@westos-mail postfix]# postmap /etc/postfix/generic
[root@westos-mail postfix]# cd /etc/postfix/
[root@westos-mail postfix]# ls
access generic main.cf recip sender virtual
access.db generic.db master.cf recip.db sender.db
canonical header_checks moreuser relocated transport
[root@westos-mail postfix]# systemctl restart postfix.service
测试:
[root@westos-mail named]# su - westos
[westos@westos-mail ~]$ mail root@name.com
Subject: 9999
qqq
xzxzx
ccz
.
EOT
[westos@westos-mail ~]$ mail
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/westos": 3 messages 1 new
1 Mail Delivery System Mon May 22 07:56 72/2294 "Undelivered Mail Returned to"
2 root Mon May 22 08:14 19/570 "5656"
>N 3 Mail Delivery System Mon May 22 08:16 73/2292 "Undelivered Mail Returned to"
& q
入站地址转换
dns mx记录解析先做好
[root@westos-mail named]# postconf -d | grep virtual
[root@westos-mail named]# postconf -e "virtual_alias_maps = hash:/etc/postfix/virtual"
[root@westos-mail named]# vim /etc/postfix/virtual
hello@name.com westos@westos.com
[root@westos-mail named]# postmap /etc/postfix/virtual
[root@westos-mail named]# systemctl restart postfix.service
测试:
[root@westos-mail named]# mail -u westos
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/mail/westos": 2 messages 1 new
1 Mail Delivery System Mon May 22 07:56 72/2294 "Undelivered Mail Returned to"
>N 2 root Mon May 22 08:14 18/559 "5656"
& 2
Message 2:
From root@westos.com Mon May 22 08:14:19 2017
Return-Path: <root@westos.com>
X-Original-To: hello@name.com
Delivered-To: westos@westos.com
Date: Mon, 22 May 2017 08:14:19 -0400
To: hello@name.com
Subject: 5656
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
From: root@westos.com (root)
Status: R
czzc
&
配置dovecot
1.给定用户
用来提供收件协议
pop3 110 ##相应的端口
imap 143
imaps 993
pop3s 995
[root@westos-mail ~]# yum install dovecot -y
[root@westos-mail ~]# vim /etc/dovecot/dovecot.conf
24 protocols = imap pop3 lmtp 协议
48 login_trusted_networks = 0.0.0.0/0
49 disable_plaintext_auth = no
[root@westos-mail ~]# vim /etc/dovecot/conf.d/10-mail.conf
30 mail_location = mbox:~/mail:INBOX=/var/mail/%u
[root@westos-mail ~]# systemctl restart dovecot
测试:
[root@westos-mail ~]# su - westos
[westos@westos-mail ~]$ mkdir -p mail/.imap/
[westos@westos-mail ~]$ touch mail/.imap/INBOX
[root@westos-mail ~]# mkdir -p /etc/skel/mail/.imap
[root@westos-mail ~]# touch /etc/skel/mail/.imap/INBOX
[root@westos-mail ~]# yum install mutt ##安装服务
[root@westos-mail ~]# mutt -f pop://westos@172.25.254.120
按o进入 输入密码可以查看自己的邮件
雷鸟
可以在网上去下载雷鸟
[root@foundation48 ~]# rpm -ivh /home/kiosk/Desktop/thunderbird-31.2.0-1.el7.x86_64.rpm