- Notifications
You must be signed in to change notification settings - Fork928
feat: Set SSH env vars:SSH_CLIENT
,SSH_CONNECTION
andSSH_TTY
#3622
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can we just hardcode these values instead? They won't be useful to any programs that read them as the IP address is not an actual routable IP address (as the networking is happening in process and not through the host).
If we're just trying to expose these variables so software can detect if it's running in an SSH connection then hardcoding them seems easier and not prone to random format changes in the future
mafredri commentedAug 22, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I was thinking that might not necessarily be the case with WireGuard/Tailscale. I guess we could hardcode them, but what would we hardcode them to? |
Hardcode to |
mafredri commentedAug 22, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Typically it'd be:
@spikecurtis Are you suggesting
A bit weird, but I don't have strong feelings on what the value should be (unless wecan make it right in the wg-case, then I think we should do it). |
I don't think we can make it "right" in the Wireguard case because unlike a typical Wireguard VPN, our use of it is implemented entire in-process (agent), so anything reading the IP addresses would be unable to route to them. |
That makes sense, yeah. I do think there's a chance for this to change, depending on what we want to do with wg/tailscale. For instance, direct workspace->workspace communication in a tailnet would be pretty cool. I'll go with the hard-coded values for now, though. 👍🏻 |
1f5afe3
to24f8e6a
Compare24f8e6a
tof7c91cc
Compare
With out current webrtc connections, the result is not ideal:
# env | grep ^SSH_SSH_CONNECTION=peer/unknown-addr 0 peer/unknown-addr 0SSH_PTY=/dev/pts/0SSH_CLIENT=peer/unknown-addr 0 0
It seems like it would be possible to extract some sensible information from the peer negotiation process.
But since we're moving towards WireGuard, I don't think it's worth it.
Using WireGuard though (
coder config-ssh --wireguard
), we actually get some more sensible output:env| grep ^SSH_SSH_CONNECTION=[66b0:b5ee:5a5f:62ec:3f95:e1ff:526c:38e4] 23171 [6a58:41de:9543:ec22:2692:f500:4768:861b] 12212SSH_PTY=/dev/pts/0SSH_CLIENT=[66b0:b5ee:5a5f:62ec:3f95:e1ff:526c:38e4] 23171 12212
Fixes#2339
We may want to re-consider the
pty
package we currently have as well, it's a bit weird we setSSH_TTY
in it now, without being more explicit about it being tied to SSH. Relevant for#3473 as well.