Repository navigation
fix: thread LocalNetPath through ciConfig for root-manager tunneling - #320
Merged
Merged
Conversation
Pair with signadot/libconnect, which now takes a ClientConfig.LocalNetPath string prepended to PATH when exec'ing tunnel-setup commands (iptables on linux; pfctl and route on darwin). Fixes the "exit status 127" seen on Gitpod and similar environments where the user's PATH lacks /usr/sbin where iptables lives. Capture $SIGNADOT_LOCALNET_PATH at CLI invocation time with os.LookupEnv so unset vs. explicitly-empty are distinguished before serialization — unset defaults to /usr/sbin:/sbin, empty disables the prepend for environments (e.g. NixOS) where the default search is incorrect, set values pass through. The resolved string lives on ciConfig.LocalNetPath and is wired into localnet.ClientConfig in the root-manager. The --preserve-env list on the sudo invocation is unchanged; the policy decision is made in the CLI (where the user's shell env is still visible) and carried through ciConfig, so libconnect holds no env-var lookup or default of its own. Bumps libconnect to the paired branch commit; needs a final bump once that PR merges and is tagged. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
scott-cotton
force-pushed
the
fix/preserve-localnet-path-through-sudo
branch
from
April 21, 2026 07:29
cab74ac to
f681494
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ClientConfig.LocalNetPathstring prepended toPATHwhen libconnect execsiptables/pfctl/route. Fixes theexit status 127seen on Gitpod where the user's PATH lacks/usr/sbin.$SIGNADOT_LOCALNET_PATHat CLI invocation withos.LookupEnvwhile the user's shell env is still visible. Unset → default/usr/sbin:/sbin; explicitly empty → no prepend (opt-out for NixOS etc.); set → pass through. Resolved string carried on a newciConfig.LocalNetPathfield and wired intolocalnet.ClientConfigin the root-manager.--preserve-envlist is unchanged — the env var never needs to survive the sudo elevation because the policy decision is resolved in the CLI before the daemon is spawned.Design note
Earlier iteration of this change extended
--preserve-envto passSIGNADOT_LOCALNET_PATHthrough sudo and had libconnect read it viaos.LookupEnv. The ciConfig route is better because:--preserve-envlist staying in sync across two repos).Behavior
iptables/pfctl/routewithPATH=/usr/sbin:/sbin:$UIDPath. Gitpod works without thesudo ln -s /usr/sbin/iptables /usr/bin/iptablesworkaround.SIGNADOT_LOCALNET_PATH=...exported by user: that value is prepended instead of the default.SIGNADOT_LOCALNET_PATH=(empty): prepend disabled, tunnel-setup execs inherit root-manager env unmodified.Test plan
go build ./...go test ./...gofmt -l internal/iptablesat/usr/sbin/iptablesis not on user PATH, confirmsignadot local connectsucceeds.aws-iam-authenticator, GKE withgke-gcloud-auth-plugin) still works.🤖 Generated with Claude Code