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

Bug or doc problem with registry_key #1268

Closed
pburkholder opened this issue Nov 1, 2016 · 1 comment
Closed

Bug or doc problem with registry_key #1268

pburkholder opened this issue Nov 1, 2016 · 1 comment
Assignees
Labels
Aspect: Docs Write the Fine Manual Type: Bug Feature not working as expected

Comments

@pburkholder
Copy link
Contributor

Description

http://inspec.io/docs/reference/resources/registry_key/ has this:

describe registry_key({
  name: 'Task Scheduler',
  hive: 'HKEY_LOCAL_MACHINE',
  key: ''\SYSTEM\CurrentControlSet\services\Schedule'
}) do
  its('Start') { should eq 2 }
end

The key clearly has an issue with the double single quote, but it seems to indicate that key path can start with a backslash. But using a path like `\SYSTEM\CurrentControlSet\services\Schedule' will result in something like:

    expected: 1
          got: nil

InSpec and Platform Version

inspec (1.3.0)
ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin13]

Replication Case

A cookbook with test/integration/default/inspec/default_spec.rb:

describe registry_key({
    hive: 'HKEY_LOCAL_MACHINE',
    key:  'Software\Policies\Microsoft\Windows NT\Terminal Services'
  }) do
    its("fEncryptRPCTraffic") { should eq 1 }
end

describe registry_key({
    hive: 'HKEY_LOCAL_MACHINE',
    key:  '\Software\Policies\Microsoft\Windows NT\Terminal Services'
  }) do
    its("fEncryptRPCTraffic") { should eq 1 }
end

against win2012rs kitchen verify:

-----> Verifying <default-windows-2012r2>...
       Detected alternative framework tests for `inspec`
       Use `/Users/peterburkholder/Projects/pburkholder/windows_stig_cookbook/test/integration/default/inspec` for testing

Target:  winrm://pburkholder@http://ec2-54-84-128-213.compute-1.amazonaws.com:5985/wsman:3389


  File c:/
     ✔  should exist
  Registry Key
     ✔  HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT\Terminal Services fEncryptRPCTraffic should eq 1
  Registry Key
     ✖  HKEY_LOCAL_MACHINE\\Software\Policies\Microsoft\Windows NT\Terminal Services fEncryptRPCTraffic should eq 1

     expected: 1
          got: nil

     (compared using ==)


Test Summary: 2 successful, 1 failures, 0 skipped

Possible Solutions

  1. Allow leading backslash

  2. Clarify the documentation

Which shall we do...??

@chris-rock
Copy link
Contributor

Actually both:

  • we prefer not to have a leading backslash, therefore we should update the documentation
  • since it is very clear what happens with a leading backslash, we should just ensure that the path is properly joined

@chris-rock chris-rock added Type: Bug Feature not working as expected Aspect: Docs Write the Fine Manual labels Nov 1, 2016
@chris-rock chris-rock reopened this Apr 6, 2017
chris-rock added a commit that referenced this issue Apr 6, 2017
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
@chris-rock chris-rock self-assigned this Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Aspect: Docs Write the Fine Manual Type: Bug Feature not working as expected
Projects
None yet
Development

No branches or pull requests

3 participants