[rocky+] Creation of application credentials fails when role assignments only come from role assignments of federated groups
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Identity (keystone) |
New
|
Undecided
|
Unassigned | ||
OpenStack Keystone SAML Mellon Charm |
New
|
Undecided
|
Unassigned |
Bug Description
[Version]
Rocky (UCA)
[Problem Description]
(see the User Scenario section below for a description of the environment)
When no direct role assignments to federated users are done and only federated group role assignments are present, application credential creation via Horizon fails with the following errors:
horizon apache2 error.log:
[Sat Jun 08 14:27:59.153479 2019] [wsgi:error] [pid 150327:tid 139962773473024] [remote 10.232.
keystone.log:
(keystone.
er or group: 794d430997c6406
(keystone.
Code-path:
create_
A detailed rpdb trace:
http://
82 def _require_
83 user_roles = self._get_
84 -> for role in roles:
85 if role['id'] not in user_roles:
86 raise exception.
87 actor_id=user_id,
88 target_
[Possible Solution]
Group membership details obtained dynamically during federated authentication and embedded into a fernet token (first an unscoped token, then a project-scoped token) need to be used in addition to querying the database for user to group membership.
[User Scenario]
Federated authentication via SAML with the following mapping (i.e. no direct role assignment to a user on a project - only federated group-based role assignment):
openstack mapping show adfs_mapping
+------
| Field | Value |
+------
| id | adfs_mapping |
| rules | [{'remote': [{'type': 'MELLON_NAME_ID'}, {'type': 'MELLON_groups'}], 'local': [{'domain': {'id': 'e834e57943714e
+------
# a federated user
openstack user list --domain adfs
+------
| ID | Name |
+------
| 794d430997c6406
+------
# a group that that exists both on the IdP and Keystone (SP) side
openstack group list --domain adfs
+------
| ID | Name |
+------
| 701f70e7549d4de
+------
# no group assignments are present in the keystone db - they are only populated on a per-token basis during federated authentication
openstack user list --domain adfs --group adfs_users ; echo $?
0
# grouptest is a project that adfs_users group members get a Member role assignment on
openstack project list --domain adfs
+------
| ID | Name |
+------
| 7de76f768cb8414
| 6a0657cf98684a6
+------
# no direct Member role assignments for federated users
openstack role assignment list --names
+------
| Role | User | Group | Project | Domain | System | Inherited |
+------
| Admin | neutron@
| Admin | designate@default | | services@default | | | False |
| Admin | image-stream@
| Admin | nova_placement@
| Member | admin@admin_domain | | admin@admin_domain | | | False |
| Admin | admin@admin_domain | | admin@admin_domain | | | False |
| Admin | admin@admin_domain | | | admin_domain | | False |
| Member | swift@service_
| Admin | swift@service_
| Admin | cinderv2_
| Member | | adfs_users@adfs | grouptest@adfs | | | False |
| Member | | adfs_users@adfs | | adfs | | False |
| Admin | neutron@default | | services@default | | | False |
| Admin | glance@default | | services@default | | | False |
| Admin | image-stream@
| Admin | cinderv2_
| Admin | glance@
| Admin | designate@
| Member | swift@default | | services@default | | | False |
| Admin | swift@default | | services@default | | | False |
| Admin | nova_placement@
+------
# same as above - no direct role assignments
openstack role assignment list --names --user 794d430997c6406
0
# role assignments for the adfs_users group (domain and project level although only the project-level one is needed)
openstack role assignment list --names --group adfs_users --group-domain adfs
+------
| Role | User | Group | Project | Domain | System | Inherited |
+------
| Member | | adfs_users@adfs | grouptest@adfs | | | False |
| Member | | adfs_users@adfs | | adfs | | False |
+------
===================
Just to make sure, adding group membership for the federated/
openstack group add user --group-domain adfs --user-domain adfs adfs_users 'intranet\
openstack user list --domain adfs --group adfs_users
+------
| ID | Name |
+------
| 794d430997c6406
+------
# *creation of an app credential succeeds via horizon*
Interesting that the application credential can't be created at all. Unfortunately even if you could create it, you couldn't use it because of this bug: https:/ /bugs.launchpad .net/keystone/ +bug/1773967