From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 3FD671FF0C4 for ; Tue, 27 Oct 2026 10:31:34 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 36CB9216A8; 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=1793008737; 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=3/yDl45v3QlsYiCD67nK0isobObsAVr4xtGz/FKvWhU=; b=uj5ABstshpeGUfzAiEAAQAYb/KMzyC0k+a/EgWTZSadPuGUDXjZoLjyMC7WxkFQcV2uHlN co+dMpgI3Ou91o9zzR/esRGsFbgMOfikUBSCg9kRrvx9XbowIgo1RhcssH3duXQ4ZykzVI mfenyYbcWfYsX29XLvwsI4CL5nkzEzMkbOb1QxHkU9F43GdO8dZsb/6HMz/g2DgXXtYRq+ 1E5SLQpGN8ZXKdE1+vUWQEFCGF0mupjRL6IZfu36oEW+JAocwUnvxtgwvi1u3nkOvvs3yB +LpLlaPQrEKIpyLpm8ZZCNijn9mTSg8p/X7d20bVWeF2HVcISfi2Zx/6UHjCbg== From: Carsten Haerle To: pmg-devel@lists.proxmox.com Subject: [PATCH pmg-api/pmg-gui/pmg-docs 0/6] fix #8231: mail proxy: make automatically trusted networks visible and the local network optional Date: Mon, 26 Oct 2026 10:58:45 +0100 Message-ID: <20261026095852.3243241-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 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: NPYMSJLK76NMYBDKZAPPGTDZ6XKKXP4X X-Message-ID-Hash: NPYMSJLK76NMYBDKZAPPGTDZ6XKKXP4X 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: Besides the networks configured under Mail Proxy > Networks, PMG adds the network of the node's IP address, the default relay and all transport hosts (if configured as IP address) to postfix' mynetworks. All hosts in it may relay through the internal port to any destination. None of these entries is shown in the GUI, so the Networks panel can be empty while a whole /24 is trusted, and the local network can only be removed by overriding the main.cf template. This series - adds the option 'trust_local_network' (default 1, current behaviour unchanged) to stop trusting the local network automatically, - lets the mynetworks API optionally list the automatic entries with their origin ('automatic=3D1', without it the result is unchanged), - shows them greyed out in the Networks panel, with a comment that tells where each one is configured, - resolves default relay and transport hosts configured by host name, so that they are trusted like hosts configured by address (pmg-api 4/6), - documents all of this. The default relay and transport hosts stay trusted unconditionally, as they are the mail servers that send outgoing mail through the internal port in the recommended setup. Patch 4/6 changes existing installations that use host names for the default relay or transports (these hosts can now relay, as they could if configured by address), so it is a separate patch and can be considered on its own. The docs patch describes the behaviour with it applied. The GUI patch (5/6) depends on pmg-api 3/6. Tested on a single-node PMG 9.1 (pmg-api 9.1.4, pmg-gui 5.2.3): - option on: generated mynetworks identical to before - option off: a host of the local network gets "454 4.7.1 Relay access denied" on port 26 for external recipients; an explicitly configured host of the same network may still relay - API without parameter returns the configured networks only; with automatic=3D1 also local network, default relay and transport hosts with their origin - default relay and transport by host name are resolved and listed with the name; a name that cannot be resolved is skipped with one warning per config sync While testing I noticed that adding, changing or removing a transport only runs postmap on the transport map but does not regenerate main.cf, so the transport host's mynetworks entry is only updated with the next full config sync. That is independent of this series and sent as a separate patch for the same bug. pmg-api: Carsten Haerle (4): fix #8231: config: add option to not trust the local network automati= cally config: factor out automatically trusted networks fix #8231: api: mynetworks: optionally list automatically trusted net= works fix #8231: config: resolve relay and transport host names for mynetwo= rks src/PMG/API2/MyNetworks.pm | 47 ++++++++++++++- src/PMG/Config.pm | 144 ++++++++++++++++++++++++++++++++---------= ---- 2 files changed, 150 insertions(+), 41 deletions(-) pmg-gui: Carsten Haerle (1): fix #8231: mail proxy: add trust local network option, show automatic= networks js/MailProxyOptions.js | 4 ++++ js/MyNetworks.js | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) pmg-docs: Carsten Haerle (1): mail proxy: networks: document automatically trusted networks pmgconfig.adoc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --=20 2.53.0