部署与运维

Harden task runners

Task runners are responsible for executing code from the Code node. While Code node executions are secure, you can follow these recommendations to further harden your task runners.

Run task runners as sidecars in external mode

To increase the isolation between the core n8n process and code in the Code node, run task runners in external mode. External task runners launch as separate containers, providing a fully isolated environment to execute the JavaScript defined in the Code node.

Use the distroless image

For a reduced attack surface, use the distroless Docker image variant. Distroless images contain only the application and its runtime dependencies, excluding package managers, shells, and other utilities that aren't needed at runtime.

To use the distroless image, append the -distroless suffix to the Docker tag. For example: 2.4.6-distroless.

Run as the nobody user

For improved security, configure task runners to run as the unprivileged nobody user with user and group ID 65532. This prevents the container process from running with root privileges and limits potential damage from security vulnerabilities.

Configure read-only root filesystem

Configure a read-only root filesystem to prevent any modifications to the container's filesystem at runtime. This helps protect against malicious code that might attempt to modify system files.

Task runners still require some temporary storage for operation. To accommodate this, mount a minimal emptyDir volume to /tmp. If your workflows require more temporary space, increase the size of the volume accordingly.

Configure an AppArmor profile

As a defence-in-depth measure, apply an AppArmor profile to prevent the task runner container from reading sensitive /proc files such as environ and mounts. These files can expose environment variables, including secrets and credentials, to code running inside the container. Refer to the Kubernetes AppArmor documentation for how to apply a profile to a pod.

Add the following rule to your AppArmor profile:

text
audit deny @{PROC}/[0-9]*/{environ,mounts} rwl,

This denies and logs any attempt to read, write, or link to per-process environ and mounts files.

官方原文和授权

本页来自 N8N 英文官方网站固定快照,并转换成 xueai 静态页面。内容以 N8N 持续更新的官方页面为准。

来源、授权与修改

本站保留许可证、固定提交号、社区作者和修改说明,不代表 n8n 对本站背书。

查看许可证查看来源和修改说明