inspec-core 5.7.9 → 5.10.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/etc/deprecations.json +0 -5
- data/lib/inspec/plugin/v2/installer.rb +9 -2
- data/lib/inspec/plugin/v2/loader.rb +13 -0
- data/lib/inspec/plugin/v2/status.rb +2 -1
- data/lib/inspec/resources/apt.rb +12 -6
- data/lib/inspec/resources/cgroup.rb +101 -0
- data/lib/inspec/resources/lxc.rb +57 -0
- data/lib/inspec/resources/oracledb_session.rb +7 -3
- data/lib/inspec/resources/postgres_session.rb +4 -2
- data/lib/inspec/resources/virtualization.rb +9 -3
- data/lib/inspec/ui.rb +9 -0
- data/lib/inspec/version.rb +1 -1
- data/lib/plugins/inspec-artifact/inspec-artifact.gemspec +9 -0
- data/lib/plugins/inspec-compliance/inspec-compliance.gemspec +9 -0
- data/lib/plugins/inspec-habitat/inspec-habitat.gemspec +9 -0
- data/lib/plugins/inspec-init/inspec-init.gemspec +9 -0
- data/lib/plugins/inspec-plugin-manager-cli/inspec-plugin-manager-cli.gemspec +10 -0
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +15 -11
- data/lib/plugins/inspec-reporter-html2/inspec-reporter-html2.gemspec +9 -0
- data/lib/plugins/inspec-reporter-json-min/inspec-reporter-json-min.gemspec +9 -0
- data/lib/plugins/inspec-reporter-junit/inspec-reporter-junit.gemspec +9 -0
- data/lib/plugins/inspec-streaming-reporter-progress-bar/inspec-streaming-reporter-progress-bar.gemspec +9 -0
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d96c590b3ff91ce5db5eaf8ee6ef68721fd17d103f250c8c3106941784f8f336
|
4
|
+
data.tar.gz: 50b56c3506f186b51fcf07df23a59050461132e0c03245bed088961ef0e854fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0eeb703b52391323d79b9ff99ce9bdc4b4aac5903fd6e10087b7ae92372b733b7a5779672fb67a3dc7aa6cfb2e3c859ca35ab81a6e49c0331ae623487e6ea241
|
7
|
+
data.tar.gz: 7f076f8c2bef5080a73b6fb8886657137a558bf9c624dd11906c91ef9f555e8c6713af8f62282f9a2fa20e650624fbcd3172fe0e9557f59dd8eb539684192ff1
|
data/etc/deprecations.json
CHANGED
@@ -83,11 +83,6 @@
|
|
83
83
|
"suffix": "This resource was removed in InSpec 4.0.",
|
84
84
|
"comment": "Needed for ServerSpec compatibility"
|
85
85
|
},
|
86
|
-
"resource_ppa": {
|
87
|
-
"action": "exit",
|
88
|
-
"suffix": "This resource was removed in InSpec 4.0.",
|
89
|
-
"comment": "Needed for ServerSpec compatibility"
|
90
|
-
},
|
91
86
|
"resource_script": {
|
92
87
|
"action": "exit",
|
93
88
|
"suffix": "This resource will be removed in InSpec 4.0"
|
@@ -149,12 +149,19 @@ module Inspec::Plugin::V2
|
|
149
149
|
|
150
150
|
gem_info = {}
|
151
151
|
matched_tuples.each do |tuple|
|
152
|
-
gem_info[tuple.first.name] ||=
|
153
|
-
gem_info[tuple.first.name]
|
152
|
+
gem_info[tuple.first.name] ||= {}
|
153
|
+
gem_info[tuple.first.name]["versions"] ||= []
|
154
|
+
gem_info[tuple.first.name]["versions"] << tuple.first.version.to_s
|
155
|
+
gem_info[tuple.first.name]["description"] ||= fetch_plugin_specs(fetcher, tuple.first.name)&.summary
|
154
156
|
end
|
155
157
|
gem_info
|
156
158
|
end
|
157
159
|
|
160
|
+
def fetch_plugin_specs(fetcher, gem_name)
|
161
|
+
plugin_dependency = Gem::Dependency.new(gem_name)
|
162
|
+
fetcher.spec_for_dependency(plugin_dependency).flatten.first
|
163
|
+
end
|
164
|
+
|
158
165
|
# Testing API. Performs a hard reset on the installer and registry, and reloads the loader.
|
159
166
|
# Not for public use.
|
160
167
|
# TODO: bad timing coupling in tests
|
@@ -259,10 +259,15 @@ module Inspec::Plugin::V2
|
|
259
259
|
status.entry_point = File.join(plugin_dir, "lib", status.name.to_s + ".rb")
|
260
260
|
status.installation_type = :core
|
261
261
|
status.loaded = false
|
262
|
+
status.description = fetch_gemspec(File.join(plugin_dir, status.name.to_s + ".gemspec"))&.summary
|
262
263
|
registry[status.name.to_sym] = status
|
263
264
|
end
|
264
265
|
end
|
265
266
|
|
267
|
+
def fetch_gemspec(spec_file)
|
268
|
+
Gem::Specification.load(spec_file)
|
269
|
+
end
|
270
|
+
|
266
271
|
def read_conf_file_into_registry
|
267
272
|
conf_file.each do |plugin_entry|
|
268
273
|
status = Inspec::Plugin::V2::Status.new
|
@@ -273,6 +278,7 @@ module Inspec::Plugin::V2
|
|
273
278
|
when :user_gem
|
274
279
|
status.entry_point = status.name.to_s
|
275
280
|
status.version = plugin_entry[:version]
|
281
|
+
status.description = fetch_plugin_specs(status.name.to_s)&.summary
|
276
282
|
when :path
|
277
283
|
status.entry_point = plugin_entry[:installation_path]
|
278
284
|
end
|
@@ -281,6 +287,12 @@ module Inspec::Plugin::V2
|
|
281
287
|
end
|
282
288
|
end
|
283
289
|
|
290
|
+
def fetch_plugin_specs(plugin_name)
|
291
|
+
fetcher = Gem::SpecFetcher.fetcher
|
292
|
+
plugin_dependency = Gem::Dependency.new(plugin_name)
|
293
|
+
fetcher.spec_for_dependency(plugin_dependency).flatten.first
|
294
|
+
end
|
295
|
+
|
284
296
|
def fixup_train_plugin_status(status)
|
285
297
|
status.api_generation = :'train-1'
|
286
298
|
if status.installation_type == :user_gem
|
@@ -327,6 +339,7 @@ module Inspec::Plugin::V2
|
|
327
339
|
status.version = plugin_spec.version.to_s
|
328
340
|
status.loaded = false
|
329
341
|
status.installation_type = :system_gem
|
342
|
+
status.description = plugin_spec.summary
|
330
343
|
|
331
344
|
if train_plugin_name?(status[:name])
|
332
345
|
# Train plugins are not true InSpec plugins; we need to decorate them a
|
@@ -14,7 +14,8 @@ module Inspec::Plugin::V2
|
|
14
14
|
:loaded, # true, false False could mean not attempted or failed
|
15
15
|
:load_exception, # Exception class if it failed to load
|
16
16
|
:name, # String name
|
17
|
-
:version
|
17
|
+
:version, # three-digit version. Core / bundled plugins use InSpec version here.
|
18
|
+
:description # Description of plugin.
|
18
19
|
) do
|
19
20
|
def initialize(*)
|
20
21
|
super
|
data/lib/inspec/resources/apt.rb
CHANGED
@@ -135,19 +135,25 @@ module Inspec::Resources
|
|
135
135
|
|
136
136
|
class PpaRepository < AptRepository
|
137
137
|
name "ppa"
|
138
|
+
desc "Use the ppa InSpec audit resource to verify PPA repositories on the Debian-based linux platforms."
|
139
|
+
example <<~EXAMPLE
|
140
|
+
describe ppa('ubuntu-wine/ppa') do
|
141
|
+
it { should exist }
|
142
|
+
it { should be_enabled }
|
143
|
+
end
|
144
|
+
|
145
|
+
describe ppa('ppa:ubuntu-wine/ppa') do
|
146
|
+
it { should exist }
|
147
|
+
it { should be_enabled }
|
148
|
+
end
|
149
|
+
EXAMPLE
|
138
150
|
|
139
151
|
def exists?
|
140
|
-
deprecated
|
141
152
|
super()
|
142
153
|
end
|
143
154
|
|
144
155
|
def enabled?
|
145
|
-
deprecated
|
146
156
|
super()
|
147
157
|
end
|
148
|
-
|
149
|
-
def deprecated
|
150
|
-
Inspec.deprecate(:resource_ppa, "The `ppa` resource is deprecated. Please use `apt`")
|
151
|
-
end
|
152
158
|
end
|
153
159
|
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require "inspec/resources/command"
|
2
|
+
module Inspec::Resources
|
3
|
+
class Cgroup < Inspec.resource(1)
|
4
|
+
name "cgroup"
|
5
|
+
# Restrict to only run on the below platform
|
6
|
+
supports platform: "linux"
|
7
|
+
desc "Use the cgroup InSpec audit resource to test cgroup subsytem's parameters."
|
8
|
+
|
9
|
+
example <<~EXAMPLE
|
10
|
+
describe cgroup("foo") do
|
11
|
+
its("cpuset.cpus") { should eq 0 }
|
12
|
+
its("memory.limit_in_bytes") { should eq 499712 }
|
13
|
+
its("memory.limit_in_bytes") { should be <= 500000 }
|
14
|
+
its("memory.numa_stat") { should match /total=0/ }
|
15
|
+
end
|
16
|
+
EXAMPLE
|
17
|
+
|
18
|
+
# Resource initialization.
|
19
|
+
def initialize(cgroup_name)
|
20
|
+
raise Inspec::Exceptions::ResourceSkipped, "The `cgroup` resource is not supported on your OS yet." unless inspec.os.linux?
|
21
|
+
|
22
|
+
@cgroup_name = cgroup_name
|
23
|
+
@valid_queries, @valid_queries_split = [], []
|
24
|
+
find_valid_queries
|
25
|
+
# Used to track the method calls in an "its" query
|
26
|
+
@cgroup_info_query = []
|
27
|
+
end
|
28
|
+
|
29
|
+
def resource_id
|
30
|
+
@cgroup_name
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_s
|
34
|
+
"cgroup #{resource_id}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def method_missing(param)
|
38
|
+
# Add the latest param we've seen to the list and form the query with all the params we've seen so far.
|
39
|
+
@cgroup_info_query << param.to_s
|
40
|
+
query = @cgroup_info_query.join(".")
|
41
|
+
|
42
|
+
# The ith level param must match with atleast one row's ith column of @valid_queries_split
|
43
|
+
# Else there is no way, we would find any valid query in further iteration, so raise exception.
|
44
|
+
if @valid_queries_split.map { |e| e[@cgroup_info_query.length - 1] }.include?(param.to_s)
|
45
|
+
# If the query form so far is part of @valid_queries, we are good to trigger find_cgroup_info
|
46
|
+
# else go for next level of param
|
47
|
+
if @valid_queries.include?(query)
|
48
|
+
@cgroup_info_query = []
|
49
|
+
find_cgroup_info(query)
|
50
|
+
else
|
51
|
+
self
|
52
|
+
end
|
53
|
+
else
|
54
|
+
@cgroup_info_query = []
|
55
|
+
|
56
|
+
raise Inspec::Exceptions::ResourceFailed, "The query #{query} does not appear to be valid."
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
# Method to find cgget tool
|
63
|
+
def find_cgget_or_error
|
64
|
+
%w{/usr/sbin/cgget /sbin/cgget cgget}.each do |cmd|
|
65
|
+
return cmd if inspec.command(cmd).exist?
|
66
|
+
end
|
67
|
+
|
68
|
+
raise Inspec::Exceptions::ResourceFailed, "Could not find `cgget`"
|
69
|
+
end
|
70
|
+
|
71
|
+
# find the cgroup info of the query which is given as input by the user
|
72
|
+
def find_cgroup_info(query)
|
73
|
+
bin = find_cgget_or_error
|
74
|
+
cgget_cmd = "#{bin} -n -r #{query} #{@cgroup_name}"
|
75
|
+
cmd = inspec.command(cgget_cmd)
|
76
|
+
|
77
|
+
raise Inspec::Exceptions::ResourceFailed, "Executing cgget failed: #{cmd.stderr}" if cmd.exit_status.to_i != 0
|
78
|
+
|
79
|
+
# For complex returns the user must use match /the_regex/
|
80
|
+
param_value = cmd.stdout.split(":")
|
81
|
+
return nil if param_value.nil? || param_value.empty?
|
82
|
+
|
83
|
+
param_value = param_value[1].strip.split("\t").join
|
84
|
+
param_value.match(/^\d+$/) ? param_value.to_i : param_value
|
85
|
+
end
|
86
|
+
|
87
|
+
# find all the information about all relevant controllers for the current cgroup
|
88
|
+
def find_valid_queries
|
89
|
+
bin = find_cgget_or_error
|
90
|
+
cgget_all_cmd = "#{bin} -n -a #{@cgroup_name}"
|
91
|
+
cmd = inspec.command(cgget_all_cmd)
|
92
|
+
|
93
|
+
raise Inspec::Exceptions::ResourceFailed, "Executing cgget failed: #{cmd.stderr}" if cmd.exit_status.to_i != 0
|
94
|
+
|
95
|
+
queries = cmd.stdout.to_s.gsub(/:.*/, "").gsub(/^\s+.*/, "").split("\n")
|
96
|
+
# store the relevant controller parameters in @valid_queries and the dot splitted paramters into @valid_queries_split
|
97
|
+
@valid_queries = queries.map { |q| q if q.length > 0 }.compact
|
98
|
+
@valid_queries_split = @valid_queries.map { |q| q.split(".") }.compact
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "inspec/resources/command"
|
2
|
+
module Inspec::Resources
|
3
|
+
class Lxc < Inspec.resource(1)
|
4
|
+
name "lxc"
|
5
|
+
# Restrict to only run on the below platforms
|
6
|
+
supports platform: "linux"
|
7
|
+
desc "Use the lxc InSpec audit resource to test if container exists and/or is running for linux container"
|
8
|
+
example <<~EXAMPLE
|
9
|
+
describe lxc("ubuntu-container") do
|
10
|
+
it { should exist }
|
11
|
+
it { should be_running }
|
12
|
+
end
|
13
|
+
EXAMPLE
|
14
|
+
|
15
|
+
# Resource initialization.
|
16
|
+
def initialize(container_name)
|
17
|
+
@container_name = container_name
|
18
|
+
|
19
|
+
raise Inspec::Exceptions::ResourceSkipped, "The `lxc` resource is not supported on your OS yet." unless inspec.os.linux?
|
20
|
+
end
|
21
|
+
|
22
|
+
def resource_id
|
23
|
+
@container_name
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_s
|
27
|
+
"lxc #{resource_id}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def exists?
|
31
|
+
lxc_info_cmd.exit_status.to_i == 0
|
32
|
+
end
|
33
|
+
|
34
|
+
def running?
|
35
|
+
container_info = lxc_info_cmd.stdout.split(":").map(&:strip)
|
36
|
+
container_info[0] == "Status" && container_info[1] == "Running"
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
# Method to find lxc
|
42
|
+
def find_lxc_or_error
|
43
|
+
%w{/usr/sbin/lxc /sbin/lxc lxc}.each do |cmd|
|
44
|
+
return cmd if inspec.command(cmd).exist?
|
45
|
+
end
|
46
|
+
|
47
|
+
raise Inspec::Exceptions::ResourceFailed, "Could not find `lxc`"
|
48
|
+
end
|
49
|
+
|
50
|
+
def lxc_info_cmd
|
51
|
+
bin = find_lxc_or_error
|
52
|
+
info_cmd = "info #{@container_name} | grep -i Status"
|
53
|
+
lxc_cmd = format("%s %s", bin, info_cmd).strip
|
54
|
+
inspec.command(lxc_cmd)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -61,9 +61,13 @@ module Inspec::Resources
|
|
61
61
|
raise Inspec::Exceptions::ResourceFailed, "Oracle query with errors: #{out}"
|
62
62
|
else
|
63
63
|
begin
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
unless inspec_cmd.stdout.empty?
|
65
|
+
DatabaseHelper::SQLQueryResult.new(inspec_cmd, parse_csv_result(inspec_cmd.stdout))
|
66
|
+
else
|
67
|
+
inspec_cmd.stdout
|
68
|
+
end
|
69
|
+
rescue Exception => ex
|
70
|
+
raise Inspec::Exceptions::ResourceFailed, "Oracle query with exception: #{ex}"
|
67
71
|
end
|
68
72
|
end
|
69
73
|
end
|
@@ -55,8 +55,10 @@ module Inspec::Resources
|
|
55
55
|
psql_cmd = create_psql_cmd(query, db)
|
56
56
|
cmd = inspec.command(psql_cmd, redact_regex: %r{(:\/\/[a-z]*:).*(@)})
|
57
57
|
out = cmd.stdout + "\n" + cmd.stderr
|
58
|
-
if cmd.exit_status != 0
|
59
|
-
raise Inspec::Exceptions::ResourceFailed, "PostgreSQL
|
58
|
+
if cmd.exit_status != 0 && ( out =~ /could not connect to/ || out =~ /password authentication failed/ ) && out.downcase =~ /error:/
|
59
|
+
raise Inspec::Exceptions::ResourceFailed, "PostgreSQL connection error: #{out}"
|
60
|
+
elsif cmd.exit_status != 0 && out.downcase =~ /error:/
|
61
|
+
Lines.new(out, "PostgreSQL query with error: #{query}")
|
60
62
|
else
|
61
63
|
Lines.new(cmd.stdout.strip, "PostgreSQL query: #{query}")
|
62
64
|
end
|
@@ -190,7 +190,7 @@ module Inspec::Resources
|
|
190
190
|
true
|
191
191
|
end
|
192
192
|
|
193
|
-
# Detect LXC/Docker
|
193
|
+
# Detect LXC/Docker/k8s/podman
|
194
194
|
#
|
195
195
|
# /proc/self/cgroup will look like this inside a docker container:
|
196
196
|
# <index #>:<subsystem>:/lxc/<hexadecimal container id>
|
@@ -208,7 +208,7 @@ module Inspec::Resources
|
|
208
208
|
#
|
209
209
|
# Full notes, https://tickets.opscode.com/browse/OHAI-551
|
210
210
|
# Kernel docs, https://www.kernel.org/doc/Documentation/cgroups
|
211
|
-
def
|
211
|
+
def detect_container
|
212
212
|
return false unless inspec.file("/proc/self/cgroup").exist?
|
213
213
|
|
214
214
|
cgroup_content = inspec.file("/proc/self/cgroup").content
|
@@ -216,6 +216,12 @@ module Inspec::Resources
|
|
216
216
|
cgroup_content =~ %r{^\d+:[^:]+:/[^/]+/(lxc|docker)-.+$} # rubocop:disable Layout/MultilineOperationIndentation
|
217
217
|
@virtualization_data[:system] = $1 # rubocop:disable Style/PerlBackrefs
|
218
218
|
@virtualization_data[:role] = "guest"
|
219
|
+
elsif cgroup_content =~ %r{^\d+:[^:]+:/(kubepods)/.+$}
|
220
|
+
@virtualization_data[:system] = $1
|
221
|
+
@virtualization_data[:role] = "guest"
|
222
|
+
elsif /container=podman/.match?(file_read("/proc/1/environ"))
|
223
|
+
@virtualization_data[:system] = "podman"
|
224
|
+
@virtualization_data[:role] = "guest"
|
219
225
|
elsif lxc_version_exists? && cgroup_content =~ %r{\d:[^:]+:/$}
|
220
226
|
# lxc-version shouldn't be installed by default
|
221
227
|
# Even so, it is likely we are on an LXC capable host that is not being used as such
|
@@ -297,7 +303,7 @@ module Inspec::Resources
|
|
297
303
|
return if detect_docker
|
298
304
|
return if detect_virtualbox
|
299
305
|
return if detect_lxd
|
300
|
-
return if
|
306
|
+
return if detect_container
|
301
307
|
return if detect_linux_vserver
|
302
308
|
return if detect_kvm_from_cpuinfo
|
303
309
|
return if detect_kvm_from_sys
|
data/lib/inspec/ui.rb
CHANGED
@@ -140,6 +140,15 @@ module Inspec
|
|
140
140
|
print_or_return(result, opts[:print])
|
141
141
|
end
|
142
142
|
|
143
|
+
def line_with_width(width = 80, opts = { print: true } )
|
144
|
+
if color?
|
145
|
+
result = ANSI_CODES[:bold] + GLYPHS[:heavy_dash] * width + ANSI_CODES[:reset] + "\n"
|
146
|
+
else
|
147
|
+
result = "-" * width + "\n"
|
148
|
+
end
|
149
|
+
print_or_return(result, opts[:print])
|
150
|
+
end
|
151
|
+
|
143
152
|
# Makes a bullet point.
|
144
153
|
def list_item(str, opts = { print: true })
|
145
154
|
bullet = color? ? ANSI_CODES[:bold] + ANSI_CODES[:color][:white] + GLYPHS[:bullet] + ANSI_CODES[:reset] : "*"
|
data/lib/inspec/version.rb
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
# .gemspec file is added to add plugin details
|
2
|
+
# These specs are used in plugin list and search command
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "inspec-artifact"
|
6
|
+
spec.summary = ""
|
7
|
+
spec.description = "Plugin to generate asymmetrical keys that you can use to encrypt profiles"
|
8
|
+
spec.license = "Apache-2.0"
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# .gemspec file is added to add plugin details
|
2
|
+
# These specs are used in plugin list and search command
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "inspec-compliance"
|
6
|
+
spec.summary = "Plugin to perform operations with Chef Automate"
|
7
|
+
spec.description = "This extensions will allow you to interact with Chef Automate"
|
8
|
+
spec.license = "Apache-2.0"
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# .gemspec file is added to add plugin details
|
2
|
+
# These specs are used in plugin list and search command
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "inspec-habitat"
|
6
|
+
spec.summary = "Plugin to create/upload habitat package"
|
7
|
+
spec.description = "This extensions will allow you to create/upload habitat package from an inspec profile."
|
8
|
+
spec.license = "Apache-2.0"
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# .gemspec file is added to add plugin details
|
2
|
+
# These specs are used in plugin list and search command
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "inspec-init"
|
6
|
+
spec.summary = "Plugin for scaffolding profile, plugin or a resource"
|
7
|
+
spec.description = "This extensions helps you to easily create a new profile, plugin or a resource."
|
8
|
+
spec.license = "Apache-2.0"
|
9
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# .gemspec file is added to add plugin details
|
2
|
+
# These specs are used in plugin list and search command
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "inspec-plugin-manager-cli"
|
6
|
+
spec.summary = "CLI plugin for InSpec"
|
7
|
+
spec.description = "This is a CLI plugin for InSpec. It uses the Plugins API v2 to create a
|
8
|
+
series of commands to manage plugins."
|
9
|
+
spec.license = "Apache-2.0"
|
10
|
+
end
|
@@ -41,13 +41,14 @@ module InspecPlugins
|
|
41
41
|
|
42
42
|
unless plugin_statuses.empty?
|
43
43
|
ui.table do |t|
|
44
|
-
t.header = ["Plugin Name", "Version", "Via", "ApiVer"]
|
44
|
+
t.header = ["Plugin Name", "Version", "Via", "ApiVer", "Description"]
|
45
45
|
plugin_statuses.sort_by { |s| s.name.to_s }.each do |status|
|
46
46
|
t << [
|
47
47
|
status.name,
|
48
48
|
make_pretty_version(status),
|
49
49
|
make_pretty_install_type(status),
|
50
50
|
status.api_generation,
|
51
|
+
status.description,
|
51
52
|
]
|
52
53
|
end
|
53
54
|
end
|
@@ -83,14 +84,15 @@ module InspecPlugins
|
|
83
84
|
end
|
84
85
|
|
85
86
|
puts
|
86
|
-
ui.bold(format(" %-30s%-
|
87
|
-
ui.
|
87
|
+
ui.bold(format(" %-30s%-30s%-20s\n", "Plugin Name", "Versions Available", "Description"))
|
88
|
+
ui.line_with_width(100)
|
88
89
|
search_results.keys.sort.each do |plugin_name|
|
89
|
-
versions = options[:all] ? search_results[plugin_name] : [search_results[plugin_name].first]
|
90
|
+
versions = options[:all] ? search_results[plugin_name]["versions"] : [search_results[plugin_name]["versions"].first]
|
90
91
|
versions = "(" + versions.join(", ") + ")"
|
91
|
-
|
92
|
+
description = search_results[plugin_name]["description"]
|
93
|
+
ui.plain_line(format(" %-30s%-30s%-20s", plugin_name, versions, description))
|
92
94
|
end
|
93
|
-
ui.
|
95
|
+
ui.line_with_width(100)
|
94
96
|
ui.plain_line(" #{search_results.count} plugin(s) found")
|
95
97
|
puts
|
96
98
|
|
@@ -381,9 +383,11 @@ module InspecPlugins
|
|
381
383
|
# Do an expensive search to determine the latest version.
|
382
384
|
unless requested_version
|
383
385
|
latest_version = installer.search(plugin_name, exact: true, scope: :latest)
|
384
|
-
|
385
|
-
|
386
|
-
|
386
|
+
if latest_version[plugin_name]
|
387
|
+
latest_version = latest_version[plugin_name]["versions"]&.last
|
388
|
+
if latest_version && !requested_version
|
389
|
+
requested_version = latest_version
|
390
|
+
end
|
387
391
|
end
|
388
392
|
end
|
389
393
|
|
@@ -429,7 +433,7 @@ module InspecPlugins
|
|
429
433
|
if results.empty?
|
430
434
|
ui.red("No such plugin gem #{plugin_name} could be found on " \
|
431
435
|
"#{source_host} - installation failed.\n")
|
432
|
-
elsif options[:version] && !results[plugin_name].include?(options[:version])
|
436
|
+
elsif options[:version] && results[plugin_name] && !results[plugin_name]["versions"].include?(options[:version])
|
433
437
|
ui.red("No such version - #{plugin_name} exists, but no such " \
|
434
438
|
"version #{options[:version]} found on #{source_host} - " \
|
435
439
|
"installation failed.\n")
|
@@ -460,7 +464,7 @@ module InspecPlugins
|
|
460
464
|
|
461
465
|
# Check for latest version (and implicitly, existence)
|
462
466
|
latest_version = installer.search(plugin_name, exact: true, scope: :latest)
|
463
|
-
latest_version = latest_version[plugin_name]&.last
|
467
|
+
latest_version = latest_version[plugin_name] ? latest_version[plugin_name]["versions"]&.last : nil
|
464
468
|
|
465
469
|
if pre_update_versions.include?(latest_version)
|
466
470
|
ui.plain_line("#{ui.bold("Already installed at latest version:", print: false)} " \
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# .gemspec file is added to add plugin details
|
2
|
+
# These specs are used in plugin list and search command
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "inspec-reporter-html2"
|
6
|
+
spec.summary = "Improved HTML reporter plugin"
|
7
|
+
spec.description = "An improved HTML output reporter specifically for Chef InSpec. Unlike the default html reporter, which is RSpec-based, this reporter knows about Chef InSpec structures like Controls and Profiles, and includes full metadata such as control tags, etc."
|
8
|
+
spec.license = "Apache-2.0"
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# .gemspec file is added to add plugin details
|
2
|
+
# These specs are used in plugin list and search command
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "inspec-reporter-json-min"
|
6
|
+
spec.summary = "Json-min json reporter plugin"
|
7
|
+
spec.description = "This plugin provides the `json-min` reporter, which produces test output in JSON format with less detail than the `json` reporter."
|
8
|
+
spec.license = "Apache-2.0"
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# .gemspec file is added to add plugin details
|
2
|
+
# These specs are used in plugin list and search command
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "inspec-reporter-junit"
|
6
|
+
spec.summary = "JUnit XML reporter plugin"
|
7
|
+
spec.description = "`junit` is the legacy Chef InSpec JUnit reporter, which is retained for backwards compatibility. It generates an XML report in Apache Ant JUnit format. The output format is considered nonstandard in several ways. New users are advised to use `junit2`."
|
8
|
+
spec.license = "Apache-2.0"
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# .gemspec file is added to add plugin details
|
2
|
+
# These specs are used in plugin list and search command
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "inspec-streaming-reporter-progress-bar"
|
6
|
+
spec.summary = "Displays a real-time progress bar and control title as output"
|
7
|
+
spec.description = "This plugin is a streaming reporter plugin which shows the real-time progress of a running InSpec profile using a progress bar. It also outputs the ID of a running control with an indicator showing if the control has passed, failed or skipped."
|
8
|
+
spec.license = "Apache-2.0"
|
9
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.10.5
|
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: 2022-03-
|
11
|
+
date: 2022-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-telemetry
|
@@ -511,6 +511,7 @@ files:
|
|
511
511
|
- lib/inspec/resources/cassandra.rb
|
512
512
|
- lib/inspec/resources/cassandradb_conf.rb
|
513
513
|
- lib/inspec/resources/cassandradb_session.rb
|
514
|
+
- lib/inspec/resources/cgroup.rb
|
514
515
|
- lib/inspec/resources/chocolatey_package.rb
|
515
516
|
- lib/inspec/resources/chrony_conf.rb
|
516
517
|
- lib/inspec/resources/command.rb
|
@@ -567,6 +568,7 @@ files:
|
|
567
568
|
- lib/inspec/resources/limits_conf.rb
|
568
569
|
- lib/inspec/resources/linux_kernel_parameter.rb
|
569
570
|
- lib/inspec/resources/login_defs.rb
|
571
|
+
- lib/inspec/resources/lxc.rb
|
570
572
|
- lib/inspec/resources/mongodb.rb
|
571
573
|
- lib/inspec/resources/mongodb_conf.rb
|
572
574
|
- lib/inspec/resources/mongodb_session.rb
|
@@ -708,10 +710,12 @@ files:
|
|
708
710
|
- lib/inspec/version.rb
|
709
711
|
- lib/matchers/matchers.rb
|
710
712
|
- lib/plugins/README.md
|
713
|
+
- lib/plugins/inspec-artifact/inspec-artifact.gemspec
|
711
714
|
- lib/plugins/inspec-artifact/lib/inspec-artifact.rb
|
712
715
|
- lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb
|
713
716
|
- lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb
|
714
717
|
- lib/plugins/inspec-compliance/README.md
|
718
|
+
- lib/plugins/inspec-compliance/inspec-compliance.gemspec
|
715
719
|
- lib/plugins/inspec-compliance/lib/inspec-compliance.rb
|
716
720
|
- lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb
|
717
721
|
- lib/plugins/inspec-compliance/lib/inspec-compliance/api/login.rb
|
@@ -723,12 +727,14 @@ files:
|
|
723
727
|
- lib/plugins/inspec-compliance/lib/inspec-compliance/target.rb
|
724
728
|
- lib/plugins/inspec-habitat/Berksfile
|
725
729
|
- lib/plugins/inspec-habitat/README.md
|
730
|
+
- lib/plugins/inspec-habitat/inspec-habitat.gemspec
|
726
731
|
- lib/plugins/inspec-habitat/kitchen.yml
|
727
732
|
- lib/plugins/inspec-habitat/lib/inspec-habitat.rb
|
728
733
|
- lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb
|
729
734
|
- lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb
|
730
735
|
- lib/plugins/inspec-habitat/templates/habitat/plan.sh.erb
|
731
736
|
- lib/plugins/inspec-init/README.md
|
737
|
+
- lib/plugins/inspec-init/inspec-init.gemspec
|
732
738
|
- lib/plugins/inspec-init/lib/inspec-init.rb
|
733
739
|
- lib/plugins/inspec-init/lib/inspec-init/cli.rb
|
734
740
|
- lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb
|
@@ -765,10 +771,12 @@ files:
|
|
765
771
|
- lib/plugins/inspec-init/templates/resources/plural/docs/resource-doc.erb
|
766
772
|
- lib/plugins/inspec-init/templates/resources/plural/libraries/inspec-resource-template.erb
|
767
773
|
- lib/plugins/inspec-plugin-manager-cli/README.md
|
774
|
+
- lib/plugins/inspec-plugin-manager-cli/inspec-plugin-manager-cli.gemspec
|
768
775
|
- lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb
|
769
776
|
- lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb
|
770
777
|
- lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb
|
771
778
|
- lib/plugins/inspec-reporter-html2/README.md
|
779
|
+
- lib/plugins/inspec-reporter-html2/inspec-reporter-html2.gemspec
|
772
780
|
- lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2.rb
|
773
781
|
- lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
|
774
782
|
- lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/version.rb
|
@@ -780,14 +788,17 @@ files:
|
|
780
788
|
- lib/plugins/inspec-reporter-html2/templates/result.html.erb
|
781
789
|
- lib/plugins/inspec-reporter-html2/templates/selector.html.erb
|
782
790
|
- lib/plugins/inspec-reporter-json-min/README.md
|
791
|
+
- lib/plugins/inspec-reporter-json-min/inspec-reporter-json-min.gemspec
|
783
792
|
- lib/plugins/inspec-reporter-json-min/lib/inspec-reporter-json-min.rb
|
784
793
|
- lib/plugins/inspec-reporter-json-min/lib/inspec-reporter-json-min/reporter.rb
|
785
794
|
- lib/plugins/inspec-reporter-json-min/lib/inspec-reporter-json-min/version.rb
|
786
795
|
- lib/plugins/inspec-reporter-junit/README.md
|
796
|
+
- lib/plugins/inspec-reporter-junit/inspec-reporter-junit.gemspec
|
787
797
|
- lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit.rb
|
788
798
|
- lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/reporter.rb
|
789
799
|
- lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/version.rb
|
790
800
|
- lib/plugins/inspec-streaming-reporter-progress-bar/README.md
|
801
|
+
- lib/plugins/inspec-streaming-reporter-progress-bar/inspec-streaming-reporter-progress-bar.gemspec
|
791
802
|
- lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar.rb
|
792
803
|
- lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/plugin.rb
|
793
804
|
- lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/streaming_reporter.rb
|