inspec 1.31.1 → 1.32.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bde0ae439f6b243b79718378e46563a6dad1cc5f
4
- data.tar.gz: ff5c267161334e1282bd2768da752ad8c5964ccf
3
+ metadata.gz: 948ae149c470a8f1cae9771d186aa19b58f87915
4
+ data.tar.gz: f808ef05e4b43f5ec1641587208921bed0c4cbbc
5
5
  SHA512:
6
- metadata.gz: 77fa982b37b5cfe3d0fca7e44c4400159c0465e583cfd1e11e132cc1c9a62089ff5c06fefe66252303e08e65dfc59d34cf5a525f029fbfda1e9f0283671b233c
7
- data.tar.gz: e5f847ecb5ff91141c523d290bcac93ffdecd7bb90f8ac5e1f78bdba1178489f992ff528723a3a4c4a1eceaca619e966a0df40b26efb18d1d17861075859bc8c
6
+ metadata.gz: 912882be28420aa20252d1fae9339c032fcb0fd8ba43a3f02bf1be70ac186441a107997ed5baa946ca4e5372f113f9192fccfafb9e64896a1e1172626485ddb7
7
+ data.tar.gz: e4a0b2000edff96342228396a357f92efb57bf9b00dd8f3f574222c52ff92c53e71444ec10315d013043c2403e112b1dc57513de3496de29e5159e979e5b1162
@@ -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
@@ -97,9 +97,10 @@ module Inspec
97
97
  @path = path
98
98
  @contents = {}
99
99
  @files = []
100
- ::Zip::InputStream.open(@path) do |io|
100
+ walk_zip(@path) do |io|
101
101
  while (entry = io.get_next_entry)
102
- @files.push(entry.name.sub(%r{/+$}, ''))
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
- ::Zip::InputStream.open(@path) do |io|
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
- Gem::Package::TarReader.new(Zlib::GzipReader.open(@path)) do |tar|
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
- Gem::Package::TarReader.new(Zlib::GzipReader.open(@path)) do |tar|
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
@@ -4,5 +4,5 @@
4
4
  # author: Christoph Hartmann
5
5
 
6
6
  module Inspec
7
- VERSION = '1.31.1'.freeze
7
+ VERSION = '1.32.1'.freeze
8
8
  end
@@ -148,17 +148,17 @@ module Inspec::Resources
148
148
  def resolve_with_dig(hostname)
149
149
  addresses = []
150
150
 
151
- # look for IPv6 addresses
152
- cmd = inspec.command("dig +short AAAA #{hostname}")
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::IPv6::Regex)
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 IPv4 addresses
159
- cmd = inspec.command("dig +short A #{hostname}")
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::IPv4::Regex)
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
- # TODO: we rely on getent hosts for now, but it prefers to return IPv6, only then IPv4
170
- cmd = inspec.command("getent hosts #{hostname}")
171
- return nil if cmd.exit_status.to_i != 0
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
- # extract ip adress
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
- inspec.command('dig').exist? ? resolve_with_dig(hostname) : resolve_with_getent(hostname)
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 -S #{@socket} -e \"#{escaped_query}\""
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
@@ -211,7 +211,7 @@ module XinetdParser
211
211
  res = {}
212
212
  cur_group = nil
213
213
  simple_conf = []
214
- rest = raw
214
+ rest = raw + "\n"
215
215
  until rest.empty?
216
216
  # extract content line
217
217
  nl = rest.index("\n") || (rest.length-1)
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.31.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-07-06 00:00:00.000000000 Z
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