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

如何阻止Postfix接受邮件到root@hostname.localdomain

发布时间:2020-12-13 16:56:29 所属栏目:Linux 来源:网络整理
导读:如何阻止Postfix从外部接收邮件到本地用户@ my-FQDN? $hostname -fhostname.example.com Postfix接受邮件到my-FQDN的任何本地用户.因此,我们将使用root@hostname.example.com作为示例本地用户,我想停止从外部接收邮件. 我有一个非常基本的Postfix / Dovecot
如何阻止Postfix从外部接收邮件到本地用户@ my-FQDN?
$hostname -f
hostname.example.com

Postfix接受邮件到my-FQDN的任何本地用户.因此,我们将使用root@hostname.example.com作为示例本地用户,我想停止从外部接收邮件.

我有一个非常基本的Postfix / Dovecot / SASL / LDA设置,但让我分享一些细节.

>接收虚拟本地域/用户的邮件:25
>虚拟用户发送邮件:587通过Dovecot SASL进行身份验证

我试过在/ etc / aliases和Postfix的virtual_alias_maps.cf中反转用户,但没有运气.我在更新后运行newaliases和postmap.

#/etc/aliases:
#root: user@example.com

#/etc/postfix/virtual_alias_maps.cf:
root user@example.com

我想我还有四个(更新的)选择…

>在postfix / main.cf中,搞乱mydestination.我很确定我需要在这里保留我的FQDN,所以我不认为删除它是一个不错的选择.编辑:是的,虽然从mydestination删除你的FQDN禁止外界向本地用户发送邮件,但这不是禁用它的正确方法,因为这会影响其他东西.
>在postfix / main.cf中,是否有smtpd_recipient_restrictions设置禁用此功能?我在docs找不到一个.
>希望有人读到这个知道正确方法的人.

这是我的Postfix main.cf的相关部分:

myhostname = hostname.example.com
mydomain = example.com
mydestination = $myhostname,localhost.$mydomain,localhost

smtpd_recipient_restrictions =
    reject_unknown_recipient_domain,reject_non_fqdn_recipient,reject_unauth_destination,permit_mynetworks,permit

这是我的Postfix master.cf的相关部分:

submission inet n       -       -       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_sasl_type=dovecot
  -o smtpd_sasl_path=private/auth
  -o smtpd_recipient_restrictions=
     reject_unknown_recipient_domain,permit_sasl_authenticated,reject

附:这是HowTo我从VirtualUserFlatFilesPostfix开始采用了很多设置

解决方法

你提到smtp_recipient_restrictions,你真的尝试过添加行check_recipient_access哈希:/ etc / postfix / recipient_access吗?

将它放在reject_unknown_recipient_domain之前的第一行,然后放在/ etc / postfix / recipient_access中
添加行:

root@hostname.example.com REJECT

(别忘了postmap / etc / postfix / recipient_access)

顺便说一句,postmaster地址应该始终可用,但我从未见过一个RFC说root必须可用,尽管我还没有阅读每一个与SMTP相关的RFC.

(编辑:李大同)

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

    推荐文章
      热点阅读