Bug 263813 - mail/postfix: running post-install script modifies custom configuration settings
Summary: mail/postfix: running post-install script modifies custom configuration settings
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Juraj Lutter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-06 11:55 UTC by Sascha Biberhofer
Modified: 2024-01-17 20:51 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (otis)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sascha Biberhofer 2022-05-06 11:55:45 UTC
The pkg-install routine of mail/postfix calls postfix's post-install script on every update with the upgrade-package parameter. This parameter updates installed main.cf and master.cf, regardless of whether they were modified by a user or not.

This is particularly problematic because of that script's odd behaviour to restrict postfix to ipv4 only, see [1].

We should really try to avoid changing configuration files after they've been modified by the user, in particular if it may result in unpleasant surprises. Is there any way to call this script if and only if the main.cf/master.cf file hasn't been modified by the user and/or restrict its modifications to the sample files? 

Cheers,
Sascha


[1] https://github.com/vdukhovni/postfix/blob/master/postfix/conf/post-install#L859
Comment 1 Juraj Lutter freebsd_committer freebsd_triage 2023-04-20 08:54:02 UTC
I thought it over many times and came to the conclusion that postfix's post-install script does a good job when updating the .cf files.

Do you have any particular scenario (not mentioning inet_protocols) in mind?

Because, in particular, for inet_protocols, specifying "inet_protocols=any" in main.cf is always a good idea.
Comment 2 Michael Grimm 2024-01-17 20:00:08 UTC
(In reply to Juraj Lutter from comment #1)
I ran into this issue setting inet_protocols=ipv4 after removing inet_protocols=all from my main.cf, *because* it became the default setting:

mail> postconf -d inet_protocols
inet_protocols = all

Resetting this to inet_protocols=ipv4 *without* restarting postfix left my mailserver 
complaining and even throtteling [1] due to:

http://www.postfix.org/postconf.5.html#inet_protocols
"Note: you MUST stop and start Postfix after changing this parameter."

I do sometimes recompile and reinstall all ports of mine, that is how I found out.

I do consider this a serious bug, and I was about to open a new bug report but found this.

Regards,
Michael


[1] Jan 17 20:06:31 mail postfix/master[54448]: warning: /usr/local/libexec/postfix/smtpd: bad command startup -- throttling
Comment 3 Michael Grimm 2024-01-17 20:51:55 UTC
(In reply to Michael Grimm from comment #2)
Forget the throtteling part. If one recompiles and reinstalls a port, one should restart postfix. I forgot, my bad.