-
Notifications
You must be signed in to change notification settings - Fork 860
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
/etc/ssh/ssh_host_rsa_key fails to be generated when the sshd service Is restarted after the cloud-Init boot Is completed #4070
Comments
Launchpad user shixuantong(sxt1001) wrote on 2023-02-03T09:54:46.106831+00:00 |
Launchpad user shixuantong(sxt1001) wrote on 2023-02-04T06:26:54.178975+00:00 |
Launchpad user shixuantong(sxt1001) wrote on 2023-02-04T07:28:44.351737+00:00 Can I delete this file (/run/systemd/generator.early/multi-user.target.wants/cloud-init.target) after the cloud-init boot is finished? |
Launchpad user shixuantong(sxt1001) wrote on 2023-02-04T08:32:04.138868+00:00 /etc/ssh/ssh_host_rsa_key fails to be generated: [root@localhost ~]# cloud-init status Feb 04 15:20:21 localhost cloud-init[1909]: ci-info: ... ... |
Launchpad user shixuantong(sxt1001) wrote on 2023-02-06T01:10:14.730828+00:00 No matter whether cloud-init is inactive or active, /etc/ssh/ssh_host_rsa_key generation is affected. |
Launchpad user Emanuele Esposito(esposem) wrote on 2023-02-06T12:15:32.637361+00:00 If you use cloud-init, then a drop-in disable-sshd-keygen-if-cloud-init-active.conf will be placed to prevent ssh creating keys and race with cloud-init. |
Launchpad user shixuantong(sxt1001) wrote on 2023-02-07T02:05:00.785010+00:00 but when cloud-init has finished running, sshd is always stopped because of disable-sshd-keygen-if-cloud-init-active.conf. Is that not a problem? |
Launchpad user Alberto Contreras(aciba) wrote on 2023-02-07T12:04:52.735634+00:00 Hello, shixuantong. cloud-init will create the ssh keys using the cc_ssh module on first boot, and sshd-keygen won't run. Could you please elaborate on where you think the problem is, and/or what your expectations are? |
Launchpad user shixuantong(sxt1001) wrote on 2023-02-07T12:38:21.819040+00:00 Hello, Alberto Contreras, thank you very much for your reply. I have such a use scenario here. After the cloud-init boot is complete, ssh_host_rsa_key is lost due to certain reasons (for example, manual deletion). I need to restart the sshd service to generate ssh_host_rsa_key. This scenario cannot be executed successfully because of disable-sshd-keygen-if-cloud-init-active.conf. |
Launchpad user Huijuan Zhao(huijuanzhao) wrote on 2023-02-07T15:02:20.710560+00:00 Hello shixuantong, Could you please help to check if the below workaround works for you? Generate ssh host keys manually via the below commands: Then restart sshd service Thanks! |
Launchpad user Alberto Contreras(aciba) wrote on 2023-02-08T09:58:45.758250+00:00 Then you could either
(2) is probably safe, after the first boot has run, as |
This bug was originally filed in Launchpad as LP: #2004632
Launchpad details
Launchpad user shixuantong(sxt1001) wrote on 2023-02-03T09:51:24.568811+00:00
It should be related to the following commit:
b3e31ba
The text was updated successfully, but these errors were encountered: