train icon indicating copy to clipboard operation
train copied to clipboard

Better error on failed connection

Open subhro opened this issue 6 years ago • 1 comments

Description

Attempting to use InSpec with an invalid/incorrect SSH key:

root@ip-172-31-13-75:/home/admin# /hab/pkgs/chef/inspec/3.2.6/20181220221744/bin/inspec detect -t ssh://18.188.240.220 --user ubuntu -i /root/.ssh/id_rsa
verify_host_key: false is deprecated, use :never

 ────────────────────────────── Platform Details ────────────────────────────── 

Name:      ubuntu
Families:  debian, linux, unix, os
Release:   18.04
Arch:      x86_64
root@ip-172-31-13-75:/home/admin# cat /root/.ssh/id_rsa
root@ip-172-31-13-75:/home/admin# /hab/pkgs/chef/inspec/3.2.6/20181220221744/bin/inspec detect -t ssh://18.188.240.220 --user ubuntu -i /root/.ssh/id_rsa.pub
verify_host_key: false is deprecated, use :never
verify_host_key: false is deprecated, use :never
verify_host_key: false is deprecated, use :never
verify_host_key: false is deprecated, use :never
verify_host_key: false is deprecated, use :never
Transport error, can't connect to 'ssh' backend: SSH session could not be established

We should post a better error when authentication fails.

Train and Platform Version

Inspec 3.26

Replication Case

Commands mentioned above.

Possible Solutions

We should post a better error when authentication fails. I was initially thinking my plumbing was broken.

Something like "Incorrect credentials" instead of "Transport error" might be more useful.

subhro avatar Jan 23 '19 22:01 subhro

Yup, in this case it is a transport error in the context of Train. We could have a message like:

Transport error, can't connect to 'ssh' backend: Authentication failed

jerryaldrichiii avatar Jan 23 '19 22:01 jerryaldrichiii