From e63816fbd9db55effa341ca07c99937262d2d70f Mon Sep 17 00:00:00 2001 From: st19311 <161223737+st19311@users.noreply.github.com> Date: Tue, 17 Dec 2024 12:47:16 +0100 Subject: [PATCH] Log IP address on successful auth --- src/PVE/API2/AccessControl.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PVE/API2/AccessControl.pm b/src/PVE/API2/AccessControl.pm index f23662a..abe0cc0 100644 --- a/src/PVE/API2/AccessControl.pm +++ b/src/PVE/API2/AccessControl.pm @@ -298,8 +298,8 @@ __PACKAGE__->register_method ({ ); } }; + my $clientip = $rpcenv->get_client_ip() || ''; if (my $err = $@) { - my $clientip = $rpcenv->get_client_ip() || ''; syslog('err', "authentication failure; rhost=$clientip user=$username msg=$err"); # do not return any info to prevent user enumeration attacks die PVE::Exception->new("authentication failure\n", code => 401); @@ -313,7 +313,7 @@ __PACKAGE__->register_method ({ $res->{clustername} = $clinfo->{cluster}->{name}; } - PVE::Cluster::log_msg('info', 'root@pam', "successful auth for user '$username'"); + PVE::Cluster::log_msg('info', 'root@pam', "successful auth for user '$username'; rhost=$clientip"); return $res; }});