Is there a recommended method for regenerating the keys without having
to touch the console on every virtual machine?

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to openssh in Ubuntu.
https://bugs.launchpad.net/bugs/1778386

Title:
  If SSH host keys are missing, they should automatically regenerate at
  boot time

Status in openssh package in Ubuntu:
  Won't Fix

Bug description:
  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1778386/+subscriptions

-- 
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