netatlas Star on GitHub

Istio AuthorizationPolicies: who gets in

netatlas reads the Istio AuthorizationPolicies of each cluster and works out, for every pair of workloads, whether Istio lets the caller in. The Policy map draws a line from each caller to each workload an ALLOW policy lets it call, and says so where no ALLOW policy selects a workload. The Traffic view marks the calls Istio refused. This page says how netatlas reads the policies, so you can tell what each line, note and mark means. netatlas only reads them: it never changes one.

How Istio decides

Istio denies a call when an ALLOW policy applies to the callee and no rule admits the caller, or when a DENY rule matches the caller. A callee with only DENY policies lets in every caller that no DENY rule names. Istio's own order says why: a matching CUSTOM policy that denies refuses the request, then a matching DENY policy refuses it, and then, where the workload has no ALLOW policy, the request is allowed; otherwise a matching ALLOW policy must allow it, or the request is refused.

Istio's reference says the same (AuthorizationPolicy): CUSTOM is evaluated first, then DENY, then ALLOW, and "If there are no ALLOW policies for the workload, allow the request."

Which policies apply to a workload:

  • A policy applies to the workloads its selector matches, in its own namespace. A policy with no selector applies to every workload of its namespace, or to every workload of the mesh when it is in Istio's root namespace.
  • A policy in Istio's root namespace applies to the workloads its selector matches in every namespace of the mesh. The root namespace is istio-system unless the cluster's istio.rootNamespace says otherwise (Clusters).
  • A policy with no action is an ALLOW policy, as in Istio.
  • netatlas leaves out AUDIT policies. They decide whether to log a request and do not change whether Istio lets it in.

What netatlas draws for each policy

  • A line for each ALLOW rule that admits a caller, from the caller to the callee. The label says what the rule allows: methods and paths such as GET /cart, host, port, or any request when the rule names none. A rule with several operations joins them with ; .
  • The caller's identity. principals, namespaces, serviceAccounts and trustDomains are compared with the caller's mutual TLS identity. The trust domain is cluster.local unless the cluster's istio.trustDomain says otherwise (Clusters). A * matches any value that is not empty, prefix* and *suffix match as written, and serviceAccounts takes <namespace>/<account> exactly, or <account> for the policy's own namespace.
  • Callers outside the mesh have no certificate, so those four fields never match them, and their not forms always hold. The edge says accepted unless mutual TLS is STRICT: a plain-text call gets in only while the callee's mutual TLS mode is not STRICT.
  • depends on the request is on a line whose rule uses something only a request shows: a when condition, requestPrincipals, ipBlocks or remoteIpBlocks, or a field netatlas does not know. It is also on a line that a DENY or CUSTOM policy may refuse for some of its requests. A DENY rule that names methods, paths, hosts or ports is such a policy.
  • A DENY or CUSTOM policy allows nothing, so netatlas never names one as what allows a call. It appears as a note on a line when it may refuse some of that call's requests.
  • A workload outside the mesh has no proxy to enforce a policy. Its panel says Istio not enforced, and the policy draws nothing for it.

Choose a workload on the Policy map and its panel lists each line under May call it and It may call, with its notes. On a line under It may call, the note its policy <name> names the callee's policy, because the callee's policy decides.

Workloads no ALLOW policy selects

A CUSTOM or DENY policy allows nothing, so netatlas never names one as what allows a call. Where no ALLOW policy selects the callee, it says so in words wherever it says what allows a call (the workload panel of the Policy map, the spoken labels of both maps, and What stands out): no ALLOW policy selects <callee>, so Istio lets in every request that <policies> do not refuse. The <policies> are the CUSTOM and DENY policies that may refuse some of the call's requests, with does not refuse for one of them, and the panel says it for the callee. On the Traffic view, for a pair with no Istio edge and no NetworkPolicy that lets it in, they are the CUSTOM and DENY policies that select the callee.

The Policy map draws a line to such a workload only from a caller that one of those policies may refuse. The line says any request, with the note depends on the request.

A workload in the mesh that only CUSTOM or DENY policies select, and that no NetworkPolicy selects for ingress, is open. Its panel says which of the policies do not refuse (Open workloads).

Calls Istio refused

The Traffic view marks a pair refused by Istio when the figures say the callee's Istio refused it (The marks says when). A 403 alone does not make refused by Istio: Envoy has no response flag for an access-control denial, and an application may answer 403 itself, so the policies must deny the call as well. ztunnel does say it outright: the callee's ztunnel records DENY, while the caller's ztunnel records the same refusal as CONNECT. Between sidecars nothing says it: Envoy's network filter closes a connection that an AuthorizationPolicy refuses and sets no response flag, so netatlas reads the refusal from the figures. A pair with no requests, closed connections and no response byte, that Istio's own rule denies, is refused by Istio, unless every closed connection carried one of the failure flags in the refused by the network row of The marks, which reads refused by the network first. This rule comes from one measurement of plain TCP between two sidecars (What netatlas does not do yet).

To find the policy, open the callee on the Policy map: its panel lists the policies that select it.

Ambient mode and waypoints

In ambient mode without a waypoint, ztunnel enforces a callee's policies, and it reads only their L4 attributes: identities, namespaces, IP blocks and ports. Only a waypoint enforces L7 attributes (Istio: L4 policies). netatlas draws what ztunnel enforces:

  • An ALLOW rule with an L7 attribute (methods, paths, hosts, requestPrincipals, remoteIpBlocks, or a when condition on anything but the source IP, source namespace, source principal, destination IP or destination port) never matches in ztunnel. netatlas draws no line for it, and a callee whose ALLOW policy has only such rules refuses every caller.
  • A DENY rule keeps its L4 attributes and loses its L7 ones. A DENY rule with only L7 attributes denies nothing, and one that mixes both can deny more than it says.
  • In ambient mode the same holds for a callee with only CUSTOM policies, which ztunnel ignores.

A policy attached by targetRef or targetRefs, to a waypoint or to a Gateway that is no waypoint, is not evaluated: finding what it restricts needs the Gateways and Services it names, which netatlas's role does not read. The Policy map lists it as <namespace> / <name>: Not evaluated: attached by targetRef or targetRefs, not by a selector., draws no line for it, and names it on the panel of each workload in its namespace, because it may restrict who may call them. One in the mesh's root namespace that names a GatewayClass applies to every Gateway of that class, waypoints of every namespace included, so every panel names it (What the map does not show yet).

What netatlas does not edit

Istio AuthorizationPolicies are shown as their YAML, not edited here: a policy's page says Shown, not edited here. netatlas does not create or delete policies either. Only a NetworkPolicy has an editor. Change an AuthorizationPolicy with kubectl or from git. netatlas reads them with get, list and watch (Install).