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

not working under windows, installed from gem #323

Closed
graf0 opened this issue Dec 16, 2015 · 6 comments
Closed

not working under windows, installed from gem #323

graf0 opened this issue Dec 16, 2015 · 6 comments
Assignees
Labels
Type: Bug Feature not working as expected
Milestone

Comments

@graf0
Copy link

graf0 commented Dec 16, 2015

  • I installed inpsec from gem
  • I ran (from privileged powershell) command: inspec detect
  • I've got:
{"name":null,"family":null,"release":null,"arch":null}
  • then I've created file test.rb with content (from inspec doc):
describe port(80) do
  it { should_not be_listening }
end

describe port(443) do
  it { should be_listening }
  its('protocols') {should include 'tcp'}
end
  • I ran: inspec exec test.rb
  • I've got:
Pending: (Failures listed here are expected and do not affect your suite's status)

  1) Port  80 The `port` resource is not supported on your OS yet.
     # Not yet implemented
     #

  2) Port  443 The `port` resource is not supported on your OS yet.
     # Not yet implemented
     #

Finished in 0.00174 seconds (files took 2.01 seconds to load)

I don't know, and couldn't find how to make it work :(

windows version 7 x64, ruby 2.0.0p645 32-bit, inspec gem 0.9.6

@graf0
Copy link
Author

graf0 commented Dec 16, 2015

Same situation after trying ruby 2.2.3 - both: 32-bit and 64-bit version

@chris-rock chris-rock added the Type: Bug Feature not working as expected label Dec 16, 2015
@arlimus arlimus added this to the 0.9.8 milestone Dec 21, 2015
@geerzo
Copy link

geerzo commented Dec 21, 2015

I have a similar problem on Windows through Test Kitchen via the Chef DK 0.10.0. The os object doesn't seem to be functioning properly.

The following commands all return false.

puts os.redhat?
puts os.debian?
puts os.suse?
puts os.bsd?
puts os.solaris?
puts os.linux?
puts os.unix?
puts os.windows?

@chris-rock chris-rock self-assigned this Dec 23, 2015
@chris-rock
Copy link
Contributor

@graf0 Thanks you very much for your feedback. As you figured out, InSpec does not work properly with local mode on Windows. Currently InSpec only works well if used via WinRM. The problem is located in the os-family detection in https://github.com/chef/train/blob/master/lib/train/extras/os_common.rb#L90. I started working on a fix and got this working on Windows 10. We run some extra tests with Windows 7.

We expect to release a fix for InSpec by end of this week. In the meantime you can use InSpec via WinRM only.

@chris-rock
Copy link
Contributor

@geerzo I assume this is a different issue, since the detection for Windows is working via WinRM. Which gem versions of inspec and kitchen-inspec are you using? Could you share your gem list?

@chris-rock
Copy link
Contributor

The PR inspec/train#43 fixes this issues mentioned by @graf0 . To explain the issues:
Train detected Windows properly on local mode via https://github.com/chef/train/blob/master/lib/train/transports/local_os.rb#L39. Afterwards train tried to detect the windows version with our detection script: https://github.com/chef/train/blob/master/lib/train/extras/os_detect_windows.rb#L56. This script failed due to the fact that we get a cmd shell on Windows (in contrast to WinRM where we get a PowerShell shell automatically). The PR adds the required functionality to ensure commands are executed via powershell if inspec runs on Windows locally.

@arlimus
Copy link
Contributor

arlimus commented Jan 3, 2016

Train 0.9.3 has been released and fixes this.
Please reopen this ticket if the issue persists.

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

No branches or pull requests

4 participants