From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 6F0151FF0B0 for ; Tue, 27 Oct 2026 10:31:42 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id CD5B2216E2; Tue, 27 Oct 2026 10:31:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=straightec.de; s=dkim; t=1793008743; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ahrlL+E5DNaOxykQxXpHg5VLebjjWfYMgYuDxNHe+PE=; b=FPApMppePtZFAO/CndOz1Vu6Tu68AnKIzgDwEo3g9Fw48nZVxiuOThPlwmmso8DMVkPgnK DjUze0Ldxfa4q/UYzlRhxVFeEyWs6EdPiWVW5jPS3N9CyTYBrLEGLCBManXKhXeqgyaJ/a WkjmQaQt+WyOA3yMUwA3xh+9VBQgoJFzcolTnomwxYPddIDQ5IgJkLDi2G1zlsP+MhwaZT J2iHKBC4iGEq6hB0979SoZNvM8FjAY2ap07CRV+TBhNizBwD7fxgmj59s9mqaRbSAJgJtX cUTyjBf81Yx2PSJi+XIqGqMHLNmYryK69gJaSdPOo5yjmRbqWYU7HAMsQZo8dw== From: Carsten Haerle To: pmg-devel@lists.proxmox.com Subject: [PATCH pmg-api] fix #8231: api: transport: regenerate postfix config on changes Date: Mon, 26 Oct 2026 10:58:57 +0100 Message-ID: <20261026095857.3243396-1-carsten.haerle@straightec.de> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.006 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record X-MailFrom: carsten.haerle@straightec.de X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation Message-ID-Hash: S7UESLQNZZLFRY2D5L4XWXWUJNILP2SG X-Message-ID-Hash: S7UESLQNZZLFRY2D5L4XWXWUJNILP2SG X-Mailman-Approved-At: Tue, 27 Oct 2026 10:31:21 +0100 CC: Carsten Haerle X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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; =20 use PMG::Config; +use PMG::Utils; =20 use base qw(PVE::RESTHandler); =20 @@ -127,7 +128,11 @@ __PACKAGE__->register_method({ =20 PVE::INotify::write_file('transport', $tmap); =20 - PMG::Config::postmap_pmg_transport(); + # transport hosts given as IP address are part of mynetworks + my $cfg =3D PMG::Config->new(); + if ($cfg->rewrite_config_postfix()) { + PMG::Utils::service_cmd('postfix', 'reload'); + } }; =20 PMG::Config::lock_config($code, "add transport map entry failed"); @@ -247,7 +252,11 @@ __PACKAGE__->register_method({ =20 PVE::INotify::write_file('transport', $tmap); =20 - PMG::Config::postmap_pmg_transport(); + # transport hosts given as IP address are part of mynetworks + my $cfg =3D PMG::Config->new(); + if ($cfg->rewrite_config_postfix()) { + PMG::Utils::service_cmd('postfix', 'reload'); + } }; =20 PMG::Config::lock_config($code, "update transport map entry failed= "); @@ -289,7 +298,11 @@ __PACKAGE__->register_method({ =20 PVE::INotify::write_file('transport', $tmap); =20 - PMG::Config::postmap_pmg_transport(); + # transport hosts given as IP address are part of mynetworks + my $cfg =3D PMG::Config->new(); + if ($cfg->rewrite_config_postfix()) { + PMG::Utils::service_cmd('postfix', 'reload'); + } }; =20 PMG::Config::lock_config($code, "delete transport map entry failed= "); --=20 2.53.0