inspec 4.18.24 → 4.18.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/etc/deprecations.json +4 -0
- data/inspec.gemspec +0 -1
- data/lib/inspec/cli.rb +2 -2
- data/lib/inspec/config.rb +2 -1
- data/lib/inspec/dependencies/requirement.rb +10 -6
- data/lib/inspec/describe_base.rb +25 -0
- data/lib/inspec/file_provider.rb +7 -1
- data/lib/inspec/input_dsl_helpers.rb +26 -0
- data/lib/inspec/input_registry.rb +6 -6
- data/lib/inspec/metadata.rb +6 -2
- data/lib/inspec/method_source.rb +1 -1
- data/lib/inspec/objects/control.rb +7 -0
- data/lib/inspec/objects/describe.rb +7 -0
- data/lib/inspec/objects/each_loop.rb +7 -0
- data/lib/inspec/objects/input.rb +4 -0
- data/lib/inspec/objects/or_test.rb +7 -0
- data/lib/inspec/objects/tag.rb +7 -0
- data/lib/inspec/objects/test.rb +8 -1
- data/lib/inspec/objects/value.rb +7 -0
- data/lib/inspec/plugin/v2/installer.rb +9 -4
- data/lib/inspec/resource.rb +2 -0
- data/lib/inspec/resources/apt.rb +1 -1
- data/lib/inspec/resources/auditd.rb +4 -4
- data/lib/inspec/resources/command.rb +1 -1
- data/lib/inspec/resources/filesystem.rb +3 -3
- data/lib/inspec/resources/gem.rb +3 -2
- data/lib/inspec/resources/http.rb +3 -3
- data/lib/inspec/resources/npm.rb +11 -3
- data/lib/inspec/resources/oracledb_session.rb +2 -2
- data/lib/inspec/resources/package.rb +2 -4
- data/lib/inspec/resources/service.rb +2 -0
- data/lib/inspec/resources/sys_info.rb +2 -2
- data/lib/inspec/resources/users.rb +4 -0
- data/lib/inspec/rspec_extensions.rb +4 -9
- data/lib/inspec/rule.rb +6 -1
- data/lib/inspec/runner.rb +4 -4
- data/lib/inspec/version.rb +1 -1
- data/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb +1 -1
- data/lib/plugins/inspec-artifact/test/functional/inspec_artifact_test.rb +14 -10
- data/lib/plugins/inspec-habitat/test/unit/profile_test.rb +6 -6
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/fixtures/README.md +2 -2
- data/lib/plugins/inspec-init/test/functional/inspec_init_plugin_test.rb +2 -1
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/install_test.rb +1 -1
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb +1 -1
- data/lib/plugins/shared/core_plugin_test_helper.rb +9 -11
- data/lib/resource_support/aws/aws_resource_mixin.rb +1 -1
- data/lib/resources/aws/aws_billing_report.rb +1 -1
- data/lib/resources/aws/aws_cloudtrail_trail.rb +1 -1
- data/lib/resources/aws/aws_config_delivery_channel.rb +1 -1
- data/lib/resources/aws/aws_ecs_cluster.rb +2 -2
- data/lib/resources/aws/aws_eks_cluster.rb +3 -3
- data/lib/resources/aws/aws_elb.rb +2 -2
- data/lib/resources/aws/aws_flow_log.rb +1 -1
- data/lib/resources/aws/aws_iam_user.rb +1 -1
- data/lib/resources/aws/aws_kms_key.rb +2 -2
- data/lib/resources/aws/aws_route_table.rb +2 -2
- data/lib/resources/aws/aws_sns_subscription.rb +1 -1
- data/lib/resources/aws/aws_subnet.rb +2 -2
- data/lib/resources/aws/aws_vpc.rb +2 -2
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c6bd13128388c648c4282da23a2139a861b097ba71056355b77493f81dd09a4
|
4
|
+
data.tar.gz: fb42433c9d7feb7552edadd726c9f916cf33ecb3c4cb669487e8d5037209663a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7b4fc775a7579e52b1f50bf29c6760c1c7ec9cfe65f1fe6629665d4d12807b3dbf082eeaa6f15166b6d7e8a65d0dff4d5829961f299b1eb6131c081a6a1d954
|
7
|
+
data.tar.gz: 3f1334efc5c92a9d6cba4db27783a5218a9d298b49c61e129ba6f91b43695f4b32ec6afa711c081e2e6a02b35700f3c61ef80eef82e890ae2bce4b9eff8f9364
|
data/Gemfile
CHANGED
@@ -19,9 +19,10 @@ group :omnibus do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
group :test do
|
22
|
-
gem "chefstyle", "0.13.0"
|
22
|
+
gem "chefstyle", "~> 0.13.0"
|
23
23
|
gem "coveralls", require: false
|
24
24
|
gem "minitest", "~> 5.5"
|
25
|
+
gem "minitest-sprint", "~> 1.0"
|
25
26
|
gem "rake", ">= 10"
|
26
27
|
gem "simplecov", "~> 0.10"
|
27
28
|
gem "concurrent-ruby", "~> 1.0"
|
data/etc/deprecations.json
CHANGED
data/inspec.gemspec
CHANGED
@@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
|
|
31
31
|
|
32
32
|
# Implementation dependencies
|
33
33
|
spec.add_dependency "license-acceptance", ">= 0.2.13", "< 2.0"
|
34
|
-
spec.add_dependency "chef-core", "~> 0.0"
|
35
34
|
spec.add_dependency "thor", "~> 0.20"
|
36
35
|
spec.add_dependency "json-schema", "~> 2.8"
|
37
36
|
spec.add_dependency "method_source", "~> 0.8"
|
data/lib/inspec/cli.rb
CHANGED
@@ -122,8 +122,8 @@ class Inspec::InspecCLI < Inspec::BaseCLI
|
|
122
122
|
else
|
123
123
|
%w{location profile controls timestamp valid}.each do |item|
|
124
124
|
prepared_string = format("%-12s %s",
|
125
|
-
|
126
|
-
|
125
|
+
"#{item.to_s.capitalize} :",
|
126
|
+
result[:summary][item.to_sym])
|
127
127
|
ui.plain_line(prepared_string)
|
128
128
|
end
|
129
129
|
puts
|
data/lib/inspec/config.rb
CHANGED
@@ -207,7 +207,8 @@ module Inspec
|
|
207
207
|
end
|
208
208
|
|
209
209
|
def _utc_find_credset_name(_credentials, transport_name)
|
210
|
-
return
|
210
|
+
return unless final_options[:target]
|
211
|
+
|
211
212
|
match = final_options[:target].match(%r{^#{transport_name}://(?<credset_name>[\w\-]+)$})
|
212
213
|
match ? match[:credset_name] : nil
|
213
214
|
end
|
@@ -21,16 +21,20 @@ module Inspec
|
|
21
21
|
}
|
22
22
|
|
23
23
|
new(dep[:name],
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
dep[:version],
|
25
|
+
config,
|
26
|
+
opts.merge(dep))
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.from_lock_entry(entry, config, opts = {})
|
30
|
+
resolved_source = entry[:resolved_source]
|
31
|
+
.merge(backend: config[:backend])
|
32
|
+
.merge(opts)
|
33
|
+
|
30
34
|
req = new(entry[:name],
|
31
|
-
|
32
|
-
|
33
|
-
|
35
|
+
entry[:version_constraints],
|
36
|
+
config,
|
37
|
+
resolved_source)
|
34
38
|
|
35
39
|
locked_deps = []
|
36
40
|
Array(entry[:dependencies]).each do |dep_entry|
|
data/lib/inspec/describe_base.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
+
require "inspec/input_dsl_helpers"
|
2
|
+
|
1
3
|
module Inspec
|
2
4
|
class DescribeBase
|
5
|
+
|
6
|
+
include Inspec::InputDslHelpers
|
7
|
+
|
3
8
|
def initialize(action)
|
4
9
|
@action = action
|
5
10
|
@checks = []
|
@@ -17,6 +22,14 @@ module Inspec
|
|
17
22
|
@action.call("describe.one", @checks, nil)
|
18
23
|
end
|
19
24
|
|
25
|
+
def input(input_name, options = {})
|
26
|
+
input_with_profile_id(__profile_id, input_name, options)
|
27
|
+
end
|
28
|
+
|
29
|
+
def input_object(name)
|
30
|
+
Inspec::InputRegistry.find_or_register_input(name, __profile_id)
|
31
|
+
end
|
32
|
+
|
20
33
|
def method_missing(method_name, *arguments)
|
21
34
|
Inspec::DSL.method_missing_resource(inspec, method_name, *arguments)
|
22
35
|
end
|
@@ -24,5 +37,17 @@ module Inspec
|
|
24
37
|
def describe(*args, &block)
|
25
38
|
@checks.push(["describe", args, block])
|
26
39
|
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
# While this is marked private, it gets consumed during an instance_eval,
|
44
|
+
# so it is fully visible. The double underscore is there to discourage
|
45
|
+
# use - this is a private API.
|
46
|
+
def __profile_id
|
47
|
+
# Excavate the profile ID. The action is a Method calling __add_check on
|
48
|
+
# a Rule whose profile ID we want
|
49
|
+
@action.receiver.instance_variable_get(:@__profile_id)
|
50
|
+
end
|
51
|
+
|
27
52
|
end
|
28
53
|
end
|
data/lib/inspec/file_provider.rb
CHANGED
@@ -123,6 +123,7 @@ module Inspec
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def read(file)
|
126
|
+
# TODO: this is inefficient
|
126
127
|
@contents[file] ||= read_from_zip(file)
|
127
128
|
end
|
128
129
|
|
@@ -141,6 +142,10 @@ module Inspec
|
|
141
142
|
next unless file == entry.name
|
142
143
|
|
143
144
|
res = io.read
|
145
|
+
try = res.dup
|
146
|
+
try.force_encoding Encoding::UTF_8
|
147
|
+
res = try.encode(try.encoding, universal_newline: true) if try.valid_encoding?
|
148
|
+
|
144
149
|
break
|
145
150
|
end
|
146
151
|
end
|
@@ -174,7 +179,8 @@ module Inspec
|
|
174
179
|
res = entry.read || ""
|
175
180
|
try = res.dup
|
176
181
|
try.force_encoding Encoding::UTF_8
|
177
|
-
res = try if
|
182
|
+
res = try.encode(try.encoding, universal_newline: true) if
|
183
|
+
try.valid_encoding?
|
178
184
|
res
|
179
185
|
end
|
180
186
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
require "inspec/input_registry"
|
3
|
+
|
4
|
+
module Inspec
|
5
|
+
# A mixin to provide implementations for the input() DSL methods
|
6
|
+
module InputDslHelpers
|
7
|
+
|
8
|
+
# Find or create an input, explicitly named by a profile ID and
|
9
|
+
# input name. Evaluate the input and return the value.
|
10
|
+
# @param [String] Profile ID
|
11
|
+
# @param [String] Input Name
|
12
|
+
# @param [Hash] Input options - see input docs on website
|
13
|
+
# @returns [Object] Input value
|
14
|
+
def input_with_profile_id(profile_id, input_name, options)
|
15
|
+
if options.empty?
|
16
|
+
# Simply an access, no event here
|
17
|
+
Inspec::InputRegistry.find_or_register_input(input_name, profile_id).value
|
18
|
+
else
|
19
|
+
options[:priority] = 20
|
20
|
+
options[:provider] = :inline_control_code
|
21
|
+
evt = Inspec::Input.infer_event(options)
|
22
|
+
Inspec::InputRegistry.find_or_register_input(input_name, profile_id, event: evt).value
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -208,8 +208,8 @@ module Inspec
|
|
208
208
|
data = Inspec::SecretsBackend.resolve(path)
|
209
209
|
if data.nil?
|
210
210
|
raise Inspec::Exceptions::SecretsBackendNotFound,
|
211
|
-
|
212
|
-
|
211
|
+
"Cannot find parser for inputs file '#{path}'. " \
|
212
|
+
"Check to make sure file has the appropriate extension."
|
213
213
|
end
|
214
214
|
|
215
215
|
next if data.inputs.nil?
|
@@ -230,14 +230,14 @@ module Inspec
|
|
230
230
|
def validate_inputs_file_readability!(path)
|
231
231
|
unless File.exist?(path)
|
232
232
|
raise Inspec::Exceptions::InputsFileDoesNotExist,
|
233
|
-
|
234
|
-
|
233
|
+
"Cannot find input file '#{path}'. " \
|
234
|
+
"Check to make sure file exists."
|
235
235
|
end
|
236
236
|
|
237
237
|
unless File.readable?(path)
|
238
238
|
raise Inspec::Exceptions::InputsFileNotReadable,
|
239
|
-
|
240
|
-
|
239
|
+
"Cannot read input file '#{path}'. " \
|
240
|
+
"Check to make sure file is readable."
|
241
241
|
end
|
242
242
|
|
243
243
|
true
|
data/lib/inspec/metadata.rb
CHANGED
@@ -64,6 +64,7 @@ module Inspec
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def supports_platform?(backend)
|
67
|
+
require "inspec/resources/platform" # break circularity in load
|
67
68
|
backend.platform.supported?(params[:supports])
|
68
69
|
end
|
69
70
|
|
@@ -156,9 +157,12 @@ module Inspec
|
|
156
157
|
nil
|
157
158
|
when nil then nil
|
158
159
|
else
|
159
|
-
Inspec.deprecate(
|
160
|
+
Inspec.deprecate(
|
161
|
+
:supports_syntax,
|
160
162
|
"Do not use deprecated `supports: #{x}` syntax. Instead use:\n"\
|
161
|
-
|
163
|
+
"supports:\n - os-family: #{x}\n\n"
|
164
|
+
)
|
165
|
+
|
162
166
|
{ :'os-family' => x } # rubocop:disable Style/HashSyntax
|
163
167
|
end
|
164
168
|
end
|
data/lib/inspec/method_source.rb
CHANGED
@@ -14,7 +14,7 @@ module Inspec
|
|
14
14
|
::MethodSource.expression_at(src.lines, location[:line]).force_encoding("utf-8")
|
15
15
|
rescue SyntaxError => e
|
16
16
|
raise ::MethodSource::SourceNotFoundError,
|
17
|
-
|
17
|
+
"Could not parse source at #{location[:ref]}:#{location[:line]}: #{e.message}"
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# This class is deprecated and will be removed in the next major release of InSpec.
|
2
|
+
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
3
|
+
|
4
|
+
require "inspec/utils/deprecation"
|
5
|
+
|
1
6
|
module Inspec
|
2
7
|
class Control
|
3
8
|
attr_accessor :id, :title, :descriptions, :impact, :tests, :tags, :refs, :only_if
|
@@ -6,6 +11,8 @@ module Inspec
|
|
6
11
|
@tags = []
|
7
12
|
@refs = []
|
8
13
|
@descriptions = {}
|
14
|
+
|
15
|
+
Inspec.deprecate(:object_classes, "The Inspec::Control class is deprecated. Use the Inspec::Object::Control class from the inspec-objects Ruby library.")
|
9
16
|
end
|
10
17
|
|
11
18
|
def add_test(t)
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# This class is deprecated and will be removed in the next major release of InSpec.
|
2
|
+
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
3
|
+
|
4
|
+
require "inspec/utils/deprecation"
|
5
|
+
|
1
6
|
module Inspec
|
2
7
|
class Describe
|
3
8
|
# Internal helper to structure test objects.
|
@@ -53,6 +58,8 @@ module Inspec
|
|
53
58
|
@qualifier = []
|
54
59
|
@tests = []
|
55
60
|
@variables = []
|
61
|
+
|
62
|
+
Inspec.deprecate(:object_classes, "The Inspec::Describe class is deprecated. Use the Inspec::Object::Describe class from the inspec-objects Ruby library.")
|
56
63
|
end
|
57
64
|
|
58
65
|
def add_test(its, matcher, expectation, opts = {})
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# This class is deprecated and will be removed in the next major release of InSpec.
|
2
|
+
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
3
|
+
|
4
|
+
require "inspec/utils/deprecation"
|
5
|
+
|
1
6
|
module Inspec
|
2
7
|
class EachLoop < List
|
3
8
|
attr_reader :variables
|
@@ -6,6 +11,8 @@ module Inspec
|
|
6
11
|
super
|
7
12
|
@tests = []
|
8
13
|
@variables = []
|
14
|
+
|
15
|
+
Inspec.deprecate(:object_classes, "The Inspec::EachLoop class is deprecated. Use the Inspec::Object::EachLoop class from the inspec-objects Ruby library.")
|
9
16
|
end
|
10
17
|
|
11
18
|
def add_test(t = nil)
|
data/lib/inspec/objects/input.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# This file is deprecated and will be removed in the next major release of InSpec.
|
2
|
+
# The Inspec::Input class will remain but these methods will be removed.
|
3
|
+
# Use the Inspec::Object::Input class from the inspec-objects rubygem instead.
|
4
|
+
|
1
5
|
require "inspec/input"
|
2
6
|
|
3
7
|
module Inspec
|
@@ -1,9 +1,16 @@
|
|
1
|
+
# This class is deprecated and will be removed in the next major release of InSpec.
|
2
|
+
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
3
|
+
|
4
|
+
require "inspec/utils/deprecation"
|
5
|
+
|
1
6
|
module Inspec
|
2
7
|
class OrTest
|
3
8
|
attr_reader :tests
|
4
9
|
def initialize(tests)
|
5
10
|
@tests = tests
|
6
11
|
@negated = false
|
12
|
+
|
13
|
+
Inspec.deprecate(:object_classes, "The Inspec::OrTest class is deprecated. Use the Inspec::Object::OrTest class from the inspec-objects Ruby library.")
|
7
14
|
end
|
8
15
|
|
9
16
|
def skip
|
data/lib/inspec/objects/tag.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# This class is deprecated and will be removed in the next major release of InSpec.
|
2
|
+
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
3
|
+
|
4
|
+
require "inspec/utils/deprecation"
|
5
|
+
|
1
6
|
module Inspec
|
2
7
|
class Tag
|
3
8
|
attr_accessor :key, :value
|
@@ -5,6 +10,8 @@ module Inspec
|
|
5
10
|
def initialize(key, value)
|
6
11
|
@key = key
|
7
12
|
@value = value
|
13
|
+
|
14
|
+
Inspec.deprecate(:object_classes, "The Inspec::Tag class is deprecated. Use the Inspec::Object::Tag class from the inspec-objects Ruby library.")
|
8
15
|
end
|
9
16
|
|
10
17
|
def to_hash
|
data/lib/inspec/objects/test.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# This class is deprecated and will be removed in the next major release of InSpec.
|
2
|
+
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
3
|
+
|
4
|
+
require "inspec/utils/deprecation"
|
5
|
+
|
1
6
|
module Inspec
|
2
7
|
class Test
|
3
8
|
attr_accessor :qualifier, :matcher, :expectation, :skip, :negated, :variables, :only_if
|
@@ -7,6 +12,8 @@ module Inspec
|
|
7
12
|
@qualifier = []
|
8
13
|
@negated = false
|
9
14
|
@variables = []
|
15
|
+
|
16
|
+
Inspec.deprecate(:object_classes, "The Inspec::Test class is deprecated. Use the Inspec::Object::Test class from the inspec-objects Ruby library.")
|
10
17
|
end
|
11
18
|
|
12
19
|
def negate!
|
@@ -75,7 +82,7 @@ module Inspec
|
|
75
82
|
" " + expectation.inspect
|
76
83
|
end
|
77
84
|
format("%s%sdescribe %s do\n %s { should%s %s%s }\nend",
|
78
|
-
|
85
|
+
only_if_clause, vars, res, itsy, naughty, matcher, xpect)
|
79
86
|
end
|
80
87
|
|
81
88
|
def rb_skip
|
data/lib/inspec/objects/value.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# This class is deprecated and will be removed in the next major release of InSpec.
|
2
|
+
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
3
|
+
|
4
|
+
require "inspec/utils/deprecation"
|
5
|
+
|
1
6
|
module Inspec
|
2
7
|
class Value
|
3
8
|
include ::Inspec::RubyHelper
|
@@ -9,6 +14,8 @@ module Inspec
|
|
9
14
|
def initialize(qualifiers = [])
|
10
15
|
@qualifier = qualifiers
|
11
16
|
@variable = nil
|
17
|
+
|
18
|
+
Inspec.deprecate(:object_classes, "The Inspec::Value class is deprecated. Use the Inspec::Object::Value class from the inspec-objects Ruby library.")
|
12
19
|
end
|
13
20
|
|
14
21
|
def to_ruby
|
@@ -267,12 +267,17 @@ module Inspec::Plugin::V2
|
|
267
267
|
# Make Set that encompasses just the gemfile that was provided
|
268
268
|
plugin_local_source = Gem::Source::SpecificFile.new(opts[:gem_file])
|
269
269
|
|
270
|
-
plugin_dependency = Gem::Dependency.new(
|
271
|
-
|
270
|
+
plugin_dependency = Gem::Dependency.new(
|
271
|
+
requested_plugin_name,
|
272
|
+
plugin_local_source.spec.version
|
273
|
+
)
|
272
274
|
|
273
275
|
requested_local_gem_set = Gem::Resolver::InstallerSet.new(:both)
|
274
|
-
requested_local_gem_set.add_local(
|
275
|
-
|
276
|
+
requested_local_gem_set.add_local(
|
277
|
+
plugin_dependency.name,
|
278
|
+
plugin_local_source.spec,
|
279
|
+
plugin_local_source
|
280
|
+
)
|
276
281
|
|
277
282
|
install_gem_to_plugins_dir(plugin_dependency, [requested_local_gem_set])
|
278
283
|
end
|
data/lib/inspec/resource.rb
CHANGED
data/lib/inspec/resources/apt.rb
CHANGED
@@ -92,7 +92,7 @@ module Inspec::Resources
|
|
92
92
|
# deb [trusted=yes] http://archive.ubuntu.com/ubuntu/ wily main restricted ...
|
93
93
|
|
94
94
|
words = line.split
|
95
|
-
words.
|
95
|
+
words.delete_at 1 if words[1] && words[1].start_with?("[")
|
96
96
|
type, url, distro, *components = words
|
97
97
|
url = url.delete('"') if url
|
98
98
|
|
@@ -30,7 +30,7 @@ module Inspec::Resources
|
|
30
30
|
def initialize
|
31
31
|
unless inspec.command("/sbin/auditctl").exist?
|
32
32
|
raise Inspec::Exceptions::ResourceFailed,
|
33
|
-
|
33
|
+
"Command `/sbin/auditctl` does not exist"
|
34
34
|
end
|
35
35
|
|
36
36
|
auditctl_cmd = "/sbin/auditctl -l"
|
@@ -38,7 +38,7 @@ module Inspec::Resources
|
|
38
38
|
|
39
39
|
if result.exit_status != 0
|
40
40
|
raise Inspec::Exceptions::ResourceFailed,
|
41
|
-
|
41
|
+
"Command `#{auditctl_cmd}` failed with error: #{result.stderr}"
|
42
42
|
end
|
43
43
|
|
44
44
|
@content = result.stdout
|
@@ -46,8 +46,8 @@ module Inspec::Resources
|
|
46
46
|
|
47
47
|
if @content =~ /^LIST_RULES:/
|
48
48
|
raise Inspec::Exceptions::ResourceFailed,
|
49
|
-
|
50
|
-
|
49
|
+
"The version of audit is outdated." \
|
50
|
+
"The `auditd` resource supports versions of audit >= 2.3."
|
51
51
|
end
|
52
52
|
parse_content
|
53
53
|
end
|
@@ -37,7 +37,7 @@ module Inspec::Resources
|
|
37
37
|
# Make sure command is replaced so sensitive output isn't shown
|
38
38
|
@command = "ERROR"
|
39
39
|
raise Inspec::Exceptions::ResourceFailed,
|
40
|
-
|
40
|
+
"The `redact_regex` option must be a regular expression"
|
41
41
|
end
|
42
42
|
@redact_regex = options[:redact_regex]
|
43
43
|
end
|
@@ -98,7 +98,7 @@ module Inspec::Resources
|
|
98
98
|
cmd = inspec.command("df #{partition} -PT")
|
99
99
|
if cmd.stdout.nil? || cmd.stdout.empty? || cmd.exit_status != 0
|
100
100
|
raise Inspec::Exceptions::ResourceFailed,
|
101
|
-
|
101
|
+
"Unable to get available space for partition #{partition}"
|
102
102
|
end
|
103
103
|
value = cmd.stdout.split(/\n/)[1].strip.split(" ")
|
104
104
|
{
|
@@ -125,8 +125,8 @@ module Inspec::Resources
|
|
125
125
|
fs = JSON.parse(cmd.stdout)
|
126
126
|
rescue JSON::ParserError => e
|
127
127
|
raise Inspec::Exceptions::ResourceFailed,
|
128
|
-
|
129
|
-
|
128
|
+
"Failed to parse JSON from Powershell. " \
|
129
|
+
"Error: #{e}"
|
130
130
|
end
|
131
131
|
{
|
132
132
|
name: fs["DeviceID"],
|
data/lib/inspec/resources/gem.rb
CHANGED
@@ -2,7 +2,7 @@ require "inspec/resources/command"
|
|
2
2
|
|
3
3
|
module Inspec::Resources
|
4
4
|
class GemPackage < Inspec.resource(1)
|
5
|
-
name "gem"
|
5
|
+
name "gem" # TODO: rename to "rubygem" and provide alias
|
6
6
|
supports platform: "unix"
|
7
7
|
supports platform: "windows"
|
8
8
|
desc "Use the gem InSpec audit resource to test if a global gem package is installed."
|
@@ -17,11 +17,12 @@ module Inspec::Resources
|
|
17
17
|
|
18
18
|
def initialize(package_name, gem_binary = nil)
|
19
19
|
@package_name = package_name
|
20
|
-
@gem_binary = case gem_binary
|
20
|
+
@gem_binary = case gem_binary # TODO: no. this is not right
|
21
21
|
when nil
|
22
22
|
"gem"
|
23
23
|
when :chef
|
24
24
|
if inspec.os.windows?
|
25
|
+
# TODO: what about chef-dk or other installs?
|
25
26
|
'c:\opscode\chef\embedded\bin\gem.bat'
|
26
27
|
else
|
27
28
|
"/opt/chef/embedded/bin/gem"
|
@@ -35,8 +35,8 @@ module Inspec::Resources
|
|
35
35
|
# profiles.
|
36
36
|
if opts.key?(:enable_remote_worker) && !inspec.local_transport?
|
37
37
|
warn "Ignoring `enable_remote_worker` option, the `http` resource ",
|
38
|
-
|
39
|
-
|
38
|
+
"remote worker is enabled by default for remote targets and ",
|
39
|
+
"cannot be disabled"
|
40
40
|
end
|
41
41
|
|
42
42
|
# Run locally if InSpec is ran locally and remotely if ran remotely
|
@@ -164,7 +164,7 @@ module Inspec::Resources
|
|
164
164
|
def initialize(inspec, http_method, url, opts)
|
165
165
|
unless inspec.command("curl").exist?
|
166
166
|
raise Inspec::Exceptions::ResourceSkipped,
|
167
|
-
|
167
|
+
"curl is not available on the target machine"
|
168
168
|
end
|
169
169
|
|
170
170
|
@ran_curl = false
|
data/lib/inspec/resources/npm.rb
CHANGED
@@ -27,12 +27,20 @@ module Inspec::Resources
|
|
27
27
|
return @info if defined?(@info)
|
28
28
|
|
29
29
|
if @location
|
30
|
-
|
30
|
+
command_separator = inspec.os.platform?("windows") ? ";" : "&&"
|
31
|
+
invocation = "cd #{Shellwords.escape @location} #{command_separator} npm"
|
31
32
|
else
|
32
|
-
|
33
|
+
invocation = "npm -g"
|
33
34
|
end
|
34
35
|
|
35
|
-
|
36
|
+
invocation = "#{invocation} ls --json #{@package_name}"
|
37
|
+
|
38
|
+
# If on unix, wrap in sh -c to protect against sudo
|
39
|
+
unless inspec.os.platform?("windows")
|
40
|
+
invocation = "sh -c '#{invocation}'"
|
41
|
+
end
|
42
|
+
|
43
|
+
cmd = inspec.command(invocation)
|
36
44
|
@info = {
|
37
45
|
name: @package_name,
|
38
46
|
type: "npm",
|
@@ -58,8 +58,8 @@ module Inspec::Resources
|
|
58
58
|
command = command_builder(format_options, sql)
|
59
59
|
inspec_cmd = inspec.command(command)
|
60
60
|
|
61
|
-
DatabaseHelper::SQLQueryResult.new(inspec_cmd,
|
62
|
-
|
61
|
+
DatabaseHelper::SQLQueryResult.new(inspec_cmd,
|
62
|
+
send(parser, inspec_cmd.stdout))
|
63
63
|
end
|
64
64
|
|
65
65
|
def to_s
|
@@ -217,8 +217,7 @@ module Inspec::Resources
|
|
217
217
|
}
|
218
218
|
rescue JSON::ParserError => e
|
219
219
|
raise Inspec::Exceptions::ResourceFailed,
|
220
|
-
|
221
|
-
"Error: #{e}"
|
220
|
+
"Failed to parse JSON from `brew` command. Error: #{e}"
|
222
221
|
end
|
223
222
|
end
|
224
223
|
|
@@ -307,8 +306,7 @@ module Inspec::Resources
|
|
307
306
|
package = JSON.parse(cmd.stdout)
|
308
307
|
rescue JSON::ParserError => e
|
309
308
|
raise Inspec::Exceptions::ResourceFailed,
|
310
|
-
|
311
|
-
"Error: #{e}"
|
309
|
+
"Failed to parse JSON from PowerShell. Error: #{e}"
|
312
310
|
end
|
313
311
|
|
314
312
|
# What if we match multiple packages? just pick the first one for now.
|
@@ -304,10 +304,12 @@ module Inspec::Resources
|
|
304
304
|
|
305
305
|
# LoadState values eg. loaded, not-found
|
306
306
|
installed = params["LoadState"] == "loaded"
|
307
|
+
startname = params["User"]
|
307
308
|
|
308
309
|
{
|
309
310
|
name: params["Id"],
|
310
311
|
description: params["Description"],
|
312
|
+
startname: startname,
|
311
313
|
installed: installed,
|
312
314
|
running: is_active?(service_name),
|
313
315
|
enabled: is_enabled?(service_name),
|
@@ -45,7 +45,7 @@ module Inspec::Resources
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def linux_hostname(opt = nil)
|
48
|
-
if
|
48
|
+
if opt
|
49
49
|
opt = case opt
|
50
50
|
when "f", "long", "fqdn", "full"
|
51
51
|
" -f"
|
@@ -67,7 +67,7 @@ module Inspec::Resources
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def mac_hostname(opt = nil)
|
70
|
-
if
|
70
|
+
if opt
|
71
71
|
opt = case opt
|
72
72
|
when "f", "long", "fqdn", "full"
|
73
73
|
" -f"
|
@@ -624,7 +624,9 @@ module Inspec::Resources
|
|
624
624
|
|
625
625
|
def meta_info(username)
|
626
626
|
res = identity(username)
|
627
|
+
|
627
628
|
return if res.nil?
|
629
|
+
|
628
630
|
{
|
629
631
|
home: res[:home],
|
630
632
|
shell: res[:shell],
|
@@ -635,7 +637,9 @@ module Inspec::Resources
|
|
635
637
|
|
636
638
|
def credentials(username)
|
637
639
|
res = identity(username)
|
640
|
+
|
638
641
|
return if res.nil?
|
642
|
+
|
639
643
|
{
|
640
644
|
mindays: res[:mindays],
|
641
645
|
maxdays: res[:maxdays],
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "inspec/input_registry"
|
2
2
|
require "inspec/plugin/v2"
|
3
3
|
require "rspec/core/example_group"
|
4
|
+
require "inspec/input_dsl_helpers"
|
4
5
|
|
5
6
|
# Any additions to RSpec::Core::ExampleGroup (the RSpec class behind describe blocks) should go here.
|
6
7
|
|
@@ -82,18 +83,12 @@ module Inspec
|
|
82
83
|
end
|
83
84
|
|
84
85
|
class RSpec::Core::ExampleGroup
|
86
|
+
include Inspec::InputDslHelpers
|
87
|
+
|
85
88
|
# This DSL method allows us to access the values of inputs within InSpec tests
|
86
89
|
def input(input_name, options = {})
|
87
90
|
profile_id = self.class.metadata[:profile_id]
|
88
|
-
|
89
|
-
# Simply an access, no event here
|
90
|
-
Inspec::InputRegistry.find_or_register_input(input_name, profile_id).value
|
91
|
-
else
|
92
|
-
options[:priority] = 20
|
93
|
-
options[:provider] = :inline_control_code
|
94
|
-
evt = Inspec::Input.infer_event(options)
|
95
|
-
Inspec::InputRegistry.find_or_register_input(input_name, profile_id, event: evt).value
|
96
|
-
end
|
91
|
+
input_with_profile_id(profile_id, input_name, options)
|
97
92
|
end
|
98
93
|
define_example_method :input
|
99
94
|
|
data/lib/inspec/rule.rb
CHANGED
@@ -4,6 +4,7 @@ require "method_source"
|
|
4
4
|
require "date"
|
5
5
|
require "inspec/describe_base"
|
6
6
|
require "inspec/expect"
|
7
|
+
require "inspec/impact"
|
7
8
|
require "inspec/resource"
|
8
9
|
require "inspec/resources/os"
|
9
10
|
require "inspec/input_registry"
|
@@ -204,7 +205,11 @@ module Inspec
|
|
204
205
|
|
205
206
|
def self.set_skip_rule(rule, value, message = nil, type = :only_if)
|
206
207
|
rule.instance_variable_set(:@__skip_rule,
|
207
|
-
|
208
|
+
{
|
209
|
+
result: value,
|
210
|
+
message: message,
|
211
|
+
type: type,
|
212
|
+
})
|
208
213
|
end
|
209
214
|
|
210
215
|
def self.merge_count(rule)
|
data/lib/inspec/runner.rb
CHANGED
@@ -190,10 +190,10 @@ module Inspec
|
|
190
190
|
#
|
191
191
|
def add_target(target, _opts = [])
|
192
192
|
profile = Inspec::Profile.for_target(target,
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
193
|
+
vendor_cache: @cache,
|
194
|
+
backend: @backend,
|
195
|
+
controls: @controls,
|
196
|
+
runner_conf: @conf)
|
197
197
|
raise "Could not resolve #{target} to valid input." if profile.nil?
|
198
198
|
|
199
199
|
@target_profiles << profile if supports_profile?(profile)
|
data/lib/inspec/version.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
1
|
-
require_relative "../../../shared/core_plugin_test_helper.rb"
|
2
1
|
require "fileutils"
|
2
|
+
require "plugins/shared/core_plugin_test_helper"
|
3
3
|
require "securerandom"
|
4
4
|
|
5
5
|
class ArtifactCli < Minitest::Test
|
6
6
|
include CorePluginFunctionalHelper
|
7
7
|
|
8
8
|
def test_generating_archive_keys
|
9
|
-
|
9
|
+
prepare_examples do |dir|
|
10
10
|
unique_key_name = SecureRandom.uuid
|
11
|
-
out = run_inspec_process("artifact generate --keyname #{unique_key_name}", prefix: "cd #{dir}
|
11
|
+
out = run_inspec_process("artifact generate --keyname #{unique_key_name}", prefix: "cd #{dir};")
|
12
12
|
|
13
13
|
stdout = out.stdout.force_encoding(Encoding::UTF_8)
|
14
|
-
skip_windows!
|
15
14
|
assert_includes stdout, "Generating private key"
|
16
15
|
assert_includes stdout, "Generating public key"
|
17
16
|
|
@@ -20,27 +19,32 @@ class ArtifactCli < Minitest::Test
|
|
20
19
|
end
|
21
20
|
|
22
21
|
def test_verify_and_install_signed_profile
|
23
|
-
|
22
|
+
prepare_examples do |dir|
|
24
23
|
unique_key_name = SecureRandom.uuid
|
25
24
|
install_dir = File.join(dir, SecureRandom.uuid)
|
26
25
|
FileUtils.mkdir(install_dir)
|
27
26
|
|
28
27
|
# create profile
|
29
28
|
profile = File.join(dir, "artifact-profile")
|
30
|
-
run_inspec_process("init profile artifact-profile", prefix: "cd #{dir}
|
29
|
+
run_inspec_process("init profile artifact-profile", prefix: "cd #{dir};")
|
31
30
|
|
32
|
-
out = run_inspec_process("artifact generate --keyname #{unique_key_name}", prefix: "cd #{dir}
|
33
|
-
skip_windows!
|
31
|
+
out = run_inspec_process("artifact generate --keyname #{unique_key_name}", prefix: "cd #{dir};")
|
34
32
|
assert_exit_code 0, out
|
35
33
|
|
36
|
-
out = run_inspec_process("artifact sign-profile --profile #{profile} --keyname #{unique_key_name}", prefix: "cd #{dir}
|
34
|
+
out = run_inspec_process("artifact sign-profile --profile #{profile} --keyname #{unique_key_name}", prefix: "cd #{dir};")
|
37
35
|
assert_exit_code 0, out
|
38
36
|
|
39
|
-
|
37
|
+
# The archive install commands do not currently support windows
|
38
|
+
# and use specific linux extract tar commands. Since artifact is
|
39
|
+
# still experimental we are skipping it for now.
|
40
|
+
return if is_windows?
|
41
|
+
|
42
|
+
out = run_inspec_process("artifact install-profile --infile artifact-profile-0.1.0.iaf --destdir #{install_dir}", prefix: "cd #{dir};")
|
40
43
|
assert_exit_code 0, out
|
41
44
|
|
42
45
|
assert_includes out.stdout.force_encoding(Encoding::UTF_8), "Installing to #{install_dir}"
|
43
46
|
assert_includes Dir.entries(install_dir).join, "inspec.yml"
|
47
|
+
assert_exit_code 0, out
|
44
48
|
end
|
45
49
|
end
|
46
50
|
end
|
@@ -116,8 +116,8 @@ class InspecPlugins::Habitat::ProfileTest < Minitest::Test
|
|
116
116
|
def test_duplicate_profile
|
117
117
|
current_profile = @test_profile
|
118
118
|
duplicated_profile = @hab_profile.send(:duplicate_profile,
|
119
|
-
|
120
|
-
|
119
|
+
@test_profile_path,
|
120
|
+
@tmpdir)
|
121
121
|
assert duplicated_profile.is_a?(Inspec::Profile)
|
122
122
|
assert duplicated_profile.sha256 == current_profile.sha256.to_s
|
123
123
|
refute_same duplicated_profile.root_path, current_profile.root_path
|
@@ -130,8 +130,8 @@ class InspecPlugins::Habitat::ProfileTest < Minitest::Test
|
|
130
130
|
|
131
131
|
def test_copy_profile_to_working_dir
|
132
132
|
duplicated_profile = @hab_profile.send(:duplicate_profile,
|
133
|
-
|
134
|
-
|
133
|
+
@test_profile_path,
|
134
|
+
@tmpdir)
|
135
135
|
|
136
136
|
dst = File.join(@tmpdir, "working_dir")
|
137
137
|
FileUtils.mkdir_p(dst)
|
@@ -176,7 +176,7 @@ class InspecPlugins::Habitat::ProfileTest < Minitest::Test
|
|
176
176
|
|
177
177
|
Inspec::ProfileVendor.stub :new, mock do
|
178
178
|
new_profile = @hab_profile.send(:vendor_profile_dependencies!,
|
179
|
-
|
179
|
+
@test_profile)
|
180
180
|
assert new_profile.is_a?(Inspec::Profile)
|
181
181
|
end
|
182
182
|
end
|
@@ -192,7 +192,7 @@ class InspecPlugins::Habitat::ProfileTest < Minitest::Test
|
|
192
192
|
|
193
193
|
Inspec::ProfileVendor.stub :new, mock do
|
194
194
|
new_profile = @hab_profile.send(:vendor_profile_dependencies!,
|
195
|
-
|
195
|
+
@test_profile)
|
196
196
|
assert new_profile.is_a?(Inspec::Profile)
|
197
197
|
end
|
198
198
|
mock.verify
|
data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/fixtures/README.md
CHANGED
@@ -19,6 +19,6 @@ When writing your functional tests, you can point InSpec at the various test fix
|
|
19
19
|
|
20
20
|
## Using test fixtures provided with the `inspec` source code
|
21
21
|
|
22
|
-
InSpec itself ships with many test fixtures - not just profiles, but attribute files, configuration directories, and more. Examine them at [the fixtures directory](https://github.com/inspec/inspec/tree/master/test/
|
22
|
+
InSpec itself ships with many test fixtures - not just profiles, but attribute files, configuration directories, and more. Examine them at [the fixtures directory](https://github.com/inspec/inspec/tree/master/test/fixtures)
|
23
23
|
|
24
|
-
To use them, see the helper.rb file included in the example at test/helper.rb .
|
24
|
+
To use them, see the helper.rb file included in the example at test/helper.rb .
|
@@ -142,10 +142,11 @@ class InitPluginCli < Minitest::Test
|
|
142
142
|
|
143
143
|
# Check generated files and contents.
|
144
144
|
# Each file must exist, and its contents must match each of the regexen given.
|
145
|
+
|
145
146
|
{
|
146
147
|
File.join(plugin, "README.md") => [],
|
147
148
|
File.join(plugin, "LICENSE") => [
|
148
|
-
/Copyright
|
149
|
+
/Copyright . 2018 Bob/,
|
149
150
|
/used to endorse or promote/,
|
150
151
|
],
|
151
152
|
File.join(plugin, "Gemfile") => [],
|
@@ -29,7 +29,7 @@ class PluginManagerCliInstall < Minitest::Test
|
|
29
29
|
resolved_path: File.join(core_config_dir_path, "test-fixture-1-float", "gems", ruby_abi_version, "gems", "inspec-test-fixture-0.1.0", "lib", "inspec-test-fixture.rb"),
|
30
30
|
},
|
31
31
|
"refers_to_a_relative_path" => {
|
32
|
-
given: File.join("test", "
|
32
|
+
given: File.join("test", "fixtures", "plugins", "inspec-test-fixture", "lib", "inspec-test-fixture.rb"),
|
33
33
|
},
|
34
34
|
"refers_to_a_train_plugin" => {
|
35
35
|
given: File.join(core_config_dir_path, "train-test-fixture", "gems", ruby_abi_version, "gems", "train-test-fixture-0.1.0", "lib", "train-test-fixture.rb"),
|
@@ -9,7 +9,7 @@ class PluginManagerCliDefinitionTests < Minitest::Test
|
|
9
9
|
@@orig_home = Dir.home
|
10
10
|
|
11
11
|
def setup
|
12
|
-
mock_path = File.expand_path "test/
|
12
|
+
mock_path = File.expand_path "test/fixtures"
|
13
13
|
|
14
14
|
@config_dir_path = File.join(mock_path, "config_dirs")
|
15
15
|
ENV["HOME"] = File.join(@config_dir_path, "fakehome")
|
@@ -12,6 +12,7 @@ require "tmpdir"
|
|
12
12
|
require "pathname"
|
13
13
|
require "forwardable"
|
14
14
|
|
15
|
+
require "functional/helper"
|
15
16
|
require "inspec/plugin/v2"
|
16
17
|
|
17
18
|
# Configure Minitest to expose things like `let`
|
@@ -36,35 +37,32 @@ end
|
|
36
37
|
# end
|
37
38
|
# end
|
38
39
|
|
40
|
+
# TODO: remove me! There's no need!
|
39
41
|
module CorePluginBaseHelper
|
40
|
-
|
41
|
-
|
42
|
-
let(:
|
43
|
-
let(:inspec_path) { File.join(repo_path, "inspec-bin", "bin", "inspec") }
|
44
|
-
let(:exec_inspec) { [Gem.ruby, "-I#{libdir}", inspec_path].join " " }
|
45
|
-
let(:core_mock_path) { File.join(repo_path, "test", "unit", "mock") }
|
46
|
-
let(:core_fixture_plugins_path) { File.join(core_mock_path, "plugins") }
|
47
|
-
let(:core_config_dir_path) { File.join(core_mock_path, "config_dirs") }
|
42
|
+
let(:mock_path) { File.join(repo_path, "test", "fixtures", "mock") }
|
43
|
+
let(:core_fixture_plugins_path) { File.join(mock_path, "plugins") }
|
44
|
+
let(:core_config_dir_path) { File.join(mock_path, "config_dirs") }
|
48
45
|
|
49
46
|
let(:registry) { Inspec::Plugin::V2::Registry.instance }
|
50
47
|
end
|
51
48
|
|
52
|
-
require "functional/helper"
|
53
|
-
|
54
49
|
module CorePluginFunctionalHelper
|
55
50
|
include CorePluginBaseHelper
|
56
51
|
include FunctionalHelper
|
57
52
|
|
53
|
+
# TODO: so much duplication! Remove everything we can!
|
58
54
|
require "train"
|
59
55
|
TRAIN_CONNECTION = Train.create("local", command_runner: :generic).connection
|
60
56
|
|
57
|
+
# TODO: remove me! it's in test/functional/helper.rb
|
61
58
|
def run_inspec_process(command_line, opts = {})
|
62
59
|
prefix = ""
|
63
60
|
if opts.key?(:prefix)
|
64
61
|
prefix = opts[:prefix]
|
65
62
|
elsif opts.key?(:env)
|
66
|
-
prefix = opts[:env]
|
63
|
+
prefix = assemble_env_prefix opts[:env]
|
67
64
|
end
|
65
|
+
|
68
66
|
TRAIN_CONNECTION.run_command("#{prefix} #{exec_inspec} #{command_line}")
|
69
67
|
end
|
70
68
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module AwsResourceMixin
|
2
2
|
def initialize(resource_params = {})
|
3
3
|
Inspec.deprecate(:aws_resources_in_resource_pack,
|
4
|
-
|
4
|
+
"Resource '#{@__resource_name__ ||= self.class.to_s}'")
|
5
5
|
validate_params(resource_params).each do |param, value|
|
6
6
|
instance_variable_set(:"@#{param}", value)
|
7
7
|
end
|
@@ -23,7 +23,7 @@ class AwsBillingReport < Inspec.resource(1)
|
|
23
23
|
include AwsSingularResourceMixin
|
24
24
|
|
25
25
|
attr_reader :report_name, :time_unit, :format, :compression, :s3_bucket,
|
26
|
-
|
26
|
+
:s3_prefix, :s3_region
|
27
27
|
|
28
28
|
def to_s
|
29
29
|
"AWS Billing Report #{report_name}"
|
@@ -15,7 +15,7 @@ class AwsCloudTrailTrail < Inspec.resource(1)
|
|
15
15
|
|
16
16
|
include AwsSingularResourceMixin
|
17
17
|
attr_reader :cloud_watch_logs_log_group_arn, :cloud_watch_logs_role_arn, :home_region,
|
18
|
-
|
18
|
+
:kms_key_id, :s3_bucket_name, :trail_arn
|
19
19
|
|
20
20
|
def to_s
|
21
21
|
"CloudTrail #{@trail_name}"
|
@@ -16,7 +16,7 @@ class AwsConfigDeliveryChannel < Inspec.resource(1)
|
|
16
16
|
|
17
17
|
include AwsSingularResourceMixin
|
18
18
|
attr_reader :channel_name, :s3_bucket_name, :s3_key_prefix, :sns_topic_arn,
|
19
|
-
|
19
|
+
:delivery_frequency_in_hours
|
20
20
|
|
21
21
|
def to_s
|
22
22
|
"Config_Delivery_Channel: #{@channel_name}"
|
@@ -15,8 +15,8 @@ class AwsEcsCluster < Inspec.resource(1)
|
|
15
15
|
|
16
16
|
include AwsSingularResourceMixin
|
17
17
|
attr_reader :cluster_arn, :cluster_name, :status,
|
18
|
-
|
19
|
-
|
18
|
+
:registered_container_instances_count, :running_tasks_count,
|
19
|
+
:pending_tasks_count, :active_services_count, :statistics
|
20
20
|
|
21
21
|
def to_s
|
22
22
|
"AWS ECS cluster #{cluster_name}"
|
@@ -15,9 +15,9 @@ class AwsEksCluster < Inspec.resource(1)
|
|
15
15
|
|
16
16
|
include AwsSingularResourceMixin
|
17
17
|
attr_reader :version, :arn, :cluster_name, :certificate_authority, :name,
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
:status, :endpoint, :subnets_count, :subnet_ids, :security_group_ids,
|
19
|
+
:created_at, :role_arn, :vpc_id, :security_groups_count, :creating,
|
20
|
+
:active, :failed, :deleting
|
21
21
|
# Use aliases for matchers
|
22
22
|
alias active? active
|
23
23
|
alias failed? failed
|
@@ -14,8 +14,8 @@ class AwsElb < Inspec.resource(1)
|
|
14
14
|
|
15
15
|
include AwsSingularResourceMixin
|
16
16
|
attr_reader :availability_zones, :dns_name, :elb_name, :external_ports,
|
17
|
-
|
18
|
-
|
17
|
+
:instance_ids, :internal_ports, :security_group_ids,
|
18
|
+
:subnet_ids, :vpc_id
|
19
19
|
|
20
20
|
def to_s
|
21
21
|
"AWS ELB #{elb_name}"
|
@@ -55,7 +55,7 @@ class AwsFlowLog < Inspec.resource(1)
|
|
55
55
|
|
56
56
|
if validated_params.empty?
|
57
57
|
raise ArgumentError,
|
58
|
-
|
58
|
+
"aws_flow_log requires a parameter: flow_log_id, subnet_id, or vpc_id"
|
59
59
|
end
|
60
60
|
|
61
61
|
validated_params
|
@@ -17,7 +17,7 @@ class AwsIamUser < Inspec.resource(1)
|
|
17
17
|
|
18
18
|
include AwsSingularResourceMixin
|
19
19
|
attr_reader :access_keys, :attached_policy_names, :attached_policy_arns, \
|
20
|
-
|
20
|
+
:has_console_password, :has_mfa_enabled, :inline_policy_names, :username
|
21
21
|
alias has_mfa_enabled? has_mfa_enabled
|
22
22
|
alias has_console_password? has_console_password
|
23
23
|
|
@@ -15,8 +15,8 @@ class AwsKmsKey < Inspec.resource(1)
|
|
15
15
|
|
16
16
|
include AwsSingularResourceMixin
|
17
17
|
attr_reader :key_id, :arn, :creation_date, :key_usage, :key_state, :description,
|
18
|
-
|
19
|
-
|
18
|
+
:deletion_date, :valid_to, :external, :has_key_expiration, :managed_by_aws,
|
19
|
+
:has_rotation_enabled, :enabled
|
20
20
|
# Use aliases for matchers
|
21
21
|
alias deletion_time deletion_date
|
22
22
|
alias invalidation_time valid_to
|
@@ -33,8 +33,8 @@ class AwsRouteTable < Inspec.resource(1)
|
|
33
33
|
if validated_params.key?(:route_table_id) &&
|
34
34
|
validated_params[:route_table_id] !~ /^rtb\-([0-9a-f]{17})|(^rtb\-[0-9a-f]{8})$/
|
35
35
|
raise ArgumentError,
|
36
|
-
|
37
|
-
|
36
|
+
"aws_route_table Route Table ID must be in the" \
|
37
|
+
' format "rtb-" followed by 8 or 17 hexadecimal characters.'
|
38
38
|
end
|
39
39
|
|
40
40
|
validated_params
|
@@ -20,7 +20,7 @@ class AwsSnsSubscription < Inspec.resource(1)
|
|
20
20
|
|
21
21
|
include AwsSingularResourceMixin
|
22
22
|
attr_reader :arn, :owner, :raw_message_delivery, :topic_arn, :endpoint, :protocol,
|
23
|
-
|
23
|
+
:confirmation_was_authenticated, :aws_response
|
24
24
|
|
25
25
|
alias confirmation_authenticated? confirmation_was_authenticated
|
26
26
|
alias raw_message_delivery? raw_message_delivery
|
@@ -15,8 +15,8 @@ class AwsSubnet < Inspec.resource(1)
|
|
15
15
|
|
16
16
|
include AwsSingularResourceMixin
|
17
17
|
attr_reader :assigning_ipv_6_address_on_creation, :availability_zone, :available_ip_address_count,
|
18
|
-
|
19
|
-
|
18
|
+
:available, :cidr_block, :default_for_az, :ipv_6_cidr_block_association_set,
|
19
|
+
:mapping_public_ip_on_launch, :subnet_id, :vpc_id
|
20
20
|
alias available? available
|
21
21
|
alias default_for_az? default_for_az
|
22
22
|
alias mapping_public_ip_on_launch? mapping_public_ip_on_launch
|
@@ -19,8 +19,8 @@ class AwsVpc < Inspec.resource(1)
|
|
19
19
|
"VPC #{vpc_id}"
|
20
20
|
end
|
21
21
|
|
22
|
-
attr_reader :cidr_block, :dhcp_options_id, :instance_tenancy, :is_default
|
23
|
-
|
22
|
+
attr_reader :cidr_block, :dhcp_options_id, :instance_tenancy, :is_default,
|
23
|
+
:state, :vpc_id
|
24
24
|
|
25
25
|
alias default? is_default
|
26
26
|
|
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: 4.18.
|
4
|
+
version: 4.18.38
|
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: 2019-
|
11
|
+
date: 2019-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: train
|
@@ -86,20 +86,6 @@ dependencies:
|
|
86
86
|
- - "<"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '2.0'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: chef-core
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0.0'
|
96
|
-
type: :runtime
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0.0'
|
103
89
|
- !ruby/object:Gem::Dependency
|
104
90
|
name: thor
|
105
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -485,6 +471,7 @@ files:
|
|
485
471
|
- lib/inspec/globals.rb
|
486
472
|
- lib/inspec/impact.rb
|
487
473
|
- lib/inspec/input.rb
|
474
|
+
- lib/inspec/input_dsl_helpers.rb
|
488
475
|
- lib/inspec/input_registry.rb
|
489
476
|
- lib/inspec/library_eval_context.rb
|
490
477
|
- lib/inspec/log.rb
|