inspec 1.31.1 → 1.32.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 +4 -4
- data/CHANGELOG.md +27 -5
- data/Rakefile +1 -1
- data/lib/inspec/file_provider.rb +15 -6
- data/lib/inspec/version.rb +1 -1
- data/lib/resources/host.rb +25 -13
- data/lib/resources/mysql_session.rb +1 -1
- data/lib/source_readers/inspec.rb +3 -3
- data/lib/utils/parser.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 948ae149c470a8f1cae9771d186aa19b58f87915
|
4
|
+
data.tar.gz: f808ef05e4b43f5ec1641587208921bed0c4cbbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 912882be28420aa20252d1fae9339c032fcb0fd8ba43a3f02bf1be70ac186441a107997ed5baa946ca4e5372f113f9192fccfafb9e64896a1e1172626485ddb7
|
7
|
+
data.tar.gz: e4a0b2000edff96342228396a357f92efb57bf9b00dd8f3f574222c52ff92c53e71444ec10315d013043c2403e112b1dc57513de3496de29e5159e979e5b1162
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,31 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
<!-- latest_release -->
|
4
|
+
## [v1.32.1](https://github.com/chef/inspec/tree/v1.32.1) (2017-08-03)
|
5
|
+
|
6
|
+
#### Merged Pull Requests
|
7
|
+
- Prep for 1.32.0 release [#2046](https://github.com/chef/inspec/pull/2046) ([adamleff](https://github.com/adamleff))
|
8
|
+
<!-- latest_release -->
|
9
|
+
|
10
|
+
<!-- release_rollup since=1.32.1 -->
|
11
|
+
### Changes since 1.32.1 release
|
12
|
+
<!-- release_rollup -->
|
13
|
+
|
14
|
+
<!-- latest_stable_release -->
|
15
|
+
## [v1.32.1](https://github.com/chef/inspec/tree/v1.32.1) (2017-08-03)
|
16
|
+
|
17
|
+
#### Merged Pull Requests
|
18
|
+
- bug fix: properly support profile files that are more than one directory deep
|
19
|
+
- bug fix: fix mysql_session resource to not use socket for host target
|
20
|
+
- host resource now properly handles localhost lookup
|
21
|
+
- bugfix: empty file strings from archive readers [#2027](https://github.com/chef/inspec/pull/2027) ([arlimus](https://github.com/arlimus))
|
22
|
+
- Fix issue when xinetd.conf does not end in newline [#2040](https://github.com/chef/inspec/pull/2040) ([kareiva](https://github.com/kareiva))
|
23
|
+
- catch newline issues in xinet.d [#2043](https://github.com/chef/inspec/pull/2043) ([arlimus](https://github.com/arlimus))
|
24
|
+
- Prep for 1.32.0 release [#2046](https://github.com/chef/inspec/pull/2046) ([adamleff](https://github.com/adamleff))
|
25
|
+
<!-- latest_stable_release -->
|
26
|
+
|
27
|
+
|
28
|
+
|
3
29
|
## [v1.31.1](https://github.com/chef/inspec/tree/v1.31.1) (2017-07-06)
|
4
30
|
[Full Changelog](https://github.com/chef/inspec/compare/v1.31.0...v1.31.1)
|
5
31
|
|
@@ -181,8 +207,4 @@
|
|
181
207
|
[Full Changelog](https://github.com/chef/inspec/compare/v1.21.0...v1.22.0)
|
182
208
|
|
183
209
|
## [v1.21.0](https://github.com/chef/inspec/tree/v1.21.0) (2017-04-24)
|
184
|
-
[Full Changelog](https://github.com/chef/inspec/compare/v1.20.0...v1.21.0)
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
210
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v1.20.0...v1.21.0)
|
data/Rakefile
CHANGED
@@ -176,7 +176,7 @@ task :release_habitat do
|
|
176
176
|
end
|
177
177
|
cmd = "echo #{version} > ./habitat/VERSION && "\
|
178
178
|
"hab pkg build . && " \
|
179
|
-
"hab pkg upload ./results/*.hart"
|
179
|
+
"hab pkg upload ./results/*.hart --channel stable"
|
180
180
|
puts "--> #{cmd}"
|
181
181
|
sh('sh', '-c', cmd)
|
182
182
|
end
|
data/lib/inspec/file_provider.rb
CHANGED
@@ -97,9 +97,10 @@ module Inspec
|
|
97
97
|
@path = path
|
98
98
|
@contents = {}
|
99
99
|
@files = []
|
100
|
-
|
100
|
+
walk_zip(@path) do |io|
|
101
101
|
while (entry = io.get_next_entry)
|
102
|
-
|
102
|
+
name = entry.name.sub(%r{/+$}, '')
|
103
|
+
@files.push(name) unless name.empty?
|
103
104
|
end
|
104
105
|
end
|
105
106
|
end
|
@@ -110,10 +111,14 @@ module Inspec
|
|
110
111
|
|
111
112
|
private
|
112
113
|
|
114
|
+
def walk_zip(path, &callback)
|
115
|
+
::Zip::InputStream.open(path, &callback)
|
116
|
+
end
|
117
|
+
|
113
118
|
def read_from_zip(file)
|
114
119
|
return nil unless @files.include?(file)
|
115
120
|
res = nil
|
116
|
-
|
121
|
+
walk_zip(@path) do |io|
|
117
122
|
while (entry = io.get_next_entry)
|
118
123
|
next unless file == entry.name
|
119
124
|
res = io.read
|
@@ -131,8 +136,8 @@ module Inspec
|
|
131
136
|
@path = path
|
132
137
|
@contents = {}
|
133
138
|
@files = []
|
134
|
-
|
135
|
-
@files = tar.map(&:full_name)
|
139
|
+
walk_tar(@path) do |tar|
|
140
|
+
@files = tar.map(&:full_name).find_all { |x| !x.empty? }
|
136
141
|
end
|
137
142
|
end
|
138
143
|
|
@@ -142,11 +147,15 @@ module Inspec
|
|
142
147
|
|
143
148
|
private
|
144
149
|
|
150
|
+
def walk_tar(path, &callback)
|
151
|
+
Gem::Package::TarReader.new(Zlib::GzipReader.open(path), &callback)
|
152
|
+
end
|
153
|
+
|
145
154
|
def read_from_tar(file)
|
146
155
|
return nil unless @files.include?(file)
|
147
156
|
res = nil
|
148
157
|
# NB `TarReader` includes `Enumerable` beginning with Ruby 2.x
|
149
|
-
|
158
|
+
walk_tar(@path) do |tar|
|
150
159
|
tar.each do |entry|
|
151
160
|
next unless entry.file? && file == entry.full_name
|
152
161
|
res = entry.read
|
data/lib/inspec/version.rb
CHANGED
data/lib/resources/host.rb
CHANGED
@@ -148,17 +148,17 @@ module Inspec::Resources
|
|
148
148
|
def resolve_with_dig(hostname)
|
149
149
|
addresses = []
|
150
150
|
|
151
|
-
# look for
|
152
|
-
cmd = inspec.command("dig +short
|
151
|
+
# look for IPv4 addresses
|
152
|
+
cmd = inspec.command("dig +short A #{hostname}")
|
153
153
|
cmd.stdout.lines.each do |line|
|
154
|
-
matched = line.chomp.match(Resolv::
|
154
|
+
matched = line.chomp.match(Resolv::IPv4::Regex)
|
155
155
|
addresses << matched.to_s unless matched.nil?
|
156
156
|
end
|
157
157
|
|
158
|
-
# look for
|
159
|
-
cmd = inspec.command("dig +short
|
158
|
+
# look for IPv6 addresses
|
159
|
+
cmd = inspec.command("dig +short AAAA #{hostname}")
|
160
160
|
cmd.stdout.lines.each do |line|
|
161
|
-
matched = line.chomp.match(Resolv::
|
161
|
+
matched = line.chomp.match(Resolv::IPv6::Regex)
|
162
162
|
addresses << matched.to_s unless matched.nil?
|
163
163
|
end
|
164
164
|
|
@@ -166,13 +166,25 @@ module Inspec::Resources
|
|
166
166
|
end
|
167
167
|
|
168
168
|
def resolve_with_getent(hostname)
|
169
|
-
|
170
|
-
|
171
|
-
|
169
|
+
cmd = inspec.command("getent ahosts #{hostname}")
|
170
|
+
return nil unless cmd.exit_status.to_i.zero?
|
171
|
+
|
172
|
+
# getent ahosts output is formatted like so:
|
173
|
+
# $ getent ahosts www.google.com
|
174
|
+
# 172.217.8.4 STREAM www.google.com
|
175
|
+
# 172.217.8.4 DGRAM
|
176
|
+
# 172.217.8.4 RAW
|
177
|
+
# 2607:f8b0:4004:803::2004 STREAM
|
178
|
+
# 2607:f8b0:4004:803::2004 DGRAM
|
179
|
+
# 2607:f8b0:4004:803::2004 RAW
|
180
|
+
addresses = []
|
181
|
+
cmd.stdout.lines.each do |line|
|
182
|
+
ip, = line.split(/\s+/, 2)
|
183
|
+
next unless ip.match(Resolv::IPv4::Regex) || ip.match(Resolv::IPv6::Regex)
|
184
|
+
addresses << ip unless addresses.include?(ip)
|
185
|
+
end
|
172
186
|
|
173
|
-
|
174
|
-
resolve = /^\s*(?<ip>\S+)\s+(.*)\s*$/.match(cmd.stdout.chomp)
|
175
|
-
[resolve[1]] if resolve
|
187
|
+
addresses
|
176
188
|
end
|
177
189
|
end
|
178
190
|
|
@@ -245,7 +257,7 @@ module Inspec::Resources
|
|
245
257
|
end
|
246
258
|
|
247
259
|
def resolve(hostname)
|
248
|
-
|
260
|
+
resolve_with_getent(hostname)
|
249
261
|
end
|
250
262
|
end
|
251
263
|
|
@@ -38,7 +38,7 @@ module Inspec::Resources
|
|
38
38
|
command += " -h #{@host}"
|
39
39
|
end
|
40
40
|
command += " --port #{@port}" unless @port.nil?
|
41
|
-
command += " #{db} -s -
|
41
|
+
command += " #{db} -s -e \"#{escaped_query}\""
|
42
42
|
|
43
43
|
cmd = inspec.command(command)
|
44
44
|
out = cmd.stdout + "\n" + cmd.stderr
|
@@ -54,21 +54,21 @@ module SourceReaders
|
|
54
54
|
tests = @target.files.find_all do |path|
|
55
55
|
path.start_with?('controls') && path.end_with?('.rb')
|
56
56
|
end
|
57
|
-
Hash[tests.map { |x| [x, @target.read(x)] }]
|
57
|
+
Hash[tests.map { |x| [x, @target.read(x)] }.delete_if { |_file, contents| contents.nil? }]
|
58
58
|
end
|
59
59
|
|
60
60
|
def load_libs
|
61
61
|
tests = @target.files.find_all do |path|
|
62
62
|
path.start_with?('libraries') && path.end_with?('.rb')
|
63
63
|
end
|
64
|
-
Hash[tests.map { |x| [x, @target.read(x)] }]
|
64
|
+
Hash[tests.map { |x| [x, @target.read(x)] }.delete_if { |_file, contents| contents.nil? }]
|
65
65
|
end
|
66
66
|
|
67
67
|
def load_data_files
|
68
68
|
files = @target.files.find_all do |path|
|
69
69
|
path.start_with?('files' + File::SEPARATOR)
|
70
70
|
end
|
71
|
-
Hash[files.map { |x| [x, @target.read(x)] }]
|
71
|
+
Hash[files.map { |x| [x, @target.read(x)] }.delete_if { |_file, contents| contents.nil? }]
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/lib/utils/parser.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.32.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Richter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: train
|
@@ -319,6 +319,7 @@ files:
|
|
319
319
|
- docs/migration.md
|
320
320
|
- docs/plugin_kitchen_inspec.md
|
321
321
|
- docs/profiles.md
|
322
|
+
- docs/resources.md
|
322
323
|
- docs/resources/apache_conf.md.erb
|
323
324
|
- docs/resources/apt.md.erb
|
324
325
|
- docs/resources/audit_policy.md.erb
|