linux配置电子邮件传输(二)

来源:互联网 发布:淘宝助理无法一键适配 编辑:程序博客网 时间:2024/06/06 11:04

下面我们做一些邮件客户端的配置

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]# lsaccess     canonical  header_checks  master.cf  relocated  virtualaccess.db  generic    main.cf        moreuser   transport    ##.db文件为真正的加密文件[root@westos-mail ~]# systemctl restart postfix.service 测试:[root@foundation48 ~]# telnet 172.25.254.10 25Trying 172.25.254.10...Connected to 172.25.254.10.Escape character is '^]'.220 westos-mail.westos.com ESMTP Postfixmail from:root@westos.com250 2.1.0 Okrcpt to:root@qq.com554 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/senderstudent@westos.com REJECT[root@westos-mail postfix]# postmap /etc/postfix/sender [root@westos-mail postfix]# cd /etc/postfix/[root@westos-mail postfix]# lsaccess     canonical  header_checks  master.cf  relocated  sender.db  virtualaccess.db  generic    main.cf        moreuser   sender     transport[root@westos-mail postfix]# systemctl restart postfix.service 

测试:

[root@foundation48 ~]# telnet 172.25.254.10 25Trying 172.25.254.10...Connected to 172.25.254.10.Escape character is '^]'.220 westos-mail.westos.com ESMTP Postfixmail from:student@westos.com250 2.1.0 Okrcpt to:root@westos.com554 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/recipwestos@westos.com REJECT[root@westos-mail postfix]# postmap /etc/postfix/recip[root@westos-mail postfix]# cd /etc/postfix/[root@westos-mail postfix]# lsaccess     generic        master.cf  recip.db   sender.dbaccess.db  header_checks  moreuser   relocated  transportcanonical  main.cf        recip      sender     virtual[root@westos-mail postfix]# systemctl restart postfix.service 

测试:

[root@foundation48 ~]# telnet 172.25.254.10 25Trying 172.25.254.10...Connected to 172.25.254.10.Escape character is '^]'.220 westos-mail.westos.com ESMTP Postfixmail from:westos@westos.com250 2.1.0 Okrcpt to:westos@westos.com554 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]# lsaccess     generic        main.cf    recip      sender     virtualaccess.db  generic.db     master.cf  recip.db   sender.dbcanonical  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.comSubject: 9999qqqxzxzxccz.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 westosHeirloom 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"& 2Message  2:From root@westos.com  Mon May 22 08:14:19 2017Return-Path: <root@westos.com>X-Original-To: hello@name.comDelivered-To: westos@westos.comDate: Mon, 22 May 2017 08:14:19 -0400To: hello@name.comSubject: 5656User-Agent: Heirloom mailx 12.5 7/5/10Content-Type: text/plain; charset=us-asciiFrom: root@westos.com (root)Status: Rczzc& 

配置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

原创粉丝点击