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

inetd_conf resource error #1253

Closed
humboldtux opened this issue Oct 26, 2016 · 4 comments · Fixed by #1257
Closed

inetd_conf resource error #1253

humboldtux opened this issue Oct 26, 2016 · 4 comments · Fixed by #1257
Labels
Type: Bug Feature not working as expected

Comments

@humboldtux
Copy link

Description

When i execute the following example from the documentation:

describe inetd_conf do
  its('shell') { should eq nil }
  its('login') { should eq nil }
  its('exec') { should eq nil }
end

I get the following error:

inetd.conf exec 
     wrong number of arguments (given 0, expected 1+)

InSpec and Platform Version

InSpec 1.2.0 installed via ChefDF, on Debian 8.6.

@Anirudh-Gupta
Copy link
Contributor

Anirudh-Gupta commented Oct 26, 2016

@humboldtux You need to give the inetd_conf path along with it.

  describe inetd_conf('path') do
      its('service_name') { should eq 'value' }
  end

@humboldtux
Copy link
Author

@Anirudh-Gupta thank you for your help but:

  • You don't need to specify a path when using the defaut inetd conf path (/etc/inetd.conf), look at the end of http://inspec.io/docs/reference/resources/inetd_conf/ for an example.
  • shell and login services are not returning error, it's just a problem with exec
  • Actually, i don't even have an /etc/inetd.conf file on my test server, but i tested with a sample conf file, and i got the exact same error.
  • If i replace exec by exec2, foobar or even exec\s the test is executed and inspec is not raising an error.

I think that exec is something like a reserved keyword that prevents it from being used in such a spec.

@chris-rock chris-rock added the Type: Bug Feature not working as expected label Oct 27, 2016
@chris-rock
Copy link
Contributor

@humboldtux just added the following to inetd.conf as test

login   stream  tcp6    nowait  root    /usr/sbin/in.rlogind    in.rlogind
telnet  stream  tcp6    nowait  root    /usr/sbin/in.telnetd    in.telnetd
shell   stream  tcp nowait  root    /usr/sbin/in.rshd   in.rshd
shell   stream  tcp6    nowait  root    /usr/sbin/in.rshd   in.rshd
exec    stream  tcp nowait  root    /usr/sbin/in.rexecd in.rexecd 

Then I used the inspec shell to test it:

b inspec shell -t docker://1de218c4b67c
Welcome to the interactive InSpec Shell
To find out how to use it, type: help

inspec> inetd_conf.shell
=> ["stream", "tcp6", "nowait", "root", "/usr/sbin/in.rshd", "in.rshd"]
inspec> inetd_conf.exec
=> ["stream", "tcp", "nowait", "root", "/usr/sbin/in.rexecd", "in.rexecd"]
inspec> inetd_conf.login
=> ["stream", "tcp6", "nowait", "root", "/usr/sbin/in.rlogind", "in.rlogind"]
inspec>

Now testing shell and login:

inspec> describe inetd_conf do
inspec>   its('shell') { should eq nil }  
inspec>   its('login') { should eq nil }  
inspec> end  

Profile: inspec-shell
Version: unknown



  inetd.conf shell
     ✖  should eq nil

     expected: nil
          got: ["stream", "tcp6", "nowait", "root", "/usr/sbin/in.rshd", "in.rshd"]

     (compared using ==)

     ✖  should eq nil

     expected: nil
          got: ["stream", "tcp6", "nowait", "root", "/usr/sbin/in.rlogind", "in.rlogind"]

     (compared using ==)


Test Summary: 0 successful, 2 failures, 0 skipped
inspec> 

Now lets test exec

inspec> describe inetd_conf do
inspec>   its('exec') { should eq nil }  
inspec> end   

Profile: inspec-shell
Version: unknown



  inetd.conf exec
     ✖  wrong number of arguments (0 for 1+)

Test Summary: 0 successful, 1 failures, 0 skipped
inspec>

Therefore I can confirm that this issue only happens in combination with RSpec its. Another issue related to #875

@humboldtux
Copy link
Author

Thank you @chris-rock for the extensive report. It reminds me i need to use the inspec shell a little bit more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants