On 06.01.23 17:33, Wietse Venema wrote:
Peter Wienemann:
On 06.01.23 13:15, Wietse Venema wrote:
is there a way to dump the effective postfix configuration rather than
the one specified in main.cf/master.cf? It seems that changes to
main.cf/master.cf have an immediate impact on the output of postconf
regardless of whether a reload/restart of the service was performed.
How would that work? Different Postfix processes start at different
times, and some processes (qmgr, master) run forever.
I could think of something like this:
Instead of sending a HUP signal like it is done to trigger a reload, one
sends a different signal (e. g. USR1) to the master. The further
processing of the signal is similar to the HUP case except that
configuration dumps are triggered rather than configuration reloads.
How could that be useful? On a busy server, there will be be 100+
smtpd (SMTP server) processes, 100+ cleanup processes, 100+ smtp
(SMTP client) processes and so on. Those processes were started an
different times and they will produce different dumps if you change
Postfix configuration without "postfix reload".
If you want an accurate picture of what configuration is in effect.
then I think that is not too much trouble to run "postfix reload"
after a configuration change. Then "postconf" output reflects the
effective configuration.
Instead of dumping configurations, there are other ways. For example,
each daemon could log configuration file stamps when the process
is started (or communicate that info in some other manner). Given
a history of (time stamp, config file content) you could use the
logged time stamps to find out what configuration is (or was) in
effect for each daemon process.
I am trying to solve the following problem:
Most changes in main.cf require a reload to become effective but there
are some exceptions requiring a restart, e. g. a change of
inet_interfaces. I am trying to put main.cf under configuration
management and have to trigger an action each time main.cf changes such
that the changes become effective. At the moment I always perform a
restart after a change of main.cf (just to be on the safe side). But on
a busy mail server this is not ideal. I am looking for a way to do
better. One idea that came to my mind is:
1. Initially try a reload and check whether the effective configuration
is different from the target configuration as specified in main.cf.
2. If both match, we are done. If there is a discrepancy, launch a restart.
That is how I ended up with my initial question. Maybe there are
better/simpler ways to accomplish the desired result. Suggestions are
welcome.
Peter