knife-windows 0.8.0 → 0.8.2.rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjhkMDIwNTZkZTE0MTIxOGEzY2M5ZGVmNjIzYzA2ZTU0MTkzYTRhZA==
4
+ ODBjZmJlOGYwMmU5MGMzY2VlYzIyNmJkODRiMjk0Mjg3NjJiYmVkMw==
5
5
  data.tar.gz: !binary |-
6
- MGI0ZThlYWU2MzRlMjI5YzY5ZmVmOTRkNmRlM2ZkNzMxZTM0MjIwNA==
6
+ NTRlNWY5YWVkMDJiODE2YzhjMDcwNjg1ZjU1OWNmN2QzMjMyMmRiOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjJmN2NhZTllNTQ3ZWVhYWQxMTM1NmFjYTQ1OWI2MGYxNzhlZjM5NzdkZmNm
10
- NzE2MmMzNTQ3YzY5MjUxM2IzZWM1MzVmN2JjOGVmNWM1ZjM5NGNjODBmZjg2
11
- NzE2NzNlMjc3ZDAwYzg2YWE3MWFjNDU4MWU5OTVkMTYwNjBlZTI=
9
+ YTc0MzA2NTc1ZmQ1MmZkMDAyYWJiNDk4NDIxYmJiZDlmNzJjYTlmYmJlMjU2
10
+ N2FjM2MyM2RlODY1ODFlMmI2NzI0MTU4NDA0MzliOTIxMDc3YzRiNDAyZTcy
11
+ NGZlOTg5OTdiNGU5ZjRmNWQxNmQ1YmVhZDVmYzdkNjQ5OGU2ODk=
12
12
  data.tar.gz: !binary |-
13
- MjFkY2E5MTFmMDQ1YzI1YWE2ZWM2ZDY0MTlmMjg1MDBiYWU5ZTg4ZmY0YTdl
14
- ODhlZDEzNjcxNGVmN2U3MDhkN2MyNjk0ZTU5MDE5OGZkMjYzN2EzZjE5MGY0
15
- MzRjMjUyOGFkZmMzODk0MmExMzA4MzU0NTYwNjhhOGM3OWI3ZWM=
13
+ YmNiNGM0OWVlOWRmZjg4OGI5NmJiZWMxYzhmYmI5MDMwMzBmMTBmMDRhNzRm
14
+ MWE5NWQyOGEwMTM4MWU2NzJkNzdiNTZiYTUwNThmM2MwODNhMTc2NmQyZTcw
15
+ YzAyMmMwNjRkNzY1ZmZhNzJmMGFhMmU1NmVkNDEwMWMzOTY5NjI=
data/CHANGELOG.md CHANGED
@@ -3,8 +3,11 @@
3
3
  ## Unreleased changes
4
4
  None.
5
5
 
6
+ ## Latest release: 0.8.2
7
+ * [knife-windows #108](https://github.com/opscode/knife-windows/issues/108) Error: Unencrypted communication not supported if remote server does not require encryption
8
+
6
9
  ## Latest release: 0.8.0
7
- * [knife-windows #98](https://github.com/opscode/knife-windows/issues/96) Get winrm command exit code if it is not expected
10
+ * [knife-windows #98](https://github.com/opscode/knife-windows/issues/98) Get winrm command exit code if it is not expected
8
11
  * [knife-windows #96](https://github.com/opscode/knife-windows/issues/96) Fix break from OS patch KB2918614
9
12
  * Remove the 'instance data' method of creating EC2 servers
10
13
  * Update winrm-s dependency along with em-winrm and winrm dependencies
data/DOC_CHANGES.md CHANGED
@@ -6,32 +6,18 @@ Example Doc Change:
6
6
  Description of the required change.
7
7
  -->
8
8
 
9
- # knife-windows 0.8.0 doc changes
9
+ # knife-windows 0.8.2 doc changes
10
10
 
11
11
  ### Negotiate / NTLM authentication support
12
- If `knife` is executed from a Windows system, it is no longer necessary to make
13
- additional configuration of the WinRM listener on the remote node to enable
14
- successful authentication from the workstation. It is sufficient to have a WinRM
15
- listener on the remote node configured according to the operating system's `winrm
16
- quickconfig` command default configuration because `knife-windows` now
17
- supports the Windows negotiate protocol including NTLM authentication, which
18
- matches the authentication requirements for the default WinRM listener configuration.
19
-
20
- If `knife` is executed on a non-Windows system, certificate authentication or Kerberos
21
- should be used instead via the `kerberos_service` and related options of the subcommands.
22
-
23
- **NOTE**: In order to use NTLM / Negotiate to authenticate as the user
24
- specified by the `--winrm-user` (`-x`) option, you must include the user's
25
- Windows domain when specifying the user name using the format `domain\user`
26
- where the backslash ('`\`') character separates the user from the domain. If
27
- an account local to the node is being used to access, `.` may be used as the domain:
28
-
29
- knife bootstrap windows winrm web1.cloudapp.net -r 'server::web' -x 'proddomain\webuser' -P 'super_secret_password'
30
- knife bootstrap windows winrm db1.cloudapp.net -r 'server::db' -x '.\localadmin' -P 'super_secret_password'
31
-
32
- For development and testing purposes, unencrypted traffic with Basic authentication can make it easier to test connectivity:
33
-
34
- winrm set winrm/config/service @{AllowUnencrypted="true"}
35
- winrm set winrm/config/service/auth @{Basic="true"}
36
-
37
-
12
+ If you are running `knife-windows` subcommands from a Windows workstation, you
13
+ should not specify a username argument that includes a domain name (i.e. a
14
+ name formatted like `domain\user`) unless the remote host has WinRM's
15
+ `AllowUnencrypted` setting set to `$false` (the default setting on Windows if
16
+ the `winrm quickconfig` command was used to enable WinRM). If you've modified
17
+ the host to set this to `$true` instead of its default value and you run
18
+ subcommands from a Windows workstation where the username specified to
19
+ `knife-windows` contains a domain, the command will fail with an
20
+ authentication error. To avoid this, omit the domain name (this will only work
21
+ if the system is not joined to a domain, i.e. you were specifying the local
22
+ workstation as the domain), or set `AllowUnencrypted` to `$false` which is a
23
+ more secure setting.
data/RELEASE_NOTES.md CHANGED
@@ -6,39 +6,57 @@ Example Note:
6
6
  ## Example Heading
7
7
  Details about the thing that changed that needs to get included in the Release Notes in markdown.
8
8
  -->
9
- # knife-windows 0.8.0 release notes:
10
- This release of knife-windows enables the Windows negotiate protocol to be
11
- used with the `winrm` and `bootstrap windows winrm` subcommands and also
12
- contains bug fixes and dependency updates.
9
+ # knife-windows 0.8.2.rc.0 release notes:
10
+ This release of knife-windows addresses a regression in knife-windows 0.8.0
11
+ from previous releases where `knife winrm` and `knife bootstrap windows`
12
+ commands fail due to inability to authenticate:
13
+ [knife-windows #108](https://github.com/opscode/knife-windows/issues/108).
13
14
 
14
- A thank you goes to contributor **Josh Mahowald** for contributing a fix to return nonzero exit codes.
15
+ You can install the fix for this issue by upgrading to this new version using
16
+ the `gem` command:
15
17
 
16
- Issues with `knife-windows` should be reported in the ticketing system at
17
- https://github.com/opscode/knife-windows/issues. Learn more about how you can
18
- contribute features and bug fixes to `knife-windows` in the [Chef Contributions document](http://docs.opscode.com/community_contributions.html).
18
+ gem install knife-windows --pre
19
19
 
20
- ## Features added in knife-windows 0.8.0
20
+ A thank you goes to **Richard Lavey** for reporting [knife-windows #108](https://github.com/opscode/knife-windows/issues/108).
21
21
 
22
- ### NTLM / Negotiate authentication for `winrm` and `bootstrap`
23
- If `knife` is being used on a Windows workstation, it is no longer necessary
24
- to use Kerberos or to use certificate authentication to authenticate securely
25
- with a remote node in bootstrap or command execution scenarios. The `knife winrm` and `knife
26
- windows bootstrap` commands now support the use of NTLM to authenticate to remote
27
- nodes with the default WinRM listener configuration set by the operating
28
- system's `winrm quickconfig` command.
22
+ ## Impact of [knife-windows #108](https://github.com/opscode/knife-windows/issues/108)
29
23
 
30
- When specifying the user name on the command-line or configuration, the format `domain\username` must be used for
31
- the negotiate protocol to be invoked. If the account is local to the node,
32
- '`.`' may be used for the domain. See the README.md for further detail.
24
+ [knife-windows #108](https://github.com/opscode/knife-windows/issues/108) will affect a given user if all of the following are true:
25
+
26
+ * You are running `knife-windows` subcommands on a Windows workstation
27
+ * The remote node you're interacting with via `knife-windows` has a WinRM
28
+ configuration with the `WSMan:\localhost\Service\AllowUnencrypted` (in
29
+ PowerShell's WinRM settings drive provider)
30
+
31
+ In this situation, you will receive an authentication error message from
32
+ the `knife winrm` or `knife bootstrap windows` command such as
33
+ `Error: Unencrypted communication not supported`. To resolve this error,
34
+ simply install this version of the gem as described earlier.
35
+
36
+ If you are running the `knife` commands from a non-Windows operating system,
37
+ [knife-windows #108](https://github.com/opscode/knife-windows/issues/108) does
38
+ not affect you, so you don't need to upgrade just for this issue.
39
+
40
+ ## Reporting issues and contributing
41
+
42
+ `knife-windows` issues like the one addressed in this release should be
43
+ reported in the ticketing system at https://github.com/opscode/knife-windows/issues. You can learn more about how to contribute features and bug fixes to `knife-windows` in the [Chef Contributions document](http://docs.opscode.com/community_contributions.html).
44
+
45
+ ## Features added in knife-windows 0.8.2
46
+ None.
47
+
48
+ ## Issues fixed in knife-windows 0.8.2
49
+ [knife-windows #108](https://github.com/opscode/knife-windows/issues/108) Error: Unencrypted communication not supported if remote server does not require encryption
50
+
51
+ The fix in this release will cause a behavior change from the 0.8.0 release:
52
+
53
+ * As described in the [documentation changes](https://github.com/opscode/knife-windows/blob/0.8.0/DOC_CHANGES.md) for the 0.8.0 release of the `knife-windows`, the negotiate authentication
54
+ protocol will only be used in this 0.8.2 release if a domain is specified (you can specify '.' as
55
+ the domain if you want to use the local workstation as the domain). Due to a
56
+ defect in the 0.8.0 release, the negotiate protocol was being used even when
57
+ the domain was not specified.
33
58
 
34
59
  ## knife-windows on RubyGems and Github
35
60
  https://rubygems.org/gems/knife-windows
36
61
  https://github.com/opscode/knife-windows
37
62
 
38
- ## Issues fixed in knife-windows 0.8.0
39
- * [knife-windows #98](https://github.com/opscode/knife-windows/issues/96) Get winrm command exit code if it is not expected
40
- * [knife-windows #96](https://github.com/opscode/knife-windows/issues/96) Fix break from OS patch KB2918614
41
- * Update winrm-s dependency along with em-winrm and winrm dependencies
42
- * Return failure codes from knife winrm even when `returns` is not set
43
- * Support Windows negotiate authentication protocol when running knife on Windows
44
-
@@ -74,10 +74,10 @@ class Chef
74
74
 
75
75
  end
76
76
 
77
- def success_return_codes
77
+ def success_return_codes
78
78
  #Redundant if the CLI options parsing occurs
79
- return [0] unless config[:returns]
80
- return config[:returns].split(',').collect {|item| item.to_i}
79
+ return [0] unless config[:returns]
80
+ return config[:returns].split(',').collect {|item| item.to_i}
81
81
  end
82
82
 
83
83
  # TODO: Copied from Knife::Core:GenericPresenter. Should be extracted
@@ -142,7 +142,10 @@ class Chef
142
142
  session_opts[:operation_timeout] = 1800 # 30 min OperationTimeout for long bootstraps fix for KNIFE_WINDOWS-8
143
143
 
144
144
  ## If you have a \\ in your name you need to use NTLM domain authentication
145
- if session_opts[:user].split("\\").length.eql?(2)
145
+ username_contains_domain = session_opts[:user].split("\\").length.eql?(2)
146
+
147
+ if username_contains_domain
148
+ # We cannot use basic_auth for domain authentication
146
149
  session_opts[:basic_auth_only] = false
147
150
  else
148
151
  session_opts[:basic_auth_only] = true
@@ -153,7 +156,9 @@ class Chef
153
156
  session_opts[:basic_auth_only] = false
154
157
  else
155
158
  session_opts[:transport] = (Chef::Config[:knife][:winrm_transport] || config[:winrm_transport]).to_sym
156
- if Chef::Platform.windows? and session_opts[:transport] == :plaintext
159
+
160
+ if Chef::Platform.windows? && session_opts[:transport] == :plaintext && username_contains_domain
161
+ ui.warn("Switching to Negotiate authentication, Basic does not support Domain Authentication")
157
162
  # windows - force only encrypted communication
158
163
  require 'winrm-s'
159
164
  session_opts[:transport] = :sspinegotiate
@@ -164,7 +169,6 @@ class Chef
164
169
  if session_opts[:user] and
165
170
  (not session_opts[:password])
166
171
  session_opts[:password] = Chef::Config[:knife][:winrm_password] = config[:winrm_password] = get_password
167
-
168
172
  end
169
173
  end
170
174
 
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Windows
3
- VERSION = "0.8.0"
3
+ VERSION = "0.8.2.rc.0"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
@@ -56,7 +56,7 @@ describe Chef::Knife::Winrm do
56
56
  @node_bar.automatic_attrs[:fqdn] = nil
57
57
  allow(Chef::Search::Query).to receive(:new).and_return(@query)
58
58
  end
59
-
59
+
60
60
  it "should raise a specific error (KNIFE-222)" do
61
61
  expect(@knife.ui).to receive(:fatal).with(/does not have the required attribute/)
62
62
  expect(@knife).to receive(:exit).with(10)
@@ -70,7 +70,7 @@ describe Chef::Knife::Winrm do
70
70
  allow(@query).to receive(:search).and_return([[@node_foo, @node_bar]])
71
71
  allow(Chef::Search::Query).to receive(:new).and_return(@query)
72
72
  end
73
-
73
+
74
74
  it "should use nested attributes (KNIFE-276)" do
75
75
  @knife.config[:attribute] = "ec2.public_hostname"
76
76
  allow(@knife).to receive(:session_from_list)
@@ -170,20 +170,41 @@ describe Chef::Knife::Winrm do
170
170
  end
171
171
 
172
172
  it "should have winrm opts transport set to sspinegotiate for windows" do
173
+ @winrm.config[:winrm_user] = "domain\\testuser"
173
174
  allow(Chef::Platform).to receive(:windows?).and_return(true)
174
175
  allow(@winrm).to receive(:require).with('winrm-s').and_return(true)
175
-
176
- expect(@winrm.session).to receive(:use).with("localhost", {:user=>"testuser", :password=>"testpassword", :port=>nil, :operation_timeout=>1800, :basic_auth_only=>true, :transport=>:sspinegotiate, :disable_sspi=>false})
176
+ expect(@winrm.session).to receive(:use).with("localhost", {:user=>"domain\\testuser", :password=>"testpassword", :port=>nil, :operation_timeout=>1800, :basic_auth_only=>false, :transport=>:sspinegotiate, :disable_sspi=>false})
177
177
  exit_code = @winrm.run
178
178
  end
179
179
 
180
- it "should have winrm monkey patched for windows" do
180
+ it "should use the winrm monkey patch for windows" do
181
+ @winrm.config[:winrm_user] = "domain\\testuser"
181
182
  allow(Chef::Platform).to receive(:windows?).and_return(true)
182
183
  expect(@winrm).to receive(:require).with('winrm-s')
183
184
 
184
185
  exit_code = @winrm.run
185
186
  end
186
187
 
188
+ context "when domain name not given" do
189
+ it "should skip winrm monkey patch for windows" do
190
+ @winrm.config[:winrm_user] = "testuser"
191
+ allow(Chef::Platform).to receive(:windows?).and_return(true)
192
+ expect(@winrm).to_not receive(:require).with('winrm-s')
193
+
194
+ exit_code = @winrm.run
195
+ end
196
+ end
197
+
198
+ context "when local domain name given" do
199
+ it "should use the winrm monkey patch for windows" do
200
+ @winrm.config[:winrm_user] = ".\\testuser"
201
+ allow(Chef::Platform).to receive(:windows?).and_return(true)
202
+ expect(@winrm).to receive(:require).with('winrm-s')
203
+
204
+ exit_code = @winrm.run
205
+ end
206
+ end
207
+
187
208
  it "should not have winrm opts transport set to sspinegotiate for unix" do
188
209
  allow(Chef::Platform).to receive(:windows?).and_return(false)
189
210
 
@@ -195,4 +216,4 @@ describe Chef::Knife::Winrm do
195
216
  end
196
217
  end
197
218
  end
198
- end
219
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-windows
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.2.rc.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Chisamore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-06 00:00:00.000000000 Z
11
+ date: 2014-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: winrm-s
@@ -102,9 +102,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
102
  version: 1.9.1
103
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - ! '>='
105
+ - - ! '>'
106
106
  - !ruby/object:Gem::Version
107
- version: '0'
107
+ version: 1.3.1
108
108
  requirements: []
109
109
  rubyforge_project:
110
110
  rubygems_version: 2.1.11