Page MenuHomePhabricator

SSH host key verification failures in Ganeti intra node SSH calls after Bullseye update
Open, MediumPublic

Description

sudo gnt-cluster verify fails in the ulsfo and eqsin cluster afters the update to Bullseye in the "Verifying node status" step where it's connecting in between nodes via SSH in a loop. Apart from that all cluster operations are working fine.

I obtained the exact command from the node-daemon.log:

jmm@ganeti5003:~$ sudo ssh -oEscapeChar=none -oHashKnownHosts=no -oGlobalKnownHostsFile=/var/lib/ganeti/known_hosts -oUserKnownHostsFile=/dev/null -oCheckHostIp=no -oConnectTimeout=10 -o\HostKeyAlias=ganeti01.svc.eqsin.wmnet -oPort=22 -oBatchMode=yes -oStrictHostKeyChecking=yes -4 root@ganeti5002.eqsin.wmnet
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:SvgqUu5xa8VQDLoLxIyOmrLn8MeUT9pxnen80BQKSfY.
Please contact your system administrator.
Add correct host key in /dev/null to get rid of this message.
Offending RSA key in /var/lib/ganeti/known_hosts:1
  remove with:
  ssh-keygen -f "/var/lib/ganeti/known_hosts" -R "ganeti01.svc.eqsin.wmnet"
ECDSA host key for ganeti01.svc.eqsin.wmnet has changed and you have requested strict checking.
Host key verification failed.

Surprisingly this doesn't happen on ganeti/drmrs (which was installed with Bullseye), ganeti/esams (which was upgraded from Buster to Bullseye), ganeti/test (which was upgraded from Buster to Bullseye). The same command on ganeti-test works fine:

jmm@ganeti-test2002:~$ sudo ssh -oEscapeChar=none -oHashKnownHosts=no -oGlobalKnownHostsFile=/var/lib/ganeti/known_hosts -oUserKnownHostsFile=/dev/null -oCheckHostIp=no -oConnectTimeout=10 -oHostKeyAlias=ganeti-test01.svc.codfw.wmnet -oPort=22 -oBatchMode=yes -oStrictHostKeyChecking=yes -4 root@ganeti-test2001.codfw.wmnet

When digging around I also found https://github.com/ganeti/ganeti/issues/1608 which seems to be the exact issue.

This will be fixed by managing /var/lib/ganeti/known_hosts with the fingerprints generated from Puppet, the following clusters are migrated:

  • eqiad
  • codfw
  • codfw-test
  • esams01
  • esams02
  • ulsfo
  • eqsin
  • drmrs01
  • drmrs02
  • magru01
  • magru02

Event Timeline

Should we have /var/lib/ganeti/known_hosts be managed by Puppet?

Should we have /var/lib/ganeti/known_hosts be managed by Puppet?

Yeah, I think that's the best fix for us. The impact still isn't fully understood as part as the upstream code base is concerned, I think it's caused by newer OpenSSH releases being more stringent in validating

Mentioned in SAL (#wikimedia-operations) [2024-02-26T20:44:55Z] <mutante> T358237 used the next hostname number,1004, to avoid the duplicate IP issue. makevm cookbook is at attempt 103/240 to detect a reboot of the VM and uptime just keeps going up. used the "gnt-instance console --show-cmd " trick to get a console despite https://phabricator.wikimedia.org/T309724 - was missing partman config

Change #1021896 had a related patch set uploaded (by Muehlenhoff; author: Muehlenhoff):

[operations/puppet@production] Install a Puppet generator to create a known hosts file for Ganeti

https://gerrit.wikimedia.org/r/1021896

Change #1023486 had a related patch set uploaded (by JHathaway; author: JHathaway):

[operations/puppet@production] WIP: add function to generate ganeti known hosts

https://gerrit.wikimedia.org/r/1023486

Change #1023486 merged by JHathaway:

[operations/puppet@production] ganeti: function to generate ganeti known hosts

https://gerrit.wikimedia.org/r/1023486

Change #1075898 had a related patch set uploaded (by Muehlenhoff; author: Muehlenhoff):

[operations/puppet@production] Add support for centrally managing /var/lib/ganeti/known_hosts

https://gerrit.wikimedia.org/r/1075898

Change #1021896 abandoned by Muehlenhoff:

[operations/puppet@production] Install a Puppet generator to create a known hosts file for Ganeti

Reason:

Obsoleted by https://gerrit.wikimedia.org/r/c/operations/puppet/+/1023486

https://gerrit.wikimedia.org/r/1021896

Change #1075898 merged by Muehlenhoff:

[operations/puppet@production] Add support for centrally managing /var/lib/ganeti/known_hosts

https://gerrit.wikimedia.org/r/1075898

Change #1076188 had a related patch set uploaded (by Muehlenhoff; author: Muehlenhoff):

[operations/puppet@production] Test puppet-managed /var/lib/ganeti/known_hosts on ganeti-test2003

https://gerrit.wikimedia.org/r/1076188

Change #1076188 merged by Muehlenhoff:

[operations/puppet@production] Test puppet-managed /var/lib/ganeti/known_hosts on ganeti-test2003

https://gerrit.wikimedia.org/r/1076188

Change #1083165 had a related patch set uploaded (by Muehlenhoff; author: Muehlenhoff):

[operations/puppet@production] ganeti-test: Enable puppet-managed /var/lib/ganeti/known_hosts for the role

https://gerrit.wikimedia.org/r/1083165

Change #1083165 merged by Muehlenhoff:

[operations/puppet@production] ganeti-test: Enable puppet-managed /var/lib/ganeti/known_hosts for the role

https://gerrit.wikimedia.org/r/1083165

Change #1108036 had a related patch set uploaded (by Muehlenhoff; author: Muehlenhoff):

[operations/puppet@production] Also add the cluster SSH key in managed mode

https://gerrit.wikimedia.org/r/1108036

Change #1108092 had a related patch set uploaded (by Muehlenhoff; author: Muehlenhoff):

[operations/puppet@production] Fix permissions for /var/lib/ganeti/known_hosts in managed mode

https://gerrit.wikimedia.org/r/1108092

o/ I ran into this issue trying to access the console for doc2002 and I think it's related to this.

I tried the --show-cmd, ran the output and set StrictHostKeyChecking to no but didn't work. Any idea how I can workaround this?

aokoth@ganeti2020:~$ sudo gnt-instance console doc2002.codfw.wmnet
No ECDSA host key is known for ganeti01.svc.codfw.wmnet and you have requested strict checking.
Host key verification failed.
Failure: command execution error:
Connection to console of instance doc2002.codfw.wmnet failed, please check cluster configuration

Change #1108092 merged by Muehlenhoff:

[operations/puppet@production] Fix permissions for /var/lib/ganeti/known_hosts in managed mode

https://gerrit.wikimedia.org/r/1108092

Change #1108036 merged by Muehlenhoff:

[operations/puppet@production] Also add the cluster SSH key to /var/lib/ganeti/known_hosts in managed mode

https://gerrit.wikimedia.org/r/1108036

Change #1109092 had a related patch set uploaded (by Muehlenhoff; author: Muehlenhoff):

[operations/puppet@production] Switch magru01 to managed /var/lib/ganeti/known_hosts

https://gerrit.wikimedia.org/r/1109092

Change #1110724 had a related patch set uploaded (by Muehlenhoff; author: Muehlenhoff):

[operations/puppet@production] ganeti::known_hosts: Sort hosts

https://gerrit.wikimedia.org/r/1110724

Change #1110724 merged by Muehlenhoff:

[operations/puppet@production] ganeti::known_hosts: Sort hosts

https://gerrit.wikimedia.org/r/1110724

Change #1109092 merged by Muehlenhoff:

[operations/puppet@production] Switch magru01 to managed /var/lib/ganeti/known_hosts

https://gerrit.wikimedia.org/r/1109092

Change #1131363 had a related patch set uploaded (by Volans; author: Volans):

[operations/cookbooks@master] sre.ganeti.addnode: confirm verify on failure

https://gerrit.wikimedia.org/r/1131363

Change #1131363 merged by jenkins-bot:

[operations/cookbooks@master] sre.ganeti.addnode: confirm verify on failure

https://gerrit.wikimedia.org/r/1131363

I currently can't run 'gnt-instance console' in eqiad1/ganeti1048 because of host key issues. Foolishly I tried removing the offending key and now it still fails but with less explanation:

root@ganeti1048:/var/lib/ganeti# gnt-instance console cloudbackup1002-dev.eqiad.wmnet  
No ED25519 host key is known for ganeti01.svc.eqiad.wmnet and you have requested strict checking.
Host key verification failed.
Failure: command execution error:
Connection to console of instance cloudbackup1002-dev.eqiad.wmnet failed, please check cluster configuration

Is that due to something pending on this task, or am I doing something else silly?

Ran into the issue again today while working thru T433890:

[bking@ganeti2048] ~$ sudo gnt-instance console search-loader2002
No ED25519 host key is known for ganeti01.svc.codfw.wmnet and you have requested strict checking.
Host key verification failed.

Are there any workarounds for accessing the console until this is fixed??