Skip to content

feat: Add SSHKeyGen Step from SDK#96

Merged
nywilken merged 3 commits intovmware:mainfrom
LIV2:boot_arg_sshpublickey
Sep 12, 2023
Merged

feat: Add SSHKeyGen Step from SDK#96
nywilken merged 3 commits intovmware:mainfrom
LIV2:boot_arg_sshpublickey

Conversation

@LIV2
Copy link
Copy Markdown
Contributor

@LIV2 LIV2 commented Sep 20, 2022

This change adds the SSHKeyGen step from the SDK.

This step will generate a temporary ssh keypair when there is no ssh password and no ssh key configured.

The code already includes the "StepCleanupTempKeys" step which I believe does nothing without the SSHKeyGen step anyway.

Also included is the ability to use the SSHPublicKey variable inside the boot command, I copied this from the VirtualBox builder.

Closes #102

This makes use of the SSH communicators temporary key generation

The builders already referenced "StepCleanupTempKeys" but since none were created it did nothing
@LIV2 LIV2 requested a review from a team as a code owner September 20, 2022 14:04
@tenthirtyam tenthirtyam changed the title Add SSHKeyGen Step from SDK feat: Add SSHKeyGen Step from SDK Sep 28, 2022
@tenthirtyam tenthirtyam added the enhancement Enhancement label Sep 28, 2022
@tenthirtyam
Copy link
Copy Markdown
Collaborator

Hi @LIV2 👋 -

Could you please submit an enhancement request so that this pull request can be tracked back to the use case?

From the README:

"...In case of feature contribution, we kindly ask you to open an issue to discuss it beforehand."

Thanks!

Ryan Johnson
Senior Staff Solutions Architect | Product Engineering @ VMware, Inc.

@tenthirtyam tenthirtyam added the stage/awaiting-reply Stage: Awaiting Reply label Oct 7, 2022
@tenthirtyam tenthirtyam removed the stage/awaiting-reply Stage: Awaiting Reply label Oct 20, 2022
@tenthirtyam tenthirtyam self-requested a review November 22, 2022 04:53
@tenthirtyam tenthirtyam added this to the v1.0.8 milestone Dec 4, 2022
@tenthirtyam tenthirtyam removed this from the v1.0.8 milestone Aug 22, 2023
Copy link
Copy Markdown
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening up this change @LIV2. Our focus has been on updating Packer core mainly around HCL2, the go-cty bug, and plugin integration docs so I wasn't able to get to this PR. I think this is a nice change that folks can benefit from. The example documentation is a nice touch. Before merging I will make a small change to only generate the SSHKey if using the "ssh" communicator, as opposed to always generating an SSK key.

&vmwcommon.StepSuppressMessages{},
&vmwcommon.StepHTTPIPDiscover{},
commonsteps.HTTPServerFromHTTPConfig(&b.config.HTTPConfig),
&communicator.StepSSHKeyGen{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only call StepSSHKeyGen if the configured communicator is "ssh" otherwise a SSH key will get generated when using winrm or no communicator at all. Which might be confusing.

Suggested change
&communicator.StepSSHKeyGen{
multistep.If(b.config.Comm.Type == "ssh", &communicator.StepSSHKeyGen{

@nywilken nywilken merged commit 5cf0d88 into vmware:main Sep 12, 2023
@vmware vmware locked and limited conversation to collaborators Jun 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement Enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for SSHKeyGen step from SDK

3 participants