pam: set PAM_RHOST

This allows pam modules to restrict users by host. For
instance, you could restrict root@pam to only 127.0.0.1.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2023-06-01 11:36:54 +02:00
parent 9d2996034d
commit 6c512352ae

View File

@ -43,6 +43,12 @@ sub authenticate_user {
die "error during PAM init: $err";
}
if (my $rpcenv = PVE::RPCEnvironment::get()) {
if (my $ip = $rpcenv->get_client_ip()) {
$pamh->pam_set_item(PAM_RHOST(), $ip);
}
}
my $res;
if (($res = $pamh->pam_authenticate(0)) != PAM_SUCCESS) {