From f2c11b55be5cb365bdc0863421d3cca442e2871c Mon Sep 17 00:00:00 2001 From: Stephen Fox Date: Mon, 4 Feb 2019 14:27:14 -0500 Subject: [PATCH] Renamed authorized_keys public key function. --- builder/virtualbox/common/step_ssh_key_pair.go | 2 +- helper/ssh/key_pair.go | 6 +++--- helper/ssh/key_pair_test.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/builder/virtualbox/common/step_ssh_key_pair.go b/builder/virtualbox/common/step_ssh_key_pair.go index 8bdd18842..2e157940f 100644 --- a/builder/virtualbox/common/step_ssh_key_pair.go +++ b/builder/virtualbox/common/step_ssh_key_pair.go @@ -59,7 +59,7 @@ func (s *StepSshKeyPair) Run(_ context.Context, state multistep.StateBag) multis s.Comm.SSHKeyPairName = kp.Name() s.Comm.SSHTemporaryKeyPairName = kp.Name() s.Comm.SSHPrivateKey = kp.PrivateKeyPemBlock() - s.Comm.SSHPublicKey = kp.PublicKeyAuthorizedKeysFormat(ssh.UnixNewLine) + s.Comm.SSHPublicKey = kp.PublicKeyAuthorizedKeysLine(ssh.UnixNewLine) s.Comm.SSHClearAuthorizedKeys = true ui.Say(fmt.Sprintf("Created ephemeral SSH key pair of type %s", kp.Description())) diff --git a/helper/ssh/key_pair.go b/helper/ssh/key_pair.go index 830d374cd..cd7a2f4a8 100644 --- a/helper/ssh/key_pair.go +++ b/helper/ssh/key_pair.go @@ -210,10 +210,10 @@ type KeyPair interface { // format in a Privacy-Enhanced Mail (PEM) block. PrivateKeyPemBlock() []byte - // PublicKeyAuthorizedKeysFormat returns a slice of bytes + // PublicKeyAuthorizedKeysLine returns a slice of bytes // representing the public key in OpenSSH authorized_keys format // with the specified new line. - PublicKeyAuthorizedKeysFormat(NewLineOption) []byte + PublicKeyAuthorizedKeysLine(NewLineOption) []byte } type defaultKeyPair struct { @@ -267,7 +267,7 @@ func (o defaultKeyPair) PrivateKeyPemBlock() []byte { }) } -func (o defaultKeyPair) PublicKeyAuthorizedKeysFormat(nl NewLineOption) []byte { +func (o defaultKeyPair) PublicKeyAuthorizedKeysLine(nl NewLineOption) []byte { result := gossh.MarshalAuthorizedKey(o.publicKey) if len(strings.TrimSpace(o.name)) > 0 { diff --git a/helper/ssh/key_pair_test.go b/helper/ssh/key_pair_test.go index 808e98e02..406c3b6bd 100644 --- a/helper/ssh/key_pair_test.go +++ b/helper/ssh/key_pair_test.go @@ -79,7 +79,7 @@ func (o expected) verifyPublicKeyAuthorizedKeysFormat(kp KeyPair) error { } for _, nl := range newLines { - publicKeyAk := kp.PublicKeyAuthorizedKeysFormat(nl) + publicKeyAk := kp.PublicKeyAuthorizedKeysLine(nl) if len(publicKeyAk) < 2 { return errors.New("expected public key in authorized keys format to be at least 2 bytes")