Adding remote running capability to Patrol framework for default policy files.
Tempest has a capability to get operated from remote machine.
Being a tempest plugin, Patrole must have a feature to enable operate remotely.
In multi-node deployment, If we are running Patrole from controller node or if we are running Patrole from single node deployment then it will work perfectly.
As a part of RBAC process, Patrole uses policy file parsing.
But currently parsing feature is implemented in such a way that it will always try to make a default policy file path "/etc/<
case#1: custom policy file testing (where custom policy file was located at remote machine)-
In this case, On the remote machine, we have to put custom policy files at the location /etc/<service>
case#2: Default policy testing -
As per current framework implementation, if we are running Patrole from remote machine (not part of OpenStack deployment), then still it will seek for policy file at the patch "/etc/<
Becuase path is being constructed each time whether explicit 'path' is passed or not.
From the file, rbac_role_
class RbacPolicyConve
"""A class for parsing policy rules into lists of allowed roles.
RBAC testing requires that each rule in a policy file be broken up into
the roles that constitute it. This class automates that process.
The list of roles per rule can be reverse-engineered by checking, for
each role, whether a given rule is allowed using oslo policy.
"""
def __init__(self, tenant_id, service, path=None):
Parses a policy file to create a dictionary, mapping policy actions to
roles. If a policy file does not exist, checks whether the policy file
is registered as a namespace under oslo.policy.
example, doesn't use a policy.json file by default; its policy is
implemented in code and registered as 'nova' under
If the policy file is not found in either place, raises an exception.
policy.json (for example, by creating a custom nova policy.json file),
the custom policy file over the default policy implementation is
:param tenant_id: type uuid
:param service: type string
:param path: type string
"""
service = service.
if path is None:
else:
policy_data = "{}"
# First check whether policy file exists.
if os.path.
# Otherwise use oslo_policy to fetch the rules for provided service.
else:
if policy_generator and service in policy_generator:
for r in policy_
# Otherwise raise an exception.
else:
self.rules = policy.
From above we can see that during remote run we must put custom policy files on remote machine to operate Patrole from remote machine.
But for default policy testing, putting custom policy files on remote machines violates security constrains.
So, this blueprint aims to add remote running capabilities in Patrole framework.
Blueprint information
- Status:
- Not started
- Approver:
- Felipe Monteiro
- Priority:
- Medium
- Drafter:
- Mh Raies
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- Approved
- Series goal:
- None
- Implementation:
- Deferred
- Milestone target:
- None
- Started by
- Completed by
Related branches
Related bugs
Bug #1673417: Patrole framework will always fail when running from remote machine, if policy file are not explicitly on remote machine. | Confirmed |
Sprints
Whiteboard
Before start working on this, i want a discussion on this.
Felipe, can we have a discussion on this ? ------ Mh Raies
@Mohd, Yes, we can.
Related Blueprints - (We can start this blueprint, if below blueprints are approved and completed)
https:/
https:/
https:/
https:/
https:/
https:/