public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [RFC PATCH acces-control] auth: require quorum for ticket creaton of non PAM users
Date: Mon, 24 Oct 2022 12:03:06 +0200	[thread overview]
Message-ID: <20221024100306.2005236-1-d.csapak@proxmox.com> (raw)

when the current node is not part of the quorate partition, there is no
way to determine if a user has the proper permissions or is even still
enabled, so we should prevent ticket creation for these users.

The only exception we should make is for node-local users (PAM realm),
since there is a good chance those can login via console/ssh anyway, and
it's good to have at least some users as fallback that can still login
in such cases.

This does not prevent users from using already created tickets, nor does
it prevent api calls with api tokens (that would have to be done
elsewhere).

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
sending as rfc, since i'm not completely sure that's what @Wolfgang and
@Thomas had in mind in [0], since it's not touching api tokens at all

0: https://lists.proxmox.com/pipermail/pve-devel/2022-October/054406.html

 src/PVE/API2/AccessControl.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/PVE/API2/AccessControl.pm b/src/PVE/API2/AccessControl.pm
index 104e7e3..eb0543a 100644
--- a/src/PVE/API2/AccessControl.pm
+++ b/src/PVE/API2/AccessControl.pm
@@ -143,6 +143,9 @@ my sub verify_auth : prototype($$$$$$$) {
 my sub create_ticket_do : prototype($$$$$$) {
     my ($rpcenv, $username, $pw_or_ticket, $otp, $new_format, $tfa_challenge) = @_;
 
+    # allow login for non-quorate clusters only for node-local @pam users
+    PVE::Cluster::check_cfs_quorum() if $username !~ m/\@pam$/;
+
     die "TFA response should be in 'password', not 'otp' when 'tfa-challenge' is set\n"
 	if defined($otp) && defined($tfa_challenge);
 
-- 
2.30.2





                 reply	other threads:[~2022-10-24 10:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221024100306.2005236-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal