-
Notifications
You must be signed in to change notification settings - Fork 35
Fix SetEnv SSH config parsing and accumulation #684
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
base: main
Are you sure you want to change the base?
Conversation
deansheather
left a comment
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.
Are there any other ssh options that can be specified multiple times? Would be nice to support those as well
- Add parseSshConfig function to correctly parse "SetEnv MY_VAR=value" (previously split on first "=" producing incorrect key/value) - Modify mergeSshConfigValues to concatenate SetEnv values instead of replacing, preserving the default CODER_SSH_SESSION_TYPE - Ignore empty SetEnv values to prevent accidentally clearing defaults
d80e482 to
e2ea071
Compare
I had Claude look into the Claude's AnalysisSSH Client (
|
| Option | Example | Notes |
|---|---|---|
| IdentityFile | IdentityFile ~/.ssh/id_ed25519 IdentityFile ~/.ssh/id_rsa |
Tried in sequence |
| CertificateFile | CertificateFile ~/.ssh/cert1.pub CertificateFile ~/.ssh/cert2.pub |
Tried in sequence |
| SetEnv | SetEnv FOO=bar SetEnv BAZ=qux |
Both sent to server |
| SendEnv | SendEnv LANG LC_* SendEnv MY_VAR |
Prefix with - to clear |
| LocalForward | LocalForward 8080 localhost:80 LocalForward 9090 localhost:90 |
Multiple tunnels |
| RemoteForward | RemoteForward 8080 localhost:80 | Multiple tunnels |
| DynamicForward | DynamicForward 1080 DynamicForward 1081 |
Multiple SOCKS proxies |
| GlobalKnownHostsFile | GlobalKnownHostsFile /etc/ssh/known_hosts /etc/ssh/known_hosts2 | Space-separated |
| UserKnownHostsFile | UserKnownHostsFile ~/.ssh/known_hosts ~/.ssh/known_hosts2 | Space-separated |
| PermitRemoteOpen | PermitRemoteOpen host1:80 host2:443 | Space-separated |
| CanonicalDomains | CanonicalDomains example.com corp.local | Space-separated |
Source
OpenBSD ssh_config(5) — the canonical reference (OpenSSH is developed by OpenBSD).
parseSshConfigfunction to correctly parseSetEnv MY_VAR=value(previously split on first=producing incorrect key/value)mergeSshConfigValuesto concatenateSetEnvvalues instead of replacing, preserving the defaultCODER_SSH_SESSION_TYPESetEnvvalues to prevent accidentally clearing defaultsCloses #559