3

My system is centos 7. I am setting up mail server with postfix,dovecot,mariadb based on this post.
There's a problem in my mail server, can send mail but cannot receive mail.

Then I postconf -n,the result as below:

[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

I noticed some warnings:

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

The effective part of /etc/postfix/master.cf is :

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

What's the possible reason of those warnings? How to solve it?

kittygirl
  • 855
  • 4
  • 10
  • 29

4 Answers4

14

Let me guess, you're running latest Postfix. Yep, Postfix maintainer of postfix added the mua_client_restrictions on of the config file(s) ... in a partial manner.

The "bug" was introduced in https://github.com/vdukhovni/postfix/commit/99ff75430d5c908879caffc1125680ed68019021#diff-6f25157451e1bcb001a0a6926795486bR23

You can drop a line to the Victor, Postfix maintainer, for doing the partial introduction into the default Postfix-supplied file. While Victor is really an expert on focusing toward a more secured Postfix and its security thereof, Victor has not caught up with the GitHub culture yet, much less maintain a bugzilla for Postfix, but instead relies on other distro-specific bugzillas.

Or you can fix it yourself, with this StackExchange answer.

UPDATE: Or I can cut-n-paste the answer...

Add the following to your /etc/postfix/main.cf file.

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
John Greene
  • 799
  • 7
  • 28
5

Your main.cf and master.cf configuration does not match. This is likely caused by copying configuration examples that were meant to go together and missing one side.

  1. When you changed a setting for policyd-spf, in master.cf, you called your service

    policyd-spf  unix  -       n       n       -       0       spawn
    

    but then in main.cf you are attempting to change its configuration without the d letter:

    policy-spf_time_limit=3600
    
  2. Then you did a similar thing with the smtpd_*_restrictions. You refer to mua_* settings, but did not define those anywhere.

    If you added your custom restriction lists to smtpd_restriction_classes, you could skip the $ when using them on the right hand side of restriction settings, which would net you more readable error messages in case of mistakes in configuration:

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

    And then in master.cf:

    smtps ..
      ..
      -o smtpd_client_restrictions=mua_client_restrictions
    

I highly recommend starting with a fresh set of stock configuration and step by step only add those changes you really do need.

Running postconf should issue zero warnings. Avoid running a system where postconf already tells you some parts of your configuration did not work. Even with a number of safeguards included in postfix, it is easy to create a setup that will be abused by spammers.

anx
  • 6,875
  • 4
  • 22
  • 45
1

I think syntactically you need to write these lines with the -o prefix:

     -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

At least that works for me.

Marjorie R
  • 11
  • 1
0

Given that the mua_ options aren't even valid (see man 5 postconf), I think you can just delete those lines. That's what worked for me.

Mike Conigliaro
  • 3,105
  • 2
  • 24
  • 24