.. _envoy_api_file_envoy/config/rbac/v2alpha/rbac.proto: Role Based Access Control (RBAC) ================================ .. _envoy_api_msg_config.rbac.v2alpha.RBAC: config.rbac.v2alpha.RBAC ------------------------ `[config.rbac.v2alpha.RBAC proto] `_ Role Based Access Control (RBAC) provides service-level and method-level access control for a service. RBAC policies are additive. The policies are examined in order. A request is allowed once a matching policy is found (suppose the `action` is ALLOW). Here is an example of RBAC configuration. It has two policies: * Service account "cluster.local/ns/default/sa/admin" has full access to the service, and so does "cluster.local/ns/default/sa/superuser". * Any user can read ("GET") the service at paths with prefix "/products", so long as the destination port is either 80 or 443. .. code-block:: yaml action: ALLOW policies: "service-admin": permissions: - any: true principals: - authenticated: principal_name: exact: "cluster.local/ns/default/sa/admin" - authenticated: principal_name: exact: "cluster.local/ns/default/sa/superuser" "product-viewer": permissions: - and_rules: rules: - header: { name: ":method", exact_match: "GET" } - header: { name: ":path", regex_match: "/products(/.*)?" } - or_rules: rules: - destination_port: 80 - destination_port: 443 principals: - any: true .. code-block:: json { "action": "...", "policies": "{...}" } .. _envoy_api_field_config.rbac.v2alpha.RBAC.action: action (:ref:`config.rbac.v2alpha.RBAC.Action `) The action to take if a policy matches. The request is allowed if and only if: * `action` is "ALLOWED" and at least one policy matches * `action` is "DENY" and none of the policies match .. _envoy_api_field_config.rbac.v2alpha.RBAC.policies: policies (map<`string `_, :ref:`config.rbac.v2alpha.Policy `>) Maps from policy name to policy. A match occurs when at least one policy matches the request. .. _envoy_api_enum_config.rbac.v2alpha.RBAC.Action: Enum config.rbac.v2alpha.RBAC.Action ------------------------------------ `[config.rbac.v2alpha.RBAC.Action proto] `_ Should we do safe-list or block-list style access control? .. _envoy_api_enum_value_config.rbac.v2alpha.RBAC.Action.ALLOW: ALLOW *(DEFAULT)* ⁣The policies grant access to principals. The rest is denied. This is safe-list style access control. This is the default type. .. _envoy_api_enum_value_config.rbac.v2alpha.RBAC.Action.DENY: DENY ⁣The policies deny access to principals. The rest is allowed. This is block-list style access control. .. _envoy_api_msg_config.rbac.v2alpha.Policy: config.rbac.v2alpha.Policy -------------------------- `[config.rbac.v2alpha.Policy proto] `_ Policy specifies a role and the principals that are assigned/denied the role. A policy matches if and only if at least one of its permissions match the action taking place AND at least one of its principals match the downstream. .. code-block:: json { "permissions": [], "principals": [] } .. _envoy_api_field_config.rbac.v2alpha.Policy.permissions: permissions (:ref:`config.rbac.v2alpha.Permission `, *REQUIRED*) Required. The set of permissions that define a role. Each permission is matched with OR semantics. To match all actions for this policy, a single Permission with the `any` field set to true should be used. .. _envoy_api_field_config.rbac.v2alpha.Policy.principals: principals (:ref:`config.rbac.v2alpha.Principal `, *REQUIRED*) Required. The set of principals that are assigned/denied the role based on “action”. Each principal is matched with OR semantics. To match all downstreams for this policy, a single Principal with the `any` field set to true should be used. .. _envoy_api_msg_config.rbac.v2alpha.Permission: config.rbac.v2alpha.Permission ------------------------------ `[config.rbac.v2alpha.Permission proto] `_ Permission defines an action (or actions) that a principal can take. .. code-block:: json { "and_rules": "{...}", "or_rules": "{...}", "any": "...", "header": "{...}", "destination_ip": "{...}", "destination_port": "...", "metadata": "{...}", "not_rule": "{...}" } .. _envoy_api_field_config.rbac.v2alpha.Permission.and_rules: and_rules (:ref:`config.rbac.v2alpha.Permission.Set `) A set of rules that all must match in order to define the action. Precisely one of :ref:`and_rules `, :ref:`or_rules `, :ref:`any `, :ref:`header `, :ref:`destination_ip `, :ref:`destination_port `, :ref:`metadata `, :ref:`not_rule ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Permission.or_rules: or_rules (:ref:`config.rbac.v2alpha.Permission.Set `) A set of rules where at least one must match in order to define the action. Precisely one of :ref:`and_rules `, :ref:`or_rules `, :ref:`any `, :ref:`header `, :ref:`destination_ip `, :ref:`destination_port `, :ref:`metadata `, :ref:`not_rule ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Permission.any: any (`bool `_) When any is set, it matches any action. Precisely one of :ref:`and_rules `, :ref:`or_rules `, :ref:`any `, :ref:`header `, :ref:`destination_ip `, :ref:`destination_port `, :ref:`metadata `, :ref:`not_rule ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Permission.header: header (:ref:`route.HeaderMatcher `) A header (or pseudo-header such as :path or :method) on the incoming HTTP request. Only available for HTTP request. Precisely one of :ref:`and_rules `, :ref:`or_rules `, :ref:`any `, :ref:`header `, :ref:`destination_ip `, :ref:`destination_port `, :ref:`metadata `, :ref:`not_rule ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Permission.destination_ip: destination_ip (:ref:`core.CidrRange `) A CIDR block that describes the destination IP. Precisely one of :ref:`and_rules `, :ref:`or_rules `, :ref:`any `, :ref:`header `, :ref:`destination_ip `, :ref:`destination_port `, :ref:`metadata `, :ref:`not_rule ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Permission.destination_port: destination_port (`uint32 `_) A port number that describes the destination port connecting to. Precisely one of :ref:`and_rules `, :ref:`or_rules `, :ref:`any `, :ref:`header `, :ref:`destination_ip `, :ref:`destination_port `, :ref:`metadata `, :ref:`not_rule ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Permission.metadata: metadata (:ref:`type.matcher.MetadataMatcher `) Metadata that describes additional information about the action. Only available for HTTP request. Precisely one of :ref:`and_rules `, :ref:`or_rules `, :ref:`any `, :ref:`header `, :ref:`destination_ip `, :ref:`destination_port `, :ref:`metadata `, :ref:`not_rule ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Permission.not_rule: not_rule (:ref:`config.rbac.v2alpha.Permission `) Negates matching the provided permission. For instance, if the value of `not_rule` would match, this permission would not match. Conversely, if the value of `not_rule` would not match, this permission would match. Precisely one of :ref:`and_rules `, :ref:`or_rules `, :ref:`any `, :ref:`header `, :ref:`destination_ip `, :ref:`destination_port `, :ref:`metadata `, :ref:`not_rule ` must be set. .. _envoy_api_msg_config.rbac.v2alpha.Permission.Set: config.rbac.v2alpha.Permission.Set ---------------------------------- `[config.rbac.v2alpha.Permission.Set proto] `_ Used in the `and_rules` and `or_rules` fields in the `rule` oneof. Depending on the context, each are applied with the associated behavior. .. code-block:: json { "rules": [] } .. _envoy_api_field_config.rbac.v2alpha.Permission.Set.rules: rules (:ref:`config.rbac.v2alpha.Permission `, *REQUIRED*) .. _envoy_api_msg_config.rbac.v2alpha.Principal: config.rbac.v2alpha.Principal ----------------------------- `[config.rbac.v2alpha.Principal proto] `_ Principal defines an identity or a group of identities for a downstream subject. .. code-block:: json { "and_ids": "{...}", "or_ids": "{...}", "any": "...", "authenticated": "{...}", "source_ip": "{...}", "header": "{...}", "metadata": "{...}", "not_id": "{...}" } .. _envoy_api_field_config.rbac.v2alpha.Principal.and_ids: and_ids (:ref:`config.rbac.v2alpha.Principal.Set `) A set of identifiers that all must match in order to define the downstream. Precisely one of :ref:`and_ids `, :ref:`or_ids `, :ref:`any `, :ref:`authenticated `, :ref:`source_ip `, :ref:`header `, :ref:`metadata `, :ref:`not_id ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Principal.or_ids: or_ids (:ref:`config.rbac.v2alpha.Principal.Set `) A set of identifiers at least one must match in order to define the downstream. Precisely one of :ref:`and_ids `, :ref:`or_ids `, :ref:`any `, :ref:`authenticated `, :ref:`source_ip `, :ref:`header `, :ref:`metadata `, :ref:`not_id ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Principal.any: any (`bool `_) When any is set, it matches any downstream. Precisely one of :ref:`and_ids `, :ref:`or_ids `, :ref:`any `, :ref:`authenticated `, :ref:`source_ip `, :ref:`header `, :ref:`metadata `, :ref:`not_id ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Principal.authenticated: authenticated (:ref:`config.rbac.v2alpha.Principal.Authenticated `) Authenticated attributes that identify the downstream. Precisely one of :ref:`and_ids `, :ref:`or_ids `, :ref:`any `, :ref:`authenticated `, :ref:`source_ip `, :ref:`header `, :ref:`metadata `, :ref:`not_id ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Principal.source_ip: source_ip (:ref:`core.CidrRange `) A CIDR block that describes the downstream IP. Precisely one of :ref:`and_ids `, :ref:`or_ids `, :ref:`any `, :ref:`authenticated `, :ref:`source_ip `, :ref:`header `, :ref:`metadata `, :ref:`not_id ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Principal.header: header (:ref:`route.HeaderMatcher `) A header (or pseudo-header such as :path or :method) on the incoming HTTP request. Only available for HTTP request. Precisely one of :ref:`and_ids `, :ref:`or_ids `, :ref:`any `, :ref:`authenticated `, :ref:`source_ip `, :ref:`header `, :ref:`metadata `, :ref:`not_id ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Principal.metadata: metadata (:ref:`type.matcher.MetadataMatcher `) Metadata that describes additional information about the principal. Only available for HTTP request. Precisely one of :ref:`and_ids `, :ref:`or_ids `, :ref:`any `, :ref:`authenticated `, :ref:`source_ip `, :ref:`header `, :ref:`metadata `, :ref:`not_id ` must be set. .. _envoy_api_field_config.rbac.v2alpha.Principal.not_id: not_id (:ref:`config.rbac.v2alpha.Principal `) Negates matching the provided principal. For instance, if the value of `not_id` would match, this principal would not match. Conversely, if the value of `not_id` would not match, this principal would match. Precisely one of :ref:`and_ids `, :ref:`or_ids `, :ref:`any `, :ref:`authenticated `, :ref:`source_ip `, :ref:`header `, :ref:`metadata `, :ref:`not_id ` must be set. .. _envoy_api_msg_config.rbac.v2alpha.Principal.Set: config.rbac.v2alpha.Principal.Set --------------------------------- `[config.rbac.v2alpha.Principal.Set proto] `_ Used in the `and_ids` and `or_ids` fields in the `identifier` oneof. Depending on the context, each are applied with the associated behavior. .. code-block:: json { "ids": [] } .. _envoy_api_field_config.rbac.v2alpha.Principal.Set.ids: ids (:ref:`config.rbac.v2alpha.Principal `, *REQUIRED*) .. _envoy_api_msg_config.rbac.v2alpha.Principal.Authenticated: config.rbac.v2alpha.Principal.Authenticated ------------------------------------------- `[config.rbac.v2alpha.Principal.Authenticated proto] `_ Authentication attributes for a downstream. .. code-block:: json { "principal_name": "{...}" } .. _envoy_api_field_config.rbac.v2alpha.Principal.Authenticated.principal_name: principal_name (:ref:`type.matcher.StringMatcher `) The name of the principal. If set, The URI SAN is used from the certificate, otherwise the subject field is used. If unset, it applies to any user that is authenticated.