检查 ssh 连接不工作但 ssh 连接是允许的
inspect ssh connection is not working but ssh connection is allow
我正在尝试 运行 我所有的 inspec 测试,然后再部署厨师食谱。我想知道我的实例的初始状态是什么。
我测试了 ssh 连接:
ssh -i $HOME/key.pem centos@server_ip_address
并且允许连接,但是当我尝试 运行 检查再次测试服务器时:
inspec exec ntp/test/integration/ntp.rb -t ssh://centos@server_ip_address -i /home/centos/key.pem
我收到这个错误:
I, [2017-01-17T14:10:32.835995 #2416] INFO -- : [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user centos@server_ip_address>)
I, [2017-01-17T14:10:34.619150 #2416] INFO -- : [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user centos@server_ip_address>)
I, [2017-01-17T14:10:36.403860 #2416] INFO -- : [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user centos@server_ip_address>)
I, [2017-01-17T14:10:38.188401 #2416] INFO -- : [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user centos@server_ip_address>)
W, [2017-01-17T14:10:39.971832 #2416] WARN -- : [SSH] connection failed, terminating (#<Net::SSH::AuthenticationFailed: Authentication failed for user centos@server_ip_address>)
Transport error, can't connect to 'ssh' backend: SSH session could not be established
不知道哪里出错了。有什么建议吗?
检查信息
chef gem list | grep inspec
inspec (1.9.0, 1.7.2)
好吧,我花了整个上午和下午的一部分时间进行搜索,找到了解决方案 here
我执行:
eval "$(ssh-agent)"
然后将我的密钥添加到代理:
ssh-add key.pem
所以现在我可以 运行 inspec 测试而无需执行密钥:
inspec exec cookbooks/ntp/test/integration/default/ -t ssh://centos@server_ip_address
好的,这是一个部分解决方案,因为我仍在寻找使用 -i
并将密钥用作参数的方法。问题依旧。
我正在尝试 运行 我所有的 inspec 测试,然后再部署厨师食谱。我想知道我的实例的初始状态是什么。
我测试了 ssh 连接:
ssh -i $HOME/key.pem centos@server_ip_address
并且允许连接,但是当我尝试 运行 检查再次测试服务器时:
inspec exec ntp/test/integration/ntp.rb -t ssh://centos@server_ip_address -i /home/centos/key.pem
我收到这个错误:
I, [2017-01-17T14:10:32.835995 #2416] INFO -- : [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user centos@server_ip_address>)
I, [2017-01-17T14:10:34.619150 #2416] INFO -- : [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user centos@server_ip_address>)
I, [2017-01-17T14:10:36.403860 #2416] INFO -- : [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user centos@server_ip_address>)
I, [2017-01-17T14:10:38.188401 #2416] INFO -- : [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user centos@server_ip_address>)
W, [2017-01-17T14:10:39.971832 #2416] WARN -- : [SSH] connection failed, terminating (#<Net::SSH::AuthenticationFailed: Authentication failed for user centos@server_ip_address>)
Transport error, can't connect to 'ssh' backend: SSH session could not be established
不知道哪里出错了。有什么建议吗?
检查信息
chef gem list | grep inspec
inspec (1.9.0, 1.7.2)
好吧,我花了整个上午和下午的一部分时间进行搜索,找到了解决方案 here
我执行:
eval "$(ssh-agent)"
然后将我的密钥添加到代理:
ssh-add key.pem
所以现在我可以 运行 inspec 测试而无需执行密钥:
inspec exec cookbooks/ntp/test/integration/default/ -t ssh://centos@server_ip_address
好的,这是一个部分解决方案,因为我仍在寻找使用 -i
并将密钥用作参数的方法。问题依旧。