当使用 `postconf -n` 时,警告 `未定义参数:mua_sender_restrictions`

当使用 `postconf -n` 时,警告 `未定义参数:mua_sender_restrictions`

我的系统是 centos 7。我正在使用 postfix、dovecot、mariadb 设置基于这个帖子
我的邮件服务器有问题,可以发送邮件,但不能接收邮件

然后我得到的postconf -n结果如下:

[root@server6328 log]# postconf -n
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_sender_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_client_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_helo_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_sender_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_client_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_helo_restrictions
postconf: warning: /etc/postfix/main.cf: undefined parameter: virtual_mailbox_limit_maps
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
disable_vrfy_command = yes
dovecot_destination_recipient_limit = 1
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 30720000
milter_default_action = accept
milter_protocol = 6
mydestination = $myhostname,localhost.$mydomain,localhost,localhost.localdomain
myhostname = mail.mydomain.com
mynetworks = 127.0.0.1
newaliases_path = /usr/bin/newaliases.postfix
non_smtpd_milters = $smtpd_milters
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
show_user_unknown_table_name = no
smtp_tls_security_level = may
smtpd_helo_required = yes
smtpd_helo_restrictions = reject_non_fqdn_helo_hostname,reject_invalid_helo_hostname,reject_unknown_helo_hostname
smtpd_milters = inet:127.0.0.1:8891
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination,check_policy_service unix:private/policy-spf,reject_invalid_hostname,reject_non_fqdn_helo_hostname,reject_non_fqdn_sender,reject_non_fqdn_recipient
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous, noplaintext
smtpd_sasl_tls_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = reject_non_fqdn_sender,reject_unknown_sender_domain,reject_rbl_client zen.spamhaus.org
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/pki/dovecot/certs/fullchain.cer
smtpd_tls_key_file = /etc/pki/dovecot/private/*.mydomain.com.key
smtpd_tls_loglevel = 0
smtpd_tls_security_level = may
smtpd_use_tls = yes
unknown_local_recipient_reject_code = 550
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_gid_maps = static:1000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_limit = 209715200
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_transport = dovecot
virtual_uid_maps = static:1000
postconf: warning: /etc/postfix/main.cf: unused parameter: policy_time_limit=3600s
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_maildir_limit_message=Sorry, the maildir has overdrawn diskspace quota
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_maildir_extended=yes
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_create_maildirsize=yes
postconf: warning: /etc/postfix/main.cf: unused parameter: policy-spf_time_limit=3600

我注意到一些警告

postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_sender_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_client_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_helo_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_sender_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_client_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_helo_restrictions
postconf: warning: /etc/postfix/main.cf: undefined parameter: virtual_mailbox_limit_maps

postconf: warning: /etc/postfix/main.cf: unused parameter: policy_time_limit=3600s
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_maildir_limit_message=Sorry, the maildir has overdrawn diskspace quota
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_maildir_extended=yes
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_create_maildirsize=yes
postconf: warning: /etc/postfix/main.cf: unused parameter: policy-spf_time_limit=3600

的有效部分/etc/postfix/master.cf是:

smtp      inet  n       -       n       -       -       smtpd
#smtp      inet  n       -       n       -       1       postscreen
#smtpd     pass  -       -       n       -       -       smtpd
#dnsblog   unix  -       -       n       -       0       dnsblog
#tlsproxy  unix  -       -       n       -       0       tlsproxy
submission inet n       -       n       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_reject_unlisted_recipient=no
  -o smtpd_client_restrictions=$mua_client_restrictions
  -o smtpd_helo_restrictions=$mua_helo_restrictions
  -o smtpd_sender_restrictions=$mua_sender_restrictions
 -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
smtps     inet  n       -       n       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_reject_unlisted_recipient=no
  -o smtpd_client_restrictions=$mua_client_restrictions
  -o smtpd_helo_restrictions=$mua_helo_restrictions
  -o smtpd_sender_restrictions=$mua_sender_restrictions
  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       n       -       -       qmqpd
pickup    unix  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr

dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/dovecot-lda -f ${sender} -d ${recipient}
policyd-spf  unix  -       n       n       -       0       spawn
  user=nobody argv=/usr/libexec/postfix/policyd-spf

这些警告可能是什么原因造成的?如何解决?

答案1

您的main.cfmaster.cf配置不匹配。这可能是由于复制原本应该放在一起的配置示例并缺少一侧而造成的。

  1. 当您在 master.cf 中更改 policyd-spf 的设置时,您调用了您的服务

    policyd-spf  unix  -       n       n       -       0       spawn
    

    但是当main.cf您尝试更改其配置时,如果没有字母d

    policy-spf_time_limit=3600
    
  2. 然后你对 做了类似的事情smtpd_*_restrictions。你引用了mua_*设置,但没有在任何地方定义它们。

    如果您将自定义限制列表添加到,则可以在限制设置的右侧使用它们时smtpd_restriction_classes跳过,这样在配置错误的情况下您会得到更易读的错误消息:$

    smtpd_restriction_classes = mua_sender_restrictions, mua_client_restrictions, 
                                mua_helo_restrictions, mua_sender_restrictions
    mua_client_restrictions = permit_sasl_authenticated, reject
    ...
    

    然后在master.cf

    smtps ..
      ..
      -o smtpd_client_restrictions=mua_client_restrictions
    

我强烈建议从一组全新的库存配置开始,一步一步地添加您真正需要的更改。

运行 postconf 应该会发出警告。避免运行已经告诉你配置的某些部分不起作用的系统postconf。即使包含了许多安全措施后缀,很容易创建一个会被垃圾邮件发送者滥用的设置。

答案2

让我猜一下,您正在运行最新的 Postfix。是的,Postfix 的维护者mua_client_restrictions以部分方式添加了配置文件的 on...。

这个“漏洞”出现在https://github.com/vdukhovni/postfix/commit/99ff75430d5c908879caffc1125680ed68019021#diff-6f25157451e1bcb001a0a6926795486bR23

您可以写信给胜利者Postfix 维护者,对默认 Postfix 提供的文件进行部分介绍。虽然 Victor 确实是一位专注于更安全的 Postfix 及其安全性的专家,但 Victor 尚未赶上 GitHub 文化,更不用说为 Postfix 维护 bugzilla 了,而是依赖于其他特定于发行版的 bugzilla。

或者你可以自己修复,用这个StackExchange 答案

更新:或者我可以剪切粘贴答案......

将以下内容添加到您的 /etc/postfix/main.cf 文件中。

smtpd_restriction_classes = mua_sender_restrictions, mua_client_restrictions, mua_helo_restrictions

mua_client_restrictions = permit_sasl_authenticated, reject

mua_sender_restrictions = permit_sasl_authenticated, reject

mua_helo_restrictions = permit_mynetworks, reject_non_fqdn_hostname, reject_invalid_hostname, permit

答案3

我认为从语法上讲,您需要使用 -o 前缀来编写这些行:

     -o smtpd_restriction_classes = mua_sender_restrictions, mua_client_restrictions, mua_helo_restrictions
     -o mua_client_restrictions = permit_sasl_authenticated, reject
     -o mua_sender_restrictions = permit_sasl_authenticated, reject
     -o mua_helo_restrictions = permit_mynetworks, reject_non_fqdn_hostname, reject_invalid_hostname, permit

至少对我来说这是有效的。

答案4

鉴于这些mua_选项甚至无效(见man 5 postconf),我认为您可以删除这些行。这对我有用。

相关内容