update ssh client usage for new crypto/ssh version

This commit is contained in:
Matthew Hooker
2017-05-18 12:01:44 -07:00
parent 249cb690e0
commit ee5d13611f
8 changed files with 26 additions and 9 deletions
+4 -1
View File
@@ -88,6 +88,7 @@ func SSHConfig(useAgent bool, username, password string) func(multistep.StateBag
Auth: []ssh.AuthMethod{
ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}, nil
}
@@ -103,11 +104,13 @@ func SSHConfig(useAgent bool, username, password string) func(multistep.StateBag
Auth: []ssh.AuthMethod{
ssh.PublicKeys(signer),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}, nil
} else {
return &ssh.ClientConfig{
User: username,
User: username,
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
Auth: []ssh.AuthMethod{
ssh.Password(password),
ssh.KeyboardInteractive(
+2
View File
@@ -5,6 +5,7 @@ package lin
import (
"fmt"
"github.com/hashicorp/packer/builder/azure/common/constants"
"github.com/mitchellh/multistep"
"golang.org/x/crypto/ssh"
@@ -32,6 +33,7 @@ func SSHConfig(username string) func(multistep.StateBag) (*ssh.ClientConfig, err
Auth: []ssh.AuthMethod{
ssh.PublicKeys(signer),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}, nil
}
}
+1
View File
@@ -36,6 +36,7 @@ func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) {
ssh.KeyboardInteractive(
packerssh.PasswordKeyboardInteractive(config.Comm.SSHPassword)),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}
if config.Comm.SSHPrivateKey != "" {
+2
View File
@@ -2,6 +2,7 @@ package digitalocean
import (
"fmt"
"golang.org/x/crypto/ssh"
"github.com/mitchellh/multistep"
@@ -26,5 +27,6 @@ func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) {
Auth: []ssh.AuthMethod{
ssh.PublicKeys(signer),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}, nil
}
+1
View File
@@ -27,5 +27,6 @@ func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) {
Auth: []ssh.AuthMethod{
ssh.PublicKeys(signer),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}, nil
}
+4 -1
View File
@@ -84,6 +84,7 @@ func SSHConfig(useAgent bool, username, password string) func(multistep.StateBag
Auth: []ssh.AuthMethod{
ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}, nil
}
@@ -101,12 +102,14 @@ func SSHConfig(useAgent bool, username, password string) func(multistep.StateBag
Auth: []ssh.AuthMethod{
ssh.PublicKeys(signer),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}, nil
} else {
return &ssh.ClientConfig{
User: username,
User: username,
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
Auth: []ssh.AuthMethod{
ssh.Password(password),
ssh.KeyboardInteractive(
+3 -2
View File
@@ -44,8 +44,9 @@ func SSHConfigFunc(config SSHConfig) func(multistep.StateBag) (*ssh.ClientConfig
}
return &ssh.ClientConfig{
User: config.Comm.SSHUsername,
Auth: auth,
User: config.Comm.SSHUsername,
Auth: auth,
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}, nil
}
}
+9 -5
View File
@@ -3,14 +3,15 @@ package triton
import (
"fmt"
packerssh "github.com/hashicorp/packer/communicator/ssh"
"github.com/mitchellh/multistep"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/agent"
"io/ioutil"
"log"
"net"
"os"
packerssh "github.com/hashicorp/packer/communicator/ssh"
"github.com/mitchellh/multistep"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/agent"
)
func commHost(state multistep.StateBag) (string, error) {
@@ -49,6 +50,7 @@ func sshConfig(useAgent bool, username, privateKeyPath, password string) func(mu
Auth: []ssh.AuthMethod{
ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}, nil
}
@@ -72,12 +74,14 @@ func sshConfig(useAgent bool, username, privateKeyPath, password string) func(mu
Auth: []ssh.AuthMethod{
ssh.PublicKeys(signer),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}, nil
} else {
log.Println("Configuring SSH keyboard interactive.")
return &ssh.ClientConfig{
User: username,
User: username,
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
Auth: []ssh.AuthMethod{
ssh.Password(password),
ssh.KeyboardInteractive(