winrm 1.8.0 → 1.8.1

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b3888d1c74753ca3c7f99f8b122d2f51783a798
4
- data.tar.gz: ae7a25622013aeac39f158e7a334b09bac11c0e6
3
+ metadata.gz: 0b3159eb24cc6e87747e3ac2572ace61f33c49a7
4
+ data.tar.gz: 5b7a5fd51836a9cb57981e3409949c51b94eca53
5
5
  SHA512:
6
- metadata.gz: 3770a27858e89944a0469a05990573edf9791f9eae24e73324ecf3a82c43095d30887bbbc1877371d2f15cdfbccbcb5266d94fae73bee089ec0a95c8cb6e718e
7
- data.tar.gz: 58b89418571027756d11655b2ec8e56263d05bd66edc4e29c3f4e3e82d767bc39e142f823ddd90e9a4945f590d6e55481409d23b657e5a4c1d43c481775f25ef
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')
@@ -1,5 +1,8 @@
1
1
  # WinRM Gem Changelog
2
2
 
3
+ # 1.8.1
4
+ - Http receive timeout should always be equal to 10 seconds greater than the winrm operation timeout and not default to one hour
5
+
3
6
  # 1.8.0
4
7
  - Add certificate authentication
5
8
 
@@ -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
 
@@ -3,5 +3,5 @@
3
3
  # WinRM module
4
4
  module WinRM
5
5
  # The version of the WinRM library
6
- VERSION = '1.8.0'
6
+ VERSION = '1.8.1'
7
7
  end
@@ -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 = 'PT60S'
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
- rescue NoMethodError => e
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
- resp = send_message(builder.target!)
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
- resp = send_message(builder.target!)
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
- resp = send_message(builder.target!)
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, v2).each do |winrm_version|
6
- let(:soap_fault) { File.read("spec/stubs/responses/soap_fault_#{winrm_version}.xml") }
7
- let(:open_shell) { File.read("spec/stubs/responses/open_shell_#{winrm_version}.xml") }
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
- describe "successful 200 #{winrm_version} response" do
10
- it 'returns an xml doc' do
11
- handler = WinRM::ResponseHandler.new(open_shell, 200)
12
- xml_doc = handler.parse_to_xml
13
- expect(xml_doc).to be_instance_of(REXML::Document)
14
- expect(xml_doc.to_s).to eq(REXML::Document.new(open_shell).to_s)
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
- describe "failed 500 #{winrm_version} response" do
19
- it 'raises a WinRMHTTPTransportError' do
20
- handler = WinRM::ResponseHandler.new('', 500)
21
- expect { handler.parse_to_xml }.to raise_error(WinRM::WinRMHTTPTransportError)
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
- describe "failed 401 #{winrm_version} response" do
26
- it 'raises a WinRMAuthorizationError' do
27
- handler = WinRM::ResponseHandler.new('', 401)
28
- expect { handler.parse_to_xml }.to raise_error(WinRM::WinRMAuthorizationError)
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
- describe "failed 400 #{winrm_version} response" do
33
- it 'raises a WinRMWSManFault' do
34
- handler = WinRM::ResponseHandler.new(soap_fault, 400)
35
- begin
36
- handler.parse_to_xml
37
- rescue WinRM::WinRMWSManFault => e
38
- expect(e.fault_code).to eq('2150858778')
39
- expect(e.fault_description).to include(
40
- 'The specified class does not exist in the given namespace')
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
@@ -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 3600ms' do
55
+ it 'should be 70s' do
56
56
  transportclass = subject.instance_variable_get(:@xfer)
57
- expect(transportclass.receive_timeout).to eql(3600)
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.0
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-04-27 00:00:00.000000000 Z
12
+ date: 2016-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gssapi