mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-04 20:06:27 +02:00
Support execution of remote commands using 'vault ssh'
This commit is contained in:
parent
d0dd6d27f7
commit
e4a20c0dcd
@ -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…
x
Reference in New Issue
Block a user