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 able to use password authentication for WinRM backend #369

Open
anniehedgpeth opened this issue Nov 15, 2019 · 5 comments
Open

not able to use password authentication for WinRM backend #369

anniehedgpeth opened this issue Nov 15, 2019 · 5 comments
Labels
bug error message An opportunity for error message improvement ruby gem

Comments

@anniehedgpeth
Copy link

I was able to run InSpec successfully like so with WinRM:

inspec exec ./test/integration/windows-agent-test/controls/vm.rb -b winrm -t computername.company.corp --user company\username --password "alphanumericpassword" -p 5986 --no-self-signed

However, when I tried running it with kitchen-terraform with this .kitchen.yml it failed:

driver:
  name: terraform
  root_module_directory: test/fixtures/windows-agent-test
  command_timeout: 1200

provisioner:
  name: terraform

verifier:
  name: terraform
  systems:
    - name: vm
      backend: winrm
      port: 5986
      hosts:
        - computername.company.corp
      user: company\username # I tried this in quotes, too.
      password: alphanumericpassword # I tried this in quotes, too.
      self_signed: false
      # ssl: false # I tried it with and without this, even though I didn't need it in the inspec exec.
      controls:
        - vmisconfigured

platforms:
  - name: terraform

suites:
  - name: windows-agent-test

The error doesn't seem very helpful:

>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Verify failed on instance <windows-agent-test-terraform>.  Please see .kitchen/logs/windows-agent-test-terraform.log for more details

And I'm not sure if the logs are helpful or not, but this is it:

I, [2019-11-14T18:05:19.605764 #81452]  INFO -- windows-agent-test-terraform: -----> Verifying <windows-agent-test-terraform>...
W, [2019-11-14T18:05:19.607125 #81452]  WARN -- windows-agent-test-terraform: Running command `terraform workspace select kitchen-terraform-windows-agent-test-terraform` in directory C:/Users/Annie.Hedgpeth/source/INJNK/terraform-azurerm-windows-agent/test/fixtures/windows-agent-test
E, [2019-11-14T18:06:30.905888 #81452] ERROR -- windows-agent-test-terraform: Verify failed on instance <windows-agent-test-terraform>.
E, [2019-11-14T18:06:30.906556 #81452] ERROR -- windows-agent-test-terraform: ------Exception-------
E, [2019-11-14T18:06:30.906888 #81452] ERROR -- windows-agent-test-terraform: Class: Kitchen::ActionFailed
E, [2019-11-14T18:06:30.907095 #81452] ERROR -- windows-agent-test-terraform: Message: vm: execution expired
E, [2019-11-14T18:06:30.907396 #81452] ERROR -- windows-agent-test-terraform: ----------------------
E, [2019-11-14T18:06:30.907706 #81452] ERROR -- windows-agent-test-terraform: ------Backtrace-------
E, [2019-11-14T18:06:30.907952 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/kitchen-terraform-4.9.0/lib/kitchen/verifier/terraform.rb:96:in `rescue in call'
E, [2019-11-14T18:06:30.908257 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/kitchen-terraform-4.9.0/lib/kitchen/verifier/terraform.rb:89:in `call'
E, [2019-11-14T18:06:30.908569 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:459:in `block in verify_action'
E, [2019-11-14T18:06:30.908898 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:552:in `synchronize_or_call'
E, [2019-11-14T18:06:30.909220 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:514:in `block in action'
E, [2019-11-14T18:06:30.909533 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/2.5.0/benchmark.rb:293:in `measure'
E, [2019-11-14T18:06:30.909849 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:513:in `action'
E, [2019-11-14T18:06:30.910172 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:451:in `verify_action'
E, [2019-11-14T18:06:30.910489 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:382:in `block (2 levels) in transition_to'
E, [2019-11-14T18:06:30.910812 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/lifecycle_hooks.rb:45:in `run_with_hooks'
E, [2019-11-14T18:06:30.911126 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:381:in `block in transition_to'
E, [2019-11-14T18:06:30.911376 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:380:in `each'
E, [2019-11-14T18:06:30.911683 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:380:in `transition_to'
E, [2019-11-14T18:06:30.912019 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:162:in `verify'
E, [2019-11-14T18:06:30.912355 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/command.rb:198:in `public_send'
E, [2019-11-14T18:06:30.912659 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/command.rb:198:in `run_action_in_thread'
E, [2019-11-14T18:06:30.912975 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/command.rb:169:in `block (2 levels) in run_action'
E, [2019-11-14T18:06:30.913430 #81452] ERROR -- windows-agent-test-terraform: ----End Backtrace-----
E, [2019-11-14T18:06:30.913747 #81452] ERROR -- windows-agent-test-terraform: ---Nested Exception---
E, [2019-11-14T18:06:30.914067 #81452] ERROR -- windows-agent-test-terraform: Class: Kitchen::Terraform::Error
E, [2019-11-14T18:06:30.914403 #81452] ERROR -- windows-agent-test-terraform: Message: vm: execution expired
E, [2019-11-14T18:06:30.914724 #81452] ERROR -- windows-agent-test-terraform: ----------------------
E, [2019-11-14T18:06:30.915041 #81452] ERROR -- windows-agent-test-terraform: ------Backtrace-------
E, [2019-11-14T18:06:30.915374 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/kitchen-terraform-4.9.0/lib/kitchen/verifier/terraform.rb:96:in `rescue in call'
E, [2019-11-14T18:06:30.915699 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/kitchen-terraform-4.9.0/lib/kitchen/verifier/terraform.rb:89:in `call'
E, [2019-11-14T18:06:30.916022 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:459:in `block in verify_action'
E, [2019-11-14T18:06:30.916359 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:552:in `synchronize_or_call'
E, [2019-11-14T18:06:30.916673 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:514:in `block in action'
E, [2019-11-14T18:06:30.916960 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/2.5.0/benchmark.rb:293:in `measure'
E, [2019-11-14T18:06:30.917247 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:513:in `action'
E, [2019-11-14T18:06:30.917463 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:451:in `verify_action'
E, [2019-11-14T18:06:30.917742 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:382:in `block (2 levels) in transition_to'
E, [2019-11-14T18:06:30.918027 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/lifecycle_hooks.rb:45:in `run_with_hooks'
E, [2019-11-14T18:06:30.918312 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:381:in `block in transition_to'
E, [2019-11-14T18:06:30.918666 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:380:in `each'
E, [2019-11-14T18:06:30.919010 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:380:in `transition_to'
E, [2019-11-14T18:06:30.919356 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/instance.rb:162:in `verify'
E, [2019-11-14T18:06:30.919674 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/command.rb:198:in `public_send'
E, [2019-11-14T18:06:30.919961 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/command.rb:198:in `run_action_in_thread'
E, [2019-11-14T18:06:30.920247 #81452] ERROR -- windows-agent-test-terraform: C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/test-kitchen-1.25.0/lib/kitchen/command.rb:169:in `block (2 levels) in run_action'
E, [2019-11-14T18:06:30.920479 #81452] ERROR -- windows-agent-test-terraform: ----End Backtrace-----

So do you think this is a bug or is my logic incorrect? Any help is appreciated!

@aaron-lane
Copy link
Collaborator

Hello again, @anniehedgpeth!

I have not had an opportunity to actually test against a Windows server so this is useful information. It's definitely strange that the same arguments work on the InSpec CLI; I think you've identified a bug.

This may be related to #317.

#354 will hopefully provide better error messages.

@anniehedgpeth
Copy link
Author

Hi @aaron-lane! Yes, everything is stranger on Windows. Let me know if you need help reproducing this!

@anniehedgpeth
Copy link
Author

Update: I believe this issue is due to WinRM issues. I thought it was testing the node, but it was actually testing the local workstation, giving me a false positive (on the connection, not the controls). I filed this which has the proper commands I used.

@aaron-lane aaron-lane added bug ruby gem error message An opportunity for error message improvement labels Dec 7, 2019
@anniehedgpeth
Copy link
Author

Another update: It was WinRM issues. I had no trouble getting it work with a winrm quickconfig. This did lead me to open this request, however, you're welcome to close this issue unless you want to change the error output. Thanks!

@aaron-lane
Copy link
Collaborator

Thanks for the update @anniehedgpeth! I do want to improve the error message here so I'll leave it open to track that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug error message An opportunity for error message improvement ruby gem
Projects
None yet
Development

No branches or pull requests

2 participants