train icon indicating copy to clipboard operation
train copied to clipboard

inspec exec doesn't work with ssh when ran from Ansible tower.

Open pbandari2701 opened this issue 5 years ago • 0 comments

Issue: Inspec ssh is unable to connect to a remote instance from Ansible tower. A general ssh is working as expected but when we try to connect with inspec ssh, we are unable to authenticate, or connection timed out is received.

Tried below options to run inspec ssh.

  1. Invoked inspec ssh train using below command by passing key available key files in Ansible tower. – Failed Inspec exec test.profile - -backend ssh - -host hostmachine - -user username - - key-files ~/.ssh/id_rsa

  2. Generated a ssh key via ssh-keygen and passed the generated key files to inspec train . Normal ssh i.e: ssh user@host -i ~/.ssh/id_rsa worked as expected, and able to connect to host. - Passed SSH via inspec train failed e.g : inspec exec -t ssh://user@host -i ~/.ssh/id_rsa – Failed

  3. Used ssh-add to add keys to the SSH Client on the Ansible tower machine and tried to connect via inspec ssh train – Failed.

Failed with below error.

I, INFO -- : [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user user_name@hostname) I, INFO -- : [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user user_name@hostname) I, INFO -- : [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for useruser_name@hostname) I, INFO -- : [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user user_name@hostname) W, WARN -- : [SSH] connection failed, terminating (#<Net::SSH::AuthenticationFailed: Authentication failed for user user_name@hostname) Transport error, can't connect to 'ssh' backend: SSH session could not be established

pbandari2701 avatar Mar 27 '20 16:03 pbandari2701