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 7C0641FF0AF for ; Thu, 22 Oct 2026 13:21:40 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 4E143214D3; Thu, 22 Oct 2026 13:21:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cyberfusion.io; h=cc:cc:content-transfer-encoding:date:from:from:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=default; bh=xIGxQubHSSZ4bHTrHqezmyIH8zunLTqUbUkAeCNgq4U=; b= CxkXg4HAR3G7PkglhMNt8iiPv9NtOuxGxK9ICnt9SU1IJEi5x/Aih1+XReKcwtYZ dPPEtDFG2n6KK8KeoUflT2KE0tt1moSa/+6iw+ZJUBco+LE7h+y5awiV7KwRaX6p mKWTBxXhHz9ZVHw4os8Fmm/7A1YHlcKyGSJ0/KyToM8Mmy9dIr7YeU+uZGWc1zzL 1iMuDw0Emis6X/GhU5AO3V/OnU1r8G49WURlUCgTHaB7kTIHNuciWhtDOeA7L8vF nMvE8an8D+1Ho6E9AX7Ohb4JDjJ8eujbH+2HLEkYfzasTW94487wOXapQy6HkSDG sYL8lqJAHBGOmLOb9KI3ri65tiFPTB6W3k6zzYn7XVKudKrgEnYSNbGNhEWJTY3q UIe1XTTiiTb8aauoWM8LSQl7yJtYr5aSsc2NnaENwyYCSEMHilKmXDdnBw5X2Tob UJ3VX2eSQTMZbqCO7tCJQnTIoAHgoO2LI8bmpdis1WoUTP8Oulnmy/JwmGWDdCGt 07bpHoaonyx2iWblYbOV9CyB0vwmHMdCiGQXweIprlTcgT85ZnSTNYrOcz9R7G5r 9ITsRsvNcrLGacK2fuN0CHLPEgPidHJi8SjbJJ/mAnoCsfaw17TbrC9Y0L8P9cI3 CzgkEa8/IzexcI16WguTOcMqckikK14QCPDGIARIVEQ= X-Envelope-To: pmg-devel@lists.proxmox.com X-Envelope-To: mscheer@cyberfusion.io From: Mika Scheer To: pmg-devel@lists.proxmox.com Subject: [PATCH pmg-api 1/1] fix #2999: make package update notifications configurable Date: Mon, 19 Oct 2026 17:43:15 +0200 Message-ID: <20261019154401.94264-2-mscheer@cyberfusion.io> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20261019154401.94264-1-mscheer@cyberfusion.io> References: <20261019154401.94264-1-mscheer@cyberfusion.io> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_PASS -0.001 SPF: HELO matches SPF record SPF_PASS -0.001 SPF: sender matches SPF record X-MailFrom: mscheer@cyberfusion.io X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation Message-ID-Hash: LJENJ3OKECMDJNSWJKXEIXOPPRX6QYV6 X-Message-ID-Hash: LJENJ3OKECMDJNSWJKXEIXOPPRX6QYV6 X-Mailman-Approved-At: Thu, 22 Oct 2026 13:21:38 +0200 CC: Mika Scheer 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: Signed-off-by: Mika Scheer --- src/PMG/Config.pm | 15 +++++++++++++++ src/bin/pmg-daily | 16 +++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm index 070a34f..ee8c397 100644 --- a/src/PMG/Config.pm +++ b/src/PMG/Config.pm @@ -196,6 +196,20 @@ EODESC format => 'pmg-log-tracker-base', default => '/var/log/syslog', }, + 'package-updates' => { + description => + "Control whether the daily update job should send out notifications.", + verbose_description => < 'string', + enum => ['auto', 'always', 'never'], + default => 'auto', + }, }; } @@ -218,6 +232,7 @@ sub options { 'admin-mail-from' => { optional => 1 }, 'consent-text' => { optional => 1 }, 'log-tracker-base' => { optional => 1, root_only => 1 }, + 'package-updates' => { optional => 1 }, }; } diff --git a/src/bin/pmg-daily b/src/bin/pmg-daily index 656127b..7a85c8a 100755 --- a/src/bin/pmg-daily +++ b/src/bin/pmg-daily @@ -59,10 +59,20 @@ if (my $statlifetime = $cfg->get('admin', 'statlifetime')) { } # check for available updates -# We assume that users with subscriptions want information -# about new packages. my $info = eval { PMG::API2::Subscription::read_etc_subscription() }; -my $notify = ($info && $info->{status} eq 'active') ? 1 : 0; +my $notify_on = $cfg->get('admin', 'package-updates') // 'auto'; +my $notify = 0; +if ($notify_on eq 'auto') { + # hosts with subscriptions are likely production system and thus want infos about new packages + $notify = ($info && $info->{status} eq 'active') ? 1 : 0; +} elsif ($notify_on eq 'always') { + $notify = 1; +} elsif ($notify_on eq 'never') { + $notify = 0; +} else { + warn "unexpected package-updates notify configuration value '$notify_on'\n"; +} + eval { PMG::API2::APT->update_database({ node => $nodename, notify => $notify, quiet => 1 }); }; if (my $err = $@) { syslog('err', "update apt database failed: $err"); -- 2.50.1 (Apple Git-155)