train-core 3.2.26 → 3.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/train/extras/command_wrapper.rb +4 -4
- data/lib/train/file/remote/unix.rb +8 -2
- data/lib/train/platforms/detect/specifications/os.rb +1 -0
- data/lib/train/transports/cisco_ios_connection.rb +3 -0
- data/lib/train/transports/ssh.rb +12 -1
- data/lib/train/transports/ssh_connection.rb +1 -1
- data/lib/train/version.rb +1 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d1528d472a38847644b9b12d7e7ebfd304e696bdfc50f7562b4b5bf387f5059
|
4
|
+
data.tar.gz: 4913341d6670668289ccc69ab4d67335d4529da28fb449a0f9fcb1dc191b571b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ab551ae2ab9e8ef40628edb76cf77f5ce0391483a2ae3aaf9ade688244817286d48bf4d92f0f3ca78e488dcf71c6783808e98a56a226df0a09867b0a281fff9
|
7
|
+
data.tar.gz: df2cc712d56b9e91239e6e10dd537b9233b0d97cfb8cb29771bb3539915f81df61523b222875791dd5dc8a9d0edbfa9f71f789cf7be74ee0164e0f504eba9c27
|
@@ -72,14 +72,14 @@ module Train::Extras
|
|
72
72
|
rawerr = "#{res.stdout} #{res.stderr}".strip
|
73
73
|
|
74
74
|
case rawerr
|
75
|
-
when
|
75
|
+
when /Sorry, try again/
|
76
76
|
["Wrong sudo password.", :bad_sudo_password]
|
77
|
-
when
|
77
|
+
when /sudo: no tty present and no askpass program specified/
|
78
78
|
["Sudo requires a password, please configure it.", :sudo_password_required]
|
79
|
-
when
|
79
|
+
when /sudo: command not found/
|
80
80
|
["Can't find sudo command. Please either install and "\
|
81
81
|
"configure it on the target or deactivate sudo.", :sudo_command_not_found]
|
82
|
-
when
|
82
|
+
when /sudo: sorry, you must have a tty to run sudo/
|
83
83
|
["Sudo requires a TTY. Please see the README on how to configure "\
|
84
84
|
"sudo to allow for non-interactive usage.", :sudo_no_tty]
|
85
85
|
else
|
@@ -22,8 +22,14 @@ module Train
|
|
22
22
|
def exist?
|
23
23
|
@exist ||= begin
|
24
24
|
f = @follow_symlink ? "" : " || test -L #{@spath}"
|
25
|
-
@backend.
|
26
|
-
|
25
|
+
if @backend.platform.solaris?
|
26
|
+
# Solaris does not support `-e` flag in default `test`,
|
27
|
+
# so we specify by running /usr/bin/test:
|
28
|
+
# https://github.com/inspec/train/issues/587
|
29
|
+
@backend.run_command("/usr/bin/test -e #{@spath}" + f)
|
30
|
+
else
|
31
|
+
@backend.run_command("test -e #{@spath}" + f)
|
32
|
+
end.exit_status == 0
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|
@@ -369,6 +369,7 @@ module Train::Platforms::Detect::Specifications
|
|
369
369
|
declare_bsd("freebsd", "Freebsd", "bsd", /freebsd/i)
|
370
370
|
declare_bsd("openbsd", "Openbsd", "bsd", /openbsd/i)
|
371
371
|
declare_bsd("netbsd", "Netbsd", "bsd", /netbsd/i)
|
372
|
+
declare_bsd("dragonflybsd", "Dragonflybsd", "bsd", /dragonfly/i)
|
372
373
|
end
|
373
374
|
|
374
375
|
def self.load_other
|
@@ -16,6 +16,9 @@ class Train::Transports::SSH
|
|
16
16
|
# Use all options left that are not `nil` for `Net::SSH.start` later
|
17
17
|
@ssh_options = options.reject { |_key, value| value.nil? }
|
18
18
|
|
19
|
+
# Allow older algorithms
|
20
|
+
@ssh_options[:append_all_supported_algorithms] = true
|
21
|
+
|
19
22
|
@prompt = /^\S+[>#]\r\n.*$/
|
20
23
|
end
|
21
24
|
|
data/lib/train/transports/ssh.rb
CHANGED
@@ -65,6 +65,9 @@ module Train::Transports
|
|
65
65
|
option :non_interactive, default: false
|
66
66
|
option :verify_host_key, default: false
|
67
67
|
|
68
|
+
# Allow connecting with older algorithms
|
69
|
+
option :append_all_supported_algorithms, default: true
|
70
|
+
|
68
71
|
option :compression_level do |opts|
|
69
72
|
# on nil or false: set compression level to 0
|
70
73
|
opts[:compression] ? 6 : 0
|
@@ -76,7 +79,7 @@ module Train::Transports
|
|
76
79
|
validate_options(opts)
|
77
80
|
conn_opts = connection_options(opts)
|
78
81
|
|
79
|
-
if defined?(@connection) &&
|
82
|
+
if defined?(@connection) && reusable_connection?(conn_opts)
|
80
83
|
reuse_connection(&block)
|
81
84
|
else
|
82
85
|
create_new_connection(conn_opts, &block)
|
@@ -85,6 +88,13 @@ module Train::Transports
|
|
85
88
|
|
86
89
|
private
|
87
90
|
|
91
|
+
def reusable_connection?(conn_opts)
|
92
|
+
return false unless @connection_options
|
93
|
+
|
94
|
+
# Do requested options match their current settings
|
95
|
+
@connection_options.all? { |k, v| conn_opts[k] == v }
|
96
|
+
end
|
97
|
+
|
88
98
|
def validate_options(options)
|
89
99
|
super(options)
|
90
100
|
|
@@ -167,6 +177,7 @@ module Train::Transports
|
|
167
177
|
bastion_user: opts[:bastion_user],
|
168
178
|
bastion_port: opts[:bastion_port],
|
169
179
|
non_interactive: opts[:non_interactive],
|
180
|
+
append_all_supported_algorithms: opts[:append_all_supported_algorithms],
|
170
181
|
transport_options: opts,
|
171
182
|
}
|
172
183
|
# disable host key verification. The hash key and value to use
|
@@ -54,7 +54,7 @@ class Train::Transports::SSH
|
|
54
54
|
@bastion_user = @options.delete(:bastion_user)
|
55
55
|
@bastion_port = @options.delete(:bastion_port)
|
56
56
|
|
57
|
-
@cmd_wrapper
|
57
|
+
@cmd_wrapper = CommandWrapper.load(self, @transport_options)
|
58
58
|
end
|
59
59
|
|
60
60
|
# (see Base::Connection#close)
|
data/lib/train/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: train-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef InSpec Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ffi
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "!="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.13.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "!="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.13.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: json
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +87,7 @@ dependencies:
|
|
73
87
|
version: '1.2'
|
74
88
|
- - "<"
|
75
89
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
90
|
+
version: '4.0'
|
77
91
|
type: :runtime
|
78
92
|
prerelease: false
|
79
93
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -83,7 +97,7 @@ dependencies:
|
|
83
97
|
version: '1.2'
|
84
98
|
- - "<"
|
85
99
|
- !ruby/object:Gem::Version
|
86
|
-
version: '
|
100
|
+
version: '4.0'
|
87
101
|
- !ruby/object:Gem::Dependency
|
88
102
|
name: net-ssh
|
89
103
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,7 +107,7 @@ dependencies:
|
|
93
107
|
version: '2.9'
|
94
108
|
- - "<"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
110
|
+
version: '7.0'
|
97
111
|
type: :runtime
|
98
112
|
prerelease: false
|
99
113
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -103,7 +117,7 @@ dependencies:
|
|
103
117
|
version: '2.9'
|
104
118
|
- - "<"
|
105
119
|
- !ruby/object:Gem::Version
|
106
|
-
version: '
|
120
|
+
version: '7.0'
|
107
121
|
description: A minimal Train with a backends for ssh and winrm.
|
108
122
|
email:
|
109
123
|
- inspec@chef.io
|