postfix邮件服务:限制用户发送、接收;出站地址伪装、入站地址转换

限制用户发送

配置

[root@westos-mail ~]# postconf -e “smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender”
[root@westos-mail ~]# vim /etc/postfix/sender
student@westos.com REJECT ##限制student@westos.com用户发送
[root@westos-mail ~]# postmap /etc/postfix/sender ##加密
[root@westos-mail ~]# systemctl restart postfix.service

测试

[kiosk@foundation19 Desktop]$ telnet 172.25.254.119 25
Trying 172.25.254.119…
Connected to 172.25.254.119.
Escape character is ‘^]’.
220 westos-mail.westos.com ESMTP Postfix
mail from: root@westos.com ##用root@westos.com发送
250 2.1.0 Ok
rcpt to: root@qq.com
250 2.1.5 Ok
data
354 End data with .
22222222222222222
.
250 2.0.0 Ok: queued as 07C1C246207 ##发送成功
mail from: student@westos.com ##用student@westos.com发送
250 2.1.0 Ok
rcpt to: root@qq.com
554 5.7.1 student@westos.com: Sender address rejected: Access denied ##受限

限制用户接收

配置

[root@westos-mail ~]# postconf -e “smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recip”
[root@westos-mail ~]# vim /etc/postfix/recip
student@westos.com REJECT ##限制student@westos.com用户接收
[root@westos-mail ~]# postmap /etc/postfix/recip ##加密
[root@westos-mail ~]# systemctl restart postfix.service

测试

[kiosk@foundation19 Desktop]$ telnet 172.25.254.119 25
Trying 172.25.254.119…
Connected to 172.25.254.119.
Escape character is ‘^]’.
220 westos-mail.westos.com ESMTP Postfix
mail from: student@westos.com ##用student@westos.com发送
250 2.1.0 Ok
rcpt to: root@qq.com
250 2.1.5 Ok
data
354 End data with .
dassssssssssssssssssssssss
.
250 2.0.0 Ok: queued as 79120EAC28 ##发送成功
mail from: root@westos.com
250 2.1.0 Ok
rcpt to: student@westos.com ##用student@westos.com接受
554 5.7.1 student@westos.com: Recipient address rejected: Access denied ##受限
这里写图片描述

出站地址伪装

配置

[root@westos-mail ~]# postconf -e “smtp_generic_maps = hash:/etc/postfix/generic”
[root@westos-mail ~]# vim /etc/postfix/generic
真实名 伪装名
student@westos.com hello@sb.com
[root@westos-mail ~]# postmap /etc/postfix/generic
[root@westos-mail ~]# systemctl restart postfix.service

测试

[root@westos-mail ~]# su - student
[student@westos-mail ~]$ mail root@qq.com
这里写图片描述

入站地址转换

配置

配置dns 记录解析

[root@westos-mail ~]# vim /etc/named.rfc1912.zones
zone “sb.com” IN {
type master;
file “sb.com.zone”;
allow-update { none; };
};
[root@westos-mail ~]# cp -p /var/named/westos.com.zone /var/named/sb.com.zone
[root@westos-mail ~]# vim /var/named/sb.com.zone
$TTL 1D
@ IN SOA sb.com. root.sb.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.sb.com.
dns A 172.25.254.119
sb.com. MX 1 172.25.254.119.
[root@westos-mail ~]# systemctl restart named

配置别名

[root@westos-mail ~]# postconf -e “virtual_alias_maps = hash:/etc/postfix/virtual”
[root@westos-mail ~]# vim /etc/postfix/virtual
虚拟名 真实名
hello@sb.com student@westos.com
[root@westos-mail ~]# postmap /etc/postfix/virtual
[root@westos-mail ~]# systemctl restart postfix.service

测试

[root@qq-mail ~]# mail hello@sb.com
这里写图片描述

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值