Skip to content
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

Allow vault ssh to work with single ssh args like -v #4825

Merged
merged 1 commit into from
Jul 16, 2018

Conversation

Crazybus
Copy link
Contributor

My changes in #4710 did not take into account single ssh arguments like -v for verbosity. When running a command with one of these arguments it would then attempt to parse the next argument as the value.

A simple example of where this failed.

$ vault ssh -role bastion -mode otp -- -v hostname /bin/sh -c 'command'
Error resolving the ssh hostname: "failed to resolve IP address: lookup /bin/sh: no such host"

In this case it hit -v and decided that the next value would be the value for this arg. Since -v isn't interesting for vault it skipped it and continued parsing the ssh command. Then the next bare argument was taken to be the hostname when it was actually supposed to be the command.

I really wish there was a clean solution to this which didn't involve the hardcoded list of single ssh args. The ssh client code for parsing the args is around 500 lines long and I can't see a way to programatically parse the hostname without knowing which args have values and which don't.

One potential solution for the future would be to move all ssh parsing logic out of vault and into a separate library. Right now I feel it is important to fix the current bug however this might be a good answer to solving this cleanly.

@vishalnayak vishalnayak added this to the 0.10.4 milestone Jun 25, 2018
@jefferai jefferai merged commit e32ba81 into hashicorp:master Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants