小编Chr*_*der的帖子

使用 Postfix 将外发邮件限制到发件人地址中的特定域

出于让我想伤害自己的原因,我需要支持的应用程序能够使用任何域的“MAIL FROM”地址发送邮件。因为我无法进一步锁定应用程序,所以我希望 Postfix 健全性检查所有试图离开我的网络发往世界其他地方的邮件。

如果发件人地址为“example.com”,我只希望来自内部的邮件被允许发送出去。如果来自内部的邮件的发件人地址为“someotherdomain.com”,则应通过 Postfix 阻止该邮件。

澄清一下,如果该邮件具有我的域名之一的发件人地址,我该如何配置 Postfix 以仅允许来自我本地网络的邮件?

到目前为止,我想出如何做到这一点的唯一方法如下。但还有更简单的吗?

/etc/postfix/main.cf:

smtpd_restriction_classes =
        external_sender_access
        internal_sender_access

# Intended for mail originating from outside our networks
external_sender_access =
        # Verify MAIL_FROM on incoming mail
        check_sender_access hash:/etc/postfix/external_sender_access
        # Allow all other incoming mail
        permit

# Intended for mail originating from within our networks
internal_sender_access =
        # Verify MAIL_FROM on outgoing mail
        check_sender_access hash:/etc/postfix/internal_sender_access
        # Block all other outbound mail
        reject

# Restrictions applied in the context of the MAIL FROM command.
smtpd_sender_restrictions …
Run Code Online (Sandbox Code Playgroud)

postfix

8
推荐指数
2
解决办法
8793
查看次数

标签 统计

postfix ×1