Commit 65804c07 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/null: pass SSH tests

parent fa339fc2
package null package null
import ( import (
gossh "code.google.com/p/gosshold/ssh" gossh "code.google.com/p/go.crypto/ssh"
"fmt" "fmt"
"github.com/mitchellh/multistep" "github.com/mitchellh/multistep"
"github.com/mitchellh/packer/communicator/ssh" "github.com/mitchellh/packer/communicator/ssh"
...@@ -31,15 +31,15 @@ func SSHConfig(username string, password string, privateKeyFile string) func(mul ...@@ -31,15 +31,15 @@ func SSHConfig(username string, password string, privateKeyFile string) func(mul
} }
privateKey := string(bytes) privateKey := string(bytes)
keyring := new(ssh.SimpleKeychain) signer, err := gossh.ParsePrivateKey([]byte(privateKey))
if err := keyring.AddPEMKey(privateKey); err != nil { if err != nil {
return nil, fmt.Errorf("Error setting up SSH config: %s", err) return nil, fmt.Errorf("Error setting up SSH config: %s", err)
} }
return &gossh.ClientConfig{ return &gossh.ClientConfig{
User: username, User: username,
Auth: []gossh.ClientAuth{ Auth: []gossh.AuthMethod{
gossh.ClientAuthKeyring(keyring), gossh.PublicKeys(signer),
}, },
}, nil }, nil
} else { } else {
...@@ -47,9 +47,10 @@ func SSHConfig(username string, password string, privateKeyFile string) func(mul ...@@ -47,9 +47,10 @@ func SSHConfig(username string, password string, privateKeyFile string) func(mul
return &gossh.ClientConfig{ return &gossh.ClientConfig{
User: username, User: username,
Auth: []gossh.ClientAuth{ Auth: []gossh.AuthMethod{
gossh.ClientAuthPassword(ssh.Password(password)), gossh.Password(password),
gossh.ClientAuthKeyboardInteractive(ssh.PasswordKeyboardInteractive(password)), gossh.KeyboardInteractive(
ssh.PasswordKeyboardInteractive(password)),
}, },
}, nil }, nil
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment