Oefenweb / ansible-postfix

Ansible role to set up postfix in Debian-like systems
MIT License
174 stars 82 forks source link

Add compatibility level to config #70

Closed evilhamsterman closed 3 years ago

evilhamsterman commented 5 years ago

Debian and Ubuntu default to setting the config compatibility level to 2, without this value the postfix logs spit out errors like this

Sep  3 11:20:12 smtp-relay-stage postfix[3901]: Postfix is running with backwards-compatible default settings
Sep  3 11:20:12 smtp-relay-stage postfix[3901]: See http://www.postfix.org/COMPATIBILITY_README.html for details
Sep  3 11:20:12 smtp-relay-stage postfix[3901]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"

It's a minor issue but also a relatively easy fix

tersmitten commented 5 years ago

This is not backwards compatible, right?

evilhamsterman commented 5 years ago

It's set by default in Debian and Ubuntu for a while and is supported by postfix 3+. The idea is when/if postfix updates config again it will use the compatibility level until you bump the version until then it will throw warnings about what changes you should make. I believe postfix 2 just ignores it. http://www.postfix.org/COMPATIBILITY_README.html

On Wed, Sep 4, 2019, 1:28 AM Mischa ter Smitten notifications@github.com wrote:

This is not backwards compatible, right?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Oefenweb/ansible-postfix/pull/70?email_source=notifications&email_token=AAAORKEWHL2TMWMQJLTIRMTQH5WRBA5CNFSM4ITJTV5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD52ZGHQ#issuecomment-527799070, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAORKABSCDV2WXR3CW5OV3QH5WRBANCNFSM4ITJTV5A .

tersmitten commented 5 years ago
postconf mail_version
toebivankenoebi commented 4 years ago

Are you planning on merging this?

Experiencing the same issue on Ubuntu 16.04 (3.1.0) and 18.04.(3.3.0). On Ubuntu 18.04 there is also a bad "side effect" when not defining smtp_relay_restrictions nor compatibility_level and trying to send a mail via TCP socket.

root@ansible-int-client-1804:/etc/postfix# nc localhost 25
Feb 29 13:25:32 ansible-int-client-1804 postfix/smtpd[17929]: fatal: in parameter smtpd_relay_restrictions or smtpd_recipient_restrictions, specify at least one working instance of: reject_unauth_destination, defer_unauth_destination, reject, defer, defer_if_permit or check_relay_domains
Feb 29 13:25:33 ansible-int-client-1804 postfix/master[17903]: warning: process /usr/lib/postfix/sbin/smtpd pid 17929 exit status 1
Feb 29 13:25:33 ansible-int-client-1804 postfix/master[17903]: warning: /usr/lib/postfix/sbin/smtpd: bad command startup -- throttling

Defining compatibility_level = 2 solves this issue.

This currently prevents me from properly using your role on systems that run a service that needs to be sending mails over local tcp socket.

toebivankenoebi commented 4 years ago

Btw. this behavior is due to the default values beeing

compatibility_level = 0
smtpd_relay_restrictions = ${{$compatibility_level} < {1} ? {} : {permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination}}

smtpd_relay_restrictions therefor is empty which is not allowed.

The default value in Ubuntu 16.04 is not dependable on compatibility_level

smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination
racke commented 4 years ago

@evilhamsterman I agree that this change is sane and needed. I would change the name of the variable to postfix_compatibility_level though so the relationship to the config variable is clear.

tersmitten commented 3 years ago

I try to merge this in the upcoming week. I also ran into the smtpd_relay_restrictions issue.

tersmitten commented 3 years ago

Fixed in https://github.com/Oefenweb/ansible-postfix/releases/tag/v3.2.0