From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 3A5A561752 for ; Wed, 9 Feb 2022 14:52:52 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2A8632CD3 for ; Wed, 9 Feb 2022 14:52:22 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id A2B682CCA for ; Wed, 9 Feb 2022 14:52:21 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5208F46C5F for ; Wed, 9 Feb 2022 14:52:21 +0100 (CET) Date: Wed, 9 Feb 2022 14:52:19 +0100 From: Wolfgang Bumiller To: Stefan Sterz Cc: pbs-devel@lists.proxmox.com Message-ID: <20220209135219.ytbpbw6ag2mqxhnu@wobu-vie.proxmox.com> References: <20220207124825.1116194-1-s.sterz@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220207124825.1116194-1-s.sterz@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.392 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/2] fix #3853: api: add force option to tape key change-passphrase X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Feb 2022 13:52:52 -0000 On Mon, Feb 07, 2022 at 01:48:24PM +0100, Stefan Sterz wrote: > When force is used, the current passphrase is not required. Instead > it will be read from the file pointed to by TAPE_KEYS_FILENAME and > the old key configuration will be overwritten using the new > passphrase. > > Signed-off-by: Stefan Sterz > --- > src/api2/config/tape_encryption_keys.rs | 36 ++++++++++++++++++++++--- > 1 file changed, 33 insertions(+), 3 deletions(-) > > diff --git a/src/api2/config/tape_encryption_keys.rs b/src/api2/config/tape_encryption_keys.rs > index 1ad99377..b31f741d 100644 > --- a/src/api2/config/tape_encryption_keys.rs > +++ b/src/api2/config/tape_encryption_keys.rs > @@ -70,6 +70,7 @@ pub fn list_keys( > password: { > description: "The current password.", > min_length: 5, > + optional: true, > }, > "new-password": { > description: "The new password.", > @@ -78,6 +79,12 @@ pub fn list_keys( > hint: { > schema: PASSWORD_HINT_SCHEMA, > }, > + force: { > + optional: true, > + type: bool, > + description: "Don't ask for the old passphrase and overwrite it. Root only.", "Root only.", but this seems to lack the actual permission check. You seem to be doing this on the CLI side in the other patch, but that's the wrong place for it, the API is what's reachable from the outside. Also, as an HTTP API endpoint, "don't ask for the old passphrase" is a bit of a weird description ;-)