-
Problem report
-
Resolution: Won't fix
-
Trivial
-
None
-
4.0.3
-
Production
I follow the documentation except for the location of the home of the zabbix user.
https://www.zabbix.com/documentation/4.0/manual/config/items/itemtypes/ssh_checks
I choose Key file authentication so I specified the `SSHKeyLocation=/var/lib/zabbix/.ssh` and restart `systemctl restart zabbix-server` and `systemctl restart zabbix-agent`
I generate ssh key without passphrase. I use those commande to generate both key I try to use.
First key I try `ssh-keygen -o -a 100 -t ed25519`
Second key I try `ssh-keygen -o -a 100 -t rsa -b 4096`
I generate those keys as zabbix user in the zabbix server.
On the destination server I copy both key in authorized_key and confirm it's working using those command.
`sudo -u zabbix ssh -i ~/.ssh/id_ed25519 zabbix_ssh_agent@hostname`
`sudo -u zabbix ssh -i ~/.ssh/id_rsa zabbix_ssh_agent@hostname`
Both key are working, on the destination side I create the user zabbix_ssh_agent with both public key. I choose to test both key because I started with ed25519 and I want to make sure this is not the cause of the problem.
I create the item in zabbix frontend with those parameters.
Name: SSH syntetic check Type: SSH agent Key: ssh.run[testing123] Authentification method: Public key User name: zabbix_ssh_agent Public key file: id_rsa.pub Private key file: id_rsa Execute script: ls /tmp Type of information: Text Update Interval: 1m History storage period: 90d
When I go back to the same screen to edit or validate the information I just provided to Zabbix, I have several other fields and a duplicate field. I see 2 User Name field.
I attache two screenshots.
The item start to collect information and I got that error in the frontend web page.
`Public key authentication failed: Callback returned error`
I try couple way to specify the location of the key file. When I try to specify the relative path I got that error message `Cannot access public key file /var/lib/zabbix/.ssh//var/lib/zabbix/.ssh/id_rsa.pub`
The relavite path :
```
Public key file: /var/lib/zabbix/.ssh/id_rsa.pub
Private key file: /var/lib/zabbix/.ssh/id_rsa
```
I enable debug log and collect that.
```
26326:20190131:150855.564 End of substitute_key_macros():SUCCEED data:'ssh.run[testing123]'
26326:20190131:150855.564 In substitute_simple_macros() data:'id_rsa.pub'
26326:20190131:150855.564 In substitute_simple_macros() data:'id_rsa'
26326:20190131:150855.564 In substitute_simple_macros() data:'ls /tmp'
26326:20190131:150855.564 In substitute_simple_macros() data:'SSH_DESTINATION_USER'
26326:20190131:150855.564 In substitute_simple_macros() data:EMPTY
26326:20190131:150855.564 In get_value() key:'ssh.run[testing123]'
26840:20190131:150855.564 End of preprocessor_enqueue()
26840:20190131:150855.564 In preprocessor_assign_tasks()
26840:20190131:150855.564 In preprocessor_get_queued_item()
26840:20190131:150855.564 End of preprocessor_get_queued_item()
26326:20190131:150855.564 In ssh_run()
26326:20190131:150855.684 ssh_run() supported authentication methods:'publickey'
26326:20190131:150855.685 End of ssh_run():
26326:20190131:150855.685 Item [HOSTNAME_DESTINATION:ssh.run[testing123]] error: Public key authentication failed: Callback returned error
20776:20190130:201919.772 item "HOSTNAME_DESTINATION:ssh.run[testing123]" became not supported: Public key authentication failed: Username/PublicKey combination invalid
26247:20190131:150853.823 ssh:[username:'SSH_DESTINATION_USER' password:'' authtype:1 params:'ls /tmp']
26247:20190131:150853.823 ssh:[publickey:'id_rsa.pub' privatekey:'id_rsa']
```
Thank you!!