This tool generates SSH host keys and outputs them in a format suitable for adding to a cloud-init config file.
You can use the companion tool ssh-import-known-hosts-cloud-init to then add the generated public keys to your ~/.ssh/known_hosts
file. This facilitates connecting to a cloud-init-configured instance securely with SSH without having to manually verify the host's keys.
Simply call the program and the keys are output in cloud-init compatible format that can be appended to a config file:
generate-cloud-init-ssh-host-keys >>my-cloud-init.yaml
SSH host keys are generated for the ecdsa
, ed25519
, and rsa
key types.