From 4a9ece210918f47ca56ee551f2acc3ca4b2ff4a8 Mon Sep 17 00:00:00 2001 From: Josh van Leeuwen Date: Fri, 5 Sep 2025 19:56:55 -0300 Subject: [PATCH] [1.16] Add docs on DAPR_UNSAFE_SKIP_CONTAINER_UID_GID_CHECK env var (#4832) * [1.16] Add docs on DAPR_UNSAFE_SKIP_CONTAINER_UID_GID_CHECK env var Fixes https://github.com/dapr/docs/issues/4784 Signed-off-by: joshvanl * Apply suggestions from code review Co-authored-by: Mark Fussell Signed-off-by: Josh van Leeuwen * Adds DAPR_UNSAFE_SKIP_CONTAINER_UID_GID_CHECK to environment reference Signed-off-by: joshvanl * Moved non-root execution section for Kubernetes Moved the section on running Dapr services as non-root in Kubernetes, including environment variable configuration. Signed-off-by: Mark Fussell --------- Signed-off-by: joshvanl Signed-off-by: Josh van Leeuwen Signed-off-by: Mark Fussell Co-authored-by: Mark Fussell --- daprdocs/content/en/concepts/security-concept.md | 6 ++++++ .../hosting/kubernetes/kubernetes-production.md | 12 +++++++++++- daprdocs/content/en/reference/environment/_index.md | 3 ++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/daprdocs/content/en/concepts/security-concept.md b/daprdocs/content/en/concepts/security-concept.md index 0266a75d2..fa284cde4 100644 --- a/daprdocs/content/en/concepts/security-concept.md +++ b/daprdocs/content/en/concepts/security-concept.md @@ -153,6 +153,12 @@ With Dapr OAuth 2.0 middleware, you can enable OAuth authorization on Dapr endpo You can adopt common network security technologies, such as network security groups (NSGs), demilitarized zones (DMZs), and firewalls, to provide layers of protection over your networked resources. For example, unless configured to talk to an external binding target, Dapr sidecars don’t open connections to the internet and most binding implementations only use outbound connections. You can design your firewall rules to allow outbound connections only through designated ports. +## Run as non-root in Kubernetes +When running in Kubernetes, Dapr services ensure each process is running as non-root. This is done by checking the UID & GID of the process is `65532`, and fatal erroring if it is not what is expected. If you must run a non-default UID & GID in Kubernetes, set the following env var to skip this check. +```bash +DAPR_UNSAFE_SKIP_CONTAINER_UID_GID_CHECK="true" +``` + # Security policies Dapr has an extensive set of security policies you can apply to your applications. You can scope what they are able to do, either through a policy setting in the sidecar configuration, or with the component specification. diff --git a/daprdocs/content/en/operations/hosting/kubernetes/kubernetes-production.md b/daprdocs/content/en/operations/hosting/kubernetes/kubernetes-production.md index 40c4c8d02..c4f4b88e2 100644 --- a/daprdocs/content/en/operations/hosting/kubernetes/kubernetes-production.md +++ b/daprdocs/content/en/operations/hosting/kubernetes/kubernetes-production.md @@ -343,10 +343,20 @@ By default, the Dapr sidecar injector injects a sidecar without any `seccompProf Refer to [the Arguments and Annotations overview]({{% ref "arguments-annotations-overview.md" %}}) to set the appropriate `seccompProfile` on the sidecar container. -## Best Practices +## Run as non-root +When running in Kubernetes, Dapr services ensure each process is running as non-root. +This is done by checking the UID & GID of the process is `65532`, and fatal erroring if it is not what is expected. +If you must run a non-default UID & GID in Kubernetes, set the following env var to skip this check. + +```bash +DAPR_UNSAFE_SKIP_CONTAINER_UID_GID_CHECK="true" +``` + +## Best Practices Watch this video for a deep dive into the best practices for running Dapr in production with Kubernetes. + {{< youtube id=_U9wJqq-H1g >}} ## Related links diff --git a/daprdocs/content/en/reference/environment/_index.md b/daprdocs/content/en/reference/environment/_index.md index ad26f9dcb..c2bd8f5e3 100644 --- a/daprdocs/content/en/reference/environment/_index.md +++ b/daprdocs/content/en/reference/environment/_index.md @@ -29,4 +29,5 @@ The following table lists the environment variables used by the Dapr runtime, CL | DAPR_COMPONENTS_SOCKETS_EXTENSION | .NET and Java pluggable component SDKs | A per-SDK configuration that indicates the default file extension applied to socket files created by the SDKs. Not a Dapr-enforced behavior. | | DAPR_PLACEMENT_METADATA_ENABLED | Dapr placement | Enable an endpoint for the Placement service that exposes placement table information on actor usage. Set to `true` to enable in self-hosted mode. [Learn more about the Placement API]({{% ref placement_api.md %}}) | | DAPR_HOST_IP | Dapr sidecar | The host's chosen IP address. If not specified, will loop over the network interfaces and select the first non-loopback address it finds.| -| DAPR_HEALTH_TIMEOUT | SDKs | Sets the time on the "wait for sidecar" availability. Overrides the default timeout setting of 60 seconds. | \ No newline at end of file +| DAPR_HEALTH_TIMEOUT | SDKs | Sets the time on the "wait for sidecar" availability. Overrides the default timeout setting of 60 seconds. | +| DAPR_UNSAFE_SKIP_CONTAINER_UID_GID_CHECK | Dapr control plane & sidecar | Disable the check that ensures the Dapr containers are not running as root on Kubernetes linux. This is not recommended for production environments. Set to `true` to disable the check. |