From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 06AA01FF183 for ; Wed, 30 Jul 2025 15:21:04 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 05A1EEC12; Wed, 30 Jul 2025 15:22:28 +0200 (CEST) Date: Wed, 30 Jul 2025 15:22:21 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20250729110229.118959-1-s.shaji@proxmox.com> In-Reply-To: <20250729110229.118959-1-s.shaji@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1753881715.2u78t2kbnt.astroid@yuna.none> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753881733174 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.046 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. [pveum.pm, proxmox.com] Subject: [pve-devel] applied: [PATCH pve-access-control v2] fix #6528: tfa: update user config on removal of TFA X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" thanks! On July 29, 2025 1:02 pm, Shan Shaji wrote: > When removing TFA from a user via the command line, the change was not > reflected in the GUI or in the output of `pveum user list`. Both > continued to show that TFA was enabled for the user. Fixed the issue > by updating the user configuration file. > > Signed-off-by: Shan Shaji > --- > > changes since v1: > - unconditionaly set `$update_user_config` to `true` when deleting the TFA > entry using userid. > - Fixed incomplete user config lock to avoid race conditions. > > History: > - v1: https://lore.proxmox.com/pve-devel/DBOGTW5GCZZE.3V2FS3RAXC4FR@noor/T/#t > > src/PVE/CLI/pveum.pm | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/src/PVE/CLI/pveum.pm b/src/PVE/CLI/pveum.pm > index 0645a6d..81c3a70 100755 > --- a/src/PVE/CLI/pveum.pm > +++ b/src/PVE/CLI/pveum.pm > @@ -141,13 +141,25 @@ __PACKAGE__->register_method({ > > my $userid = extract_param($param, "userid"); > my $tfa_id = extract_param($param, "id"); > + my $update_user_config; > > PVE::AccessControl::lock_tfa_config(sub { > my $tfa_cfg = cfs_read_file('priv/tfa.cfg'); > if (defined($tfa_id)) { > - $tfa_cfg->api_delete_tfa($userid, $tfa_id); > + my $has_entries_left = $tfa_cfg->api_delete_tfa($userid, $tfa_id); > + $update_user_config = !$has_entries_left; > } else { > $tfa_cfg->remove_user($userid); > + $update_user_config = 1; > + } > + > + if ($update_user_config) { > + PVE::AccessControl::lock_user_config(sub { > + my $user_cfg = cfs_read_file('user.cfg'); > + my $user = $user_cfg->{users}->{$userid}; > + $user->{keys} = undef; > + cfs_write_file('user.cfg', $user_cfg); > + }); > } > cfs_write_file('priv/tfa.cfg', $tfa_cfg); > }); > -- > 2.39.5 > > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel