* [PATCH pmg-api] fix #8231: api: transport: regenerate postfix config on changes
@ 2026-10-26 9:58 Carsten Haerle
0 siblings, 0 replies; only message in thread
From: Carsten Haerle @ 2026-10-26 9:58 UTC (permalink / raw)
To: pmg-devel; +Cc: Carsten Haerle
Transport hosts configured as IP address are added to postfix'
mynetworks, so they may relay through the internal port. Adding,
changing or removing a transport only ran postmap on the transport map,
though, so main.cf and thus mynetworks were only updated with the next
full config sync. Until then a new transport host could not relay, and
a removed one still could.
Regenerate the postfix configuration and reload postfix if it changed,
as is already done for changes of the trusted networks.
rewrite_config_postfix() also runs postmap on the transport map.
Signed-off-by: Carsten Haerle <carsten.haerle@straightec.de>
---
src/PMG/API2/Transport.pm | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/PMG/API2/Transport.pm b/src/PMG/API2/Transport.pm
index c592518..937f99d 100644
--- a/src/PMG/API2/Transport.pm
+++ b/src/PMG/API2/Transport.pm
@@ -12,6 +12,7 @@ use PVE::RESTHandler;
use PVE::INotify;
use PMG::Config;
+use PMG::Utils;
use base qw(PVE::RESTHandler);
@@ -127,7 +128,11 @@ __PACKAGE__->register_method({
PVE::INotify::write_file('transport', $tmap);
- PMG::Config::postmap_pmg_transport();
+ # transport hosts given as IP address are part of mynetworks
+ my $cfg = PMG::Config->new();
+ if ($cfg->rewrite_config_postfix()) {
+ PMG::Utils::service_cmd('postfix', 'reload');
+ }
};
PMG::Config::lock_config($code, "add transport map entry failed");
@@ -247,7 +252,11 @@ __PACKAGE__->register_method({
PVE::INotify::write_file('transport', $tmap);
- PMG::Config::postmap_pmg_transport();
+ # transport hosts given as IP address are part of mynetworks
+ my $cfg = PMG::Config->new();
+ if ($cfg->rewrite_config_postfix()) {
+ PMG::Utils::service_cmd('postfix', 'reload');
+ }
};
PMG::Config::lock_config($code, "update transport map entry failed");
@@ -289,7 +298,11 @@ __PACKAGE__->register_method({
PVE::INotify::write_file('transport', $tmap);
- PMG::Config::postmap_pmg_transport();
+ # transport hosts given as IP address are part of mynetworks
+ my $cfg = PMG::Config->new();
+ if ($cfg->rewrite_config_postfix()) {
+ PMG::Utils::service_cmd('postfix', 'reload');
+ }
};
PMG::Config::lock_config($code, "delete transport map entry failed");
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-27 9:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-26 9:58 [PATCH pmg-api] fix #8231: api: transport: regenerate postfix config on changes Carsten Haerle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox