Skip to content

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

@pbandari2701

Description

@pbandari2701

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions