Page 1 of 2

Remote command execution failed: Host key verification faile

Posted: Tue Dec 02, 2014 10:00 am
by danoreilly
Doing the monitoring by SSH. I have a nagios public key set up properly. As user nagios from my nagios server, I can ssh to the target remote node as nagios just fine, so I know key authentication is set up properly. However, none of the commands I set up work. They all fail with "Remote command execution failed: Host key verification failed.". I'm at a loss to explain why.

A sample command definition is:

define command{
command_name check_byssh_disk
command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -n $HOSTNAME$ -C '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$'
}

Re: Remote command execution failed: Host key verification f

Posted: Tue Dec 02, 2014 10:05 am
by eloyd
Can you do this as the nagios user:

Code: Select all

ssh <remote host> hostname
From the command line?

Re: Remote command execution failed: Host key verification f

Posted: Tue Dec 02, 2014 3:46 pm
by danoreilly
Yes. I have no problem doing it from the command lines (even executing the Nagios commands on the remote node).

Re: Remote command execution failed: Host key verification f

Posted: Tue Dec 02, 2014 4:19 pm
by eloyd
"Host key verification failed" is a very specific error in SSH. It means that the host key of the remote host was changed. Ssh stores the host keys of the remote hosts in ~/.ssh/known_hosts. Are you SURE you're becoming the nagios user and using it's .known_hosts file:

Code: Select all

(root)# su - nagios
(nagios)$ ssh <host> uptime

Re: Remote command execution failed: Host key verification f

Posted: Tue Dec 02, 2014 5:40 pm
by slansing
@danoreilly, please let us know when you've got some updates to Eloyd's questions, thank you!

Re: Remote command execution failed: Host key verification f

Posted: Wed Dec 03, 2014 12:04 pm
by danoreilly
As I've stated at twice in this thread, I can ssh just fine:

# su - nagios
[nagios@tadmin03 ~]$ ssh ubdepot uptime
10:03:33 up 30 days, 2:25, 0 users, load average: 0.08, 0.03, 0.05
[nagios@tadmin03 ~]$

Re: Remote command execution failed: Host key verification f

Posted: Wed Dec 03, 2014 12:07 pm
by eloyd
Yes, but we have to double check. :-)

Can you confirm that Nagios software is running as the nagios user?

Re: Remote command execution failed: Host key verification f

Posted: Wed Dec 03, 2014 12:09 pm
by abrist
eloyd wrote:Can you confirm that Nagios software is running as the nagios user?

Code: Select all

grep user /usr/local/nagios/etc/nagios.cfg

Re: Remote command execution failed: Host key verification f

Posted: Wed Dec 03, 2014 12:21 pm
by danoreilly
[ADMIN root@tadmin03: /root]
# grep user /usr/local/nagios/etc/nagios.cfg
# considered to be sensitive (usernames, passwords, etc) can be
# This determines the effective user that Nagios should run as.
# You can either supply a username or a UID.
nagios_user=nagios
# by users, so it must be writeable by the user that the web server
# this data to determine the number of users running specific version of
# it calculates (those not explicitly specified by the user).
[ADMIN root@tadmin03: /root]

and yes, on the Nagios host server it's running as nagios.

Re: Remote command execution failed: Host key verification f

Posted: Wed Dec 03, 2014 12:30 pm
by eloyd
For fun, run these commands:

Code: Select all

(as root): su - nagios
$ rm ~/.ssh/known_hosts
$ ssh <hostname> uptime
(answer yes to storing the host key if it asks)
Then see if your check runs