winrm 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/winrm/http/transport.rb +15 -0
- data/lib/winrm.rb +6 -0
- data/winrm.gemspec +1 -0
- metadata +70 -63
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
data/lib/winrm/http/transport.rb
CHANGED
@@ -12,6 +12,7 @@ module WinRM
|
|
12
12
|
@endpoint = endpoint.is_a?(String) ? URI.parse(endpoint) : endpoint
|
13
13
|
@httpcli = HTTPClient.new(:agent_name => 'Ruby WinRM Client')
|
14
14
|
@httpcli.receive_timeout = 3600 # Set this to an unreasonable amount for now because WinRM has timeouts
|
15
|
+
@logger = Logging.logger[self]
|
15
16
|
end
|
16
17
|
|
17
18
|
def send_request(message)
|
@@ -35,12 +36,19 @@ module WinRM
|
|
35
36
|
auths = @httpcli.www_auth.instance_variable_get('@authenticator')
|
36
37
|
auths.delete_if {|i| i.scheme !~ /basic/i}
|
37
38
|
end
|
39
|
+
|
40
|
+
# Disable SSPI Auth
|
41
|
+
def no_sspi_auth!
|
42
|
+
auths = @httpcli.www_auth.instance_variable_get('@authenticator')
|
43
|
+
auths.delete_if {|i| i.is_a? HTTPClient::SSPINegotiateAuth }
|
44
|
+
end
|
38
45
|
end
|
39
46
|
|
40
47
|
class HttpPlaintext < HttpTransport
|
41
48
|
def initialize(endpoint, user, pass, opts)
|
42
49
|
super(endpoint)
|
43
50
|
@httpcli.set_auth(nil, user, pass)
|
51
|
+
no_sspi_auth! if opts[:disable_sspi]
|
44
52
|
basic_auth_only! if opts[:basic_auth_only]
|
45
53
|
end
|
46
54
|
end
|
@@ -51,6 +59,7 @@ module WinRM
|
|
51
59
|
super(endpoint)
|
52
60
|
@httpcli.set_auth(endpoint, user, pass)
|
53
61
|
@httpcli.ssl_config.set_trust_ca(ca_trust_path) unless ca_trust_path.nil?
|
62
|
+
no_sspi_auth! if opts[:disable_sspi]
|
54
63
|
basic_auth_only! if opts[:basic_auth_only]
|
55
64
|
end
|
56
65
|
end
|
@@ -102,6 +111,7 @@ Content-Type: application/octet-stream\r
|
|
102
111
|
|
103
112
|
|
104
113
|
def init_krb
|
114
|
+
@logger.debug "Initializing Kerberos for #{@service}"
|
105
115
|
@gsscli = GSSAPI::Simple.new(@endpoint.host, @service)
|
106
116
|
token = @gsscli.init_context
|
107
117
|
auth = Base64.strict_encode64 token
|
@@ -110,6 +120,7 @@ Content-Type: application/octet-stream\r
|
|
110
120
|
"Connection" => "Keep-Alive",
|
111
121
|
"Content-Type" => "application/soap+xml;charset=UTF-8"
|
112
122
|
}
|
123
|
+
@logger.debug "Sending HTTP POST for Kerberos Authentication"
|
113
124
|
r = @httpcli.post(@endpoint, '', hdr)
|
114
125
|
itok = r.header["WWW-Authenticate"].pop
|
115
126
|
itok = itok.split.last
|
@@ -119,6 +130,7 @@ Content-Type: application/octet-stream\r
|
|
119
130
|
|
120
131
|
# @return [String] the encrypted request string
|
121
132
|
def winrm_encrypt(str)
|
133
|
+
@logger.debug "Encrypting SOAP message:\n#{str}"
|
122
134
|
iov_cnt = 3
|
123
135
|
iov = FFI::MemoryPointer.new(GSSAPI::LibGSSAPI::GssIOVBufferDesc.size * iov_cnt)
|
124
136
|
|
@@ -148,6 +160,7 @@ Content-Type: application/octet-stream\r
|
|
148
160
|
|
149
161
|
# @return [String] the unencrypted response string
|
150
162
|
def winrm_decrypt(str)
|
163
|
+
@logger.debug "Decrypting SOAP message:\n#{str}"
|
151
164
|
iov_cnt = 3
|
152
165
|
iov = FFI::MemoryPointer.new(GSSAPI::LibGSSAPI::GssIOVBufferDesc.size * iov_cnt)
|
153
166
|
|
@@ -176,6 +189,8 @@ Content-Type: application/octet-stream\r
|
|
176
189
|
|
177
190
|
maj_stat = GSSAPI::LibGSSAPI.gss_unwrap_iov(min_stat, @gsscli.context, conf_state, qop_state, iov, iov_cnt)
|
178
191
|
|
192
|
+
@logger.debug "SOAP message decrypted (MAJ: #{maj_stat}, MIN: #{min_stat.read_int}):\n#{iov1[:buffer].value}"
|
193
|
+
|
179
194
|
Nokogiri::XML(iov1[:buffer].value)
|
180
195
|
end
|
181
196
|
|
data/lib/winrm.rb
CHANGED
@@ -21,6 +21,12 @@
|
|
21
21
|
# We only what one instance of this class so include Singleton
|
22
22
|
require 'date'
|
23
23
|
require 'kconv' if(RUBY_VERSION.start_with? '1.9') # bug in rubyntlm with ruby 1.9.x
|
24
|
+
require 'logging'
|
25
|
+
|
26
|
+
module WinRM
|
27
|
+
Logging.logger.root.level = :info
|
28
|
+
Logging.logger.root.appenders = Logging.appenders.stdout
|
29
|
+
end
|
24
30
|
|
25
31
|
require 'winrm/helpers/iso8601_duration'
|
26
32
|
require 'winrm/soap_provider'
|
data/winrm.gemspec
CHANGED
metadata
CHANGED
@@ -1,93 +1,103 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: winrm
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.5
|
4
5
|
prerelease:
|
5
|
-
version: 1.0.4
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Dan Wanek
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-02-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: gssapi
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &13630060 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
18
|
+
requirements:
|
21
19
|
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
20
|
+
- !ruby/object:Gem::Version
|
23
21
|
version: 1.0.0
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: nokogiri
|
28
23
|
prerelease: false
|
29
|
-
|
24
|
+
version_requirements: *13630060
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: nokogiri
|
27
|
+
requirement: &13629380 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
29
|
+
requirements:
|
32
30
|
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
31
|
+
- !ruby/object:Gem::Version
|
34
32
|
version: 1.4.4
|
35
33
|
type: :runtime
|
36
|
-
version_requirements: *id002
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: httpclient
|
39
34
|
prerelease: false
|
40
|
-
|
35
|
+
version_requirements: *13629380
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: httpclient
|
38
|
+
requirement: &13628760 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
40
|
+
requirements:
|
43
41
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
42
|
+
- !ruby/object:Gem::Version
|
45
43
|
version: 2.2.0.2
|
46
44
|
type: :runtime
|
47
|
-
version_requirements: *id003
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: rubyntlm
|
50
45
|
prerelease: false
|
51
|
-
|
46
|
+
version_requirements: *13628760
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rubyntlm
|
49
|
+
requirement: &13627940 !ruby/object:Gem::Requirement
|
52
50
|
none: false
|
53
|
-
requirements:
|
51
|
+
requirements:
|
54
52
|
- - ~>
|
55
|
-
- !ruby/object:Gem::Version
|
53
|
+
- !ruby/object:Gem::Version
|
56
54
|
version: 0.1.1
|
57
55
|
type: :runtime
|
58
|
-
version_requirements: *id004
|
59
|
-
- !ruby/object:Gem::Dependency
|
60
|
-
name: uuidtools
|
61
56
|
prerelease: false
|
62
|
-
|
57
|
+
version_requirements: *13627940
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: uuidtools
|
60
|
+
requirement: &13627460 !ruby/object:Gem::Requirement
|
63
61
|
none: false
|
64
|
-
requirements:
|
62
|
+
requirements:
|
65
63
|
- - ~>
|
66
|
-
- !ruby/object:Gem::Version
|
64
|
+
- !ruby/object:Gem::Version
|
67
65
|
version: 2.1.2
|
68
66
|
type: :runtime
|
69
|
-
version_requirements: *id005
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: savon
|
72
67
|
prerelease: false
|
73
|
-
|
68
|
+
version_requirements: *13627460
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: savon
|
71
|
+
requirement: &13626900 !ruby/object:Gem::Requirement
|
74
72
|
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
73
|
+
requirements:
|
74
|
+
- - =
|
75
|
+
- !ruby/object:Gem::Version
|
78
76
|
version: 0.9.5
|
79
77
|
type: :runtime
|
80
|
-
|
81
|
-
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *13626900
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: logging
|
82
|
+
requirement: &13626200 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.6.1
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *13626200
|
91
|
+
description: ! ' Ruby library for Windows Remote Management
|
92
|
+
|
93
|
+
'
|
82
94
|
email: dan.wanek@gmail.com
|
83
95
|
executables: []
|
84
|
-
|
85
96
|
extensions: []
|
86
|
-
|
87
|
-
extra_rdoc_files:
|
97
|
+
extra_rdoc_files:
|
88
98
|
- README
|
89
99
|
- COPYING.txt
|
90
|
-
files:
|
100
|
+
files:
|
91
101
|
- .gitignore
|
92
102
|
- COPYING.txt
|
93
103
|
- README
|
@@ -110,33 +120,30 @@ files:
|
|
110
120
|
- winrm.gemspec
|
111
121
|
homepage: http://github.com/zenchild/WinRM
|
112
122
|
licenses: []
|
113
|
-
|
114
123
|
post_install_message:
|
115
|
-
rdoc_options:
|
124
|
+
rdoc_options:
|
116
125
|
- -x
|
117
126
|
- test/
|
118
127
|
- -x
|
119
128
|
- examples/
|
120
|
-
require_paths:
|
129
|
+
require_paths:
|
121
130
|
- lib
|
122
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
132
|
none: false
|
124
|
-
requirements:
|
125
|
-
- -
|
126
|
-
- !ruby/object:Gem::Version
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
127
136
|
version: 1.9.0
|
128
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
138
|
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version:
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
134
143
|
requirements: []
|
135
|
-
|
136
144
|
rubyforge_project:
|
137
145
|
rubygems_version: 1.8.10
|
138
146
|
signing_key:
|
139
147
|
specification_version: 3
|
140
148
|
summary: Ruby library for Windows Remote Management
|
141
149
|
test_files: []
|
142
|
-
|