You have been subscribed to a public bug:

When SSH host keys are missing, they should be automatically regenerated
at boot time so SSH functions.  This is particularly useful if cloning
VM's or using a VM template.

I have modified the following using CentOS 7's .service file.

/lib/systemd/system/ssh-keygen.service :

[Unit]
Description=OpenSSH Server Key Generation
ConditionFileNotEmpty=|!/etc/ssh/ssh_host_rsa_key
ConditionFileNotEmpty=|!/etc/ssh/ssh_host_ecdsa_key
ConditionFileNotEmpty=|!/etc/ssh/ssh_host_ed25519_key
PartOf=ssh.service sshd.socket

[Service]
ExecStart=/usr/sbin/dpkg-reconfigure openssh-server
Type=oneshot
RemainAfterExit=yes

And added the following to ssh.service.

/lib/systemd/system/ssh.service :
[Unit]
...
After=network.target ssh-keygen.service
...
Wants=ssh-keygen.service
...

I have tested this and it is working.

** Affects: openssh (Ubuntu)
     Importance: Undecided
         Status: Won't Fix


** Tags: ssh
-- 
If SSH host keys are missing, they should automatically regenerate at boot time
https://bugs.launchpad.net/bugs/1778386
You received this bug notification because you are a member of Ubuntu Touch 
seeded packages, which is subscribed to openssh in Ubuntu.

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to