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

Fix/ami authorized keys #517

Merged
merged 3 commits into from
Mar 18, 2024
Merged

Fix/ami authorized keys #517

merged 3 commits into from
Mar 18, 2024

Conversation

shub-kris
Copy link
Contributor

What does this PR do?

This PR adds ssh_clear_authorized_keys = true in sources.pkr.hcl to clean up the authorized keys so that AMI can be submitted to AWS Marketplace without any error.

Read more about error here.

According to the packer official documentation:

ssh_clear_authorized_keys (bool) - If true, Packer will attempt to remove its temporary key from ~/.ssh/authorized_keys and /root/.ssh/authorized_keys. This is a mostly cosmetic option, since Packer will delete the temporary private key from the host system regardless of whether this is set to true (unless the user has set the -debug flag). Defaults to "false"; currently only works on guests with sed installed.

I tested it by creating a live instance on top of the AMI here built using CI. After launching the AMI, it only contained the key chosen in the AWS "launch instance" wizard, and not the packer temporary keypair.

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

@shub-kris shub-kris merged commit 709b625 into main Mar 18, 2024
1 check passed
@shub-kris shub-kris deleted the fix/ami-authorized-keys branch March 18, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants