-
Notifications
You must be signed in to change notification settings - Fork 661
SSH host keys are regenerated each time a VM does a stop/start #678
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
Comments
CC @jandubois (author of #273) |
Yes, this is unintended. Do you have any suggestion how to deal with this? My naïve idea would be to create a |
As long as that file is dropped after cloud-init has run for the first time, that shouldn't cause any issues with cloud images that may already have SSH host keys in them (we want them to be deleted and regenerated), and it should address this problem. |
This will automatically be true because we can't run anything until cloud-init has dropped our authorized keys. Note that you can do this right now yourself in provision:
- mode: system
script: |
#!/bin/sh
mkdir -p /etc/cloud/cloud.cfg.d
echo "ssh_deletekeys: false" > /etc/cloud/cloud.cfg.d/lima Well, maybe use a different name than Put this into |
I more meant sticking it in the cloud-init config provided at boot vs. dropping a file "manually" after first boot. |
All files to be read by cloud-init in folder /etc/cloud/cloud.cfg.d/ must have .cfg extension so if you want to use the workaround by @jandubois add .cfg to the filename in override .yaml file example: provision:
- mode: system
script: |
#!/bin/sh
mkdir -p /etc/cloud/cloud.cfg.d
echo "ssh_deletekeys: false" > /etc/cloud/cloud.cfg.d/lima-local.cfg |
Description
This is a (hopefully) unintended side effect of #273. Because the
instance-id
changes,cloud-init
treats it like it's the first boot and does all the first boot things, like deleting the existing SSH host keys and regenerating new ones. I was able to work around this in an existing VM by creating a file in/etc/cloud/cloud.cfg.d
withssh_deletekeys: false
, but this is not an ideal solution.The text was updated successfully, but these errors were encountered: