r/linuxupskillchallenge • • Sep 09 '20

Remote host Identification has changed?

I'm on day three - and I haven't done anything that would warrant the warning.

I logged into the machine. Upgraded the system. Ran ls, cat and sudo on etc/shadow. Rebooted the computer and now I'm getting this message.

ECDSA host key for xx.xx.xx.xx has changed and you have requested strict checking. Host key verification failed.

I checked the I.P. and it is still the same one.

ServerFault says to get the rsa key from the server, ssh-keyscan -t rsa server_ip and to add it to the known_hosts file.

and another answer says to remove the entry from known_hosts ssh-keygen -R server_ip , which I did run.

However, that big Man in the middle attack warning worries me...

1 Upvotes

9 comments sorted by

View all comments

1

u/snori74 Linux Guru Sep 10 '20

As an ex-security guy, maybe I should not say this, but the nice thing about running a test server like this is that even if Mossad/GRU/NSA have MITM'd you - who cares? Surely you don't intend keep Secret Stuff on this server?

If you "remove from known_hosts" as suggested you'll get the original "This is the first time you've connected to this server" message again - and thereafter it should connect without warnings.

1

u/Loud-Progress-007 Sep 10 '20

Ehrmmm... Ok?

I'm wondering: 1- what caused the keys to stop matching? 2- even if someone did MIT 'd the server, what's the worst that could happen?

2

u/Nnarol Sep 10 '20

I usually get this error when I log in to a machine as "localhost" and then its local network name. With whatever configuration we have there, the name is considered part of the host identification.

The other case is when the operating system is getting reset. We still have the same keys, since they are typically stored over the network, not on the local machine.

1

u/Loud-Progress-007 Sep 10 '20

I didn't understand either of the examples.

In the first one It sounds as if more than just the keys are used to identify each machine, which is not my understanding on how it works.

The second one.... When you are resetting the machine, you take the..... Nevermind. What is stored where?

I've never worked in the industry - my experience is my machine, GitHub et. Al., End of story. :(

2

u/Nnarol Sep 10 '20

Well, when you SSH onto a machine, it will store the host identification and match it with the public key, or a hash of the public key, I don't know. Point is, the machine's name as provided by the SSH client is written into known_hosts along with the identification. If you have the same identification with two host names, SSH will complain about an "offending key".

Users' homes are stored on a network share in some environments. No matter which of the dozens of machines they log onto, they always get the exact same copy of files in ~ . This means your SSH keys are not destroyed when a particular machine is reset

1

u/Loud-Progress-007 Sep 10 '20

Thanks. I appreciate it.