加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 如何在Postfix中强制发件人地址为“logged-in-user@exa

发布时间:2020-12-13 18:28:17 所属栏目:Linux 来源:网络整理
导读:我已经设置了一个带有SMTP AUTH的Postfix服务器(端口587上的STARTTLS).我的所有用户都在“example.org”域中.我想强制发件人地址为“logged-in-user@example.org”. 我了解到这可以通过main.cf选项实现 smtpd_sender_restrictions = reject_sender_login_mis
我已经设置了一个带有SMTP AUTH的Postfix服务器(端口587上的STARTTLS).我的所有用户都在“example.org”域中.我想强制发件人地址为“logged-in-user@example.org”.

我了解到这可以通过main.cf选项实现

smtpd_sender_restrictions = reject_sender_login_mismatch,...
smtpd_sender_login_maps = hash:/etc/postfix/smtpd_sender_login_maps

使用login_maps文件,如:

a@example.org a
b@example.org b
c@example.org c
...

(另请参阅Block sender address spoofing with SMPT AUTH),但这意味着每次有新用户时我都必须编辑login_maps文件.我不需要这样灵活的映射:它应该始终是“logged-in-user@example.org”.有更简单的选择吗?

解决方法

首先,通过输入命令postconf -m并在其中查找带有pcre的行来检查Postfix的安装是否支持pcre.一旦确认您有pcre支持,您可以执行以下操作:

/etc/postfix/login_maps.pcre:

/^(.*)@example.org$/   ${1}

在main.cf中:

smtpd_sender_login_maps = pcre:/etc/postfix/login_maps.pcre

这应该工作正常.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读