Closed ssok1 closed 3 years ago
kitchen.yml:
driver: name: ec2 aws_ssh_key_id: <%= ENV['AWS_SSH_KEYNAME'] %> region: us-east-1 instance_type: <%= ENV['AWS_INSTANCE_TYPE'] %> spot_price: <%= ENV['AWS_SPOT_PRICE'] %> associate_public_ip: false interface: private subnet_id: <%= ENV['AWS_SUBNET_ID'] %> security_group_ids: <%= ENV['AWS_SG_ID'] %> retryable_tries: 200 shared_credentials_profile: saml user_data: user_data_centos_8.sh
provisioner: name: shell log_level: 5 max_retries: 3 wait_for_retry: 30 retry_on_exit_code: # will retry if winrm is unable to connect to the ec2 instance
verifier: name: inspec format: documentation reporter:
transport: name: ssh ssh_key: ~/.ssh/<%= ENV['AWS_SSH_KEYNAME'] %>.pem max_wait_until_ready: 900 connect_timeout: 60 connection_retries: 10 connection_retry_sleep: 10 username: centos
platforms:
suites:
SSH refused then fails:
[SSH] opening connection to user@##.###.##.##<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :keepalive_maxcount=>3, :timeout=>15, :keys_only=>true, :keys=>["/root/.ssh/####.pem"], :auth_methods=>["publickey"], :verify_host_key=>:never, :logger=>#<Logger:0x0000000003aeb1d8 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x0000000003aeb138 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x0000000003aeb0e8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:>, @mon_mutex=#, @mon_mutex_owner_object_id=30890100, @mon_owner=nil, @mon_count=0>>, :password_prompt=>#, :user=>"user"}>
[SSH] connection failed (#<Errno::ECONNREFUSED: Connection refused - connect(2) for ##.###.##.##:22>) Waiting for SSH service on ##.###.##.##:22, retrying in 3 seconds [SSH] opening connection to user@##.###.##.##<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :keepalive_maxcount=>3, :timeout=>15, :keys_only=>true, :keys=>["/root/.ssh/####.pem"], :auth_methods=>["publickey"], :verify_host_key=>:never, :logger=>#<Logger:0x0000000003aeb1d8 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x0000000003aeb138 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x0000000003aeb0e8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:>, @mon_mutex=#, @mon_mutex_owner_object_id=30890100, @mon_owner=nil, @mon_count=0>>, :password_prompt=>#, :user=>"user"}> [SSH] connection failed (#<Net::SSH::AuthenticationFailed: Authentication failed for user user@##.###.##.##>)
When attempting to SSH manually with the same key it works.
related to #398
kitchen.yml:
driver: name: ec2 aws_ssh_key_id: <%= ENV['AWS_SSH_KEYNAME'] %> region: us-east-1 instance_type: <%= ENV['AWS_INSTANCE_TYPE'] %> spot_price: <%= ENV['AWS_SPOT_PRICE'] %> associate_public_ip: false interface: private subnet_id: <%= ENV['AWS_SUBNET_ID'] %> security_group_ids: <%= ENV['AWS_SG_ID'] %> retryable_tries: 200 shared_credentials_profile: saml user_data: user_data_centos_8.sh
provisioner: name: shell log_level: 5 max_retries: 3 wait_for_retry: 30 retry_on_exit_code: # will retry if winrm is unable to connect to the ec2 instance
verifier: name: inspec format: documentation reporter:
transport: name: ssh ssh_key: ~/.ssh/<%= ENV['AWS_SSH_KEYNAME'] %>.pem max_wait_until_ready: 900 connect_timeout: 60 connection_retries: 10 connection_retry_sleep: 10 username: centos
platforms:
suites:
SSH refused then fails:
[SSH] opening connection to user@##.###.##.##<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :keepalive_maxcount=>3, :timeout=>15, :keys_only=>true, :keys=>["/root/.ssh/####.pem"], :auth_methods=>["publickey"], :verify_host_key=>:never, :logger=>#<Logger:0x0000000003aeb1d8 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x0000000003aeb138 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x0000000003aeb0e8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:>, @mon_mutex=#, @mon_mutex_owner_object_id=30890100, @mon_owner=nil, @mon_count=0>>, :password_prompt=>#, :user=>"user"}>
[SSH] connection failed (#<Errno::ECONNREFUSED: Connection refused - connect(2) for ##.###.##.##:22>) Waiting for SSH service on ##.###.##.##:22, retrying in 3 seconds [SSH] opening connection to user@##.###.##.##<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :keepalive_maxcount=>3, :timeout=>15, :keys_only=>true, :keys=>["/root/.ssh/####.pem"], :auth_methods=>["publickey"], :verify_host_key=>:never, :logger=>#<Logger:0x0000000003aeb1d8 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x0000000003aeb138 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x0000000003aeb0e8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:>, @mon_mutex=#, @mon_mutex_owner_object_id=30890100, @mon_owner=nil, @mon_count=0>>, :password_prompt=>#, :user=>"user"}>
[SSH] connection failed (#<Net::SSH::AuthenticationFailed: Authentication failed for user user@##.###.##.##>)
When attempting to SSH manually with the same key it works.