Should I Replace SSH Keys When Upgrading My Server’s OS?

0
4
Asked By TechieNinja42 On

I'm currently upgrading several older servers from Rocky 8.x to Rocky 10.x. This means setting up new VMs, configuring them, and adopting the previous server's IP addresses. There aren't any major changes to services or configurations, just the OS upgrade. My question is whether I should replace the existing SSH host keys or keep them. I've always generated new keys in the past, as a best practice, but this leads to broken trust relationships for any automation tools that connect. I usually copy the `.ssh` directory and the `authorized_keys` over, yet when the host key changes, it requires updating every remote connection. I don't believe the host keys are compromised, so I'm considering keeping the old keys for convenience. How do others handle these in-place upgrades?

5 Answers

Answered By KernelWizard21 On

When moving to a new OS, I don't typically bring over the known hosts; I just take the authorized keys. The first time you connect, it prompts for confirmation of the new key, and you can accept it then. Some folks might find this process challenging, but it provides a clean slate. However, don't use the option to ignore the host key; it's risky.

Answered By NetworkNerd42 On

It might be worth considering certificate authentication instead. If your server can use a certificate, it could take the place of the host key, and that might simplify some of your trust issues.

Answered By SecureGadget99 On

Generally, you wouldn't need to regenerate your SSH keys during an in-place upgrade unless there's a known security compromise or you're moving to a new encryption standard. Since you're keeping the same server functionality, it makes sense to keep the existing keys to avoid those trust issues with automation tools. If you're using something like Ansible, it can help manage host key changes, but that's often more hassle than it's worth if you're not dealing with a compromised system.

Answered By CloudSavvy76 On

If you're not planning to replace the entire system, I see no reason to change your host keys. The server is still the same entity in terms of user connection, and changing keys could confuse users unnecessarily. As long as the old system wasn't compromised, keeping the old keys is the way to go.

Answered By DevOps_Guru88 On

I prefer to rotate host keys during a rebuild for a clear trust boundary. Sure, it breaks things temporarily, but if you manage it well via config management, it's manageable. New keys are more secure, and over time, this approach keeps your system cleaner.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.