Support execution of remote commands using 'vault ssh'
This commit is contained in:
parent
3c01b9a22c
commit
e029d3c87a
|
@ -174,6 +174,9 @@ func (c *SSHCommand) Run(args []string) int {
|
|||
sshpassPath, err := exec.LookPath("sshpass")
|
||||
if err == nil {
|
||||
sshCmdArgs = append(sshCmdArgs, []string{"-p", string(resp.Key), "ssh", "-o UserKnownHostsFile=" + userKnownHostsFile, "-o StrictHostKeyChecking=" + strictHostKeyChecking, "-p", resp.Port, username + "@" + ip.String()}...)
|
||||
if len(args) > 1 {
|
||||
sshCmdArgs = append(sshCmdArgs, args[1:]...)
|
||||
}
|
||||
sshCmd := exec.Command(sshpassPath, sshCmdArgs...)
|
||||
sshCmd.Stdin = os.Stdin
|
||||
sshCmd.Stdout = os.Stdout
|
||||
|
@ -187,6 +190,9 @@ func (c *SSHCommand) Run(args []string) int {
|
|||
c.Ui.Output("[Note: Install 'sshpass' to automate typing in OTP]")
|
||||
}
|
||||
sshCmdArgs = append(sshCmdArgs, []string{"-o UserKnownHostsFile=" + userKnownHostsFile, "-o StrictHostKeyChecking=" + strictHostKeyChecking, "-p", resp.Port, username + "@" + ip.String()}...)
|
||||
if len(args) > 1 {
|
||||
sshCmdArgs = append(sshCmdArgs, args[1:]...)
|
||||
}
|
||||
|
||||
sshCmd := exec.Command("ssh", sshCmdArgs...)
|
||||
sshCmd.Stdin = os.Stdin
|
||||
|
|
Loading…
Reference in a new issue