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

限制用户发送

配置

[root@westos-mail ~]# postconf -e “smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender”
[root@westos-mail ~]# vim /etc/postfix/sender
[email protected] REJECT ##限制[email protected]用户发送
[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: [email protected] ##用[email protected]发送
250 2.1.0 Ok
rcpt to: [email protected]
250 2.1.5 Ok
data
354 End data with .
22222222222222222
.
250 2.0.0 Ok: queued as 07C1C246207 ##发送成功
mail from: [email protected] ##用[email protected]发送
250 2.1.0 Ok
rcpt to: [email protected]
554 5.7.1 [email protected]: 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
[email protected] REJECT ##限制[email protected]用户接收
[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: [email protected] ##用[email protected]发送
250 2.1.0 Ok
rcpt to: [email protected]
250 2.1.5 Ok
data
354 End data with .
dassssssssssssssssssssssss
.
250 2.0.0 Ok: queued as 79120EAC28 ##发送成功
mail from: [email protected]
250 2.1.0 Ok
rcpt to: [email protected] ##用[email protected]接受
554 5.7.1 [email protected]: Recipient address rejected: Access denied ##受限
postfix邮件服务:限制用户发送、接收;出站地址伪装、入站地址转换_第1张图片

出站地址伪装

配置

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

测试

[root@westos-mail ~]# su - student
[student@westos-mail ~]$ mail [email protected]
postfix邮件服务:限制用户发送、接收;出站地址伪装、入站地址转换_第2张图片

入站地址转换

配置

配置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
虚拟名 真实名
[email protected] [email protected]
[root@westos-mail ~]# postmap /etc/postfix/virtual
[root@westos-mail ~]# systemctl restart postfix.service

测试

[root@qq-mail ~]# mail [email protected]
postfix邮件服务:限制用户发送、接收;出站地址伪装、入站地址转换_第3张图片

你可能感兴趣的:(学习文档)