Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SSHKeygen step from SDK #165

Merged
merged 2 commits into from
Mar 19, 2024
Merged

Add SSHKeygen step from SDK #165

merged 2 commits into from
Mar 19, 2024

Conversation

LIV2
Copy link
Contributor

@LIV2 LIV2 commented Mar 6, 2024

This change adds the SSHKeyGen step from the SDK.

When the communicator configured is SSH, this step will generate a temporary ssh keypair when there is no ssh password and no ssh key configured.

Also included is the ability to use the SSHPublicKey variable inside the boot command.

This feature is present in the Virtualbox and VMware builders and I thought it would be good to have it here too.

@LIV2 LIV2 requested a review from a team as a code owner March 6, 2024 00:01
Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

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

Hi @LIV2,

Sorry for the delay before review, the code looks straightforward enough, and I really like your example, this is really nice.

Thanks for that feature, I left a small question on the example itself, but overall this looks good to me, we can merge this ASAP.

There's just the documentation to generate, may I ask you to run make generate on the project, and commit the resulting files?
Let me know if this is problematic, I can give you a hand on that.


```json
"boot_command": [
"<up><wait><tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg PACKER_USER={{ user `username` }} PACKER_AUTHORIZED_KEY={{ .SSHPublicKey | urlquery }}<enter>"
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, why the urlquery for the public key? If this is raw base64 encoded data, there shouldn't be anything problematic here, is there?
Or maybe spaces, is that the reason why?
If so, maybe escaping the payload would be enough?

Don't get me wrong it's an example so it's fine if it's not perfect/robust in every case, the current implementation should work also.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably the spaces, this was just copied from the virtualbox-iso documentation

I will run make generate and commit the files

@lbajolet-hashicorp lbajolet-hashicorp merged commit 0552de5 into hashicorp:main Mar 19, 2024
12 checks passed
@lbajolet-hashicorp
Copy link
Contributor

Many thanks for the quick reroll @LIV2, much appreciated!
I'll make a note to release the plugin tomorrow with this in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants