Warning `undefined parameter: mua_sender_restrictions` when `postconf -n`

Solution 1:

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. 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

Solution 2:

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:

  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.