forked from OpenVoxProject/openbolt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwinrm.rb
More file actions
63 lines (55 loc) · 1.55 KB
/
winrm.rb
File metadata and controls
63 lines (55 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# frozen_string_literal: true
require_relative '../../../bolt/error'
require_relative '../../../bolt/config/transport/base'
module Bolt
class Config
module Transport
class WinRM < Base
OPTIONS = %w[
basic-auth-only
cacert
cleanup
connect-timeout
extensions
file-protocol
host
interpreters
password
port
realm
smb-port
ssl
ssl-verify
tmpdir
user
].freeze
DEFAULTS = {
"basic-auth-only" => false,
"cleanup" => true,
"connect-timeout" => 10,
"ssl" => true,
"ssl-verify" => true,
"file-protocol" => "winrm"
}.freeze
private def validate
super
if @config['ssl']
if @config['file-protocol'] == 'smb'
raise Bolt::ValidationError, "SMB file transfers are not allowed with SSL enabled"
end
if @config['cacert']
@config['cacert'] = File.expand_path(@config['cacert'], @project)
Bolt::Util.validate_file('cacert', @config['cacert'])
end
end
if !@config['ssl'] && @config['basic-auth-only']
raise Bolt::ValidationError, "Basic auth is only allowed when using SSL"
end
if @config['interpreters']
@config['interpreters'] = normalize_interpreters(@config['interpreters'])
end
end
end
end
end
end