bug(cli): Correctly generate private key file (#2274)

pull/2278/head
Louis Ruch 4 years ago committed by GitHub
parent d37f80879a
commit d6c1402223
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -111,6 +111,12 @@ func (s *sshFlags) buildArgs(c *Command, port, ip, addr string, creds credential
}
return nil
})
// SSH requires the private key file to end with a newline.
// When injesting a ssh_private_key from a file:// Boundary calls strings.TrimSpace
// which will also trim newlines.
if !strings.HasSuffix(privateKey, "\n") {
privateKey = fmt.Sprintln(privateKey)
}
_, err = pkFile.WriteString(privateKey)
if err != nil {
return nil, nil, credentials{}, fmt.Errorf("Error writing private key file to %s: %w", pkFile.Name(), err)

Loading…
Cancel
Save