Commit Graph

11 Commits

Author SHA1 Message Date
Dan Smith 066e1e69d1 Remove system scope from all APIs
In line with the recent RBAC working group discussion and operator
feedback, this converts all our APIs back to project-only. It leaves
the actual scope_types in place, with them all set to project. This
allows an operator to turn on scope checking to *ensure* that only
project-scoped tokens are used, in case system scope is in use
elsewhere in the deployment (i.e. for keystone or ironic). Without
this, system scoped tokens will fail some operations in strange
(read: 500 and "database error") ways.

Change-Id: I951a11affa1d1e42863967cdc713618ff0a74814
2022-08-24 13:12:16 +00:00
Ghanshyam Mann ab084d4d1d Modify remaining APIs as per RBAC new guidelines
As per the RBAC new direction, we will allow
project resources operation to be performed by
the project scoped token only and system user will
be allowed to perform system level operation only
not project resources specific.

Details about new direction can be found in community-wide
goal
- https://governance.openstack.org/tc/goals/selected/consistent-and-secure-rbac.html

This commit modify remaining APIs as per the new guidelines.

Also, allow all project admin to list the other project limits. This is
what we allowed in legacy policy and until we have domain admin or other
way to list other project resources/info, we will keep that behaviour.

Also modifying and adding tests for four cases:
1. enforce_scope=False + legacy rule (current default policies)
2. enforce_scope=False + No legacy rule
3. enforce_scope=True + legacy rule
4. enforce_scope=True + no legacy rule (end goal of new RBAC)

Partial implement blueprint policy-defaults-refresh-2

Change-Id: I006d47aa2f4678a06c78057bcf407302abbe4907
2022-02-24 10:24:55 -06:00
Ghanshyam Mann 66bfb27b1d Add new default roles in keypairs policies
This adds new defaults roles in keypairs API policies.
- SYSTEM_ADMIN, for create, delete keypairs
- SYSTEM_READER for GET keypairs

Also add tests to simulates the future where we drop the deprecation
fall back in the policy by overriding the rules with a version where
there are no deprecated rule options. Operators can do the same by
adding overrides in their policy files that match the default but
stop the rule deprecation fallback from happening.

Partial implement blueprint policy-defaults-refresh

Change-Id: I90cbd4de22bbce1a7cbd0c5d3bb5ee0a27429dbc
2020-04-10 01:18:00 +00:00
Ghanshyam Mann f4dcce2743 Introduce scope_types in keypairs
oslo.policy introduced the scope_type feature which can
control the access level at system-level and project-level.
 - https://docs.openstack.org/oslo.policy/latest/user/usage.html#setting-scope
 - http://specs.openstack.org/openstack/keystone-specs/specs/keystone/queens/system-scope.html

Appropriate scope_type for nova case:
- https://specs.openstack.org/openstack/nova-specs/specs/ussuri/approved/policy-defaults-refresh.html#scope

This commit introduce scope_type for keypairs API policies as 'system' and 'project'

Also adds the test case with scope_type enabled and verify we
pass and fail the policy check with expected context.

Partial implement blueprint policy-defaults-refresh

Change-Id: Ia2c0b8b4869f1c5190036dadcea9b5e804aba9d6
2020-04-10 01:17:50 +00:00
ghanshyam f72fa9a739 Remove the deprecated API extensions policies
API extensions policies have been deprecated in 17.0.0
release[1]. This commit removes them.

[1] Ie05f4e84519f8a00ffb66ea5ee920d5c7722a66b
Change-Id: Ib3faf85c78bc2cdee13175560dc1458ddb6cb7a8
2018-08-17 07:11:45 +00:00
ghanshyam f2d18c2e99 Deprecate API extensions policies
Nova API extension concept is removed in Pike. These extensions
have their own policies enforcement which are not needed any more.

All the below policies which were added mainly for extensions are
deprecated for removal-
        - 'os_compute_api:os-config-drive'
        - 'os_compute_api:os-extended-availability-zone'
        - 'os_compute_api:os-extended-status'
        - 'os_compute_api:os-extended-volumes'
        - 'os_compute_api:os-keypairs'
        - 'os_compute_api:os-server-usage'
        - 'os_compute_api:os-security-groups' (only from /servers APIs)
        - 'os_compute_api:os-flavor-rxtx'
        - 'os_compute_api:os-flavor-access' (only from /flavors APIs)
        - 'os_compute_api:image-size'

Implement blueprint api-extensions-policy-removal

Depends-On: I6aed4909b0e7efe9c95d1f7398db613eca05e5ce

Change-Id: Ie05f4e84519f8a00ffb66ea5ee920d5c7722a66b
2017-12-07 04:05:58 +00:00
Stephen Finucane 145b3cc7f0 Remove 'create_rule_default'
This is a simple wrapper for an oslo.policy function, so remove it.

Also fixes the alignment in the agents policy module to be like
all the others.

Change-Id: I8a45cff3b1abea98bf04f111bdd6a9ace91a9980
Implements: blueprint policy-docs
2017-07-13 13:06:01 -04:00
He Jie Xu 3052a451d1 Add more description to policies in the keypairs.py
This updates the policy doc for server extend controller in keypairs.py

Partial implement blueprint blueprint policy-docs

Change-Id: I32d2dae19fc2cfa99470edbb39dafd56de279b73
2017-05-11 11:53:23 +08:00
John Garbutt d3b647a000 Remove all discoverable policy rules
We have signaled many times the use of API extensions to change the API
has been deprecated, including:
04f8612aa9

This patch ensures we no longer check any of the discoverable rules when
compiling the list of extensions to list in the API. This stops users
from being able to use policy to hide certain API extensions. This was
never that useful, but now you can't turn any extensions off and we
report the API version number, it is basically useless.

Note the change in the policy cmd unit test is to ensure now there are
no rules that use the ANY rule, we correctly check we return an empty
list of rules that match.

blueprint remove-discoverable-policy-rules

Change-Id: I61d8063708731133177534888ba7f5f05a6bd901
2017-04-26 15:31:37 +01:00
Kevin_Zheng dd1286135e Add description to policies in keypairs.py
blueprint policy-docs

Change-Id: I4a36b76626ca580522c953170327478c72be9556
2017-03-27 11:06:16 +00:00
Claudiu Belu f13a933300 policy: Add defaults in code (part 4)
Partially-Implements: bp policy-in-code

Change-Id: I8ae24035ec6aee8fa93f3f55cbafc843d0e9d5ae
2016-06-23 19:25:06 +00:00