@@ -95,26 +95,43 @@ The agent sees a normal network — outbound flows just route through
9595the gateway, which matches each request against the rules, injects
9696the configured credential, and forwards.
9797
98- #### No root inside ` clawpatrol run ` (Linux)
99-
100- The wrapped command runs in an unprivileged user namespace. As a
101- consequence of how Linux user namespaces work, that namespace has no
102- mapped root: your own uid is the only one mapped in, host root (uid 0)
103- is not. So commands that need real root won't work — ` sudo ` fails
104- with messages like:
105-
106- ```
107- sudo: /etc/sudo.conf is owned by uid 65534, should be 0
108- sudo: The "no new privileges" flag is set, which prevents sudo from running as root.
109- ```
110-
111- The first is the namespace mapping root-owned files to "nobody"
112- (65534); the second is the ` no_new_privileges ` flag clawpatrol sets to
113- install its unprivileged seccomp filter. This isn't a deliberate
114- restriction — it falls out of running unprivileged, and the host's own
115- ` sudo ` is unaffected outside the wrapper.
116-
117- If a command needs to act as root:
98+ #### Root and ` sudo ` inside ` clawpatrol run ` (Linux)
99+
100+ ` clawpatrol run ` builds the network namespace one of two ways,
101+ depending on whether the invoking user has ** passwordless ` sudo ` ** :
102+
103+ - ** Passwordless ` sudo ` available (preferred).** clawpatrol uses it to
104+ set up the net + mount namespace as real root, then drops back to
105+ your own user before exec'ing the command. Inside the wrapper you
106+ are your normal uid, root (uid 0) exists in the namespace, and
107+ ` sudo ` works — a command that needs to elevate can just call ` sudo `
108+ as it would anywhere. The wrapped command can't tell it was launched
109+ this way: clean environment, normal uid, no leftover ` SUDO_* ` vars.
110+ - ** No passwordless ` sudo ` (or ` CLAWPATROL_NO_SUDO=1 ` ).** clawpatrol
111+ falls back to an unprivileged user namespace. As a consequence of
112+ how Linux user namespaces work, that namespace has no mapped root:
113+ your own uid is the only one mapped in, host root (uid 0) is not. So
114+ commands that need real root won't work — ` sudo ` fails with messages
115+ like:
116+
117+ ```
118+ sudo: /etc/sudo.conf is owned by uid 65534, should be 0
119+ sudo: The "no new privileges" flag is set, which prevents sudo from running as root.
120+ ```
121+
122+ The first is the namespace mapping root-owned files to "nobody"
123+ (65534); the second is the ` no_new_privileges ` flag clawpatrol sets
124+ to install its unprivileged seccomp filter. This isn't a deliberate
125+ restriction — it falls out of running unprivileged, and the host's
126+ own ` sudo ` is unaffected outside the wrapper.
127+
128+ Gaining root inside the wrapper doesn't bypass the gateway's purpose:
129+ real secrets never leave the gateway, so a process that steps around
130+ the tunnel only reaches the network with placeholder credentials that
131+ mean nothing upstream. The namespace makes the gateway the path of
132+ least resistance, not an escape-proof jail.
133+
134+ If you're on the unprivileged path and a command needs to act as root:
118135
119136- ** Install the tooling on the host first** , then launch — e.g.
120137 ` sudo apt-get install -y postgresql-client && clawpatrol run -- psql … ` .
@@ -206,6 +223,7 @@ device-side knobs:
206223| ` CLAWPATROL_RUN_CONF ` | Override the WG conf path ` clawpatrol run ` reads |
207224| ` CLAWPATROL_DEBUG ` | Print the relay / auto-expose diagnostic lines, which are otherwise silent |
208225| ` CLAWPATROL_NO_ENV ` | Skip the env pushdown (` SSL_CERT_FILE ` , placeholders) when wrapping a command |
226+ | ` CLAWPATROL_NO_SUDO ` | Force the unprivileged user-namespace path even when passwordless ` sudo ` is available (see [ Root and ` sudo ` inside ` clawpatrol run ` ] ( #root-and-sudo-inside-clawpatrol-run-linux ) ); ` sudo ` won't work inside the wrapper |
209227| ` CLAWPATROL_TELEMETRY ` | ` 0 ` to disable telemetry (same as ` DO_NOT_TRACK=1 ` ) |
210228| ` DO_NOT_TRACK ` | Standard opt-out, honored |
211229| ` TS_AUTHKEY ` | Used by ` clawpatrol login ` to authenticate to Tailscale non-interactively |
0 commit comments