v0.10.0: each viewer sees what their own RBAC allows
Until now anyone admitted through Dex saw every namespace and every log, read with the module's service account. auth.visibility: ViewerRBAC (the default) asks the API server as the viewer, with the token the DexAuthenticator forwards: list pods in all namespaces means the whole cluster; otherwise the namespaces where they can list pods. Logs also need get pods/log, node cards list nodes, cluster-wide alerts are for cluster-wide viewers. Traffic to a hidden namespace keeps its counts with the peer shown as hidden. One minute cache per token hash, SSARs in parallel (8), a cluster-wide viewer costs two. Verified against the live cluster with two real tokens: a service account with view in one namespace got that namespace only (0 nodes, 403 on another namespace's YAML and logs, 403 on node usage); the module's own account, cluster-wide, got all 56 namespaces and 6 nodes; no token, 401. auth.visibility: Everything keeps the old behaviour. The DexAuthenticator now forwards the token when either actions or ViewerRBAC need it (templates/_helpers.tpl). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ce6dad9a58
commit
c50020e420
@@ -0,0 +1,6 @@
|
||||
{{- /* "true" when the module needs the viewer's own token in each request:
|
||||
for actions (they run as the viewer) and for ViewerRBAC visibility
|
||||
(what the viewer may see is asked as the viewer). */}}
|
||||
{{- define "cluster_map_viewer_token" -}}
|
||||
{{- or .Values.clusterMap.actions.enabled (eq .Values.clusterMap.auth.visibility "ViewerRBAC") -}}
|
||||
{{- end -}}
|
||||
@@ -98,6 +98,8 @@ spec:
|
||||
value: /etc/hubble-ca/ca.crt
|
||||
- name: ACTIONS_ENABLED
|
||||
value: {{ .Values.clusterMap.actions.enabled | quote }}
|
||||
- name: VISIBILITY
|
||||
value: {{ .Values.clusterMap.auth.visibility | quote }}
|
||||
- name: LOG_TAIL_LINES
|
||||
value: {{ .Values.clusterMap.logs.tailLines | quote }}
|
||||
- name: SYSTEM_NAMESPACE_PREFIXES
|
||||
|
||||
@@ -10,10 +10,11 @@ metadata:
|
||||
name: cluster-map
|
||||
namespace: d8-cluster-map
|
||||
{{- include "helm_lib_module_labels" (list . (dict "app" "dex-authenticator" "name" "cluster-map")) | nindent 2 }}
|
||||
{{- if .Values.clusterMap.actions.enabled }}
|
||||
{{- if eq (include "cluster_map_viewer_token" .) "true" }}
|
||||
annotations:
|
||||
# user-authn then asks Dex for a token with the kubernetes audience,
|
||||
# which the API server accepts: actions run with it (as the console does)
|
||||
# which the API server accepts: actions and ViewerRBAC visibility use it
|
||||
# (as the console does)
|
||||
dexauthenticator.deckhouse.io/allow-access-to-kubernetes: "true"
|
||||
{{- end }}
|
||||
spec:
|
||||
@@ -26,9 +27,9 @@ spec:
|
||||
applicationHTTPRouteListenerSetName: cluster-map
|
||||
{{- end }}
|
||||
applicationIngressClassName: {{ include "helm_lib_module_ingress_class" . | quote }}
|
||||
{{- if .Values.clusterMap.actions.enabled }}
|
||||
# actions run as the viewer: the user's token goes to the module in the
|
||||
# Authorization header
|
||||
{{- if eq (include "cluster_map_viewer_token" .) "true" }}
|
||||
# actions and visibility run as the viewer: the user's token goes to the
|
||||
# module in the Authorization header
|
||||
sendAuthorizationHeader: true
|
||||
{{- end }}
|
||||
{{- with .Values.clusterMap.auth.allowedUserEmails }}
|
||||
|
||||
@@ -59,7 +59,7 @@ metadata:
|
||||
{{- if and (ne (include "helm_lib_module_https_mode" .) "Disabled") .Values.clusterMap.auth.externalAuthentication }}
|
||||
alb.network.deckhouse.io/auth-signin: {{ replace "$host" (include "helm_lib_module_public_domain" (list . "cluster-map")) .Values.clusterMap.auth.externalAuthentication.authSignInURL | quote }}
|
||||
alb.network.deckhouse.io/auth-url: {{ .Values.clusterMap.auth.externalAuthentication.authURL | quote }}
|
||||
alb.network.deckhouse.io/auth-response-headers: {{ ternary "X-Auth-Request-User,X-Auth-Request-Email,Authorization" "X-Auth-Request-User,X-Auth-Request-Email" .Values.clusterMap.actions.enabled | quote }}
|
||||
alb.network.deckhouse.io/auth-response-headers: {{ ternary "X-Auth-Request-User,X-Auth-Request-Email,Authorization" "X-Auth-Request-User,X-Auth-Request-Email" (eq (include "cluster_map_viewer_token" .) "true") | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.clusterMap.auth.whitelistSourceRanges }}
|
||||
alb.network.deckhouse.io/whitelist-source-range: {{ .Values.clusterMap.auth.whitelistSourceRanges | join "," | quote }}
|
||||
|
||||
@@ -15,7 +15,7 @@ metadata:
|
||||
{{- if and (ne (include "helm_lib_module_https_mode" .) "Disabled") .Values.clusterMap.auth.externalAuthentication }}
|
||||
nginx.ingress.kubernetes.io/auth-signin: {{ .Values.clusterMap.auth.externalAuthentication.authSignInURL | quote }}
|
||||
nginx.ingress.kubernetes.io/auth-url: {{ .Values.clusterMap.auth.externalAuthentication.authURL | quote }}
|
||||
nginx.ingress.kubernetes.io/auth-response-headers: {{ ternary "X-Auth-Request-User,X-Auth-Request-Email,Authorization" "X-Auth-Request-User,X-Auth-Request-Email" .Values.clusterMap.actions.enabled | quote }}
|
||||
nginx.ingress.kubernetes.io/auth-response-headers: {{ ternary "X-Auth-Request-User,X-Auth-Request-Email,Authorization" "X-Auth-Request-User,X-Auth-Request-Email" (eq (include "cluster_map_viewer_token" .) "true") | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.clusterMap.auth.whitelistSourceRanges }}
|
||||
nginx.ingress.kubernetes.io/whitelist-source-range: {{ .Values.clusterMap.auth.whitelistSourceRanges | join "," | quote }}
|
||||
|
||||
Reference in New Issue
Block a user