From: Carsten Haerle <carsten.haerle@straightec.de>
To: pmg-devel@lists.proxmox.com
Cc: Carsten Haerle <carsten.haerle@straightec.de>
Subject: [PATCH pmg-api] fix #8231: api: transport: regenerate postfix config on changes
Date: Mon, 26 Oct 2026 10:58:57 +0100 [thread overview]
Message-ID: <20261026095857.3243396-1-carsten.haerle@straightec.de> (raw)
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
reply other threads:[~2026-10-27 9:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261026095857.3243396-1-carsten.haerle@straightec.de \
--to=carsten.haerle@straightec.de \
--cc=pmg-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox