update ssh client usage for new crypto/ssh version
This commit is contained in:
parent
249cb690e0
commit
ee5d13611f
|
@ -88,6 +88,7 @@ func SSHConfig(useAgent bool, username, password string) func(multistep.StateBag
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers),
|
ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers),
|
||||||
},
|
},
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,11 +104,13 @@ func SSHConfig(useAgent bool, username, password string) func(multistep.StateBag
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.PublicKeys(signer),
|
ssh.PublicKeys(signer),
|
||||||
},
|
},
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}, nil
|
}, nil
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return &ssh.ClientConfig{
|
return &ssh.ClientConfig{
|
||||||
User: username,
|
User: username,
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.Password(password),
|
ssh.Password(password),
|
||||||
ssh.KeyboardInteractive(
|
ssh.KeyboardInteractive(
|
||||||
|
|
|
@ -5,6 +5,7 @@ package lin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
|
@ -32,6 +33,7 @@ func SSHConfig(username string) func(multistep.StateBag) (*ssh.ClientConfig, err
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.PublicKeys(signer),
|
ssh.PublicKeys(signer),
|
||||||
},
|
},
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) {
|
||||||
ssh.KeyboardInteractive(
|
ssh.KeyboardInteractive(
|
||||||
packerssh.PasswordKeyboardInteractive(config.Comm.SSHPassword)),
|
packerssh.PasswordKeyboardInteractive(config.Comm.SSHPassword)),
|
||||||
},
|
},
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.Comm.SSHPrivateKey != "" {
|
if config.Comm.SSHPrivateKey != "" {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package digitalocean
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
|
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
|
@ -26,5 +27,6 @@ func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) {
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.PublicKeys(signer),
|
ssh.PublicKeys(signer),
|
||||||
},
|
},
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,5 +27,6 @@ func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) {
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.PublicKeys(signer),
|
ssh.PublicKeys(signer),
|
||||||
},
|
},
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ func SSHConfig(useAgent bool, username, password string) func(multistep.StateBag
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers),
|
ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers),
|
||||||
},
|
},
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,12 +102,14 @@ func SSHConfig(useAgent bool, username, password string) func(multistep.StateBag
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.PublicKeys(signer),
|
ssh.PublicKeys(signer),
|
||||||
},
|
},
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}, nil
|
}, nil
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return &ssh.ClientConfig{
|
return &ssh.ClientConfig{
|
||||||
User: username,
|
User: username,
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.Password(password),
|
ssh.Password(password),
|
||||||
ssh.KeyboardInteractive(
|
ssh.KeyboardInteractive(
|
||||||
|
|
|
@ -44,8 +44,9 @@ func SSHConfigFunc(config SSHConfig) func(multistep.StateBag) (*ssh.ClientConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
return &ssh.ClientConfig{
|
return &ssh.ClientConfig{
|
||||||
User: config.Comm.SSHUsername,
|
User: config.Comm.SSHUsername,
|
||||||
Auth: auth,
|
Auth: auth,
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,15 @@ package triton
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"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"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"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) {
|
func commHost(state multistep.StateBag) (string, error) {
|
||||||
|
@ -49,6 +50,7 @@ func sshConfig(useAgent bool, username, privateKeyPath, password string) func(mu
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers),
|
ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers),
|
||||||
},
|
},
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,12 +74,14 @@ func sshConfig(useAgent bool, username, privateKeyPath, password string) func(mu
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.PublicKeys(signer),
|
ssh.PublicKeys(signer),
|
||||||
},
|
},
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
}, nil
|
}, nil
|
||||||
} else {
|
} else {
|
||||||
log.Println("Configuring SSH keyboard interactive.")
|
log.Println("Configuring SSH keyboard interactive.")
|
||||||
|
|
||||||
return &ssh.ClientConfig{
|
return &ssh.ClientConfig{
|
||||||
User: username,
|
User: username,
|
||||||
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
ssh.Password(password),
|
ssh.Password(password),
|
||||||
ssh.KeyboardInteractive(
|
ssh.KeyboardInteractive(
|
||||||
|
|
Loading…
Reference in New Issue