the current logic for reloading postfix only does so if the tls config
parameter changes (after rewriting the config files).
this does not cover the case where a certificate is replaced in a
setup, which already has tls enabled (config stays the same, so
postfix does not get reloaded)
the issue is mostly cosmetic, since postfix does eventually fork off
new smtpd instances, which read the files from disk, but it's
inconvenient, when trying out the new acme integration, and then
running a ssl-check on your PMG from external just to see that the
certificate was not updated.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
my $code = sub {
my $cfg = PMG::Config->new();
- if (!$cfg->get('mail', 'tls') == !$on) {
- return;
+ if (!$cfg->get('mail', 'tls') != !$on) {
+ print "Rewriting postfix config\n";
+ $cfg->set('mail', 'tls', $on);
+ $cfg->write();
+ my $changed = $cfg->rewrite_config_postfix();
}
- print "Rewriting postfix config\n";
- $cfg->set('mail', 'tls', $on);
- $cfg->write();
- my $changed = $cfg->rewrite_config_postfix();
-
- if ($changed && $reload) {
+ if ($reload) {
print "Reloading postfix\n";
PMG::Utils::service_cmd('postfix', 'reload');
}