knife-windows 0.8.0 → 0.8.2.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +4 -1
- data/DOC_CHANGES.md +13 -27
- data/RELEASE_NOTES.md +44 -26
- data/lib/chef/knife/winrm.rb +10 -6
- data/lib/knife-windows/version.rb +1 -1
- data/spec/unit/knife/winrm_spec.rb +27 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODBjZmJlOGYwMmU5MGMzY2VlYzIyNmJkODRiMjk0Mjg3NjJiYmVkMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTRlNWY5YWVkMDJiODE2YzhjMDcwNjg1ZjU1OWNmN2QzMjMyMmRiOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTc0MzA2NTc1ZmQ1MmZkMDAyYWJiNDk4NDIxYmJiZDlmNzJjYTlmYmJlMjU2
|
10
|
+
N2FjM2MyM2RlODY1ODFlMmI2NzI0MTU4NDA0MzliOTIxMDc3YzRiNDAyZTcy
|
11
|
+
NGZlOTg5OTdiNGU5ZjRmNWQxNmQ1YmVhZDVmYzdkNjQ5OGU2ODk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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/
|
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.
|
9
|
+
# knife-windows 0.8.2 doc changes
|
10
10
|
|
11
11
|
### Negotiate / NTLM authentication support
|
12
|
-
If `knife`
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
quickconfig` command
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
11
|
-
|
12
|
-
|
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
|
-
|
15
|
+
You can install the fix for this issue by upgrading to this new version using
|
16
|
+
the `gem` command:
|
15
17
|
|
16
|
-
|
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
|
-
|
20
|
+
A thank you goes to **Richard Lavey** for reporting [knife-windows #108](https://github.com/opscode/knife-windows/issues/108).
|
21
21
|
|
22
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
data/lib/chef/knife/winrm.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
|
@@ -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
|
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-
|
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:
|
107
|
+
version: 1.3.1
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
110
|
rubygems_version: 2.1.11
|