Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

be_reacheable matcher for host resource should not always use ping on linux #1504

Closed
scboucher opened this issue Feb 23, 2017 · 1 comment
Closed

Comments

@scboucher
Copy link
Contributor

Description

host resource always use ping on linux. When the proto is set to tcp or udp it should at least warning the use it is going to use ping instead.

See also #1439

InSpec and Platform Version

inspec --version
1.14.1
linux debian

Replication Case

Here is an example of control that

control 'server-1.0' do
  impact 1.0
  title 'Access to my server'
  desc 'builders should be able to access my server'
  describe host('www.example.com', port: 443, proto: 'tcp') do
    it { should be_reachable }
  end
end

Possible Solutions

host could use netcat when proto is 'tcp' or 'udp'
tcp

nc -v -w 1 example.com 443

or
udp

nc -v -u -w3 example.com 53

Stacktrace

D, [2017-02-22T19:26:24.014917 #9326] DEBUG -- : [SSH] myuser@example.com<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :auth_methods=>["none", "publickey"], :keys_only=>nil, :keys=>nil, :forward_agent=>nil, :logger=>#<Logger:0x007f9dc6a56e30 @progname=nil, @level=4, @default_formatter=#<Logger::Formatter:0x007f9dc6a56bd8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x007f9dc6a56b60 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007f9dc6a56ae8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007f9dc6a569a8>>>>, :password_prompt=>#<Net::SSH::Prompt:0x007f9dc6a568e0>, :user=>"myuser"}> (ping -w 1 -c 1 exemple.com)
@scboucher scboucher changed the title be_reacheable matcher for host resource should not always use ping be_reacheable matcher for host resource should not always use ping on linux Feb 23, 2017
@adamleff
Copy link
Contributor

@scboucher Thanks for submitting this issue! It does appear we could offer better transparency and better functionality here.

Since this enhancement is already requested in #1439 as you've indicated, I'm going to close this issue as a duplicate of that one. Please feel free to subscribe to that one for further updates. In addition, as a friendly reminder, Pull Requests are always welcome. 😄

Thanks again for reaching out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants