Agent exited with code 255: Host key verification failed

CMK version: Checkmk Raw Edition 2.3.0p1
OS version: Official Checkmk Raw Docker Image

Error message:
Agent exited with code 255: Host key verification failed.

I try to connect a Linux Agent legacy mode using SSH certificates, described in the documentation: Monitoring Linux in legacy mode - 6. Encrypted: Use of an SSH tunnel.

I saved the ssh-private-key file here:
/opt/omd/sites/cmk/ssh/checkmk_ssh.

ssh certificate file permissions:
-rw------- 1 cmk cmk 411 May 14 12:00 checkmk_ssh

directory permissions:
drwx------ 1 cmk cmk 4.0K May 14 11:55 ssh

Individual program call instead of agent access command line:
ssh -i $OMD_ROOT/ssh/checkmk_ssh -T root@$HOSTADDRESS$

I created a host in Hosts with it’s IPv4 address.


I activated the changed and when testing the connection to host page (https://XXXX/cmk/check_mk/index.py?start_url=%2Fcmk%2Fcheck_mk%2Fwato.py) I get successful ping, but failed “Agent” box: Agent exited with code 255: Host key verification failed.


The key works when I use it on my machine to login to the server.

UPDATE: WORKS!

What I did:
su cmk ssh -i checkmk_ssh root@<target-server>

Asked me to trust the fingerprint. YES. Now it works!

Edit: Here the full command for anybody with same problem:
ssh -o StrictHostKeyChecking=no -i $OMD_ROOT/ssh/checkmk_ssh -T root@$_HOSTADDRESS_4$

Thanks @aeckstein

Hi,

you need to accept the remote host key of the monitored System on the checkmk server, If it is only one system you can create a ssh session from inside your checkmk site (as the Site User) with the same command you are using, but with the variables changed for the real values.
An insecure option could be to add
-o StrictHostKeyChecking=no to the ssh command.

Ok, we wrote at the same time :slight_smile:

2 Likes