Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
EhabY wants to merge2 commits intocoder:main
base:main
Choose a base branch
Loading
fromEhabY:fix-setenv-ssh-config

Conversation

@EhabY
Copy link
Collaborator

@EhabYEhabY commentedDec 15, 2025
edited
Loading

  • AddparseSshConfig function to correctly parseSetEnv MY_VAR=value (previously split on first= producing incorrect key/value)
  • ModifymergeSshConfigValues to concatenateSetEnv values instead of replacing, preserving the defaultCODER_SSH_SESSION_TYPE
  • Ignore emptySetEnv values to prevent accidentally clearing defaults

Closes#559

Copy link
Member

@deansheatherdeansheather left a 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
@EhabY
Copy link
CollaboratorAuthor

EhabY commentedDec 16, 2025
edited
Loading

Are there any other ssh options that can be specified multiple times? Would be nice to support those as well

I had Claude look into thessh_config documentation and here is the full list. We only care about multiple entries so in this case, it would beIdentityFile,CertificateFile,SetEnv,SendEnv,LocalForward,RemoteForward,DynamicForward can be accumulating. Alternatively, why not let the SSH client handle it? Like we can just pass the configs as is (override configs would be the put first since it's "first match wins"). I do not love that we have to re-implement this override behavior ourselves 🤔. If we want leaner files then we can still apply the overriding but we can always add entries from the list above as is (we do not manually combine them but pass them as is, such thatoverride is earlier than the base config).


Claude's Analysis

SSH Client (ssh_config) Accumulating Options

Options thataccumulate across multiple declarations, unlike standard "first match wins" behavior.

OptionExampleNotes
IdentityFileIdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Tried in sequence
CertificateFileCertificateFile ~/.ssh/cert1.pub
CertificateFile ~/.ssh/cert2.pub
Tried in sequence
SetEnvSetEnv FOO=bar
SetEnv BAZ=qux
Both sent to server
SendEnvSendEnv LANG LC_*
SendEnv MY_VAR
Prefix with - to clear
LocalForwardLocalForward 8080 localhost:80
LocalForward 9090 localhost:90
Multiple tunnels
RemoteForwardRemoteForward 8080 localhost:80Multiple tunnels
DynamicForwardDynamicForward 1080
DynamicForward 1081
Multiple SOCKS proxies
GlobalKnownHostsFileGlobalKnownHostsFile /etc/ssh/known_hosts /etc/ssh/known_hosts2Space-separated
UserKnownHostsFileUserKnownHostsFile ~/.ssh/known_hosts ~/.ssh/known_hosts2Space-separated
PermitRemoteOpenPermitRemoteOpen host1:80 host2:443Space-separated
CanonicalDomainsCanonicalDomains example.com corp.localSpace-separated

Source

OpenBSD ssh_config(5) — the canonical reference (OpenSSH is developed by OpenBSD).

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@deansheatherdeansheatherdeansheather approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

SSH config cannot use SetEnv without multiple problems

2 participants

@EhabY@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp