Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

ssh transport fails to read identity files prefixed with '~' in SSH config #724

Open
ekinanp opened this issue Feb 10, 2020 · 2 comments
Open
Labels
bug Something isn't working

Comments

@ekinanp
Copy link
Contributor

ekinanp commented Feb 10, 2020

For example, given an ssh config file that's something like

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa
  User root

The SSH transport fails to read ~/.ssh/id_rsa @ https://github.com/puppetlabs/wash/blob/master/transport/ssh.go#L161 b/c ioutil.ReadFile does not read paths prefixed with ~.

We should probably ensure that common UNIX-y paths like ~ are properly expanded before reading the file, but only if that is a common idiom. Given that this issue was filed months after the SSH transport was written, it probably isn't a common idiom and instead a result of me not knowing SSH config file conventions.

@ekinanp ekinanp added the bug Something isn't working label Feb 10, 2020
@ekinanp
Copy link
Contributor Author

ekinanp commented Feb 10, 2020

WORKAROUND: Use absolute paths for identity files in your SSH config.

@ekinanp ekinanp changed the title ssh transport fails to read relative-path identity files in SSH config ssh transport fails to read UNIX-y (e.g. prefixed with ~) identity files in SSH config Feb 10, 2020
@ekinanp ekinanp changed the title ssh transport fails to read UNIX-y (e.g. prefixed with ~) identity files in SSH config ssh transport fails to read identity files prefixed with '~' in SSH config Feb 10, 2020
@MikaelSmith
Copy link
Contributor

This seems to come up repeatedly with config files. There's not a consistent pattern of handling them. golang/go#4140 talks about one perspective on it; in many of Puppet's tools we've chosen to expand tilde.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants