From: Thomas Skinner <thomas@atskinner.net>
To: Mira Limbeck <m.limbeck@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH access-control v3 1/1] fix #4411: openid: add logic for openid groups support
Date: Wed, 19 Mar 2025 05:30:46 -0500 [thread overview]
Message-ID: <CALn9RMcfOp1Fi9xwc_92tULWrwOkrrp_rO5rEHO+y1JcX9VaVg@mail.gmail.com> (raw)
In-Reply-To: <f5c1f44d-5b66-43ee-8217-463c6ab49193@proxmox.com>
On Tue, Mar 18, 2025 at 4:34 AM Mira Limbeck <m.limbeck@proxmox.com> wrote:
>
> On 3/17/25 13:18, Fabian Grünbichler wrote:
> > On February 13, 2025 12:03 pm, Fabian Grünbichler wrote:
> >>
> >>> Mira Limbeck <m.limbeck@proxmox.com> hat am 12.02.2025 15:51 CET geschrieben:
> >>>
> >>>
> >>> On 2/11/25 06:40, Thomas Skinner wrote:
> >>>> Signed-off-by: Thomas Skinner <thomas@atskinner.net>
> >>>> ---
> >>>> src/PVE/API2/OpenId.pm | 79 ++++++++++++++++++++++++++++++++++++++++
> >>>> src/PVE/AccessControl.pm | 2 +-
> >>>> src/PVE/Auth/OpenId.pm | 33 +++++++++++++++++
> >>>> src/PVE/Auth/Plugin.pm | 1 +
> >>>> 4 files changed, 114 insertions(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/src/PVE/API2/OpenId.pm b/src/PVE/API2/OpenId.pm
> >>>> index 77410e6..818175e 100644
> >>>> --- a/src/PVE/API2/OpenId.pm
> >>>> +++ b/src/PVE/API2/OpenId.pm
> >>>> @@ -13,6 +13,7 @@ use PVE::Cluster qw(cfs_read_file cfs_write_file);
> >>>> use PVE::AccessControl;
> >>>> use PVE::JSONSchema qw(get_standard_option);
> >>>> use PVE::Auth::Plugin;
> >>>> +use PVE::Auth::OpenId;
> >>>>
> >>>> use PVE::RESTHandler;
> >>>>
> >>>> @@ -220,6 +221,84 @@ __PACKAGE__->register_method ({
> >>>> $rpcenv->check_user_enabled($username);
> >>>> }
> >>>>
> >>>> + if (defined(my $groups_claim = $config->{'groups-claim'})) {
> >>>> + if (defined(my $groups_list = $info->{$groups_claim})) {
> >>>> + if (ref($groups_list) eq 'ARRAY') {
> >>>> + PVE::AccessControl::lock_user_config(sub {
> >>>> + my $usercfg = cfs_read_file("user.cfg");
> >>>> +
> >>>> + # replace any invalid characters with
> >>>> + my $replace_character = $config->{'groups-replace-character'} // '_';
> >>>> + my $oidc_groups = { map {
> >>>> + $_ =~ s/[^$PVE::Auth::Plugin::groupname_regex_chars]/$replace_character/gr => 1
> >>>> + } $groups_list->@* };
> >>> maybe we could log any of those replacements here? doing this silently
> >>> may lead to confusion when groups don't match
> >>
> >> a similar issue is filed for LDAP/AD sync as well - and I now wonder based on the discussion there - do we really want to make this configurable? how do we want to handle conflicts? while it's a bit less critical for two or more OIDC groups to be mapped to the same PVE-side group (compared to the same happening with users ;)), if it's possible to avoid it that would still be great..
> >>
> >> groups currently allow .-_ as special characters, so we could designate one of them as escape character and then have a unique mapping for each character that isn't allowed on the PVE side (including that escape character ;))
> >>
> >> e.g., an OIDC group called "foo bar" could be encoded as "foo_32_bar" (where 32 is hex for ASCII-" "). correspondingly, a group called "foo_bar" would need to be encoded as "foo_5F_bar". (the second '_' could of course be left off if desired).
> >>
> >> unfortunately, adding an entirely new escape character is not really possible unless we want to wait for 9.0, as that would then break parsing of user.cfg in a mixed cluster which can have really dangerous side-effects..
> >>
> >> or we could live with such a potentially lossy mapping, but then I am not sure whether a single, hard-coded, documented value wouldn't be better? the main issue with that is if you allow (unprivileged) creation and joining of groups on the OIDC side, as then if there already is a group called "System Administrators" that got mapped to "System_Adminstrators" on the PVE side, a user could create and join "System!Administrators" on the OIDC side and get mapped to the existing, probably privileged "System_Administrators" group..
> >
> > this part now got split out into its own discussion:
> >
> > https://lore.proxmox.com/pve-devel/b8fba9f6-6c83-4846-923f-2f7b93856bcf@proxmox.com/T/#u
I've been lightly following this, but it's clear there's not quite a
determination yet. Groups with spaces in the names would be highly
useful for Active Directory environments.
> >
> > what do you think about the following to not keep this blocked longer:
> >
> > - rebase this series
> > - drop the name mangling/.. part for now, and only allow groups that
> > work with the PVE constraints for the time being
> >
> > we can implement it when we've decided how to handle the name
> > mangling/collision/.. issue, and ensure we get a consistent
> > implementation for both LDAP/AD and OIDC.
> >
>
> Sounds good to me. Group support is a huge improvement even with this
> limitation for now.
>
Good with me, too. I'll use the same logic as the current LDAP group
sync to only allow the groups that are already within constraints to
get through. I'll submit it by this weekend. Thanks!
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-03-19 10:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 5:40 [pve-devel] [PATCH SERIES access-control/docs/manager/proxmox-openid v3] fix #4411: add support for openid groups Thomas Skinner
2025-02-11 5:40 ` [pve-devel] [PATCH docs v3 1/1] fix #4411: openid: add docs for openid groups support Thomas Skinner
2025-02-11 5:40 ` [pve-devel] [PATCH proxmox-openid v3 1/1] fix #4411: openid: add library code for generic id token claim support Thomas Skinner
2025-02-11 5:40 ` [pve-devel] [PATCH access-control v3 1/1] fix #4411: openid: add logic for openid groups support Thomas Skinner
2025-02-12 14:51 ` Mira Limbeck
2025-02-13 11:03 ` Fabian Grünbichler
2025-03-17 12:18 ` Fabian Grünbichler
2025-03-18 9:34 ` Mira Limbeck
2025-03-19 10:30 ` Thomas Skinner [this message]
2025-02-11 5:40 ` [pve-devel] [PATCH manager v3 1/1] fix #4411: openid: add ui config " Thomas Skinner
2025-02-12 14:47 ` [pve-devel] [PATCH SERIES access-control/docs/manager/proxmox-openid v3] fix #4411: add support for openid groups Mira Limbeck
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=CALn9RMcfOp1Fi9xwc_92tULWrwOkrrp_rO5rEHO+y1JcX9VaVg@mail.gmail.com \
--to=thomas@atskinner.net \
--cc=m.limbeck@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