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 60F4C9EFCF for ; Fri, 3 Nov 2023 15:35:05 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3A4521F8B2 for ; Fri, 3 Nov 2023 15:34:35 +0100 (CET) Received: from beacon.altlinux.org (unknown [193.43.10.250]) by firstgate.proxmox.com (Proxmox) with ESMTP for ; Fri, 3 Nov 2023 15:34:31 +0100 (CET) Received: by beacon.altlinux.org (Postfix, from userid 734) id 8D3BFA3F14; Fri, 3 Nov 2023 17:27:44 +0300 (MSK) From: "Andrew A. Vasilyev" To: pve-devel@lists.proxmox.com Date: Fri, 3 Nov 2023 17:27:42 +0300 Message-Id: <20231103142742.3182264-1-andy@altlinux.org> X-Mailer: git-send-email 2.33.8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.624 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 RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_FAIL 0.001 SPF: sender does not match SPF record (fail) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [acl.pm, user.pm] X-Mailman-Approved-At: Mon, 06 Nov 2023 10:13:15 +0100 Subject: [pve-devel] [PATCH pve-access-control 1/1] add logging for ACL and user status change 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: , X-List-Received-Date: Fri, 03 Nov 2023 14:35:05 -0000 Signed-off-by: "Andrew A. Vasilyev" --- src/PVE/API2/ACL.pm | 2 ++ src/PVE/API2/User.pm | 4 ++++ 2 files changed, 6 insertions(+) diff --git src/PVE/API2/ACL.pm src/PVE/API2/ACL.pm index f0c9efb..6ec23d7 100644 --- src/PVE/API2/ACL.pm +++ src/PVE/API2/ACL.pm @@ -183,8 +183,10 @@ __PACKAGE__->register_method ({ if ($param->{delete}) { delete ($node->{users}->{$username}->{$role}); + PVE::Cluster::log_msg('info', 'root@pam', "delete $role from $path for user '$username'"); } else { $node->{users}->{$username}->{$role} = $propagate; + PVE::Cluster::log_msg('info', 'root@pam', "add $role to $path for user '$username'"); } } diff --git src/PVE/API2/User.pm src/PVE/API2/User.pm index ed4cb70..87a5d77 100644 --- src/PVE/API2/User.pm +++ src/PVE/API2/User.pm @@ -283,6 +283,7 @@ __PACKAGE__->register_method ({ $usercfg->{users}->{$username}->{keys} = $param->{keys} if $param->{keys}; cfs_write_file("user.cfg", $usercfg); + PVE::Cluster::log_msg('info', 'root@pam', "create user '$username'"); }, "create user failed"); return undef; @@ -402,6 +403,7 @@ __PACKAGE__->register_method ({ $usercfg->{users}->{$username}->{keys} = $param->{keys} if defined($param->{keys}); cfs_write_file("user.cfg", $usercfg); + PVE::Cluster::log_msg('info', 'root@pam', "update user '$username'"); }, "update user failed"); return undef; @@ -463,6 +465,7 @@ __PACKAGE__->register_method ({ $partial_deletion .= ', ACLs'; cfs_write_file("user.cfg", $usercfg); + PVE::Cluster::log_msg('info', 'root@pam', "delete user '$userid'"); }; die "$@$partial_deletion\n" if $@; }, "delete user failed"); @@ -795,6 +798,7 @@ __PACKAGE__->register_method ({ delete $usercfg->{users}->{$userid}->{tokens}->{$tokenid}; cfs_write_file("user.cfg", $usercfg); + PVE::Cluster::log_msg('info', 'root@pam', "logout user '$userid'"); }, 'deleting token failed'); return; -- 2.33.8