inspec-core 4.7.3 → 4.7.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bundles/inspec-supermarket/api.rb +2 -1
  3. data/lib/bundles/inspec-supermarket/cli.rb +6 -6
  4. data/lib/bundles/inspec-supermarket/target.rb +1 -0
  5. data/lib/fetchers/git.rb +3 -1
  6. data/lib/fetchers/mock.rb +1 -0
  7. data/lib/fetchers/url.rb +6 -3
  8. data/lib/inspec/backend.rb +1 -0
  9. data/lib/inspec/base_cli.rb +4 -1
  10. data/lib/inspec/cli.rb +5 -4
  11. data/lib/inspec/config.rb +9 -1
  12. data/lib/inspec/control_eval_context.rb +1 -0
  13. data/lib/inspec/dependencies/cache.rb +1 -0
  14. data/lib/inspec/dependencies/dependency_set.rb +2 -0
  15. data/lib/inspec/dependencies/lockfile.rb +1 -0
  16. data/lib/inspec/dependencies/requirement.rb +8 -7
  17. data/lib/inspec/dependencies/resolver.rb +3 -3
  18. data/lib/inspec/describe.rb +1 -0
  19. data/lib/inspec/dsl.rb +1 -1
  20. data/lib/inspec/dsl_shared.rb +1 -1
  21. data/lib/inspec/env_printer.rb +4 -4
  22. data/lib/inspec/fetcher.rb +4 -2
  23. data/lib/inspec/file_provider.rb +18 -8
  24. data/lib/inspec/formatters/base.rb +5 -0
  25. data/lib/inspec/impact.rb +2 -0
  26. data/lib/inspec/input_registry.rb +14 -13
  27. data/lib/inspec/metadata.rb +6 -2
  28. data/lib/inspec/method_source.rb +1 -1
  29. data/lib/inspec/objects/control.rb +4 -1
  30. data/lib/inspec/objects/describe.rb +3 -1
  31. data/lib/inspec/objects/input.rb +6 -5
  32. data/lib/inspec/objects/list.rb +2 -0
  33. data/lib/inspec/objects/test.rb +3 -2
  34. data/lib/inspec/plugin/v1/plugin_types/resource.rb +7 -0
  35. data/lib/inspec/plugin/v1/plugins.rb +4 -3
  36. data/lib/inspec/plugin/v1/registry.rb +3 -2
  37. data/lib/inspec/plugin/v2.rb +1 -0
  38. data/lib/inspec/plugin/v2/activator.rb +2 -0
  39. data/lib/inspec/plugin/v2/config_file.rb +4 -1
  40. data/lib/inspec/plugin/v2/filter.rb +1 -0
  41. data/lib/inspec/plugin/v2/installer.rb +9 -7
  42. data/lib/inspec/plugin/v2/loader.rb +2 -0
  43. data/lib/inspec/plugin/v2/plugin_base.rb +1 -0
  44. data/lib/inspec/plugin/v2/plugin_types/cli.rb +2 -2
  45. data/lib/inspec/plugin/v2/registry.rb +3 -1
  46. data/lib/inspec/profile.rb +13 -6
  47. data/lib/inspec/profile_context.rb +4 -2
  48. data/lib/inspec/reporters/cli.rb +14 -10
  49. data/lib/inspec/reporters/json.rb +1 -0
  50. data/lib/inspec/reporters/json_automate.rb +3 -0
  51. data/lib/inspec/reporters/json_min.rb +2 -0
  52. data/lib/inspec/resource.rb +2 -0
  53. data/lib/inspec/resources/aide_conf.rb +4 -3
  54. data/lib/inspec/resources/apache_conf.rb +1 -1
  55. data/lib/inspec/resources/apt.rb +2 -0
  56. data/lib/inspec/resources/auditd.rb +19 -18
  57. data/lib/inspec/resources/bridge.rb +5 -2
  58. data/lib/inspec/resources/chocolatey_package.rb +2 -0
  59. data/lib/inspec/resources/command.rb +1 -1
  60. data/lib/inspec/resources/crontab.rb +9 -8
  61. data/lib/inspec/resources/csv.rb +1 -1
  62. data/lib/inspec/resources/dh_params.rb +6 -0
  63. data/lib/inspec/resources/docker.rb +37 -34
  64. data/lib/inspec/resources/docker_container.rb +1 -0
  65. data/lib/inspec/resources/docker_image.rb +1 -0
  66. data/lib/inspec/resources/docker_plugin.rb +1 -0
  67. data/lib/inspec/resources/docker_service.rb +1 -0
  68. data/lib/inspec/resources/elasticsearch.rb +24 -24
  69. data/lib/inspec/resources/etc_fstab.rb +8 -7
  70. data/lib/inspec/resources/etc_group.rb +4 -0
  71. data/lib/inspec/resources/etc_hosts.rb +4 -4
  72. data/lib/inspec/resources/etc_hosts_allow_deny.rb +5 -3
  73. data/lib/inspec/resources/file.rb +4 -1
  74. data/lib/inspec/resources/filesystem.rb +5 -3
  75. data/lib/inspec/resources/firewalld.rb +7 -4
  76. data/lib/inspec/resources/groups.rb +6 -4
  77. data/lib/inspec/resources/grub_conf.rb +3 -0
  78. data/lib/inspec/resources/host.rb +5 -3
  79. data/lib/inspec/resources/http.rb +6 -4
  80. data/lib/inspec/resources/iis_app.rb +1 -0
  81. data/lib/inspec/resources/iis_app_pool.rb +1 -1
  82. data/lib/inspec/resources/iis_site.rb +4 -3
  83. data/lib/inspec/resources/interface.rb +10 -7
  84. data/lib/inspec/resources/json.rb +1 -1
  85. data/lib/inspec/resources/kernel_module.rb +1 -1
  86. data/lib/inspec/resources/kernel_parameter.rb +2 -1
  87. data/lib/inspec/resources/key_rsa.rb +5 -0
  88. data/lib/inspec/resources/mount.rb +3 -1
  89. data/lib/inspec/resources/mysql_conf.rb +3 -1
  90. data/lib/inspec/resources/mysql_session.rb +2 -0
  91. data/lib/inspec/resources/nginx.rb +1 -0
  92. data/lib/inspec/resources/nginx_conf.rb +10 -6
  93. data/lib/inspec/resources/ntp_conf.rb +1 -0
  94. data/lib/inspec/resources/oneget.rb +1 -1
  95. data/lib/inspec/resources/oracledb_session.rb +4 -2
  96. data/lib/inspec/resources/os_env.rb +1 -0
  97. data/lib/inspec/resources/package.rb +10 -6
  98. data/lib/inspec/resources/packages.rb +7 -5
  99. data/lib/inspec/resources/passwd.rb +7 -7
  100. data/lib/inspec/resources/pip.rb +2 -0
  101. data/lib/inspec/resources/port.rb +22 -8
  102. data/lib/inspec/resources/postgres.rb +2 -1
  103. data/lib/inspec/resources/postgres_conf.rb +2 -0
  104. data/lib/inspec/resources/postgres_hba_conf.rb +6 -6
  105. data/lib/inspec/resources/postgres_ident_conf.rb +3 -3
  106. data/lib/inspec/resources/processes.rb +16 -15
  107. data/lib/inspec/resources/rabbitmq_config.rb +2 -0
  108. data/lib/inspec/resources/registry_key.rb +8 -3
  109. data/lib/inspec/resources/security_identifier.rb +3 -1
  110. data/lib/inspec/resources/security_policy.rb +2 -1
  111. data/lib/inspec/resources/service.rb +13 -1
  112. data/lib/inspec/resources/shadow.rb +1 -0
  113. data/lib/inspec/resources/ssh_config.rb +2 -0
  114. data/lib/inspec/resources/ssl.rb +12 -11
  115. data/lib/inspec/resources/users.rb +29 -19
  116. data/lib/inspec/resources/virtualization.rb +10 -0
  117. data/lib/inspec/resources/windows_feature.rb +1 -1
  118. data/lib/inspec/resources/windows_hotfix.rb +2 -0
  119. data/lib/inspec/resources/windows_task.rb +4 -0
  120. data/lib/inspec/resources/wmi.rb +2 -1
  121. data/lib/inspec/resources/x509_certificate.rb +8 -0
  122. data/lib/inspec/resources/xinetd_conf.rb +10 -9
  123. data/lib/inspec/resources/yum.rb +15 -11
  124. data/lib/inspec/resources/zfs_dataset.rb +4 -2
  125. data/lib/inspec/resources/zfs_pool.rb +2 -1
  126. data/lib/inspec/rule.rb +11 -1
  127. data/lib/inspec/runner.rb +9 -6
  128. data/lib/inspec/runner_rspec.rb +10 -8
  129. data/lib/inspec/schema.rb +1 -0
  130. data/lib/inspec/secrets.rb +1 -0
  131. data/lib/inspec/secrets/yaml.rb +1 -0
  132. data/lib/inspec/shell.rb +20 -19
  133. data/lib/inspec/shell_detector.rb +1 -1
  134. data/lib/inspec/source_reader.rb +2 -0
  135. data/lib/inspec/ui.rb +1 -0
  136. data/lib/inspec/utils/deprecation/config_file.rb +8 -4
  137. data/lib/inspec/utils/erlang_parser.rb +2 -0
  138. data/lib/inspec/utils/file_reader.rb +1 -1
  139. data/lib/inspec/utils/filter.rb +16 -3
  140. data/lib/inspec/utils/find_files.rb +2 -2
  141. data/lib/inspec/utils/object_traversal.rb +1 -0
  142. data/lib/inspec/utils/parser.rb +2 -0
  143. data/lib/inspec/utils/simpleconfig.rb +4 -1
  144. data/lib/inspec/utils/telemetry/global_methods.rb +1 -0
  145. data/lib/inspec/version.rb +1 -1
  146. data/lib/matchers/matchers.rb +4 -1
  147. data/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb +12 -11
  148. data/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb +15 -11
  149. data/lib/plugins/inspec-compliance/lib/inspec-compliance/api/login.rb +4 -2
  150. data/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb +13 -12
  151. data/lib/plugins/inspec-compliance/lib/inspec-compliance/http.rb +3 -0
  152. data/lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb +1 -1
  153. data/lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb +2 -2
  154. data/lib/plugins/inspec-init/lib/inspec-init/renderer.rb +1 -0
  155. data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +6 -5
  156. data/lib/plugins/shared/core_plugin_test_helper.rb +1 -0
  157. data/lib/source_readers/flat.rb +1 -0
  158. data/lib/source_readers/inspec.rb +1 -0
  159. metadata +2 -2
@@ -45,6 +45,7 @@ module InspecPlugins
45
45
  def self.post_file(url, headers, file_path, insecure)
46
46
  uri = _parse_url(url)
47
47
  raise "Unable to parse URL: #{url}" if uri.nil? || uri.host.nil?
48
+
48
49
  http = Net::HTTP.new(uri.host, uri.port)
49
50
 
50
51
  # set connection flags
@@ -69,6 +70,7 @@ module InspecPlugins
69
70
  def self.post_multipart_file(url, headers, file_path, insecure)
70
71
  uri = _parse_url(url)
71
72
  raise "Unable to parse URL: #{url}" if uri.nil? || uri.host.nil?
73
+
72
74
  http = Net::HTTP.new(uri.host, uri.port)
73
75
 
74
76
  # set connection flags
@@ -93,6 +95,7 @@ module InspecPlugins
93
95
  opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE if insecure
94
96
 
95
97
  raise "Unable to parse URI: #{uri}" if uri.nil? || uri.host.nil?
98
+
96
99
  res = Net::HTTP.start(uri.host, uri.port, opts) do |http|
97
100
  http.request(req)
98
101
  end
@@ -194,7 +194,7 @@ module InspecPlugins
194
194
  FileUtils.mkdir_p(File.dirname(file))
195
195
  template_path = File.join(__dir__, "../../templates/habitat", template)
196
196
  contents = ERB.new(File.read(template_path))
197
- .result(OpenStruct.new(vars).instance_eval { binding })
197
+ .result(OpenStruct.new(vars).instance_eval { binding })
198
198
  File.write(file, contents)
199
199
  end
200
200
 
@@ -21,12 +21,12 @@ module InspecPlugins
21
21
 
22
22
  desc "profile [OPTIONS] NAME", "Generate a new profile"
23
23
  option :platform, default: "os", type: :string, aliases: [:p],
24
- desc: "Which platform to generate a profile for: choose from #{valid_profile_platforms.join(', ')}"
24
+ desc: "Which platform to generate a profile for: choose from #{valid_profile_platforms.join(", ")}"
25
25
  option :overwrite, type: :boolean, default: false,
26
26
  desc: "Overwrites existing directory"
27
27
  def profile(new_profile_name)
28
28
  unless valid_profile_platforms.include?(options[:platform])
29
- ui.error "Unable to generate profile: No template available for platform '#{options[:platform]}' (expected one of: #{valid_profile_platforms.join(', ')})"
29
+ ui.error "Unable to generate profile: No template available for platform '#{options[:platform]}' (expected one of: #{valid_profile_platforms.join(", ")})"
30
30
  ui.exit(:usage_error)
31
31
  end
32
32
  template_path = File.join("profiles", options[:platform])
@@ -54,6 +54,7 @@ module InspecPlugins
54
54
  Dir.glob(template_glob) do |source_file|
55
55
  relative_destination_item_path = Pathname.new(source_file).relative_path_from(Pathname.new(source_dir)).to_s
56
56
  next if skip_files.include? relative_destination_item_path
57
+
57
58
  relative_destination_item_path = file_rename_map[relative_destination_item_path] || relative_destination_item_path
58
59
  full_destination_item_path = Pathname.new(full_destination_path).join(relative_destination_item_path)
59
60
  if File.directory?(source_file)
@@ -20,7 +20,7 @@ module InspecPlugins
20
20
  option :all, desc: "Include plugins shipped with #{PRODUCT_NAME} as well.", type: :boolean, aliases: [:a]
21
21
  def list
22
22
  plugin_statuses = Inspec::Plugin::V2::Registry.instance.plugin_statuses
23
- plugin_statuses.reject! { |s| [:core, :bundle].include?(s.installation_type) } unless options[:all]
23
+ plugin_statuses.reject! { |s| %i{core bundle}.include?(s.installation_type) } unless options[:all]
24
24
 
25
25
  # TODO: ui object support
26
26
  puts
@@ -353,7 +353,7 @@ module InspecPlugins
353
353
  puts(red { "Plugin already installed at latest version" } + " - plugin #{plugin_name} #{requested_version} - refusing to install.")
354
354
  else
355
355
  # There are existing versions installed, but none of them are what was requested
356
- puts(red { "Update required" } + " - plugin #{plugin_name}, requested #{requested_version}, have #{pre_installed_versions.join(', ')}; use `inspec plugin update` - refusing to install.")
356
+ puts(red { "Update required" } + " - plugin #{plugin_name}, requested #{requested_version}, have #{pre_installed_versions.join(", ")}; use `inspec plugin update` - refusing to install.")
357
357
  end
358
358
 
359
359
  exit 2
@@ -370,6 +370,7 @@ module InspecPlugins
370
370
  exit 2
371
371
  rescue Inspec::Plugin::V2::InstallError
372
372
  raise if Inspec::Log.level == :debug
373
+
373
374
  results = installer.search(plugin_name, exact: true)
374
375
  if results.empty?
375
376
  puts(red { "No such plugin gem " } + plugin_name + " could be found on rubygems.org - installation failed.")
@@ -433,9 +434,9 @@ module InspecPlugins
433
434
  # TODO: this is naive, and assumes the latest version is the one that will be used. Logged on #3317
434
435
  # In fact, the logic to determine "what version would be used" belongs in the Loader.
435
436
  Inspec::Plugin::V2::Loader.list_installed_plugin_gems
436
- .select { |spec| spec.name == status.name.to_s }
437
- .sort_by(&:version)
438
- .last.version
437
+ .select { |spec| spec.name == status.name.to_s }
438
+ .sort_by(&:version)
439
+ .last.version
439
440
  when :path
440
441
  "src"
441
442
  end
@@ -126,6 +126,7 @@ module CorePluginFunctionalHelper
126
126
  plugin_name = project_dir.basename
127
127
  entry_point = File.join(project_dir.to_s, "lib", plugin_name.to_s + ".rb")
128
128
  raise "Could not find plugin entry point" unless File.exist?(entry_point)
129
+
129
130
  entry_point
130
131
  end
131
132
 
@@ -13,6 +13,7 @@ module SourceReaders
13
13
  x.end_with?(".rb") && !x.include?("/") && x != "metadata.rb"
14
14
  end
15
15
  return nil if files.empty?
16
+
16
17
  new(target, files)
17
18
  end
18
19
 
@@ -8,6 +8,7 @@ module SourceReaders
8
8
 
9
9
  def self.resolve(target)
10
10
  return new(target, "inspec.yml") if target.files.include?("inspec.yml")
11
+
11
12
  nil
12
13
  end
13
14
 
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: 4.7.3
4
+ version: 4.7.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-09 00:00:00.000000000 Z
11
+ date: 2019-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: train-core