inspec-core 4.3.2 → 4.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (285) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +37 -21
  3. data/etc/deprecations.json +10 -0
  4. data/etc/plugin_filters.json +8 -0
  5. data/lib/bundles/inspec-compliance/api.rb +1 -1
  6. data/lib/bundles/inspec-compliance/configuration.rb +1 -1
  7. data/lib/bundles/inspec-compliance/http.rb +1 -1
  8. data/lib/bundles/inspec-compliance/support.rb +1 -1
  9. data/lib/bundles/inspec-compliance/target.rb +1 -1
  10. data/lib/bundles/inspec-supermarket.rb +3 -7
  11. data/lib/bundles/inspec-supermarket/api.rb +10 -13
  12. data/lib/bundles/inspec-supermarket/cli.rb +12 -15
  13. data/lib/bundles/inspec-supermarket/target.rb +7 -11
  14. data/lib/fetchers/git.rb +14 -15
  15. data/lib/fetchers/local.rb +6 -10
  16. data/lib/fetchers/mock.rb +3 -5
  17. data/lib/fetchers/url.rb +42 -44
  18. data/lib/inspec.rb +23 -24
  19. data/lib/inspec/archive/tar.rb +2 -6
  20. data/lib/inspec/archive/zip.rb +3 -7
  21. data/lib/inspec/backend.rb +8 -9
  22. data/lib/inspec/base_cli.rb +64 -65
  23. data/lib/inspec/cached_fetcher.rb +2 -3
  24. data/lib/inspec/cli.rb +136 -97
  25. data/lib/inspec/config.rb +71 -61
  26. data/lib/inspec/control_eval_context.rb +22 -18
  27. data/lib/inspec/dependencies/cache.rb +2 -3
  28. data/lib/inspec/dependencies/dependency_set.rb +2 -3
  29. data/lib/inspec/dependencies/lockfile.rb +8 -9
  30. data/lib/inspec/dependencies/requirement.rb +7 -8
  31. data/lib/inspec/dependencies/resolver.rb +5 -7
  32. data/lib/inspec/describe.rb +2 -6
  33. data/lib/inspec/dist.rb +20 -0
  34. data/lib/inspec/dsl.rb +4 -7
  35. data/lib/inspec/dsl_shared.rb +1 -2
  36. data/lib/inspec/env_printer.rb +11 -12
  37. data/lib/inspec/errors.rb +0 -4
  38. data/lib/inspec/exceptions.rb +0 -1
  39. data/lib/inspec/expect.rb +5 -8
  40. data/lib/inspec/fetcher.rb +7 -10
  41. data/lib/inspec/file_provider.rb +24 -24
  42. data/lib/inspec/formatters.rb +3 -3
  43. data/lib/inspec/formatters/base.rb +8 -8
  44. data/lib/inspec/globals.rb +2 -2
  45. data/lib/inspec/impact.rb +5 -7
  46. data/lib/inspec/input_registry.rb +84 -33
  47. data/lib/inspec/library_eval_context.rb +3 -6
  48. data/lib/inspec/log.rb +1 -5
  49. data/lib/inspec/metadata.rb +17 -16
  50. data/lib/inspec/method_source.rb +5 -9
  51. data/lib/inspec/objects.rb +10 -12
  52. data/lib/inspec/objects/control.rb +7 -9
  53. data/lib/inspec/objects/describe.rb +9 -11
  54. data/lib/inspec/objects/each_loop.rb +1 -3
  55. data/lib/inspec/objects/input.rb +24 -26
  56. data/lib/inspec/objects/list.rb +4 -6
  57. data/lib/inspec/objects/or_test.rb +2 -4
  58. data/lib/inspec/objects/ruby_helper.rb +3 -5
  59. data/lib/inspec/objects/tag.rb +0 -2
  60. data/lib/inspec/objects/test.rb +9 -11
  61. data/lib/inspec/objects/value.rb +3 -5
  62. data/lib/inspec/plugin/v1.rb +2 -2
  63. data/lib/inspec/plugin/v1/plugin_types/cli.rb +1 -5
  64. data/lib/inspec/plugin/v1/plugin_types/fetcher.rb +2 -5
  65. data/lib/inspec/plugin/v1/plugin_types/resource.rb +4 -6
  66. data/lib/inspec/plugin/v1/plugin_types/secret.rb +1 -5
  67. data/lib/inspec/plugin/v1/plugin_types/source_reader.rb +1 -5
  68. data/lib/inspec/plugin/v1/plugins.rb +15 -19
  69. data/lib/inspec/plugin/v1/registry.rb +0 -4
  70. data/lib/inspec/plugin/v2.rb +8 -8
  71. data/lib/inspec/plugin/v2/activator.rb +1 -1
  72. data/lib/inspec/plugin/v2/config_file.rb +6 -6
  73. data/lib/inspec/plugin/v2/filter.rb +13 -13
  74. data/lib/inspec/plugin/v2/installer.rb +36 -24
  75. data/lib/inspec/plugin/v2/loader.rb +28 -28
  76. data/lib/inspec/plugin/v2/plugin_base.rb +15 -2
  77. data/lib/inspec/plugin/v2/plugin_types/cli.rb +5 -5
  78. data/lib/inspec/plugin/v2/plugin_types/input.rb +34 -0
  79. data/lib/inspec/plugin/v2/plugin_types/mock.rb +1 -1
  80. data/lib/inspec/plugin/v2/registry.rb +7 -7
  81. data/lib/inspec/polyfill.rb +0 -3
  82. data/lib/inspec/profile.rb +55 -63
  83. data/lib/inspec/profile_context.rb +27 -30
  84. data/lib/inspec/profile_vendor.rb +6 -9
  85. data/lib/inspec/reporters.rb +24 -24
  86. data/lib/inspec/reporters/automate.rb +17 -19
  87. data/lib/inspec/reporters/base.rb +1 -1
  88. data/lib/inspec/reporters/cli.rb +88 -91
  89. data/lib/inspec/reporters/json.rb +2 -4
  90. data/lib/inspec/reporters/json_automate.rb +1 -3
  91. data/lib/inspec/reporters/json_min.rb +1 -3
  92. data/lib/inspec/reporters/junit.rb +26 -28
  93. data/lib/inspec/reporters/yaml.rb +1 -3
  94. data/lib/inspec/require_loader.rb +0 -4
  95. data/lib/inspec/resource.rb +4 -125
  96. data/lib/inspec/resources.rb +121 -0
  97. data/lib/{resources → inspec/resources}/aide_conf.rb +24 -25
  98. data/lib/{resources → inspec/resources}/apache.rb +13 -14
  99. data/lib/{resources → inspec/resources}/apache_conf.rb +16 -17
  100. data/lib/{resources → inspec/resources}/apt.rb +17 -17
  101. data/lib/{resources → inspec/resources}/audit_policy.rb +7 -6
  102. data/lib/{resources → inspec/resources}/auditd.rb +62 -64
  103. data/lib/{resources → inspec/resources}/auditd_conf.rb +7 -8
  104. data/lib/{resources → inspec/resources}/bash.rb +6 -8
  105. data/lib/{resources → inspec/resources}/bond.rb +15 -14
  106. data/lib/{resources → inspec/resources}/bridge.rb +8 -8
  107. data/lib/{resources → inspec/resources}/chocolatey_package.rb +10 -8
  108. data/lib/{resources → inspec/resources}/command.rb +11 -10
  109. data/lib/{resources → inspec/resources}/cpan.rb +12 -12
  110. data/lib/{resources → inspec/resources}/cran.rb +9 -9
  111. data/lib/{resources → inspec/resources}/crontab.rb +47 -48
  112. data/lib/{resources → inspec/resources}/csv.rb +5 -5
  113. data/lib/{resources → inspec/resources}/dh_params.rb +5 -7
  114. data/lib/{resources → inspec/resources}/directory.rb +5 -7
  115. data/lib/{resources → inspec/resources}/docker.rb +63 -63
  116. data/lib/{resources → inspec/resources}/docker_container.rb +6 -6
  117. data/lib/{resources → inspec/resources}/docker_image.rb +9 -9
  118. data/lib/{resources → inspec/resources}/docker_object.rb +8 -13
  119. data/lib/{resources → inspec/resources}/docker_plugin.rb +6 -6
  120. data/lib/{resources → inspec/resources}/docker_service.rb +7 -7
  121. data/lib/{resources → inspec/resources}/elasticsearch.rb +40 -42
  122. data/lib/{resources → inspec/resources}/etc_fstab.rb +23 -24
  123. data/lib/{resources → inspec/resources}/etc_group.rb +26 -27
  124. data/lib/{resources → inspec/resources}/etc_hosts.rb +11 -13
  125. data/lib/{resources → inspec/resources}/etc_hosts_allow_deny.rb +25 -27
  126. data/lib/{resources → inspec/resources}/file.rb +80 -79
  127. data/lib/{resources → inspec/resources}/filesystem.rb +20 -15
  128. data/lib/{resources → inspec/resources}/firewalld.rb +26 -26
  129. data/lib/{resources → inspec/resources}/gem.rb +12 -12
  130. data/lib/{resources → inspec/resources}/groups.rb +28 -27
  131. data/lib/{resources → inspec/resources}/grub_conf.rb +46 -48
  132. data/lib/{resources → inspec/resources}/host.rb +31 -29
  133. data/lib/{resources → inspec/resources}/http.rb +24 -24
  134. data/lib/{resources → inspec/resources}/iis_app.rb +6 -7
  135. data/lib/{resources → inspec/resources}/iis_app_pool.rb +21 -19
  136. data/lib/{resources → inspec/resources}/iis_site.rb +17 -15
  137. data/lib/{resources → inspec/resources}/inetd_conf.rb +9 -10
  138. data/lib/{resources → inspec/resources}/ini.rb +7 -8
  139. data/lib/{resources → inspec/resources}/interface.rb +30 -30
  140. data/lib/{resources → inspec/resources}/iptables.rb +8 -8
  141. data/lib/{resources → inspec/resources}/json.rb +8 -10
  142. data/lib/{resources → inspec/resources}/kernel_module.rb +15 -15
  143. data/lib/{resources → inspec/resources}/kernel_parameter.rb +8 -8
  144. data/lib/{resources → inspec/resources}/key_rsa.rb +8 -10
  145. data/lib/{resources → inspec/resources}/ksh.rb +6 -8
  146. data/lib/{resources → inspec/resources}/limits_conf.rb +8 -9
  147. data/lib/{resources/login_def.rb → inspec/resources/login_defs.rb} +9 -10
  148. data/lib/{resources → inspec/resources}/mount.rb +6 -8
  149. data/lib/{resources → inspec/resources}/mssql_session.rb +16 -18
  150. data/lib/inspec/resources/mysql.rb +81 -0
  151. data/lib/{resources → inspec/resources}/mysql_conf.rb +13 -14
  152. data/lib/{resources → inspec/resources}/mysql_session.rb +16 -16
  153. data/lib/{resources → inspec/resources}/nginx.rb +16 -17
  154. data/lib/{resources → inspec/resources}/nginx_conf.rb +26 -27
  155. data/lib/{resources → inspec/resources}/npm.rb +9 -10
  156. data/lib/{resources → inspec/resources}/ntp_conf.rb +9 -10
  157. data/lib/{resources → inspec/resources}/oneget.rb +8 -8
  158. data/lib/{resources → inspec/resources}/oracledb_session.rb +33 -34
  159. data/lib/{resources → inspec/resources}/os.rb +6 -8
  160. data/lib/{resources → inspec/resources}/os_env.rb +11 -12
  161. data/lib/{resources → inspec/resources}/package.rb +66 -65
  162. data/lib/{resources → inspec/resources}/packages.rb +13 -13
  163. data/lib/{resources → inspec/resources}/parse_config.rb +8 -8
  164. data/lib/{resources → inspec/resources}/passwd.rb +18 -19
  165. data/lib/{resources → inspec/resources}/pip.rb +19 -19
  166. data/lib/{resources → inspec/resources}/platform.rb +9 -11
  167. data/lib/{resources → inspec/resources}/port.rb +134 -136
  168. data/lib/{resources → inspec/resources}/postgres.rb +40 -32
  169. data/lib/{resources → inspec/resources}/postgres_conf.rb +17 -17
  170. data/lib/{resources → inspec/resources}/postgres_hba_conf.rb +21 -23
  171. data/lib/{resources → inspec/resources}/postgres_ident_conf.rb +12 -14
  172. data/lib/{resources → inspec/resources}/postgres_session.rb +8 -9
  173. data/lib/{resources → inspec/resources}/powershell.rb +17 -13
  174. data/lib/{resources → inspec/resources}/processes.rb +29 -29
  175. data/lib/{resources/rabbitmq_conf.rb → inspec/resources/rabbitmq_config.rb} +10 -11
  176. data/lib/{resources → inspec/resources}/registry_key.rb +14 -14
  177. data/lib/inspec/resources/script.rb +1 -0
  178. data/lib/{resources → inspec/resources}/security_identifier.rb +11 -10
  179. data/lib/{resources → inspec/resources}/security_policy.rb +59 -58
  180. data/lib/{resources → inspec/resources}/service.rb +74 -75
  181. data/lib/{resources → inspec/resources}/shadow.rb +44 -45
  182. data/lib/{resources/ssh_conf.rb → inspec/resources/ssh_config.rb} +16 -17
  183. data/lib/{resources → inspec/resources}/ssl.rb +28 -29
  184. data/lib/inspec/resources/sys_info.rb +30 -0
  185. data/lib/{resources → inspec/resources}/toml.rb +5 -7
  186. data/lib/{resources → inspec/resources}/users.rb +65 -65
  187. data/lib/{resources → inspec/resources}/vbscript.rb +8 -9
  188. data/lib/{resources → inspec/resources}/virtualization.rb +60 -62
  189. data/lib/{resources → inspec/resources}/windows_feature.rb +9 -9
  190. data/lib/{resources → inspec/resources}/windows_hotfix.rb +5 -5
  191. data/lib/{resources → inspec/resources}/windows_task.rb +16 -15
  192. data/lib/{resources → inspec/resources}/wmi.rb +7 -8
  193. data/lib/{resources → inspec/resources}/x509_certificate.rb +9 -11
  194. data/lib/{resources/xinetd.rb → inspec/resources/xinetd_conf.rb} +27 -29
  195. data/lib/{resources → inspec/resources}/xml.rb +7 -7
  196. data/lib/{resources → inspec/resources}/yaml.rb +5 -6
  197. data/lib/{resources → inspec/resources}/yum.rb +10 -10
  198. data/lib/{resources → inspec/resources}/zfs_dataset.rb +6 -6
  199. data/lib/{resources → inspec/resources}/zfs_pool.rb +4 -4
  200. data/lib/inspec/rspec_extensions.rb +24 -8
  201. data/lib/inspec/rule.rb +14 -15
  202. data/lib/inspec/runner.rb +28 -28
  203. data/lib/inspec/runner_mock.rb +1 -5
  204. data/lib/inspec/runner_rspec.rb +18 -20
  205. data/lib/inspec/runtime_profile.rb +2 -5
  206. data/lib/inspec/schema.rb +142 -143
  207. data/lib/inspec/secrets.rb +3 -7
  208. data/lib/inspec/secrets/yaml.rb +3 -5
  209. data/lib/inspec/shell.rb +11 -15
  210. data/lib/inspec/shell_detector.rb +6 -7
  211. data/lib/inspec/source_reader.rb +4 -8
  212. data/lib/inspec/ui.rb +33 -39
  213. data/lib/inspec/ui_table_helper.rb +12 -0
  214. data/lib/{utils → inspec/utils}/command_wrapper.rb +4 -8
  215. data/lib/{utils → inspec/utils}/convert.rb +0 -4
  216. data/lib/{utils → inspec/utils}/database_helpers.rb +4 -8
  217. data/lib/inspec/utils/deprecation.rb +6 -0
  218. data/lib/{utils → inspec/utils}/deprecation/config_file.rb +19 -19
  219. data/lib/{utils → inspec/utils}/deprecation/deprecator.rb +12 -12
  220. data/lib/{utils → inspec/utils}/deprecation/errors.rb +1 -1
  221. data/lib/{utils → inspec/utils}/deprecation/global_method.rb +2 -2
  222. data/lib/{utils → inspec/utils}/enumerable_delegation.rb +0 -2
  223. data/lib/{utils → inspec/utils}/erlang_parser.rb +61 -65
  224. data/lib/{utils → inspec/utils}/file_reader.rb +1 -2
  225. data/lib/{utils → inspec/utils}/filter.rb +30 -33
  226. data/lib/{utils → inspec/utils}/filter_array.rb +0 -2
  227. data/lib/{utils → inspec/utils}/find_files.rb +9 -12
  228. data/lib/{utils → inspec/utils}/hash.rb +1 -5
  229. data/lib/inspec/utils/json_log.rb +15 -0
  230. data/lib/inspec/utils/latest_version.rb +13 -0
  231. data/lib/{utils → inspec/utils}/modulator.rb +0 -3
  232. data/lib/{utils → inspec/utils}/nginx_parser.rb +31 -35
  233. data/lib/{utils → inspec/utils}/object_traversal.rb +0 -3
  234. data/lib/{utils → inspec/utils}/parser.rb +45 -45
  235. data/lib/{utils → inspec/utils}/pkey_reader.rb +4 -2
  236. data/lib/{utils → inspec/utils}/simpleconfig.rb +8 -10
  237. data/lib/{utils → inspec/utils}/spdx.rb +1 -4
  238. data/lib/{utils → inspec/utils}/spdx.txt +0 -0
  239. data/lib/inspec/utils/telemetry.rb +3 -3
  240. data/lib/inspec/utils/telemetry/collector.rb +30 -9
  241. data/lib/inspec/utils/telemetry/data_series.rb +3 -1
  242. data/lib/inspec/utils/telemetry/global_methods.rb +1 -1
  243. data/lib/inspec/version.rb +1 -1
  244. data/lib/matchers/matchers.rb +22 -25
  245. data/lib/plugins/inspec-artifact/lib/inspec-artifact.rb +1 -1
  246. data/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb +52 -45
  247. data/lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb +18 -16
  248. data/lib/plugins/inspec-compliance/lib/inspec-compliance.rb +1 -1
  249. data/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb +73 -73
  250. data/lib/plugins/inspec-compliance/lib/inspec-compliance/api/login.rb +66 -62
  251. data/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb +59 -57
  252. data/lib/plugins/inspec-compliance/lib/inspec-compliance/configuration.rb +11 -11
  253. data/lib/plugins/inspec-compliance/lib/inspec-compliance/http.rb +20 -22
  254. data/lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb +2 -4
  255. data/lib/plugins/inspec-compliance/lib/inspec-compliance/target.rb +30 -27
  256. data/lib/plugins/inspec-habitat/Berksfile +2 -2
  257. data/lib/plugins/inspec-habitat/lib/inspec-habitat.rb +1 -1
  258. data/lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb +15 -13
  259. data/lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb +64 -63
  260. data/lib/plugins/inspec-habitat/templates/habitat/hooks/run.erb +3 -3
  261. data/lib/plugins/inspec-habitat/templates/habitat/plan.sh.erb +11 -11
  262. data/lib/plugins/inspec-init/lib/inspec-init.rb +1 -1
  263. data/lib/plugins/inspec-init/lib/inspec-init/cli.rb +6 -8
  264. data/lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb +72 -74
  265. data/lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb +9 -11
  266. data/lib/plugins/inspec-init/lib/inspec-init/renderer.rb +4 -4
  267. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Gemfile +0 -1
  268. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/inspec-plugin-template.gemspec +0 -2
  269. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template.rb +0 -2
  270. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/cli_command.rb +0 -2
  271. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/plugin.rb +0 -2
  272. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/version.rb +0 -2
  273. data/lib/plugins/inspec-init/templates/profiles/os/controls/example.rb +6 -7
  274. data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb +1 -2
  275. data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +72 -70
  276. data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb +1 -1
  277. data/lib/plugins/shared/core_plugin_test_helper.rb +43 -38
  278. data/lib/source_readers/flat.rb +6 -10
  279. data/lib/source_readers/inspec.rb +8 -12
  280. metadata +139 -140
  281. data/lib/resources/mysql.rb +0 -82
  282. data/lib/resources/sys_info.rb +0 -28
  283. data/lib/utils/deprecation.rb +0 -6
  284. data/lib/utils/json_log.rb +0 -18
  285. data/lib/utils/latest_version.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8a2ad37fec927c5277645005285178479229d1d9e4b27eac72017e76fe148d6
4
- data.tar.gz: c273fc61ad231069fde8d7fac64283b1598cd02da1630ce5305d3d1533af213e
3
+ metadata.gz: a1351e4c5e9234d0ca3b130fbe26164740664f824d5ec6d47b92cff852d85581
4
+ data.tar.gz: 11f2e2b519e46df3d9e6029ec739fb4af344efe83890673a08b16cada8469cbc
5
5
  SHA512:
6
- metadata.gz: 347841dadf8b6f8b91a0d61190b8095e6adf218308d17e5cee66e1ec615cde84ed6bdfa060362df9fc7cf3b0b93ffccd7275a83d54387797cae504f378ae7ef6
7
- data.tar.gz: c042b3def3f7a0cd52c782b197dd35fd38e7d19a1cbb82b0928a8e9b04e7c08076a08540dac8473b8768cc4cc6e079134845e6049c334c3ecf4320ec428af368
6
+ metadata.gz: 8b06543170f47bef790cd2cfeac502a9ac8bc43fcea41ae363b4f7193890a24de52a9a4da464eb08c9b1671a87659d5e7b94adc3eeca821701e685210d0d23da
7
+ data.tar.gz: 0c5e6ec5a1b125d64d3e4c589b4bf46e072d19b6c9fe3d4a29448c9c34be580a68c8240360b83b52b659a77c8a3d8463597dace2b24f280648c755cb4940a132
data/README.md CHANGED
@@ -1,10 +1,17 @@
1
- # InSpec: Inspect Your Infrastructure
1
+ # Chef InSpec: Inspect Your Infrastructure
2
+
3
+ * **Project State: Active**
4
+ * **Issues Response SLA: 3 business days**
5
+ * **Pull Request Response SLA: 3 business days**
6
+
7
+ For more information on project states and SLAs, see [this documentation](https://github.com/chef/chef-oss-practices/blob/master/repo-management/repo-states.md).
2
8
 
3
9
  [![Slack](https://community-slack.chef.io/badge.svg)](https://community-slack.chef.io/)
4
10
  [![Build Status Master](https://travis-ci.org/inspec/inspec.svg?branch=master)](https://travis-ci.org/inspec/inspec)
5
11
  [![Build Status Master](https://ci.appveyor.com/api/projects/status/github/inspec/inspec?branch=master&svg=true&passingText=master%20-%20Ok&pendingText=master%20-%20Pending&failingText=master%20-%20Failing)](https://ci.appveyor.com/project/Chef/inspec/branch/master)
12
+ [![Coverage Status](https://coveralls.io/repos/github/inspec/inspec/badge.svg?branch=master)](https://coveralls.io/github/inspec/inspec?branch=master)
6
13
 
7
- InSpec is an open-source testing framework for infrastructure with a human- and machine-readable language for specifying compliance, security and policy requirements.
14
+ Chef InSpec is an open-source testing framework for infrastructure with a human- and machine-readable language for specifying compliance, security and policy requirements.
8
15
 
9
16
  ```ruby
10
17
  # Disallow insecure protocols by testing
@@ -18,7 +25,7 @@ describe inetd_conf do
18
25
  end
19
26
  ```
20
27
 
21
- InSpec makes it easy to run your tests wherever you need. More options are found in our [CLI docs](https://www.inspec.io/docs/reference/cli/).
28
+ Chef InSpec makes it easy to run your tests wherever you need. More options are found in our [CLI docs](https://www.inspec.io/docs/reference/cli/).
22
29
 
23
30
  ```bash
24
31
  # run test locally
@@ -27,7 +34,7 @@ inspec exec test.rb
27
34
  # run test on remote host on SSH
28
35
  inspec exec test.rb -t ssh://user@hostname -i /path/to/key
29
36
 
30
- # run test on remote host using SSH agent private key authentication. Requires InSpec 1.7.1
37
+ # run test on remote host using SSH agent private key authentication. Requires Chef InSpec 1.7.1
31
38
  inspec exec test.rb -t ssh://user@hostname
32
39
 
33
40
  # run test on remote windows host on WinRM
@@ -40,17 +47,19 @@ inspec exec test.rb -t docker://container_id
40
47
  # Features
41
48
 
42
49
  - Built-in Compliance: Compliance no longer occurs at the end of the release cycle
43
- - Targeted Tests: InSpec writes tests that specifically target compliance issues
50
+ - Targeted Tests: Chef InSpec writes tests that specifically target compliance issues
44
51
  - Metadata: Includes the metadata required by security and compliance pros
45
52
  - Easy Testing: Includes a command-line interface to run tests quickly
46
53
 
47
54
  ## Installation
48
55
 
49
- InSpec requires Ruby ( >= 2.4 ).
56
+ Chef InSpec requires Ruby ( >= 2.4 ).
57
+
58
+ Note: Versions of Chef InSpec 4.0 and later require accepting the EULA to use. Please visit the [license acceptance page](https://docs.chef.io/chef_license_accept.html) on the Chef docs site for more information.
50
59
 
51
60
  ### Install as package
52
61
 
53
- The InSpec package is available for MacOS, RedHat, Ubuntu and Windows. Download the latest package at [InSpec Downloads](https://downloads.chef.io/inspec) or install InSpec via script:
62
+ The Chef InSpec package is available for MacOS, RedHat, Ubuntu and Windows. Download the latest package at [Chef InSpec Downloads](https://downloads.chef.io/inspec) or install Chef InSpec via script:
54
63
 
55
64
  ```
56
65
  # RedHat, Ubuntu, and macOS
@@ -76,12 +85,19 @@ For Ubuntu:
76
85
  apt-get -y install ruby ruby-dev gcc g++ make
77
86
  ```
78
87
 
79
- To install inspec from [rubygems](https://rubygems.org/):
88
+ To install the `inspec` executable, which requires accepting the [Chef License](https://docs.chef.io/chef_license_accept.html), run:
89
+
90
+ ```bash
91
+ gem install inspec-bin
92
+ ```
93
+
94
+ You may also use `inspec` as a library, with no executable. This does not require accepting the license. To install the library as a gem, run:
80
95
 
81
96
  ```bash
82
97
  gem install inspec
83
98
  ```
84
99
 
100
+
85
101
  ### Usage via Docker
86
102
 
87
103
  Download the image and define a function for convenience:
@@ -135,11 +151,11 @@ gem install inspec-*.gem
135
151
 
136
152
  On Windows, you need to install [Ruby](http://rubyinstaller.org/downloads/) with [Ruby Development Kit](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit) to build dependencies with its native extensions.
137
153
 
138
- ### Install via Habitat
154
+ ### Install via Chef Habitat
139
155
 
140
- Currently, this method of installation only supports Linux. See the [Habitat site](https://www.habitat.sh/) for more information.
156
+ Currently, this method of installation only supports Linux. See the [Chef Habitat site](https://www.habitat.sh/) for more information.
141
157
 
142
- Download the `hab` binary from the [Habitat](https://www.habitat.sh/docs/get-habitat/) site.
158
+ Download the `hab` binary from the [Chef Habitat](https://www.habitat.sh/docs/get-habitat/) site.
143
159
 
144
160
  ```bash
145
161
  hab pkg install chef/inspec --binlink
@@ -147,7 +163,7 @@ hab pkg install chef/inspec --binlink
147
163
  inspec
148
164
  ```
149
165
 
150
- ### Run InSpec
166
+ ### Run Chef InSpec
151
167
 
152
168
  You should now be able to run:
153
169
 
@@ -203,10 +219,10 @@ end
203
219
  ```
204
220
 
205
221
  Also have a look at our examples for:
206
- - [Using InSpec with Test Kitchen & Chef](https://github.com/chef/inspec/tree/master/examples/kitchen-chef)
207
- - [Using InSpec with Test Kitchen & Puppet](https://github.com/chef/inspec/tree/master/examples/kitchen-puppet)
208
- - [Using InSpec with Test Kitchen & Ansible](https://github.com/chef/inspec/tree/master/examples/kitchen-ansible)
209
- - [Implementing an InSpec profile](https://github.com/chef/inspec/tree/master/examples/profile)
222
+ - [Using Chef InSpec with Test Kitchen & Chef Infra](https://github.com/chef/inspec/tree/master/examples/kitchen-chef)
223
+ - [Using Chef InSpec with Test Kitchen & Puppet](https://github.com/chef/inspec/tree/master/examples/kitchen-puppet)
224
+ - [Using Chef InSpec with Test Kitchen & Ansible](https://github.com/chef/inspec/tree/master/examples/kitchen-ansible)
225
+ - [Implementing an Chef InSpec profile](https://github.com/chef/inspec/tree/master/examples/profile)
210
226
 
211
227
  ## Or tests: Testing for a OR b
212
228
 
@@ -335,13 +351,13 @@ Relationship to other tools (RSpec, Serverspec):
335
351
 
336
352
  ## Share your Profiles
337
353
 
338
- You may share your InSpec Profiles in the [Tools & Plugins section](https://supermarket.chef.io/tools-directory) of the [Chef Supermarket](https://supermarket.chef.io/). [Sign in](https://supermarket.chef.io/sign-in) and [add the details of your profile](https://supermarket.chef.io/tools/new).
354
+ You may share your Chef InSpec Profiles in the [Tools & Plugins section](https://supermarket.chef.io/tools-directory) of the [Chef Supermarket](https://supermarket.chef.io/). [Sign in](https://supermarket.chef.io/sign-in) and [add the details of your profile](https://supermarket.chef.io/tools/new).
339
355
 
340
356
  You may also [browse the Supermarket for shared Compliance Profiles](https://supermarket.chef.io/tools?type=compliance_profile).
341
357
 
342
358
  ## Kudos
343
359
 
344
- InSpec is inspired by the wonderful [Serverspec](http://serverspec.org) project. Kudos to [mizzy](https://github.com/mizzy) and [all contributors](https://github.com/mizzy/serverspec/graphs/contributors)!
360
+ Chef InSpec is inspired by the wonderful [Serverspec](http://serverspec.org) project. Kudos to [mizzy](https://github.com/mizzy) and [all contributors](https://github.com/mizzy/serverspec/graphs/contributors)!
345
361
 
346
362
  The AWS resources were inspired by [inspec-aws](https://github.com/arothian/inspec-aws) from [arothian](https://github.com/arothian).
347
363
 
@@ -353,7 +369,7 @@ The AWS resources were inspired by [inspec-aws](https://github.com/arothian/insp
353
369
  1. Push to the branch (git push origin my-new-feature)
354
370
  1. Create new Pull Request
355
371
 
356
- The InSpec community and maintainers are very active and helpful. This project benefits greatly from this activity.
372
+ The Chef InSpec community and maintainers are very active and helpful. This project benefits greatly from this activity.
357
373
 
358
374
  If you'd like to chat with the community and maintainers directly join us in the `#inspec` channel on the [Chef Community Slack](http://community-slack.chef.io/).
359
375
 
@@ -361,7 +377,7 @@ As a reminder, all participants are expected to follow the [Code of Conduct](htt
361
377
 
362
378
  [![Slack](https://community-slack.chef.io/badge.svg)](https://community-slack.chef.io/)
363
379
 
364
- ## Testing InSpec
380
+ ## Testing Chef InSpec
365
381
 
366
382
  We offer `unit`, `integration`, and `aws` tests.
367
383
 
@@ -389,7 +405,7 @@ bundle exec m test/unit/resources/user_test.rb -l 123
389
405
 
390
406
  ### Integration tests
391
407
 
392
- These tests download various virtual machines, to ensure InSpec is working as expected across different operating systems.
408
+ These tests download various virtual machines, to ensure Chef InSpec is working as expected across different operating systems.
393
409
 
394
410
  These tests require the following gems:
395
411
 
@@ -6,6 +6,16 @@
6
6
  "action": "warn",
7
7
  "prefix": "The 'default' option for attributes is being replaced by 'value' - please use it instead."
8
8
  },
9
+ "attrs_dsl": {
10
+ "action": "ignore",
11
+ "comment": "See #3853",
12
+ "prefix": "The 'attribute' DSL keyword is being replaced by 'input' - please use it instead."
13
+ },
14
+ "attrs_rename_in_metadata": {
15
+ "action": "ignore",
16
+ "comment": "See 3854",
17
+ "prefix": "Inputs should be specified by using the 'inputs' key in profile metadata, not 'attributes'."
18
+ },
9
19
  "aws_resources_in_resource_pack": {
10
20
  "comment": "See #3822",
11
21
  "action": "warn",
@@ -5,6 +5,14 @@
5
5
  "plugin_name": "inspec-core",
6
6
  "rationale": "This gem is a stripped-down alternate packaging of InSpec. It is not a plugin."
7
7
  },
8
+ {
9
+ "plugin_name": "inspec-bin",
10
+ "rationale": "This gem contains the executable for Chef InSpec. It is not a plugin."
11
+ },
12
+ {
13
+ "plugin_name": "inspec-core-bin",
14
+ "rationale": "This gem contains the executable for a lightweight version of Chef InSpec. It is not a plugin."
15
+ },
8
16
  {
9
17
  "plugin_name": "inspec-k8s",
10
18
  "rationale": "This gem is currently only a placeholder, waiting to be built."
@@ -1,7 +1,7 @@
1
1
  # This file has been moved to the v2.0 plugins. This redirect allows for legacy use.
2
2
  # TODO: Remove in inspec 4.0
3
3
 
4
- require 'plugins/inspec-compliance/lib/inspec-compliance/api'
4
+ require "plugins/inspec-compliance/lib/inspec-compliance/api"
5
5
 
6
6
  # Backport old namespace
7
7
  Compliance = InspecPlugins::Compliance unless defined?(Compliance)
@@ -1,7 +1,7 @@
1
1
  # This file has been moved to the v2.0 plugins. This redirect allows for legacy use.
2
2
  # TODO: Remove in inspec 4.0
3
3
 
4
- require 'plugins/inspec-compliance/lib/inspec-compliance/configuration'
4
+ require "plugins/inspec-compliance/lib/inspec-compliance/configuration"
5
5
 
6
6
  # Backport old namespace
7
7
  Compliance = InspecPlugins::Compliance unless defined?(Compliance)
@@ -1,7 +1,7 @@
1
1
  # This file has been moved to the v2.0 plugins. This redirect allows for legacy use.
2
2
  # TODO: Remove in inspec 4.0
3
3
 
4
- require 'plugins/inspec-compliance/lib/inspec-compliance/http'
4
+ require "plugins/inspec-compliance/lib/inspec-compliance/http"
5
5
 
6
6
  # Backport old namespace
7
7
  Compliance = InspecPlugins::Compliance unless defined?(Compliance)
@@ -1,7 +1,7 @@
1
1
  # This file has been moved to the v2.0 plugins. This redirect allows for legacy use.
2
2
  # TODO: Remove in inspec 4.0
3
3
 
4
- require 'plugins/inspec-compliance/lib/inspec-compliance/support'
4
+ require "plugins/inspec-compliance/lib/inspec-compliance/support"
5
5
 
6
6
  # Backport old namespace
7
7
  Compliance = InspecPlugins::Compliance unless defined?(Compliance)
@@ -1,7 +1,7 @@
1
1
  # This file has been moved to the v2.0 plugins. This redirect allows for legacy use.
2
2
  # TODO: Remove in inspec 4.0
3
3
 
4
- require 'plugins/inspec-compliance/lib/inspec-compliance/target'
4
+ require "plugins/inspec-compliance/lib/inspec-compliance/target"
5
5
 
6
6
  # Backport old namespace
7
7
  Compliance = InspecPlugins::Compliance unless defined?(Compliance)
@@ -1,13 +1,9 @@
1
- # encoding: utf-8
2
- # author: Christoph Hartmann
3
- # author: Dominik Richter
4
-
5
1
  libdir = File.dirname(__FILE__)
6
2
  $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
7
3
 
8
4
  module Supermarket
9
- autoload :API, 'inspec-supermarket/api'
5
+ autoload :API, "inspec-supermarket/api"
10
6
  end
11
7
 
12
- require 'inspec-supermarket/cli'
13
- require 'inspec-supermarket/target'
8
+ require "inspec-supermarket/cli"
9
+ require "inspec-supermarket/target"
@@ -1,26 +1,23 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
- # author: Christoph Hartmann
4
- # author: Dominik Richter
5
2
 
6
- require 'net/http'
7
- require 'addressable/uri'
3
+ require "net/http"
4
+ require "addressable/uri"
8
5
 
9
6
  module Supermarket
10
7
  class API
11
- SUPERMARKET_URL = 'https://supermarket.chef.io'
8
+ SUPERMARKET_URL = "https://supermarket.chef.io"
12
9
 
13
10
  # displays a list of profiles
14
11
  def self.profiles(supermarket_url = SUPERMARKET_URL)
15
12
  url = "#{supermarket_url}/api/v1/tools-search"
16
- _success, data = get(url, { type: 'compliance_profile', items: 100 })
13
+ _success, data = get(url, { type: "compliance_profile", items: 100 })
17
14
  if !data.nil?
18
15
  profiles = JSON.parse(data)
19
- profiles['items'].map { |x|
20
- m = %r{^#{supermarket_url}/api/v1/tools/(?<slug>[\w-]+)(/)?$}.match(x['tool'])
21
- x['slug'] = m[:slug]
16
+ profiles["items"].map do |x|
17
+ m = %r{^#{supermarket_url}/api/v1/tools/(?<slug>[\w-]+)(/)?$}.match(x["tool"])
18
+ x["slug"] = m[:slug]
22
19
  x
23
- }
20
+ end
24
21
  else
25
22
  []
26
23
  end
@@ -54,7 +51,7 @@ module Supermarket
54
51
 
55
52
  # Tool name in Supermarket URL is downcased so we need to downcase
56
53
  tool = "#{supermarket_url}/api/v1/tools/#{tool_name.downcase}"
57
- supermarket_tool['tool_owner'] == tool_owner && supermarket_tool['tool'] == tool
54
+ supermarket_tool["tool_owner"] == tool_owner && supermarket_tool["tool"] == tool
58
55
  end
59
56
 
60
57
  def self.find(profile, supermarket_url = SUPERMARKET_URL)
@@ -80,7 +77,7 @@ module Supermarket
80
77
 
81
78
  def self.send_request(uri, req)
82
79
  # send request
83
- res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
80
+ res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
84
81
  http.request(req)
85
82
  end
86
83
  [res.is_a?(Net::HTTPSuccess), res.body]
@@ -1,11 +1,8 @@
1
- # encoding: utf-8
2
- # author: Christoph Hartmann
3
- # author: Dominik Richter
4
- require 'inspec/base_cli'
1
+ require "inspec/base_cli"
5
2
 
6
3
  module Supermarket
7
4
  class SupermarketCLI < Inspec::BaseCLI
8
- namespace 'supermarket'
5
+ namespace "supermarket"
9
6
 
10
7
  # TODO: find another solution, once https://github.com/erikhuda/thor/issues/261 is fixed
11
8
  def self.banner(command, _namespace = nil, _subcommand = false)
@@ -16,18 +13,18 @@ module Supermarket
16
13
  namespace
17
14
  end
18
15
 
19
- desc 'profiles', 'list all available profiles in Chef Supermarket'
16
+ desc "profiles", "list all available profiles in Chef Supermarket"
20
17
  def profiles
21
18
  # display profiles in format user/profile
22
19
  supermarket_profiles = Supermarket::API.profiles
23
20
 
24
- headline('Available profiles:')
25
- supermarket_profiles.each { |p|
21
+ headline("Available profiles:")
22
+ supermarket_profiles.each do |p|
26
23
  li("#{p['tool_name']} #{mark_text(p['tool_owner'] + '/' + p['slug'])}")
27
- }
24
+ end
28
25
  end
29
26
 
30
- desc 'exec PROFILE', 'execute a Supermarket profile'
27
+ desc "exec PROFILE", "execute a Supermarket profile"
31
28
  exec_options
32
29
  def exec(*tests)
33
30
  o = config
@@ -35,7 +32,7 @@ module Supermarket
35
32
  configure_logger(o)
36
33
 
37
34
  # iterate over tests and add compliance scheme
38
- tests = tests.map { |t| 'supermarket://' + t }
35
+ tests = tests.map { |t| "supermarket://" + t }
39
36
 
40
37
  runner = Inspec::Runner.new(o)
41
38
  tests.each { |target| runner.add_target(target) }
@@ -46,13 +43,13 @@ module Supermarket
46
43
  exit 1
47
44
  end
48
45
 
49
- desc 'info PROFILE', 'display Supermarket profile details'
46
+ desc "info PROFILE", "display Supermarket profile details"
50
47
  def info(profile)
51
48
  # check that the profile is available
52
49
  supermarket_profiles = Supermarket::API.profiles
53
- found = supermarket_profiles.select { |p|
50
+ found = supermarket_profiles.select do |p|
54
51
  profile == "#{p['tool_owner']}/#{p['slug']}"
55
- }
52
+ end
56
53
 
57
54
  if found.empty?
58
55
  puts "#{mark_text(profile)} is not available on Supermarket"
@@ -70,5 +67,5 @@ module Supermarket
70
67
  end
71
68
 
72
69
  # register the subcommand to InSpec CLI registry
73
- Inspec::Plugins::CLI.add_subcommand(SupermarketCLI, 'supermarket', 'supermarket SUBCOMMAND ...', 'Supermarket commands', {})
70
+ Inspec::Plugins::CLI.add_subcommand(SupermarketCLI, "supermarket", "supermarket SUBCOMMAND ...", "Supermarket commands", {})
74
71
  end
@@ -1,19 +1,15 @@
1
- # encoding: utf-8
2
- # author: Christoph Hartmann
3
- # author: Dominik Richter
4
-
5
- require 'uri'
6
- require 'inspec/fetcher'
7
- require 'fetchers/url'
1
+ require "uri"
2
+ require "inspec/fetcher"
3
+ require "fetchers/url"
8
4
 
9
5
  # InSpec Target Helper for Supermarket
10
6
  module Supermarket
11
7
  class Fetcher < Inspec.fetcher(1)
12
- name 'supermarket'
8
+ name "supermarket"
13
9
  priority 500
14
10
 
15
11
  def self.resolve(target, opts = {})
16
- supermarket_uri, supermarket_server = if target.is_a?(String) && URI(target).scheme == 'supermarket'
12
+ supermarket_uri, supermarket_server = if target.is_a?(String) && URI(target).scheme == "supermarket"
17
13
  [target, Supermarket::API::SUPERMARKET_URL]
18
14
  elsif target.respond_to?(:key?) && target.key?(:supermarket)
19
15
  supermarket_server = target[:supermarket_url] || Supermarket::API::SUPERMARKET_URL
@@ -22,13 +18,13 @@ module Supermarket
22
18
  return nil unless supermarket_uri
23
19
  return nil unless Supermarket::API.exist?(supermarket_uri, supermarket_server)
24
20
  tool_info = Supermarket::API.find(supermarket_uri, supermarket_server)
25
- resolve_next(tool_info['tool_source_url'], opts)
21
+ resolve_next(tool_info["tool_source_url"], opts)
26
22
  rescue URI::Error
27
23
  nil
28
24
  end
29
25
 
30
26
  def to_s
31
- 'Chef Compliance Profile Loader'
27
+ "Chef Compliance Profile Loader"
32
28
  end
33
29
  end
34
30
  end
data/lib/fetchers/git.rb CHANGED
@@ -1,8 +1,7 @@
1
- # encoding: utf-8
2
- require 'tmpdir'
3
- require 'fileutils'
4
- require 'mixlib/shellout'
5
- require 'inspec/log'
1
+ require "tmpdir"
2
+ require "fileutils"
3
+ require "mixlib/shellout"
4
+ require "inspec/log"
6
5
 
7
6
  module Fetchers
8
7
  #
@@ -25,12 +24,12 @@ module Fetchers
25
24
  # omnibus source for hints.
26
25
  #
27
26
  class Git < Inspec.fetcher(1)
28
- name 'git'
27
+ name "git"
29
28
  priority 200
30
29
 
31
30
  def self.resolve(target, opts = {})
32
31
  if target.is_a?(String)
33
- new(target, opts) if target.start_with?('git@') || target.end_with?('.git')
32
+ new(target, opts) if target.start_with?("git@") || target.end_with?(".git")
34
33
  elsif target.respond_to?(:has_key?) && target.key?(:git)
35
34
  new(target[:git], opts.merge(target))
36
35
  end
@@ -54,7 +53,7 @@ module Fetchers
54
53
  Dir.mktmpdir do |tmpdir|
55
54
  checkout(tmpdir)
56
55
  Inspec::Log.debug("Checkout of #{resolved_ref} successful. Moving checkout to #{dir}")
57
- FileUtils.cp_r(tmpdir + '/.', @repo_directory)
56
+ FileUtils.cp_r(tmpdir + "/.", @repo_directory)
58
57
  end
59
58
  end
60
59
  @repo_directory
@@ -82,7 +81,7 @@ module Fetchers
82
81
  elsif @tag
83
82
  resolve_ref(@tag)
84
83
  else
85
- resolve_ref('master')
84
+ resolve_ref("master")
86
85
  end
87
86
  end
88
87
 
@@ -130,7 +129,7 @@ module Fetchers
130
129
  end
131
130
 
132
131
  def cloned?
133
- File.directory?(File.join(@repo_directory, '.git'))
132
+ File.directory?(File.join(@repo_directory, ".git"))
134
133
  end
135
134
 
136
135
  def clone(dir = @repo_directory)
@@ -149,7 +148,7 @@ module Fetchers
149
148
  cmd.error!
150
149
  cmd.status
151
150
  rescue Errno::ENOENT
152
- raise 'To use git sources, you must have git installed.'
151
+ raise "To use git sources, you must have git installed."
153
152
  end
154
153
 
155
154
  def shellout(cmd, opts = {})
@@ -157,12 +156,12 @@ module Fetchers
157
156
  cmd = Mixlib::ShellOut.new(cmd, opts)
158
157
  cmd.run_command
159
158
  Inspec::Log.debug("External command: completed with exit status: #{cmd.exitstatus}")
160
- Inspec::Log.debug('External command: STDOUT BEGIN')
159
+ Inspec::Log.debug("External command: STDOUT BEGIN")
161
160
  Inspec::Log.debug(cmd.stdout)
162
- Inspec::Log.debug('External command: STDOUT END')
163
- Inspec::Log.debug('External command: STDERR BEGIN')
161
+ Inspec::Log.debug("External command: STDOUT END")
162
+ Inspec::Log.debug("External command: STDERR BEGIN")
164
163
  Inspec::Log.debug(cmd.stderr)
165
- Inspec::Log.debug('External command: STDERR END')
164
+ Inspec::Log.debug("External command: STDERR END")
166
165
  cmd
167
166
  end
168
167
  end