Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "tailscale ssh" when built with ts_include_cli tag #12109

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SuperSandro2000
Copy link

@SuperSandro2000 SuperSandro2000 commented May 12, 2024

When tailscale is built with the ts_include_cli tag and the tailscaled binary is symlinked to tailscale (https://tailscale.com/kb/1207/small-tailscale), tailscale ssh fails like:

$ tailscale ssh host -v
...
debug1: Local version string SSH-2.0-OpenSSH_9.7
2024/05/12 22:57:44 tailscaled does not take non-flag arguments: ["nc" "host" "22"]
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

Closes #12125

tailscaleBin,
// os.Executable() would return the real running binary but in case tailscale is built with the ts_include_cli tag,
// we need to return the started symlink instead
os.Args[0],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've taken this from https://github.com/tailscale/tailscale/pull/5193/files

and verified it by running PATH=/nix/store/klzg9xnlkhxfwlxwm21mfy0jnw5mpyc7-openssh-9.7p1/bin /nix/store/h98b7fwi6ic7cx699f67gp2slawfcv15-strace-6.8/bin/strace ./result/bin/tailscale ssh host -v and checking the execve syscall.

I've also looked at other usages of os.Executable() and I don't think they have a similar problem.

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.

tailscale ssh is not working when built with ts_include_cli
2 participants