inspec-core 5.7.9 → 5.14.0
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/cli.rb +2 -0
- 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/profile.rb +7 -5
- data/lib/inspec/resources/apt.rb +12 -6
- data/lib/inspec/resources/cgroup.rb +101 -0
- data/lib/inspec/resources/default_gateway.rb +61 -0
- data/lib/inspec/resources/docker_container.rb +21 -0
- data/lib/inspec/resources/docker_image.rb +53 -0
- data/lib/inspec/resources/file.rb +91 -0
- data/lib/inspec/resources/groups.rb +5 -0
- data/lib/inspec/resources/linux_audit_system.rb +81 -0
- data/lib/inspec/resources/lxc.rb +57 -0
- data/lib/inspec/resources/mail_alias.rb +46 -0
- data/lib/inspec/resources/oracledb_session.rb +7 -3
- data/lib/inspec/resources/postgres_session.rb +4 -2
- data/lib/inspec/resources/routing_table.rb +137 -0
- data/lib/inspec/resources/service.rb +87 -1
- data/lib/inspec/resources/user.rb +12 -0
- data/lib/inspec/resources/users.rb +79 -14
- 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
- data/lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/streaming_reporter.rb +32 -21
- metadata +17 -2
@@ -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
|
@@ -41,9 +41,9 @@ module InspecPlugins::StreamingReporterProgressBar
|
|
41
41
|
# Groovy UTF-8 characters for everyone else...
|
42
42
|
# ...even though they probably only work on Mac
|
43
43
|
INDICATORS = {
|
44
|
-
"failed" => "×",
|
45
|
-
"skipped" => "↺",
|
46
|
-
"passed" => "✔",
|
44
|
+
"failed" => "× [FAILED] ",
|
45
|
+
"skipped" => "↺ [SKIPPED]",
|
46
|
+
"passed" => "✔ [PASSED] ",
|
47
47
|
}.freeze
|
48
48
|
end
|
49
49
|
|
@@ -54,58 +54,69 @@ module InspecPlugins::StreamingReporterProgressBar
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def example_passed(notification)
|
57
|
-
|
58
|
-
set_status_mapping(control_id, "passed")
|
59
|
-
show_progress(control_id) if control_ended?(control_id)
|
57
|
+
set_example(notification, "passed")
|
60
58
|
end
|
61
59
|
|
62
60
|
def example_failed(notification)
|
63
|
-
|
64
|
-
set_status_mapping(control_id, "failed")
|
65
|
-
show_progress(control_id) if control_ended?(control_id)
|
61
|
+
set_example(notification, "failed")
|
66
62
|
end
|
67
63
|
|
68
64
|
def example_pending(notification)
|
69
|
-
|
70
|
-
set_status_mapping(control_id, "skipped")
|
71
|
-
show_progress(control_id) if control_ended?(control_id)
|
65
|
+
set_example(notification, "skipped")
|
72
66
|
end
|
73
67
|
|
74
68
|
private
|
75
69
|
|
76
|
-
def
|
70
|
+
def set_example(notification, status)
|
71
|
+
control_id = notification.example.metadata[:id]
|
72
|
+
title = notification.example.metadata[:title]
|
73
|
+
full_description = notification.example.metadata[:full_description]
|
74
|
+
control_impact = notification.example.metadata[:impact]
|
75
|
+
set_status_mapping(control_id, status)
|
76
|
+
show_progress(control_id, title, full_description, control_impact) if control_ended?(control_id)
|
77
|
+
end
|
78
|
+
|
79
|
+
def show_progress(control_id, title, full_description, control_impact)
|
77
80
|
@bar ||= ProgressBar.new(controls_count, :bar, :counter, :percentage)
|
78
81
|
sleep 0.1
|
79
82
|
@bar.increment!
|
80
|
-
@bar.puts format_it(control_id)
|
81
|
-
rescue
|
82
|
-
raise "Exception in Progress Bar streaming reporter: #{
|
83
|
+
@bar.puts format_it(control_id, title, full_description, control_impact)
|
84
|
+
rescue StandardError => e
|
85
|
+
raise "Exception in Progress Bar streaming reporter: #{e}"
|
83
86
|
end
|
84
87
|
|
85
|
-
def format_it(control_id)
|
88
|
+
def format_it(control_id, title, full_description, control_impact)
|
86
89
|
control_status = if @status_mapping[control_id].include? "failed"
|
87
90
|
"failed"
|
88
|
-
elsif @status_mapping[control_id].include? "skipped"
|
89
|
-
"skipped"
|
90
91
|
elsif @status_mapping[control_id].include? "passed"
|
91
92
|
"passed"
|
93
|
+
else
|
94
|
+
@status_mapping[control_id].include? "skipped"
|
95
|
+
"skipped"
|
92
96
|
end
|
93
|
-
|
94
97
|
indicator = INDICATORS[control_status]
|
95
98
|
message_to_format = ""
|
96
99
|
message_to_format += "#{indicator} "
|
97
|
-
message_to_format += control_id.to_s.
|
100
|
+
message_to_format += "#{control_id.to_s.strip.dup.force_encoding(Encoding::UTF_8)} "
|
101
|
+
message_to_format += "#{title.gsub(/\n*\s+/, " ").to_s.force_encoding(Encoding::UTF_8)} " if title
|
102
|
+
message_to_format += "#{full_description.gsub(/\n*\s+/, " ").to_s.force_encoding(Encoding::UTF_8)} " unless title
|
98
103
|
format_with_color(control_status, message_to_format)
|
104
|
+
rescue Exception => e
|
105
|
+
raise "Exception in show_progress: #{e}"
|
99
106
|
end
|
100
107
|
|
101
108
|
def format_with_color(color_name, text)
|
102
109
|
"#{COLORS[color_name]}#{text}#{COLORS["reset"]}"
|
110
|
+
rescue StandardError => e
|
111
|
+
raise "Exception in format_with_color: #{e}"
|
103
112
|
end
|
104
113
|
|
105
114
|
# status mapping with control id to decide the final state of the control
|
106
115
|
def set_status_mapping(control_id, status)
|
107
116
|
@status_mapping[control_id] = [] if @status_mapping[control_id].nil?
|
108
117
|
@status_mapping[control_id].push(status)
|
118
|
+
rescue StandardError => e
|
119
|
+
raise "Exception in format_with_color: #{e}"
|
109
120
|
end
|
110
121
|
|
111
122
|
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.14.0
|
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-
|
11
|
+
date: 2022-04-20 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
|
@@ -519,6 +520,7 @@ files:
|
|
519
520
|
- lib/inspec/resources/cron.rb
|
520
521
|
- lib/inspec/resources/crontab.rb
|
521
522
|
- lib/inspec/resources/csv.rb
|
523
|
+
- lib/inspec/resources/default_gateway.rb
|
522
524
|
- lib/inspec/resources/dh_params.rb
|
523
525
|
- lib/inspec/resources/directory.rb
|
524
526
|
- lib/inspec/resources/docker.rb
|
@@ -565,8 +567,11 @@ files:
|
|
565
567
|
- lib/inspec/resources/ksh.rb
|
566
568
|
- lib/inspec/resources/launchd_service.rb
|
567
569
|
- lib/inspec/resources/limits_conf.rb
|
570
|
+
- lib/inspec/resources/linux_audit_system.rb
|
568
571
|
- lib/inspec/resources/linux_kernel_parameter.rb
|
569
572
|
- lib/inspec/resources/login_defs.rb
|
573
|
+
- lib/inspec/resources/lxc.rb
|
574
|
+
- lib/inspec/resources/mail_alias.rb
|
570
575
|
- lib/inspec/resources/mongodb.rb
|
571
576
|
- lib/inspec/resources/mongodb_conf.rb
|
572
577
|
- lib/inspec/resources/mongodb_session.rb
|
@@ -611,6 +616,7 @@ files:
|
|
611
616
|
- lib/inspec/resources/rabbitmq_conf.rb
|
612
617
|
- lib/inspec/resources/rabbitmq_config.rb
|
613
618
|
- lib/inspec/resources/registry_key.rb
|
619
|
+
- lib/inspec/resources/routing_table.rb
|
614
620
|
- lib/inspec/resources/runit_service.rb
|
615
621
|
- lib/inspec/resources/script.rb
|
616
622
|
- lib/inspec/resources/security_identifier.rb
|
@@ -708,10 +714,12 @@ files:
|
|
708
714
|
- lib/inspec/version.rb
|
709
715
|
- lib/matchers/matchers.rb
|
710
716
|
- lib/plugins/README.md
|
717
|
+
- lib/plugins/inspec-artifact/inspec-artifact.gemspec
|
711
718
|
- lib/plugins/inspec-artifact/lib/inspec-artifact.rb
|
712
719
|
- lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb
|
713
720
|
- lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb
|
714
721
|
- lib/plugins/inspec-compliance/README.md
|
722
|
+
- lib/plugins/inspec-compliance/inspec-compliance.gemspec
|
715
723
|
- lib/plugins/inspec-compliance/lib/inspec-compliance.rb
|
716
724
|
- lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb
|
717
725
|
- lib/plugins/inspec-compliance/lib/inspec-compliance/api/login.rb
|
@@ -723,12 +731,14 @@ files:
|
|
723
731
|
- lib/plugins/inspec-compliance/lib/inspec-compliance/target.rb
|
724
732
|
- lib/plugins/inspec-habitat/Berksfile
|
725
733
|
- lib/plugins/inspec-habitat/README.md
|
734
|
+
- lib/plugins/inspec-habitat/inspec-habitat.gemspec
|
726
735
|
- lib/plugins/inspec-habitat/kitchen.yml
|
727
736
|
- lib/plugins/inspec-habitat/lib/inspec-habitat.rb
|
728
737
|
- lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb
|
729
738
|
- lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb
|
730
739
|
- lib/plugins/inspec-habitat/templates/habitat/plan.sh.erb
|
731
740
|
- lib/plugins/inspec-init/README.md
|
741
|
+
- lib/plugins/inspec-init/inspec-init.gemspec
|
732
742
|
- lib/plugins/inspec-init/lib/inspec-init.rb
|
733
743
|
- lib/plugins/inspec-init/lib/inspec-init/cli.rb
|
734
744
|
- lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb
|
@@ -765,10 +775,12 @@ files:
|
|
765
775
|
- lib/plugins/inspec-init/templates/resources/plural/docs/resource-doc.erb
|
766
776
|
- lib/plugins/inspec-init/templates/resources/plural/libraries/inspec-resource-template.erb
|
767
777
|
- lib/plugins/inspec-plugin-manager-cli/README.md
|
778
|
+
- lib/plugins/inspec-plugin-manager-cli/inspec-plugin-manager-cli.gemspec
|
768
779
|
- lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb
|
769
780
|
- lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb
|
770
781
|
- lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb
|
771
782
|
- lib/plugins/inspec-reporter-html2/README.md
|
783
|
+
- lib/plugins/inspec-reporter-html2/inspec-reporter-html2.gemspec
|
772
784
|
- lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2.rb
|
773
785
|
- lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
|
774
786
|
- lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/version.rb
|
@@ -780,14 +792,17 @@ files:
|
|
780
792
|
- lib/plugins/inspec-reporter-html2/templates/result.html.erb
|
781
793
|
- lib/plugins/inspec-reporter-html2/templates/selector.html.erb
|
782
794
|
- lib/plugins/inspec-reporter-json-min/README.md
|
795
|
+
- lib/plugins/inspec-reporter-json-min/inspec-reporter-json-min.gemspec
|
783
796
|
- lib/plugins/inspec-reporter-json-min/lib/inspec-reporter-json-min.rb
|
784
797
|
- lib/plugins/inspec-reporter-json-min/lib/inspec-reporter-json-min/reporter.rb
|
785
798
|
- lib/plugins/inspec-reporter-json-min/lib/inspec-reporter-json-min/version.rb
|
786
799
|
- lib/plugins/inspec-reporter-junit/README.md
|
800
|
+
- lib/plugins/inspec-reporter-junit/inspec-reporter-junit.gemspec
|
787
801
|
- lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit.rb
|
788
802
|
- lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/reporter.rb
|
789
803
|
- lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/version.rb
|
790
804
|
- lib/plugins/inspec-streaming-reporter-progress-bar/README.md
|
805
|
+
- lib/plugins/inspec-streaming-reporter-progress-bar/inspec-streaming-reporter-progress-bar.gemspec
|
791
806
|
- lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar.rb
|
792
807
|
- lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/plugin.rb
|
793
808
|
- lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/streaming_reporter.rb
|