[RFE] system scope and scoped RBAC: support enforce_scope on Queens+ deployments

Bug #1774733 reported by Dmitrii Shcherbakov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Keystone Charm
Triaged
Wishlist
Unassigned

Bug Description

Upstream Keystone is progressing with better scoping of tokens and policies to address the following bugs:

https://bugs.launchpad.net/keystone/+bug/968696
https://bugs.launchpad.net/keystone?field.searchtext=the+v3+for+different+scopes&search=Search&field.status%3Alist=NEW&field.status%3Alist=INCOMPLETE_WITH_RESPONSE&field.status%3Alist=INCOMPLETE_WITHOUT_RESPONSE&field.status%3Alist=CONFIRMED&field.status%3Alist=TRIAGED&field.status%3Alist=INPROGRESS&field.status%3Alist=FIXCOMMITTED&field.assignee=&field.bug_reporter=&field.omit_dupes=on&field.has_patch=&field.has_no_package=

As of keystone there is now a "system" scope in addition to domain and project-level scopes.

Over time charms need to be converted to support setups with system scope admins where enforce_scope option is set to True:
https://docs.openstack.org/releasenotes/oslo.policy/queens.html#new-features

https://blueprints.launchpad.net/keystone/+spec/system-scope
https://specs.openstack.org/openstack/oslo-specs/specs/queens/include-scope-in-policy.html

It will also require modifications of default policy files or their modification/removal in favor of policy-in-code approach with customizations handled by:

1) policy.json/yaml customization via policy_dirs https://bugs.launchpad.net/charm-keystone/+bug/1741723

(discontinued)
2) verb + URL API-based checks for scoped RBAC https://specs.openstack.org/openstack/keystone-specs/specs/keystone/ongoing/role-check-from-middleware.html

Currently we hard-code admin_domain_id and service_tenant_id for policy rules while we could simply use system-scoped admin roles in the future.
https://github.com/openstack/charm-keystone/blob/master/templates/ocata/policy.json#L3-L4

`keystone-manage bootstrap` as of Queens
https://github.com/openstack/keystone/commit/3c524e6491c1b35a2f8413ebe046c238bf530d71

https://docs.openstack.org/releasenotes/keystone/queens.html#new-features
"Keystone now supports the ability to assign roles to users and groups on the system. As a result, users and groups with system role assignment will be able to request system-scoped tokens. Additional logic has been added to keystone-manage bootstrap to ensure the administrator has a role on the project and system."

description: updated
Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :
Download full text (8.3 KiB)

An example of how to create a system-scoped token via keystone API (openstack client support seems to be missing at the time of writing) with a notably different scope section in the request:

openstack user list --domain admin_domain
+----------------------------------+-------+
| ID | Name |
+----------------------------------+-------+
| 24c00642cc954b108a612a60c190e80a | test |
| c35ddbaea658492baa16c7e15a14320f | admin |
+----------------------------------+-------+
openstack user list --domain a
+----------------------------------+-------+
| ID | Name |
+----------------------------------+-------+
| 0009487964b148c5aa8f1f004109fc93 | usera |
| 300be329708e40d6a2266d738233e96e | adma |
+----------------------------------+-------+

openstack role list
+----------------------------------+---------+
| ID | Name |
+----------------------------------+---------+
| 2c998c11b22d40cd98e617060447579e | Admin |
| ceaeb81722d74385ab82c9a38ff54e2a | Member |
| cecb51748dec4348b3028616dfbf711c | service |
+----------------------------------+---------+

openstack role assignment list
+----------------------------------+----------------------------------+-------+----------------------------------+----------------------------------+-----------+
| Role | User | Group | Project | Domain | Inherited |
+----------------------------------+----------------------------------+-------+----------------------------------+----------------------------------+-----------+
| 2c998c11b22d40cd98e617060447579e | 0009487964b148c5aa8f1f004109fc93 | | 55d11414559d400796c0a96b2b6f9862 | | False |
| 2c998c11b22d40cd98e617060447579e | 0009487964b148c5aa8f1f004109fc93 | | 92bb8ef45f3c490c9b0588b1bf6b0c1b | | False |
| 2c998c11b22d40cd98e617060447579e | 0009487964b148c5aa8f1f004109fc93 | | | 2c0d6ccea9c94017a613cdb195877176 | False |
| ceaeb81722d74385ab82c9a38ff54e2a | 0009487964b148c5aa8f1f004109fc93 | | | 40635a04cf954b5f9d7f717e8da23b26 | False |
| 2c998c11b22d40cd98e617060447579e | 0009487964b148c5aa8f1f004109fc93 | | | 6c2a44b399f14ec5899696526d3c2cc9 | False |
| 2c998c11b22d40cd98e617060447579e | 1279d1c3e7444dd799915948ab166cc6 | | 8ed89949272545a68a36e5fd30f062ab | | False |
| 2c998c11b22d40cd98e617060447579e | 2091908c458d4c29b80da77cbbb34318 | | c15d9ac702b84f12a622536a9aeaa399 | | False |
| 2c998c11b22d40cd98e617060447579e | 300be329708e40d6a2266d738233e96e | | | 40635a04cf954b5f9d7f717e8da23b26 | False |
| 2c998c11b22d40cd98e617060447579e | 36b8d20cb3ca4805a0e68f3f17d7ea39 | | c15d9ac702b84f12a622536a9aeaa399 | | False |
| 2c998c11b22d40cd98e617060447579e | 411eb24f18274a4ead12d40b32dd95e...

Read more...

Revision history for this message
Frode Nordahl (fnordahl) wrote :

This is indeed good input. We will probably revisit this as we approach reworking how Keystone is bootstrapped in the charm.

Changed in charm-keystone:
status: New → Triaged
importance: Undecided → Wishlist
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to charm-keystone (master)

Reviewed: https://review.opendev.org/712040
Committed: https://git.openstack.org/cgit/openstack/charm-keystone/commit/?id=0a02c30fe5f4650235519897b71588ae22fa0971
Submitter: Zuul
Branch: master

commit 0a02c30fe5f4650235519897b71588ae22fa0971
Author: Frode Nordahl <email address hidden>
Date: Mon Mar 9 15:06:09 2020 +0100

    Replace use of admin_token with Keystone bootstrap

    Stop the use of the admin_token and use the bootstrap process
    to initialize Keystone instead. Fortunately the implementation
    of the bootstrap process is both idempotent when it needs to be
    and it can be safely called on an existing deployment.

    Subsequently we can migrate by just removing the admin_token
    from the configuration and create new credentials for use by
    the charm with a call to ``keystone-manage bootstrap``.

    Remove configuration templates for versions prior to Mitaka, by
    doing this we need to move any configuration initially defined
    prior to Miataka forward to the ``templates/mitaka`` folder.

    A side effect of this migration is that newly bootstrapped
    deployments will get their ``default`` domain created with a
    literal ID of ``default``. Prior to this change third party
    software making assumptions about that being the case may have
    had issues.

    Closes-Bug: #1859844
    Closes-Bug: #1837113
    Related-Bug: #1774733
    Closes-Bug: #1648719
    Closes-Bug: #1578678
    Func-Test-Pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/191
    Change-Id: I23940720c24527ee34149f035c3bdf9ff54812c9

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.