From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH api 2/2] pam: set PAM_RHOST
Date: Tue, 27 Jun 2023 15:39:08 +0200 [thread overview]
Message-ID: <20230627133908.186940-2-w.bumiller@proxmox.com> (raw)
In-Reply-To: <20230627133908.186940-1-w.bumiller@proxmox.com>
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>
---
src/PMG/AccessControl.pm | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/PMG/AccessControl.pm b/src/PMG/AccessControl.pm
index 7926d4b..5ac4bc0 100644
--- a/src/PMG/AccessControl.pm
+++ b/src/PMG/AccessControl.pm
@@ -138,6 +138,12 @@ sub authenticate_pam_user {
return @res;
});
+ if (my $rpcenv = PMG::RESTEnvironment->get()) {
+ if (my $ip = $rpcenv->get_client_ip()) {
+ $pamh->pam_set_item(PAM_RHOST(), $ip);
+ }
+ }
+
if (!ref($pamh)) {
my $err = $pamh->pam_strerror($pamh);
die "Error during PAM init: $err";
--
2.39.2
next prev parent reply other threads:[~2023-06-27 13:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-27 13:39 [pmg-devel] [PATCH api 1/2] auth: set PAM context to 'proxmox-mailgateway-auth' Wolfgang Bumiller
2023-06-27 13:39 ` Wolfgang Bumiller [this message]
2023-06-27 14:08 ` [pmg-devel] applied-series: " Thomas Lamprecht
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=20230627133908.186940-2-w.bumiller@proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=pmg-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