#1053412 postfix config script overwrites explicitly set destinations with default postfix value

Package:
postfix
Source:
postfix
Description:
High-performance mail transport agent
Submitter:
Jonathan Kamens
Date:
2024-12-04 15:39:03 UTC
Severity:
normal
Tags:
#1053412#5
Date:
2023-10-03 15:43:57 UTC
From:
To:
Note: I am specifically discussing the postfix/destinations debconf
setting and the corresponding mydestination setting in
/etc/postfix/main.cf, but looking at the code in the postfix config
script, I suspect this issue may apply to other settings as well.

If I preload the postfix settings I want into the debconf database --
in particular if I set postfix/destinations to "localhost" -- and then
call dpkg-reconfigure -fnoninteractive postfix, here's what happens:

1. The config script notices that I have set postfix/destinations.
2. It calls postfix -hx mydestination, which returns the value of
   mydestination in /etc/postfix/main.cf OR THE DEFAULT VALUE IF THERE
   IS NO VALUE IN THE FILE.
3. It overwrites the postfix/destinations debconf setting with
   whatever postconf returned.
4. The postinst script is called and writes the value from
   postfix/destinations into /etc/postfix/main.cf.

As a result, the value that I explicitly put into the debconf setting
is lost, AND the wrong, default value that I don't want is explicitly
hard-coded into /etc/postfix/main.cf, perpetuating the error.

I kind of get the argument that if there is a value explicitly set in
/etc/postfix/main.cf it should override the debconf value, but if
there's no value in /etc/postfix/main.cf, then I don't think the
default value returned by postconf should overwrite an explicitly set
debconf value!

I think the fix for this would probably be to modify the config script
so that it calls postconf -nhx instead of postconf -hx and then only
replaces the setting in debconf if postconf returns a non-empty value.

Thanks,

Jonathan Kamens

#1053412#10
Date:
2024-12-04 15:36:10 UTC
From:
To:
Control: severity -1 important
Control: tag -1 + confirmed
Control: merge 734401 -1

Yes, you're exactly right here.  See also https://bugs.debian.org/734401
(filed 10 years ago) which says exactly the same.

Thanks,

/mjt