From: "Andrew A. Vasilyev" <andy@altlinux.org>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-access-control 1/1] add logging for ACL and user status change
Date: Fri, 3 Nov 2023 17:27:42 +0300 [thread overview]
Message-ID: <20231103142742.3182264-1-andy@altlinux.org> (raw)
Signed-off-by: "Andrew A. Vasilyev" <andy@altlinux.org>
---
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
next reply other threads:[~2023-11-03 14:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-03 14:27 Andrew A. Vasilyev [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-11-03 12:26 Andrew A. Vasilyev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231103142742.3182264-1-andy@altlinux.org \
--to=andy@altlinux.org \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox