Neutron has a policy enforment feature, which controlls(allow,deny, filterout) the API Request/Response mechanism.
Policy file is configured in neutron.conf file,
policy_file = /etc/neutron/policy.json
The default policy file is /etc/neutron/policy.json.
Policy check is performed by the Neutron during the following phases,
Each line is defined as below,
<target> : <rule>
Here "rule" defines the authroziation.
SIMPLE RULE
Inbuilt rule (character) | Action |
---|---|
" " (Empty String in double quote ) | ALLOW |
¡ (exclamation symbol) | DENY |
@ | ALLOW |
Example:
"create_network" : "@"
This policy allows create_network API to be used all the users(roles).
USER DEFINED RULE/ CUSTOM RULES
The other type of rules are below;
<role>:<role name>, a test whether the API credentials contain this role.
<rule>:<rule name>, the definition of an alias.
Example1:
"create_network": "role:admin"
Example2:
"context_is_admin": "role:admin or user_name:neutron"
"admin_only": "rule:context_is_admin"
"create_network:router:external": "rule:admin_only"
In this example, alias is created and applied to the action.
ACTION:
Some sample actions are create_network, deletenetwork, create_port etc. Each Neutron API is referred by the Action.
References:
https://docs.openstack.org/developer/neutron/devref/policy.html
https://docs.openstack.org/kilo/config-reference/content/policy-json-file.html