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

ssh/tailssh: add support for forwarding unix sockets #12081

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Xenfo
Copy link

@Xenfo Xenfo commented May 10, 2024

closes #6232

Based off of @deansheather's work at gliderlabs/ssh#196 and https://github.com/coder/coder/blob/2c0f653aa85ab4d2c4be410642776c772eb524ac/agent/agentssh/forward.go, this PR finally adds support for forwarding unix sockets. This allows workflows such as GPG agent forwarding to work.

Just as a side note, I'm not very familiar with networking and the security that comes with it so this code will probably need to be modified to meet whatever requirements Tailscale has during review.

Updates tailscale#6232
Signed-off-by: Samuel Corsi-House <chouse.samuel@gmail.com>
Updates tailscale#6232
Signed-off-by: Samuel Corsi-House <chouse.samuel@gmail.com>
Comment on lines +2460 to +2467
// AllowLocalUnixForwarding, if true, allows accepted connections
// to use local unix forwarding if requested.
AllowLocalUnixForwarding bool `json:"allowLocalUnixForwarding,omitempty"`

// AllowRemoteUnixForwarding, if true, allows accepted connections
// to use remote unix forwarding if requested.
AllowRemoteUnixForwarding bool `json:"allowRemoteUnixForwarding,omitempty"`

Copy link
Author

@Xenfo Xenfo May 10, 2024

Choose a reason for hiding this comment

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

Not sure how to actually change these values on the client, could it be part of another project? Currently they seem to default to false.

Edit: Looking at Headscale's source code I think it's part of the proprietary code that Tailscale uses.

return false, nil
}

if err := os.Chmod(addr, os.FileMode(0777)); err != nil {
Copy link
Author

Choose a reason for hiding this comment

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

Is there a better permission that can be used on the socket?

@Xenfo Xenfo marked this pull request as ready for review May 10, 2024 12:05
@Xenfo Xenfo requested a review from a team as a code owner May 10, 2024 12:05
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.

FR: make Tailscale SSH port forwarding work with unix socket
1 participant