inspec-core 5.22.50 → 6.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Chef-EULA +9 -0
- data/Gemfile +14 -4
- data/etc/features.sig +6 -0
- data/etc/features.yaml +97 -0
- data/inspec-core.gemspec +17 -7
- data/lib/inspec/backend.rb +2 -0
- data/lib/inspec/base_cli.rb +80 -4
- data/lib/inspec/cached_fetcher.rb +24 -3
- data/lib/inspec/cli.rb +293 -236
- data/lib/inspec/config.rb +24 -2
- data/lib/inspec/dependencies/cache.rb +33 -0
- data/lib/inspec/enhanced_outcomes.rb +1 -0
- data/lib/inspec/errors.rb +5 -0
- data/lib/inspec/exceptions.rb +2 -0
- data/lib/inspec/feature/config.rb +75 -0
- data/lib/inspec/feature/runner.rb +29 -0
- data/lib/inspec/feature.rb +42 -0
- data/lib/inspec/fetcher/git.rb +5 -0
- data/lib/inspec/fetcher/url.rb +24 -4
- data/lib/inspec/globals.rb +6 -0
- data/lib/inspec/iaf_file.rb +3 -2
- data/lib/inspec/input_registry.rb +5 -1
- data/lib/inspec/plugin/v1/plugin_types/fetcher.rb +7 -0
- data/lib/inspec/plugin/v2/plugin_types/streaming_reporter.rb +30 -2
- data/lib/inspec/profile.rb +44 -1
- data/lib/inspec/reporters.rb +67 -54
- data/lib/inspec/resources/nftables.rb +14 -1
- data/lib/inspec/resources/oracledb_session.rb +12 -3
- data/lib/inspec/resources/ssh_config.rb +100 -9
- data/lib/inspec/resources/ssh_key.rb +124 -0
- data/lib/inspec/resources/sshd_active_config.rb +2 -0
- data/lib/inspec/resources/sybase_session.rb +11 -2
- data/lib/inspec/resources.rb +1 -0
- data/lib/inspec/rule.rb +6 -6
- data/lib/inspec/run_data.rb +7 -5
- data/lib/inspec/runner.rb +43 -6
- data/lib/inspec/runner_rspec.rb +12 -9
- data/lib/inspec/secrets/yaml.rb +9 -3
- data/lib/inspec/shell.rb +10 -0
- data/lib/inspec/ui.rb +4 -0
- data/lib/inspec/utils/licensing_config.rb +9 -0
- data/lib/inspec/utils/telemetry/base.rb +149 -0
- data/lib/inspec/utils/telemetry/http.rb +40 -0
- data/lib/inspec/utils/telemetry/null.rb +11 -0
- data/lib/inspec/utils/telemetry/run_context_probe.rb +13 -1
- data/lib/inspec/utils/telemetry.rb +74 -3
- data/lib/inspec/version.rb +1 -1
- data/lib/inspec/waiver_file_reader.rb +68 -27
- data/lib/inspec.rb +2 -2
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb +189 -168
- data/lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb +10 -3
- data/lib/plugins/inspec-init/lib/inspec-init/cli.rb +1 -0
- data/lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb +23 -21
- data/lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb +15 -13
- data/lib/plugins/inspec-init/lib/inspec-init/cli_resource.rb +15 -13
- data/lib/plugins/inspec-license/README.md +16 -0
- data/lib/plugins/inspec-license/inspec-license.gemspec +6 -0
- data/lib/plugins/inspec-license/lib/inspec-license/cli.rb +26 -0
- data/lib/plugins/inspec-license/lib/inspec-license.rb +14 -0
- data/lib/plugins/inspec-parallel/README.md +27 -0
- data/lib/plugins/inspec-parallel/inspec-parallel.gemspec +6 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/child_status_reporter.rb +61 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/cli.rb +39 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/command.rb +219 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/runner.rb +270 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/super_reporter/base.rb +24 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/super_reporter/silent.rb +7 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/super_reporter/status.rb +125 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/super_reporter/text.rb +23 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb +170 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel.rb +18 -0
- data/lib/plugins/inspec-sign/lib/inspec-sign/base.rb +20 -8
- data/lib/plugins/inspec-sign/lib/inspec-sign/cli.rb +11 -4
- data/lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/streaming_reporter.rb +6 -13
- metadata +61 -19
- data/lib/inspec/utils/telemetry/collector.rb +0 -81
- data/lib/inspec/utils/telemetry/data_series.rb +0 -44
- data/lib/inspec/utils/telemetry/global_methods.rb +0 -22
@@ -1,81 +0,0 @@
|
|
1
|
-
require "inspec/config"
|
2
|
-
require "inspec/utils/telemetry/data_series"
|
3
|
-
require "singleton" unless defined?(Singleton)
|
4
|
-
|
5
|
-
module Inspec::Telemetry
|
6
|
-
# A Singleton collection of data series objects.
|
7
|
-
class Collector
|
8
|
-
include Singleton
|
9
|
-
|
10
|
-
attr_reader :config
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
@data_series = []
|
14
|
-
@telemetry_toggled_off = false
|
15
|
-
load_config
|
16
|
-
end
|
17
|
-
|
18
|
-
# Allow loading a configuration, useful when testing.
|
19
|
-
def load_config(config = Inspec::Config.cached)
|
20
|
-
@config = config
|
21
|
-
end
|
22
|
-
|
23
|
-
# Add a data series to the collection.
|
24
|
-
# @return [True]
|
25
|
-
def add_data_series(data_series)
|
26
|
-
@data_series << data_series
|
27
|
-
end
|
28
|
-
|
29
|
-
# The loaded configuration should have a option to configure
|
30
|
-
# telemetry, if not default to false.
|
31
|
-
# @return [True, False]
|
32
|
-
def telemetry_enabled?
|
33
|
-
if @telemetry_toggled_off
|
34
|
-
false
|
35
|
-
else
|
36
|
-
config_telemetry_options.fetch("enable_telemetry", false)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# A way to disable the telemetry system.
|
41
|
-
def disable_telemetry
|
42
|
-
@telemetry_toggled_off = true
|
43
|
-
end
|
44
|
-
|
45
|
-
# The entire data series collection.
|
46
|
-
# @return [Array]
|
47
|
-
def list_data_series
|
48
|
-
@data_series
|
49
|
-
end
|
50
|
-
|
51
|
-
# Finds the data series object with the specified name and returns it.
|
52
|
-
# If it does not exist then creates a new data series with that name
|
53
|
-
# and returns it.
|
54
|
-
# @return [Inspec::Telemetry::DataSeries]
|
55
|
-
def find_or_create_data_series(name)
|
56
|
-
ds = @data_series.select { |data_series| data_series.name.eql?(name) }
|
57
|
-
if ds.empty?
|
58
|
-
new_data_series = Inspec::Telemetry::DataSeries.new(name)
|
59
|
-
@data_series << new_data_series
|
60
|
-
new_data_series
|
61
|
-
else
|
62
|
-
ds.first
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# Blanks the contents of the data series collection.
|
67
|
-
# Reset telemetry toggle
|
68
|
-
# @return [True]
|
69
|
-
def reset!
|
70
|
-
@data_series = []
|
71
|
-
@telemetry_toggled_off = false
|
72
|
-
end
|
73
|
-
|
74
|
-
private
|
75
|
-
|
76
|
-
# Minimize exposure of Inspec::Config interface
|
77
|
-
def config_telemetry_options
|
78
|
-
config.telemetry_options
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require "json" unless defined?(JSON)
|
2
|
-
|
3
|
-
module Inspec; end
|
4
|
-
|
5
|
-
# A minimal Dataseries Object
|
6
|
-
# Stores the name of the data series and an array of data.
|
7
|
-
# Stored data should be a object that supports #to_s
|
8
|
-
module Inspec::Telemetry
|
9
|
-
class DataSeries
|
10
|
-
def initialize(name)
|
11
|
-
@name = name
|
12
|
-
@enabled = true
|
13
|
-
@data ||= []
|
14
|
-
end
|
15
|
-
|
16
|
-
attr_reader :data, :name
|
17
|
-
|
18
|
-
# This needs to also be set by configuration.
|
19
|
-
def enabled?
|
20
|
-
@enabled
|
21
|
-
end
|
22
|
-
|
23
|
-
def disable
|
24
|
-
@enabled = false
|
25
|
-
end
|
26
|
-
|
27
|
-
def <<(appending_data)
|
28
|
-
data << appending_data
|
29
|
-
end
|
30
|
-
|
31
|
-
alias push <<
|
32
|
-
|
33
|
-
def to_h
|
34
|
-
{
|
35
|
-
name: @name,
|
36
|
-
data: @data,
|
37
|
-
}
|
38
|
-
end
|
39
|
-
|
40
|
-
def to_json
|
41
|
-
to_h.to_json
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require "inspec/utils/telemetry/collector"
|
2
|
-
|
3
|
-
module Inspec
|
4
|
-
# A Global method to add a data series object to the Telemetry Collection.
|
5
|
-
# `data_series_name`s are unique, so `:dependency_group` will always return
|
6
|
-
# the same object.
|
7
|
-
# `data_point` is optional, you may also supply a block with several data points.
|
8
|
-
# All data points should allow #to_s
|
9
|
-
def self.record_telemetry_data(data_series_name, data_point = nil)
|
10
|
-
coll = Inspec::Telemetry::Collector.instance
|
11
|
-
return unless coll.telemetry_enabled?
|
12
|
-
|
13
|
-
ds = coll.find_or_create_data_series(data_series_name)
|
14
|
-
return unless ds.enabled?
|
15
|
-
|
16
|
-
if block_given?
|
17
|
-
ds << yield
|
18
|
-
else
|
19
|
-
ds << data_point
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|