Fix SetEnv SSH config parsing and accumulation#684
Conversation
deansheather
left a comment
There was a problem hiding this comment.
Are there any other ssh options that can be specified multiple times? Would be nice to support those as well
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).
- 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
e2ea071 to
8ff27d9
Compare
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