Allow user to get public key straight up, or URL encoded.
This commit is contained in:
parent
4b649f7ce4
commit
f9d24ccda0
|
@ -66,6 +66,8 @@ func (s *StepSshKeyPair) Run(_ context.Context, state multistep.StateBag) multis
|
||||||
|
|
||||||
// If we're in debug mode, output the private key to the working
|
// If we're in debug mode, output the private key to the working
|
||||||
// directory.
|
// directory.
|
||||||
|
// TODO: It would be better if the file was 'chmod' before writing
|
||||||
|
// the key to the disk - or if umask was set before creating the file.
|
||||||
if s.Debug {
|
if s.Debug {
|
||||||
ui.Message(fmt.Sprintf("Saving communicator private key for debug purposes: %s", s.DebugKeyPath))
|
ui.Message(fmt.Sprintf("Saving communicator private key for debug purposes: %s", s.DebugKeyPath))
|
||||||
f, err := os.Create(s.DebugKeyPath)
|
f, err := os.Create(s.DebugKeyPath)
|
||||||
|
|
|
@ -27,8 +27,13 @@ type bootCommandTemplateData struct {
|
||||||
// Name is the VM's name.
|
// Name is the VM's name.
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
// SSHPublicKey is the URL encoded public key in
|
// EncodedSSHPublicKey is the URL encoded SSH public key in
|
||||||
// authorized_keys format.
|
// OpenSSH authorized_keys format. This is safe for usage
|
||||||
|
// on the the kernel command line, or other places that split
|
||||||
|
// on whitespace.
|
||||||
|
EncodedSSHPublicKey string
|
||||||
|
|
||||||
|
// SSHPublicKey is the SSH public key in OpenSSH authorized_keys format.
|
||||||
SSHPublicKey string
|
SSHPublicKey string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +75,8 @@ func (s *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag)
|
||||||
HTTPIP: hostIP,
|
HTTPIP: hostIP,
|
||||||
HTTPPort: httpPort,
|
HTTPPort: httpPort,
|
||||||
Name: s.VMName,
|
Name: s.VMName,
|
||||||
SSHPublicKey: s.Comm.SSHPublicKeyUrlEncoded(),
|
EncodedSSHPublicKey: s.Comm.SSHPublicKeyUrlEncoded(),
|
||||||
|
SSHPublicKey: string(s.Comm.SSHPublicKey),
|
||||||
}
|
}
|
||||||
|
|
||||||
sendCodes := func(codes []string) error {
|
sendCodes := func(codes []string) error {
|
||||||
|
|
Loading…
Reference in New Issue