Skip to content

cmd/tclipd: support reading TS_AUTHKEY from a file - #113

Open
RyanDraves wants to merge 1 commit into
tailscale-dev:mainfrom
RyanDraves:authkey-file-indirection
Open

RyanDraves wants to merge 1 commit into
tailscale-dev:mainfrom
RyanDraves:authkey-file-indirection

Conversation

@RyanDraves

Copy link
Copy Markdown

The published image is based on gcr.io/distroless/static and so has no
shell, and tsnet reads TS_AUTHKEY directly from the environment. Together
these mean there is no way to supply the authkey as a Docker or Kubernetes
secret, which is delivered as a mounted file: the usual trick of reading
the file in an entrypoint would require the missing shell.

Resolve the "file:" prefix already used by the Tailscale container images,
so TS_AUTHKEY=file:/run/secrets/tclip_authkey reads the key from that path.
Surrounding whitespace is trimmed, since secret files conventionally end in
a newline. A missing or empty file is fatal rather than falling through to
an interactive login the operator would never see.

Test plan: I build the docker image and confirmed docker compose secrets work
as specified in the README example.

AI usage: Claude generated the commit. I reviewed and cleaned up its writing.

The published image is based on gcr.io/distroless/static and so has no
shell, and tsnet reads TS_AUTHKEY directly from the environment. Together
these mean there is no way to supply the authkey as a Docker or Kubernetes
secret, which is delivered as a mounted file: the usual trick of reading
the file in an entrypoint needs a shell that isn't there.

Resolve the "file:" prefix already used by the Tailscale container images,
so TS_AUTHKEY=file:/run/secrets/tclip_authkey reads the key from that path.
Surrounding whitespace is trimmed, since secret files conventionally end in
a newline. A missing or empty file is fatal rather than falling through to
an interactive login the operator would never see.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant