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 690B01FF16B for ; Fri, 26 Sep 2025 20:45:53 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 46956171B7; Fri, 26 Sep 2025 20:46:26 +0200 (CEST) From: Stoiko Ivanov To: pmg-devel@lists.proxmox.com Date: Fri, 26 Sep 2025 20:43:27 +0200 Message-ID: <20250926184558.84147-1-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1758912365218 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.071 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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. [sacustom.pm, pmg-scores.cf] Subject: [pmg-devel] [PATCH pmg-api] fix #5367 api: sa-custom-score: add missing permissions to api-calls X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pmg-devel-bounces@lists.proxmox.com Sender: "pmg-devel" It seems we never added permission properties for the CRUD api calls, for SpamAssassin custom scores. This results in them being available only to root@pam. OTOH the reverting (by deleting the shadow-file), applying (by moving the shadow-file in place and restarting pmg-smtp-filter) was available to all admin users, and listing all configured scores was available to all 'admin' and 'audit' users. The functionality itself should not be restricted to root@pam only. Additionally remove a left-over commented 'protected => 1' and and one that was active but not needed (reading /etc/mail/spamassassin/pmg-scores.cf is possible for pmgproxy (running as 'www-data'). Finally fix a mistake in describing the DELETE method. Tested this with 'abc@pmg' as user - when the permissions were 'Auditor' the writing commands produced and error, with 'Administrator' everything worked. Fixes: 9aeedf1b ("add SACustom Package and API Calls for custom SpamAssassin scores") Signed-off-by: Stoiko Ivanov --- src/PMG/API2/SACustom.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/PMG/API2/SACustom.pm b/src/PMG/API2/SACustom.pm index 80a415f7..52a0fa38 100644 --- a/src/PMG/API2/SACustom.pm +++ b/src/PMG/API2/SACustom.pm @@ -54,7 +54,6 @@ __PACKAGE__->register_method({ path => '', method => 'GET', description => "List custom scores.", - # protected => 1, permissions => { check => ['admin', 'audit'] }, proxyto => 'master', parameters => { @@ -184,6 +183,7 @@ __PACKAGE__->register_method({ description => "Create custom SpamAssassin score", protected => 1, proxyto => 'master', + permissions => { check => ['admin'] }, parameters => { additionalProperties => 0, properties => json_config_properties({ @@ -226,8 +226,8 @@ __PACKAGE__->register_method({ path => '{name}', method => 'GET', description => "Get custom SpamAssassin score", - protected => 1, proxyto => 'master', + permissions => { check => ['admin', 'audit'] }, parameters => { additionalProperties => 0, properties => { @@ -262,6 +262,7 @@ __PACKAGE__->register_method({ description => "Edit custom SpamAssassin score", protected => 1, proxyto => 'master', + permissions => { check => ['admin'] }, parameters => { additionalProperties => 0, properties => json_config_properties({ @@ -303,9 +304,10 @@ __PACKAGE__->register_method({ name => 'delete_score', path => '{name}', method => 'DELETE', - description => "Edit custom SpamAssassin score", + description => "Delete custom SpamAssassin score", protected => 1, proxyto => 'master', + permissions => { check => ['admin'] }, parameters => { additionalProperties => 0, properties => { -- 2.47.3 _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel