Commit aa193ab
authored
fix(cli): improved support for native sidecar servers in
(Extracted from #14566)
The logic behind the `linkerd authz` command wasn't accounting for ports
in init containers, so authorization policies pointing to those ports
were not reported by the command.
Say for example you had a strict auth policy for the `linkerd-admin`
port, allowing only access from prometheus. For emojivoto's web workload
you could set that up like this:
```yaml
apiVersion: policy.linkerd.io/v1beta3
kind: Server
metadata:
annotations:
name: admin
namespace: emojivoto
spec:
accessPolicy: deny
podSelector:
matchLabels:
app: web-svc
port: linkerd-admin
proxyProtocol: HTTP/1
---
apiVersion: policy.linkerd.io/v1alpha1
kind: MeshTLSAuthentication
metadata:
namespace: emojivoto
name: prometheus
spec:
identities:
- "prometheus.linkerd-viz.serviceaccount.identity.linkerd.cluster.local"
---
apiVersion: policy.linkerd.io/v1alpha1
kind: AuthorizationPolicy
metadata:
namespace: emojivoto
name: web-http-sa
spec:
targetRef:
group: policy.linkerd.io
kind: Server
name: admin
requiredAuthenticationRefs:
- name: prometheus
kind: MeshTLSAuthentication
group: policy.linkerd.io
```
Invoking `linkerd authz` would return nothing, but after this change we
can see the auth:
```
$ linkerd authz -n emojivoto deploy/web
ROUTE SERVER AUTHORIZATION_POLICY SERVER_AUTHORIZATION
* admin web-http-sa
```linkerd authz (#14780)1 parent 7a1a06c commit aa193ab
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
| 250 | + | |
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| |||
0 commit comments