From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 648451FF13B for ; Mon, 08 Jun 2026 16:02:09 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3333C1E8CD; Mon, 8 Jun 2026 16:02:09 +0200 (CEST) From: Stoiko Ivanov To: pmg-devel@lists.proxmox.com Subject: [PATCH pmg-api] quarantine: link generate call: restrict link to relay domains Date: Mon, 8 Jun 2026 16:01:31 +0200 Message-ID: <20260608140136.687820-1-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1780927281700 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.064 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [quarantine.pm] Message-ID-Hash: FAMEJR6GDE2IYN5F33ZU574SHKNI2HAV X-Message-ID-Hash: FAMEJR6GDE2IYN5F33ZU574SHKNI2HAV X-MailFrom: s.ivanov@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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: both when using the send quarantine link functionality before logging in, as well as when sending out reports to users, we verify that the e-mail address is internal (in the sense of being an address inside one of the relay domains). while allowing this for all addresses could make sense in certain use-cases (e.g. making some mail-content available to an external contact, without sending it via SMTP on the public internet), treat it as an error for now - relaxing the constraint on the address later is always possible, restricting it might brake the workflow of some users. follows commit: 2d3a8a50 ("fix #3414: quarantine: add API to get a login link for a mail") minimally tested with `pmgsh get /quarantine/link -mail` with relayed and external addresses. Signed-off-by: Stoiko Ivanov --- src/PMG/API2/Quarantine.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/PMG/API2/Quarantine.pm b/src/PMG/API2/Quarantine.pm index 6f88ddee..eb31be77 100644 --- a/src/PMG/API2/Quarantine.pm +++ b/src/PMG/API2/Quarantine.pm @@ -1723,7 +1723,16 @@ __PACKAGE__->register_method({ my $cfg = PMG::Config->new(); - my ($link) = build_quarantine_link($cfg, $param->{mail}); + my $domains = PVE::INotify::read_file('domains'); + my $domainregex = PMG::Utils::domain_regex([keys %$domains]); + + my $receiver = $param->{mail}; + + raise_param_exc({ + mail => "link generation only allowed for address inside relay domains" }) + if ($receiver !~ $domainregex); + + my ($link) = build_quarantine_link($cfg, $receiver); return { link => $link }; }, -- 2.47.3