mirror of
https://github.com/nwtgck/handy-sshd.git
synced 2025-06-08 07:03:04 +00:00
test: use HostKeyCallback: ssh.InsecureIgnoreHostKey()
This commit is contained in:
parent
2295abacdd
commit
f36e6f8702
1 changed files with 20 additions and 34 deletions
|
@ -47,9 +47,7 @@ func TestAllPermissionsAllowed(t *testing.T) {
|
||||||
sshClientConfig := &ssh.ClientConfig{
|
sshClientConfig := &ssh.ClientConfig{
|
||||||
User: "john",
|
User: "john",
|
||||||
Auth: []ssh.AuthMethod{ssh.Password("mypassword")},
|
Auth: []ssh.AuthMethod{ssh.Password("mypassword")},
|
||||||
HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error {
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
return nil
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
||||||
|
|
||||||
|
@ -78,9 +76,7 @@ func TestEmptyPassword(t *testing.T) {
|
||||||
waitTCPServer(port)
|
waitTCPServer(port)
|
||||||
sshClientConfig := &ssh.ClientConfig{
|
sshClientConfig := &ssh.ClientConfig{
|
||||||
User: "john",
|
User: "john",
|
||||||
HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error {
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
return nil
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
||||||
|
|
||||||
|
@ -135,9 +131,7 @@ func TestWrongPassword(t *testing.T) {
|
||||||
sshClientConfig := &ssh.ClientConfig{
|
sshClientConfig := &ssh.ClientConfig{
|
||||||
User: "john",
|
User: "john",
|
||||||
Auth: []ssh.AuthMethod{ssh.Password("mywrongpassword")},
|
Auth: []ssh.AuthMethod{ssh.Password("mywrongpassword")},
|
||||||
HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error {
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
return nil
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
||||||
_, err := ssh.Dial("tcp", address, sshClientConfig)
|
_, err := ssh.Dial("tcp", address, sshClientConfig)
|
||||||
|
@ -160,9 +154,7 @@ func TestAllowExecute(t *testing.T) {
|
||||||
sshClientConfig := &ssh.ClientConfig{
|
sshClientConfig := &ssh.ClientConfig{
|
||||||
User: "john",
|
User: "john",
|
||||||
Auth: []ssh.AuthMethod{ssh.Password("mypassword")},
|
Auth: []ssh.AuthMethod{ssh.Password("mypassword")},
|
||||||
HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error {
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
return nil
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
||||||
client, err := ssh.Dial("tcp", address, sshClientConfig)
|
client, err := ssh.Dial("tcp", address, sshClientConfig)
|
||||||
|
@ -191,9 +183,7 @@ func TestAllowTcpipForward(t *testing.T) {
|
||||||
sshClientConfig := &ssh.ClientConfig{
|
sshClientConfig := &ssh.ClientConfig{
|
||||||
User: "john",
|
User: "john",
|
||||||
Auth: []ssh.AuthMethod{ssh.Password("mypassword")},
|
Auth: []ssh.AuthMethod{ssh.Password("mypassword")},
|
||||||
HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error {
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
return nil
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
||||||
client, err := ssh.Dial("tcp", address, sshClientConfig)
|
client, err := ssh.Dial("tcp", address, sshClientConfig)
|
||||||
|
@ -222,9 +212,7 @@ func TestAllowDirectTcpip(t *testing.T) {
|
||||||
sshClientConfig := &ssh.ClientConfig{
|
sshClientConfig := &ssh.ClientConfig{
|
||||||
User: "john",
|
User: "john",
|
||||||
Auth: []ssh.AuthMethod{ssh.Password("mypassword")},
|
Auth: []ssh.AuthMethod{ssh.Password("mypassword")},
|
||||||
HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error {
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
return nil
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
||||||
client, err := ssh.Dial("tcp", address, sshClientConfig)
|
client, err := ssh.Dial("tcp", address, sshClientConfig)
|
||||||
|
@ -253,9 +241,7 @@ func TestAllowSftp(t *testing.T) {
|
||||||
sshClientConfig := &ssh.ClientConfig{
|
sshClientConfig := &ssh.ClientConfig{
|
||||||
User: "john",
|
User: "john",
|
||||||
Auth: []ssh.AuthMethod{ssh.Password("mypassword")},
|
Auth: []ssh.AuthMethod{ssh.Password("mypassword")},
|
||||||
HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error {
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
return nil
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
|
||||||
client, err := ssh.Dial("tcp", address, sshClientConfig)
|
client, err := ssh.Dial("tcp", address, sshClientConfig)
|
||||||
|
|
Loading…
Add table
Reference in a new issue