When are host keys for the server generated

Garnet

I am writing a hardening script to be run by kickstart during the post-installation phase. One of the requirements is to change the permissions on /etc/ssh/ssh_host*key files. My problem is that those keys are not generated when the script is run. I have two questions:

  1. When are those keys generated during the installation process?

  2. Will I break anything if I generate them with my script?

Romeo Ninov

AFAIK the keys are generated during first start of the server (after install).

About generate new one: yes, there is no problem as far as they are described (with filenames) in /etc/ssh/sshd_config. And you restart sshd after generation. But if you have already some host/user which get the server public key (before new generation) this may lead to errors in ssh sessions.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Are ssh keys generated individually by Ubuntu Server LTS 14.04 setup?

MySQL Error when using Statement.RETURN_GENERATED_KEYS

How to obtain the generated keys when using the NamedParameterJDBCTemplate in a batchUpdate

keyword error generated when Passing a dictionary to a function with tuples as the keys

Only apply virtual host when the server name is used as host

Existing host keys found error when ssh in gcp vm instance

Sage notebook server error when not logged in to host

Sage notebook server error when not logged in to host

How to deny all when the host is a development server

Using SSH to connect to a new server without storing the host keys in the $HOME/.ssh/known_host file

Error `could not load host key` when trying to recreate SSH host keys

Is there any way to automatically accept SSH host keys—even when keys are changed—in PuTTY?

Why does SSH hosts keys differ when connecting if the host_keys are the same?

pysftp.CnOpts() 'No Host Keys Found' error despite known_hosts file generated using ssh-keyscan

How to correctly send HTTPS request to Server using auto-generated SSL keys?

Hashing passwords even when password is server-generated?

getting the active alarms for specific host generated in zabbix when there is fault using zabbix api

Vuetify errors when loading a Vue-generated web component into a host/parent that is also a Vue app

Generated files on host from docker

Define custom DNS server when looking up host

Symfony - Unknown MySQL server host when using command line

Invalid Host Header when ngrok tries to connect to React dev server

Error When Loading Images on Local Host Test Server

ConnectionRefusedError when trying to host python socket server on raspberry pi

error when connecting to remote MySQL (host gator) server using JDBC

"Unknown MySQL server host" when using Flask in Python

How do I set OWIN keys like host.AppMode when running under IIS (Host.SystemWeb)?

How are software license keys generated?

Two Foreign Keys generated with EF