blob: 6110ddae5ffa75539a2f3ea014efea8010986111 [file] [log] [blame]
Felipe Monteiroc4589322017-06-09 19:42:50 +01001========================
2Team and repository tags
3========================
4
shangxiaobj11b02322017-08-14 22:45:11 -07005.. image:: https://governance.openstack.org/tc/badges/patrole.svg
6 :target: https://governance.openstack.org/tc/reference/tags/index.html
Felipe Monteiroc4589322017-06-09 19:42:50 +01007
Felipe Monteiroc4589322017-06-09 19:42:50 +01008Patrole - RBAC Integration Tempest Plugin
9=========================================
DavidPurcell663aedf2017-01-03 10:01:14 -050010
Felipe Monteiro780210d2017-07-17 22:21:53 +010011Patrole is a security validation tool for verifying that Role-Based Access
12Control is correctly configured and enforced in a system. It runs Tempest-based
13API tests using specified RBAC roles, thus allowing deployments to verify that
14only intended roles have access to those APIs.
DavidPurcell663aedf2017-01-03 10:01:14 -050015
Felipe Monteiro780210d2017-07-17 22:21:53 +010016Patrole currently offers testing for the following OpenStack services: Nova,
17Neutron, Glance, Cinder and Keystone.
DavidPurcell663aedf2017-01-03 10:01:14 -050018
19Features
Felipe Monteiro780210d2017-07-17 22:21:53 +010020--------
21* Validation of default policy definitions located in policy.json files.
22* Validation of in-code policy definitions.
23* Validation of custom policy file definitions that override default policy
24 definitions.
25* Built-in positive and negative testing. Positive and negative testing
26 are performed using the same tests and role-switching.
27* Valdation of custom roles as well as default OpenStack roles.
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010028
29.. note::
30
Felipe Monteiro780210d2017-07-17 22:21:53 +010031 Patrole does not yet support policy.yaml files, the new file format for
32 policy files in OpenStack.
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010033
34How It Works
Felipe Monteiro780210d2017-07-17 22:21:53 +010035------------
36Patrole leverages ``oslo.policy`` (OpenStack's policy enforcement engine) to
37determine whether a given role is allowed to perform a policy action, given a
38specific role and OpenStack service. The output from ``oslo.policy`` (the
39expected result) and the actual result from test execution are compared to
40each other: if both results match, then the test passes; else it fails.
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010041
gaozx268b71d2017-07-20 21:35:35 -040042* Documentation: https://docs.openstack.org/patrole/latest/
Felipe Monteiro780210d2017-07-17 22:21:53 +010043* Bugs: https://bugs.launchpad.net/patrole
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010044
Felipe Monteiro780210d2017-07-17 22:21:53 +010045Quickstart
Felipe Monteiro7c7b5702017-07-21 01:43:42 +010046----------
Felipe Monteiro780210d2017-07-17 22:21:53 +010047Tempest is a prerequisite for running Patrole. If you do not have Tempest
48installed, please reference the official Tempest documentation for guidance.
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010049
Felipe Monteiro780210d2017-07-17 22:21:53 +010050Assuming Tempest is installed, the simplest way to configure Patrole is:
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010051
Felipe Monteiro780210d2017-07-17 22:21:53 +0100521. Open up the ``tempest.conf`` configuration file and include the following
53settings:
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010054
Felipe Monteiro780210d2017-07-17 22:21:53 +010055.. code-block:: ini
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010056
Felipe Monteiro780210d2017-07-17 22:21:53 +010057 [rbac]
58 enable_rbac = True
59 rbac_test_role = admin
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010060
Felipe Monteiro780210d2017-07-17 22:21:53 +010061These settings tell Patrole to run RBAC tests using the "admin" role (which
62is the default admin role in OpenStack) to verify the default policy
63definitions used by OpenStack services. Specifying a different role
64for ``rbac_test_role`` will run Patrole tests against that role. For additional
65information about Patrole's configuration settings, please refer to
66:ref:`patrole-configuration` and :ref:`patrole-sampleconf` for a sample
67configuration file.
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010068
Felipe Monteiro780210d2017-07-17 22:21:53 +0100692. You are now ready to run Patrole. To do so, you can use any testr-based test
70runner::
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010071
Felipe Monteiro780210d2017-07-17 22:21:53 +010072 $ testr run patrole_tempest_plugin.tests.api
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010073
Felipe Monteiro780210d2017-07-17 22:21:53 +010074or::
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010075
Felipe Monteiro780210d2017-07-17 22:21:53 +010076 $ ostestr --regex '(?!.*\[.*\bslow\b.*\])(^patrole_tempest_plugin\.tests\.api)'
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010077
Felipe Monteiro780210d2017-07-17 22:21:53 +010078It is also possible to run Patrole using tox::
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010079
Felipe Monteiro780210d2017-07-17 22:21:53 +010080 tox -eall-plugin -- patrole_tempest_plugin.tests.api
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010081
Felipe Monteiro780210d2017-07-17 22:21:53 +010082Release Versioning
Felipe Monteiro7c7b5702017-07-21 01:43:42 +010083------------------
Felipe Monteiro780210d2017-07-17 22:21:53 +010084`Patrole Release Notes <https://docs.openstack.org/releasenotes/patrole/>`_
85shows which changes have been released for each version.
Felipe Monteiro7bc35dc2017-04-19 21:11:46 +010086
Felipe Monteiro780210d2017-07-17 22:21:53 +010087Patrole's release versioning follows Tempest's conventions. Like Tempest,
88Patrole is branchless and uses versioning instead.