Repository navigation
Conversation
Opt-in Tailscale SSH setup for devcontainers. Both subcommands are silent no-ops when TAILSCALE_AUTHKEY is unset. Refs: #208
7 tasks
Contributor
|
Would it make sense to install tailscale in the image instead of at the host, and only enable if the env variable is set? |
Contributor
Author
|
it is doing it in the image. that was the idea, also in this way it does not persist, i.e. you can set ephemeral auth in tailscale so it will die eventually. |
Contributor
|
@gerchowl Somehow for me the |
Architecture decisions, lifecycle hook placement, programmatic key generation via OAuth API, git signing gap, and future considerations. Ported from fd5 prototype and extended with OAuth key generation flow. Refs: #208
7 of 8 tasks
gerchowl
added a commit
that referenced
this pull request
Mar 7, 2026
## Summary - Add `--open <ide>|none` flag to decouple IDE from infra (`--open none` for headless/scripted use) - Add `--yes` flag for non-interactive mode - Add `inject_tailscale_key()` — generates ephemeral Tailscale auth keys via OAuth API and injects into remote `docker-compose.local.yaml` - Key injection is fully opt-in: silent no-op when `TS_CLIENT_ID`/`TS_CLIENT_SECRET` are absent ## How it works ``` Local: TS_CLIENT_ID + TS_CLIENT_SECRET → OAuth token from api.tailscale.com → Ephemeral auth key (tag:devcontainer) → SSH inject into remote docker-compose.local.yaml → compose up → container joins tailnet ``` ## Test plan - [x] BATS: `--open none` skips editor detection - [x] BATS: `--open code` fails when code not in PATH - [x] BATS: `--open invalid` rejected - [x] BATS: `--yes` accepted - [x] BATS: `inject_tailscale_key` skips when OAuth creds unset - [x] BATS: function defined and called in main - [x] All 34 existing + new tests pass - [ ] Manual: test with real Tailscale OAuth creds on remote host ## Part of Epic: #232 Closes: #230 Depends on: #208 (Tailscale SSH in workspace template) ## References - Design doc: `docs/designs/tailscale-ssh.md` (added in PR #211) - [Tailscale OAuth API](https://tailscale.com/kb/1215/oauth-clients)
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.
Description
Add opt-in Tailscale SSH support to the devcontainer workspace template. When
TAILSCALE_AUTHKEYis set viadocker-compose.local.yaml, Tailscale is installed at container creation and started on every container start, enabling direct SSH access over the tailnet. When unset, all hooks are silent no-ops — zero impact on existing users.This enables tools like Cur*or GUI to execute shell commands inside the container via SSH remote, working around the known devcontainer protocol limitation.
Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
assets/workspace/.devcontainer/scripts/setup-tailscale.sh(new) — Single script withinstallandstartsubcommands. Uses userspace networking (--tun=userspace-networking), Tailscale SSH (--ssh), and auto-generates hostname fromdevcontainer.jsonname field.assets/workspace/.devcontainer/scripts/post-create.sh— Added hook tosetup-tailscale.sh installafter dependency sync.assets/workspace/.devcontainer/scripts/post-start.sh— AddedSCRIPT_DIRresolution and hook tosetup-tailscale.sh startafter dependency sync.assets/workspace/.devcontainer/docker-compose.local.yaml— Added commented example forTAILSCALE_AUTHKEYandTAILSCALE_HOSTNAMEenv vars.assets/workspace/.devcontainer/README.md— Added "Tailscale SSH" section with prerequisites, setup, ACL configuration, and how-it-works documentation.tests/bats/setup-tailscale.bats(new) — 9 BATS tests covering script structure, opt-in gate (no-op when authkey unset/empty), and invalid subcommand handling.CHANGELOG.md— Added entry under## Unreleased→### Added.Changelog Entry
Added
setup-tailscale.shscript withinstallandstartsubcommandspost-create.sh(install) andpost-start.sh(start)TAILSCALE_AUTHKEYis unset — zero impact on existing usersdocker-compose.local.yamlfor quick setup.devcontainer/README.mdwith quick-start and ACL instructionsTesting
just test)Manual Testing Details
N/A — Live Tailscale testing requires network access and a valid authkey. BATS tests cover the opt-in gate logic (the critical behavior).
Checklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
vig-os/fd5commit13797dbRefs: #208