From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 057991FF15C
	for <inbox@lore.proxmox.com>; Wed, 13 Nov 2024 15:08:26 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id D931F16E0B;
	Wed, 13 Nov 2024 15:08:25 +0100 (CET)
Message-ID: <3fee9614-5a2e-4a3c-afef-75f4ded2dfd6@proxmox.com>
Date: Wed, 13 Nov 2024 15:08:22 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
From: Mira Limbeck <m.limbeck@proxmox.com>
To: pve-devel@lists.proxmox.com
References: <20240901165512.687801-1-thomas@atskinner.net>
Content-Language: en-US
In-Reply-To: <20240901165512.687801-1-thomas@atskinner.net>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.334 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pve-devel] [PATCH SERIES openid/access-control/docs/manager]
 fix #4411: add support for openid groups
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

On 9/1/24 18:55, Thomas Skinner wrote:
> This patch series adds support for groups for OpenID logins. 
> 
> The following options are implemented:
>   - Configurable claim for retrieving a list of groups and adding them to the 
>     user in PVE
>   - Allowing "synchronization" of groups on login by overriding groups assigned
>     to the user in PVE (this option is off by default)
>   - Replacing invalid characters in group names with a configurable valid characters
>     (by default, this is an underscore '_')
> 
> The logic implemented by this patch expects the groups claim in the ID token/userinfo
> endpoint to send a list of groups.
> 
> This patch also adds support for using additional claims from the OpenID provider
> by exposing all additional claims and their values from the ID token (previously
> only available for the userinfo endpoint). This is necessary for OpenID providers
> that do not support additional information in the userinfo endpoint.

I did a small test of this patch series with a Keycloak 17 as provider.

For the test I added a `Client Scope` in the realm with the predefined
mapper `groups'. The user info can then be checked under Realm -> Client
Scope -> Evaluate -> (select user, evaluate) -> Generated User Info


Tests done:

1)
* no groups defined in PVE
* realm configured with:
  - Groups Claim: `groups`
  - Overwrite Groups: true
* user in keycloak configured with groups: group1, group2, group3
* login with user
* no groups created and/or assigned to the user (missing 3 groups)

2)
* group1 defined in PVE
* realm configured with:
  - Groups Claim: `groups`
  - Overwrite Groups: true
* user in keycloak configured with groups: group1, group2, group3
* login with user
* user was assigned the group1 (missing 2 others)

3)
* group2 defined in PVE
* realm configured with:
  - Groups Claim: `groups`
  - Overwrite Groups: true
* user in keycloak configured with groups: group1, group2, group3
* login with user
* group was switched from group1 to group2

4)
* group1, group2 defined in PVE
* realm configured with:
  - Groups Claim: `groups`
  - Overwrite Groups: false
* user in keycloak configured with groups: group1, group3
* login with user
* group1 was added, group2 was kept

5)
* group1, group2 defined in PVE
* realm configured with:
  - Groups Claim: none (default)
  - Overwrite Groups: <any>
* user in keycloak configured with groups: group1, group2, group3
* login with user
* no changes


It seemed to work reliably once Keycloak was configured correctly. One
thing that was confusing, even with `Overwrite Groups` no groups are set
if they aren't already configured on the PVE cluster.

I haven't tested the character replacement yet.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel