mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-19 11:25:06 +00:00
ssh: use resolved IP address while executing ssh command
This commit is contained in:
@@ -147,8 +147,7 @@ func (c *SSHCommand) Run(args []string) int {
|
|||||||
// Feel free to try and remove this dependency.
|
// Feel free to try and remove this dependency.
|
||||||
sshpassPath, err := exec.LookPath("sshpass")
|
sshpassPath, err := exec.LookPath("sshpass")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
sshCmdArgs = append(sshCmdArgs, []string{"-p", string(resp.Key), "ssh", "-p", port}...)
|
sshCmdArgs = append(sshCmdArgs, []string{"-p", string(resp.Key), "ssh", "-p", port, username + "@" + ip.String()}...)
|
||||||
sshCmdArgs = append(sshCmdArgs, args...)
|
|
||||||
sshCmd := exec.Command(sshpassPath, sshCmdArgs...)
|
sshCmd := exec.Command(sshpassPath, sshCmdArgs...)
|
||||||
sshCmd.Stdin = os.Stdin
|
sshCmd.Stdin = os.Stdin
|
||||||
sshCmd.Stdout = os.Stdout
|
sshCmd.Stdout = os.Stdout
|
||||||
@@ -161,8 +160,7 @@ func (c *SSHCommand) Run(args []string) int {
|
|||||||
c.Ui.Output("OTP for the session is " + resp.Key)
|
c.Ui.Output("OTP for the session is " + resp.Key)
|
||||||
c.Ui.Output("[Note: Install 'sshpass' to automate typing in OTP]")
|
c.Ui.Output("[Note: Install 'sshpass' to automate typing in OTP]")
|
||||||
}
|
}
|
||||||
sshCmdArgs = append(sshCmdArgs, []string{"-p", port}...)
|
sshCmdArgs = append(sshCmdArgs, []string{"-p", port, username + "@" + ip.String()}...)
|
||||||
sshCmdArgs = append(sshCmdArgs, args...)
|
|
||||||
|
|
||||||
sshCmd := exec.Command("ssh", sshCmdArgs...)
|
sshCmd := exec.Command("ssh", sshCmdArgs...)
|
||||||
sshCmd.Stdin = os.Stdin
|
sshCmd.Stdin = os.Stdin
|
||||||
|
|||||||
Reference in New Issue
Block a user