]> git.proxmox.com Git - pmg-api.git/commitdiff
fix #2360: cluster: reload pmg-smtp-filter on rulechange
authorStoiko Ivanov <s.ivanov@proxmox.com>
Fri, 6 Sep 2019 13:30:15 +0000 (15:30 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 9 Sep 2019 06:01:26 +0000 (08:01 +0200)
When a node detects a change of the rule-database during clustersync,
the database update got done, however the running `pmg-smtp-filter`
instance was not notified of the updated ruleset. Adding a call to
PMG::DBTools::reload_ruledb (like in the API2 paths) fixes the issue.

As this is guarded by a digest change check it'll only reload if the
ruleDB really changed.

We do not pass the currewnt ruleDB instance to the reload method, as
it is only used for "rewrite_postfix_whitelist", which is already
executed through the pmgmirror::cluster_sync call to
PMG::Config->rewrite_config, if needed, so don't do that twice.

Tested by
* creating a 2 node PMG cluster
* adding and removing e-mail-addresses to the Blacklist (which was used in
  a high priority, active rule)
* sending e-mails from those addresses through PMG
* observing the action taken before/after the Rule DB got synced

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PMG/Cluster.pm

index 319a45bb388aed65cc403a45c79421dd880eaf3b..3f055a01a0148fd407c19c54008e903fa614a9f2 100644 (file)
@@ -501,6 +501,8 @@ sub sync_ruledb_from_master {
        die $err;
     }
 
+    PMG::DBTools::reload_ruledb();
+
     syslog('info', "finished rule database sync from host '$ni->{ip}'");
 }