all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Carsten Haerle <carsten.haerle@straightec.de>
To: pmg-devel@lists.proxmox.com
Cc: Carsten Haerle <carsten.haerle@straightec.de>
Subject: [PATCH pmg-api 1/6] fix #8231: config: add option to not trust the local network automatically
Date: Mon, 26 Oct 2026 10:58:46 +0100	[thread overview]
Message-ID: <20261026095852.3243241-2-carsten.haerle@straightec.de> (raw)
In-Reply-To: <20261026095852.3243241-1-carsten.haerle@straightec.de>

The network of the node's IP address is always added to postfix'
mynetworks, so every host in it may relay mail through the internal
port to any destination. This is not visible in the GUI and can only be
changed by overriding the main.cf template, which then has to be kept
in sync with every update.

Add the 'trust_local_network' option to the mail section. It defaults
to 1, keeping the current behaviour. If disabled, only loopback, the
default relay, transport hosts and the configured networks are trusted.

Signed-off-by: Carsten Haerle <carsten.haerle@straightec.de>
---
 src/PMG/Config.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index 070a34f..655a433 100644
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -695,6 +695,14 @@ sub properties {
             type => 'boolean',
             default => 0,
         },
+        trust_local_network => {
+            description => "Trust the network of the node's IP address, that is, allow all"
+                . " hosts in it to relay mail through the internal port. If disabled, only"
+                . " the default relay, transport hosts and the configured networks are"
+                . " trusted.",
+            type => 'boolean',
+            default => 1,
+        },
         maxsize => {
             description =>
                 "Maximum email size. Larger mails are rejected. (postfix option `message_size_limit`)",
@@ -876,6 +884,7 @@ sub options {
         max_filters => { optional => 1 },
         max_policy => { optional => 1 },
         hide_received => { optional => 1 },
+        trust_local_network => { optional => 1 },
         rejectunknown => { optional => 1 },
         rejectunknownsender => { optional => 1 },
         conn_count_limit => { optional => 1 },
@@ -1578,7 +1587,8 @@ sub get_template_vars {
 
     $vars->{postfix}->{transportnets} = join(' ', sort keys %$transportnets);
 
-    if (defined($int_ip)) { # we cannot really do anything and the loopback nets are already added
+    # without an IP we cannot really do anything and the loopback nets are already added
+    if (defined($int_ip) && $self->get('mail', 'trust_local_network')) {
         if (my $int_net_cidr = PMG::Utils::find_local_network_for_ip($int_ip, 1)) {
             if ($int_net_cidr =~ m/^($IPV6RE)\/(\d+)$/) {
                 $mynetworks->{"[$1]/$2"} = 1;
-- 
2.53.0








  reply	other threads:[~2026-10-27  9:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26  9:58 [PATCH pmg-api/pmg-gui/pmg-docs 0/6] fix #8231: mail proxy: make automatically trusted networks visible and the local network optional Carsten Haerle
2026-10-26  9:58 ` Carsten Haerle [this message]
2026-10-26  9:58 ` [PATCH pmg-api 2/6] config: factor out automatically trusted networks Carsten Haerle
2026-10-26  9:58 ` [PATCH pmg-api 3/6] fix #8231: api: mynetworks: optionally list " Carsten Haerle
2026-10-26  9:58 ` [PATCH pmg-api 4/6] fix #8231: config: resolve relay and transport host names for mynetworks Carsten Haerle
2026-10-26  9:58 ` [PATCH pmg-gui 5/6] fix #8231: mail proxy: add trust local network option, show automatic networks Carsten Haerle
2026-10-26  9:58 ` [PATCH pmg-docs 6/6] mail proxy: networks: document automatically trusted networks Carsten Haerle

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=20261026095852.3243241-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal