winrm 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/changelog.md +3 -0
- data/lib/winrm/http/transport.rb +0 -3
- data/lib/winrm/version.rb +1 -1
- data/lib/winrm/winrm_service.rb +6 -6
- data/spec/response_handler_spec.rb +31 -29
- data/spec/winrm_options_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b3159eb24cc6e87747e3ac2572ace61f33c49a7
|
4
|
+
data.tar.gz: 5b7a5fd51836a9cb57981e3409949c51b94eca53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cbdb867c4ef6cc8174291f270a27c2d06e5254158a826c711e6a85fcf4b15acfd0509b10b6d938f8339d691e296acc5cda7067dd9caf7e5cdba887cc05d2c23
|
7
|
+
data.tar.gz: 3ad40706cdf3183eebd038921a933fac788b27c138e54330c8430bb96edf3291e53e7c78912577569ddcbb36b0e152fc49a615877b3507bb02cede84e2bac65a
|
data/README.md
CHANGED
@@ -107,6 +107,8 @@ Perform the following steps to authenticate with a certificate instead of a user
|
|
107
107
|
|
108
108
|
5. Add a winrm user mapping for the issuing certificate: `New-Item -Path WSMan:\localhost\ClientCertificate -Subject <user UPN> -URI * -Issuer <issuing certificate thumbprint> -Credential (Get-Credential) -Force`
|
109
109
|
|
110
|
+
See [this post](http://www.hurryupandwait.io/blog/certificate-password-less-based-authentication-in-winrm) for more details on certificate authentication.
|
111
|
+
|
110
112
|
#### Kerberos
|
111
113
|
```ruby
|
112
114
|
WinRM::WinRMWebService.new(endpoint, :kerberos, :realm => 'MYREALM.COM')
|
data/changelog.md
CHANGED
data/lib/winrm/http/transport.rb
CHANGED
@@ -22,15 +22,12 @@ module WinRM
|
|
22
22
|
# This backend will maintain state for every WinRMWebService instance that is instantiated so it
|
23
23
|
# is possible to use GSSAPI with Keep-Alive.
|
24
24
|
class HttpTransport
|
25
|
-
# Set this to an unreasonable amount because WinRM has its own timeouts
|
26
|
-
DEFAULT_RECEIVE_TIMEOUT = 3600
|
27
25
|
|
28
26
|
attr_reader :endpoint
|
29
27
|
|
30
28
|
def initialize(endpoint)
|
31
29
|
@endpoint = endpoint.is_a?(String) ? URI.parse(endpoint) : endpoint
|
32
30
|
@httpcli = HTTPClient.new(agent_name: 'Ruby WinRM Client')
|
33
|
-
@httpcli.receive_timeout = DEFAULT_RECEIVE_TIMEOUT
|
34
31
|
@logger = Logging.logger[self]
|
35
32
|
end
|
36
33
|
|
data/lib/winrm/version.rb
CHANGED
data/lib/winrm/winrm_service.rb
CHANGED
@@ -25,7 +25,7 @@ module WinRM
|
|
25
25
|
# This is the main class that does the SOAP request/response logic. There are a few helper
|
26
26
|
# classes, but pretty much everything comes through here first.
|
27
27
|
class WinRMWebService
|
28
|
-
DEFAULT_TIMEOUT =
|
28
|
+
DEFAULT_TIMEOUT = 60
|
29
29
|
DEFAULT_MAX_ENV_SIZE = 153600
|
30
30
|
DEFAULT_LOCALE = 'en-US'
|
31
31
|
|
@@ -42,7 +42,6 @@ module WinRM
|
|
42
42
|
# @see WinRM::HTTP::HttpSSL
|
43
43
|
def initialize(endpoint, transport = :kerberos, opts = {})
|
44
44
|
@endpoint = endpoint
|
45
|
-
@timeout = DEFAULT_TIMEOUT
|
46
45
|
@max_env_sz = DEFAULT_MAX_ENV_SIZE
|
47
46
|
@locale = DEFAULT_LOCALE
|
48
47
|
@output_decoder = CommandOutputDecoder.new
|
@@ -50,7 +49,8 @@ module WinRM
|
|
50
49
|
configure_retries(opts)
|
51
50
|
begin
|
52
51
|
@xfer = send "init_#{transport}_transport", opts.merge({endpoint: endpoint})
|
53
|
-
|
52
|
+
set_timeout(DEFAULT_TIMEOUT)
|
53
|
+
rescue NoMethodError
|
54
54
|
raise "Invalid transport '#{transport}' specified, expected: negotiate, kerberos, plaintext, ssl."
|
55
55
|
end
|
56
56
|
end
|
@@ -227,7 +227,7 @@ module WinRM
|
|
227
227
|
env_body << Gyoku.xml(body)
|
228
228
|
end
|
229
229
|
end
|
230
|
-
|
230
|
+
send_message(builder.target!)
|
231
231
|
true
|
232
232
|
end
|
233
233
|
|
@@ -299,7 +299,7 @@ module WinRM
|
|
299
299
|
env_body.tag!("#{NS_WIN_SHELL}:Signal", {'CommandId' => command_id}) { |cl| cl << Gyoku.xml(body) }
|
300
300
|
end
|
301
301
|
end
|
302
|
-
|
302
|
+
send_message(builder.target!)
|
303
303
|
true
|
304
304
|
end
|
305
305
|
|
@@ -316,7 +316,7 @@ module WinRM
|
|
316
316
|
env.tag!('env:Body')
|
317
317
|
end
|
318
318
|
|
319
|
-
|
319
|
+
send_message(builder.target!)
|
320
320
|
logger.debug("[WinRM] remote shell #{shell_id} closed")
|
321
321
|
true
|
322
322
|
end
|
@@ -2,42 +2,44 @@
|
|
2
2
|
require 'winrm/http/response_handler'
|
3
3
|
|
4
4
|
describe 'response handler', unit: true do
|
5
|
-
%w(v1
|
6
|
-
|
7
|
-
|
5
|
+
%w(v1 v2).each do |winrm_version|
|
6
|
+
context "winrm_version #{winrm_version}" do
|
7
|
+
let(:soap_fault) { File.read("spec/stubs/responses/soap_fault_#{winrm_version}.xml") }
|
8
|
+
let(:open_shell) { File.read("spec/stubs/responses/open_shell_#{winrm_version}.xml") }
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
describe "successful 200 #{winrm_version} response" do
|
11
|
+
it 'returns an xml doc' do
|
12
|
+
handler = WinRM::ResponseHandler.new(open_shell, 200)
|
13
|
+
xml_doc = handler.parse_to_xml
|
14
|
+
expect(xml_doc).to be_instance_of(REXML::Document)
|
15
|
+
expect(xml_doc.to_s).to eq(REXML::Document.new(open_shell).to_s)
|
16
|
+
end
|
15
17
|
end
|
16
|
-
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
describe "failed 500 #{winrm_version} response" do
|
20
|
+
it 'raises a WinRMHTTPTransportError' do
|
21
|
+
handler = WinRM::ResponseHandler.new('', 500)
|
22
|
+
expect { handler.parse_to_xml }.to raise_error(WinRM::WinRMHTTPTransportError)
|
23
|
+
end
|
22
24
|
end
|
23
|
-
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
describe "failed 401 #{winrm_version} response" do
|
27
|
+
it 'raises a WinRMAuthorizationError' do
|
28
|
+
handler = WinRM::ResponseHandler.new('', 401)
|
29
|
+
expect { handler.parse_to_xml }.to raise_error(WinRM::WinRMAuthorizationError)
|
30
|
+
end
|
29
31
|
end
|
30
|
-
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
describe "failed 400 #{winrm_version} response" do
|
34
|
+
it 'raises a WinRMWSManFault' do
|
35
|
+
handler = WinRM::ResponseHandler.new(soap_fault, 400)
|
36
|
+
begin
|
37
|
+
handler.parse_to_xml
|
38
|
+
rescue WinRM::WinRMWSManFault => e
|
39
|
+
expect(e.fault_code).to eq('2150858778')
|
40
|
+
expect(e.fault_description).to include(
|
41
|
+
'The specified class does not exist in the given namespace')
|
42
|
+
end
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
data/spec/winrm_options_spec.rb
CHANGED
@@ -52,9 +52,9 @@ describe 'WinRM options', unit: true do
|
|
52
52
|
|
53
53
|
context 'default' do
|
54
54
|
describe '#receive_timeout' do
|
55
|
-
it 'should be
|
55
|
+
it 'should be 70s' do
|
56
56
|
transportclass = subject.instance_variable_get(:@xfer)
|
57
|
-
expect(transportclass.receive_timeout).to eql(
|
57
|
+
expect(transportclass.receive_timeout).to eql(70)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
describe '#timeout' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: winrm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Wanek
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gssapi
|