inspec 4.18.51 → 4.18.85

Sign up to get free protection for your applications and to get access to all the features.
Files changed (371) hide show
  1. checksums.yaml +4 -4
  2. data/inspec.gemspec +15 -37
  3. data/lib/resource_support/aws/aws_resource_mixin.rb +1 -1
  4. metadata +22 -709
  5. data/Gemfile +0 -61
  6. data/LICENSE +0 -14
  7. data/README.md +0 -474
  8. data/etc/deprecations.json +0 -125
  9. data/etc/plugin_filters.json +0 -45
  10. data/lib/bundles/README.md +0 -3
  11. data/lib/bundles/inspec-compliance/api.rb +0 -7
  12. data/lib/bundles/inspec-compliance/configuration.rb +0 -7
  13. data/lib/bundles/inspec-compliance/http.rb +0 -7
  14. data/lib/bundles/inspec-compliance/support.rb +0 -7
  15. data/lib/bundles/inspec-compliance/target.rb +0 -7
  16. data/lib/bundles/inspec-supermarket.rb +0 -9
  17. data/lib/bundles/inspec-supermarket/README.md +0 -45
  18. data/lib/bundles/inspec-supermarket/api.rb +0 -87
  19. data/lib/bundles/inspec-supermarket/cli.rb +0 -71
  20. data/lib/bundles/inspec-supermarket/target.rb +0 -31
  21. data/lib/inspec.rb +0 -30
  22. data/lib/inspec/archive/tar.rb +0 -25
  23. data/lib/inspec/archive/zip.rb +0 -15
  24. data/lib/inspec/backend.rb +0 -101
  25. data/lib/inspec/base_cli.rb +0 -318
  26. data/lib/inspec/cached_fetcher.rb +0 -65
  27. data/lib/inspec/cli.rb +0 -469
  28. data/lib/inspec/completions/bash.sh.erb +0 -45
  29. data/lib/inspec/completions/fish.sh.erb +0 -34
  30. data/lib/inspec/completions/zsh.sh.erb +0 -61
  31. data/lib/inspec/config.rb +0 -511
  32. data/lib/inspec/control_eval_context.rb +0 -248
  33. data/lib/inspec/dependencies/cache.rb +0 -74
  34. data/lib/inspec/dependencies/dependency_set.rb +0 -93
  35. data/lib/inspec/dependencies/lockfile.rb +0 -115
  36. data/lib/inspec/dependencies/requirement.rb +0 -135
  37. data/lib/inspec/dependencies/resolver.rb +0 -86
  38. data/lib/inspec/describe_base.rb +0 -53
  39. data/lib/inspec/dist.rb +0 -20
  40. data/lib/inspec/dsl.rb +0 -115
  41. data/lib/inspec/dsl_shared.rb +0 -32
  42. data/lib/inspec/env_printer.rb +0 -156
  43. data/lib/inspec/errors.rb +0 -18
  44. data/lib/inspec/exceptions.rb +0 -11
  45. data/lib/inspec/expect.rb +0 -42
  46. data/lib/inspec/fetcher.rb +0 -48
  47. data/lib/inspec/fetcher/git.rb +0 -211
  48. data/lib/inspec/fetcher/local.rb +0 -116
  49. data/lib/inspec/fetcher/mock.rb +0 -34
  50. data/lib/inspec/fetcher/url.rb +0 -281
  51. data/lib/inspec/file_provider.rb +0 -318
  52. data/lib/inspec/formatters.rb +0 -3
  53. data/lib/inspec/formatters/base.rb +0 -269
  54. data/lib/inspec/formatters/json_rspec.rb +0 -20
  55. data/lib/inspec/formatters/show_progress.rb +0 -12
  56. data/lib/inspec/globals.rb +0 -9
  57. data/lib/inspec/impact.rb +0 -36
  58. data/lib/inspec/input.rb +0 -421
  59. data/lib/inspec/input_dsl_helpers.rb +0 -26
  60. data/lib/inspec/input_registry.rb +0 -315
  61. data/lib/inspec/library_eval_context.rb +0 -55
  62. data/lib/inspec/log.rb +0 -7
  63. data/lib/inspec/metadata.rb +0 -253
  64. data/lib/inspec/method_source.rb +0 -20
  65. data/lib/inspec/objects.rb +0 -14
  66. data/lib/inspec/objects/control.rb +0 -85
  67. data/lib/inspec/objects/describe.rb +0 -106
  68. data/lib/inspec/objects/each_loop.rb +0 -41
  69. data/lib/inspec/objects/input.rb +0 -49
  70. data/lib/inspec/objects/list.rb +0 -15
  71. data/lib/inspec/objects/or_test.rb +0 -45
  72. data/lib/inspec/objects/ruby_helper.rb +0 -13
  73. data/lib/inspec/objects/tag.rb +0 -32
  74. data/lib/inspec/objects/test.rb +0 -94
  75. data/lib/inspec/objects/value.rb +0 -32
  76. data/lib/inspec/plugin/v1.rb +0 -2
  77. data/lib/inspec/plugin/v1/plugin_types/cli.rb +0 -22
  78. data/lib/inspec/plugin/v1/plugin_types/fetcher.rb +0 -83
  79. data/lib/inspec/plugin/v1/plugin_types/resource.rb +0 -176
  80. data/lib/inspec/plugin/v1/plugin_types/secret.rb +0 -11
  81. data/lib/inspec/plugin/v1/plugin_types/source_reader.rb +0 -36
  82. data/lib/inspec/plugin/v1/plugins.rb +0 -59
  83. data/lib/inspec/plugin/v1/registry.rb +0 -90
  84. data/lib/inspec/plugin/v2.rb +0 -46
  85. data/lib/inspec/plugin/v2/activator.rb +0 -40
  86. data/lib/inspec/plugin/v2/config_file.rb +0 -151
  87. data/lib/inspec/plugin/v2/filter.rb +0 -96
  88. data/lib/inspec/plugin/v2/installer.rb +0 -512
  89. data/lib/inspec/plugin/v2/loader.rb +0 -321
  90. data/lib/inspec/plugin/v2/plugin_base.rb +0 -112
  91. data/lib/inspec/plugin/v2/plugin_types/cli.rb +0 -49
  92. data/lib/inspec/plugin/v2/plugin_types/dsl.rb +0 -11
  93. data/lib/inspec/plugin/v2/plugin_types/input.rb +0 -34
  94. data/lib/inspec/plugin/v2/plugin_types/mock.rb +0 -12
  95. data/lib/inspec/plugin/v2/registry.rb +0 -98
  96. data/lib/inspec/plugin/v2/status.rb +0 -29
  97. data/lib/inspec/profile.rb +0 -658
  98. data/lib/inspec/profile_context.rb +0 -203
  99. data/lib/inspec/profile_vendor.rb +0 -84
  100. data/lib/inspec/reporters.rb +0 -73
  101. data/lib/inspec/reporters/automate.rb +0 -78
  102. data/lib/inspec/reporters/base.rb +0 -25
  103. data/lib/inspec/reporters/cli.rb +0 -370
  104. data/lib/inspec/reporters/json.rb +0 -113
  105. data/lib/inspec/reporters/json_automate.rb +0 -80
  106. data/lib/inspec/reporters/json_min.rb +0 -48
  107. data/lib/inspec/reporters/junit.rb +0 -77
  108. data/lib/inspec/reporters/yaml.rb +0 -20
  109. data/lib/inspec/require_loader.rb +0 -29
  110. data/lib/inspec/resource.rb +0 -114
  111. data/lib/inspec/resources.rb +0 -130
  112. data/lib/inspec/resources/aide_conf.rb +0 -153
  113. data/lib/inspec/resources/apache.rb +0 -47
  114. data/lib/inspec/resources/apache_conf.rb +0 -156
  115. data/lib/inspec/resources/apt.rb +0 -151
  116. data/lib/inspec/resources/audit_policy.rb +0 -64
  117. data/lib/inspec/resources/auditd.rb +0 -251
  118. data/lib/inspec/resources/auditd_conf.rb +0 -45
  119. data/lib/inspec/resources/bash.rb +0 -33
  120. data/lib/inspec/resources/bond.rb +0 -70
  121. data/lib/inspec/resources/bridge.rb +0 -125
  122. data/lib/inspec/resources/bsd_service.rb +0 -2
  123. data/lib/inspec/resources/chocolatey_package.rb +0 -82
  124. data/lib/inspec/resources/command.rb +0 -91
  125. data/lib/inspec/resources/cpan.rb +0 -58
  126. data/lib/inspec/resources/cran.rb +0 -64
  127. data/lib/inspec/resources/crontab.rb +0 -173
  128. data/lib/inspec/resources/csv.rb +0 -56
  129. data/lib/inspec/resources/dh_params.rb +0 -83
  130. data/lib/inspec/resources/directory.rb +0 -23
  131. data/lib/inspec/resources/docker.rb +0 -274
  132. data/lib/inspec/resources/docker_container.rb +0 -91
  133. data/lib/inspec/resources/docker_image.rb +0 -84
  134. data/lib/inspec/resources/docker_object.rb +0 -52
  135. data/lib/inspec/resources/docker_plugin.rb +0 -64
  136. data/lib/inspec/resources/docker_service.rb +0 -91
  137. data/lib/inspec/resources/elasticsearch.rb +0 -165
  138. data/lib/inspec/resources/etc_fstab.rb +0 -96
  139. data/lib/inspec/resources/etc_group.rb +0 -157
  140. data/lib/inspec/resources/etc_hosts.rb +0 -68
  141. data/lib/inspec/resources/etc_hosts_allow.rb +0 -2
  142. data/lib/inspec/resources/etc_hosts_allow_deny.rb +0 -114
  143. data/lib/inspec/resources/etc_hosts_deny.rb +0 -2
  144. data/lib/inspec/resources/file.rb +0 -339
  145. data/lib/inspec/resources/filesystem.rb +0 -139
  146. data/lib/inspec/resources/firewalld.rb +0 -148
  147. data/lib/inspec/resources/gem.rb +0 -80
  148. data/lib/inspec/resources/group.rb +0 -2
  149. data/lib/inspec/resources/groups.rb +0 -241
  150. data/lib/inspec/resources/grub_conf.rb +0 -230
  151. data/lib/inspec/resources/host.rb +0 -310
  152. data/lib/inspec/resources/http.rb +0 -275
  153. data/lib/inspec/resources/iis_app.rb +0 -101
  154. data/lib/inspec/resources/iis_app_pool.rb +0 -127
  155. data/lib/inspec/resources/iis_site.rb +0 -148
  156. data/lib/inspec/resources/iis_website.rb +0 -2
  157. data/lib/inspec/resources/inetd_conf.rb +0 -53
  158. data/lib/inspec/resources/ini.rb +0 -28
  159. data/lib/inspec/resources/interface.rb +0 -204
  160. data/lib/inspec/resources/ip6tables.rb +0 -79
  161. data/lib/inspec/resources/iptables.rb +0 -80
  162. data/lib/inspec/resources/json.rb +0 -116
  163. data/lib/inspec/resources/kernel_module.rb +0 -106
  164. data/lib/inspec/resources/kernel_parameter.rb +0 -54
  165. data/lib/inspec/resources/key_rsa.rb +0 -66
  166. data/lib/inspec/resources/ksh.rb +0 -33
  167. data/lib/inspec/resources/launchd_service.rb +0 -2
  168. data/lib/inspec/resources/limits_conf.rb +0 -45
  169. data/lib/inspec/resources/linux_kernel_parameter.rb +0 -2
  170. data/lib/inspec/resources/login_defs.rb +0 -56
  171. data/lib/inspec/resources/mount.rb +0 -88
  172. data/lib/inspec/resources/mssql_session.rb +0 -117
  173. data/lib/inspec/resources/mysql.rb +0 -81
  174. data/lib/inspec/resources/mysql_conf.rb +0 -128
  175. data/lib/inspec/resources/mysql_session.rb +0 -88
  176. data/lib/inspec/resources/nginx.rb +0 -96
  177. data/lib/inspec/resources/nginx_conf.rb +0 -232
  178. data/lib/inspec/resources/noop.rb +0 -9
  179. data/lib/inspec/resources/npm.rb +0 -68
  180. data/lib/inspec/resources/ntp_conf.rb +0 -51
  181. data/lib/inspec/resources/oneget.rb +0 -71
  182. data/lib/inspec/resources/oracledb_session.rb +0 -149
  183. data/lib/inspec/resources/os.rb +0 -34
  184. data/lib/inspec/resources/os_env.rb +0 -86
  185. data/lib/inspec/resources/package.rb +0 -391
  186. data/lib/inspec/resources/packages.rb +0 -111
  187. data/lib/inspec/resources/parse_config.rb +0 -112
  188. data/lib/inspec/resources/parse_config_file.rb +0 -2
  189. data/lib/inspec/resources/passwd.rb +0 -73
  190. data/lib/inspec/resources/pip.rb +0 -132
  191. data/lib/inspec/resources/platform.rb +0 -112
  192. data/lib/inspec/resources/port.rb +0 -791
  193. data/lib/inspec/resources/postfix_conf.rb +0 -35
  194. data/lib/inspec/resources/postgres.rb +0 -152
  195. data/lib/inspec/resources/postgres_conf.rb +0 -116
  196. data/lib/inspec/resources/postgres_hba_conf.rb +0 -86
  197. data/lib/inspec/resources/postgres_ident_conf.rb +0 -75
  198. data/lib/inspec/resources/postgres_session.rb +0 -70
  199. data/lib/inspec/resources/powershell.rb +0 -67
  200. data/lib/inspec/resources/ppa.rb +0 -2
  201. data/lib/inspec/resources/processes.rb +0 -219
  202. data/lib/inspec/resources/rabbitmq_conf.rb +0 -2
  203. data/lib/inspec/resources/rabbitmq_config.rb +0 -52
  204. data/lib/inspec/resources/registry_key.rb +0 -296
  205. data/lib/inspec/resources/runit_service.rb +0 -2
  206. data/lib/inspec/resources/script.rb +0 -1
  207. data/lib/inspec/resources/security_identifier.rb +0 -91
  208. data/lib/inspec/resources/security_policy.rb +0 -182
  209. data/lib/inspec/resources/service.rb +0 -820
  210. data/lib/inspec/resources/shadow.rb +0 -150
  211. data/lib/inspec/resources/ssh_config.rb +0 -98
  212. data/lib/inspec/resources/sshd_config.rb +0 -2
  213. data/lib/inspec/resources/ssl.rb +0 -99
  214. data/lib/inspec/resources/sys_info.rb +0 -119
  215. data/lib/inspec/resources/systemd_service.rb +0 -2
  216. data/lib/inspec/resources/sysv_service.rb +0 -2
  217. data/lib/inspec/resources/toml.rb +0 -30
  218. data/lib/inspec/resources/upstart_service.rb +0 -2
  219. data/lib/inspec/resources/user.rb +0 -1
  220. data/lib/inspec/resources/users.rb +0 -742
  221. data/lib/inspec/resources/vbscript.rb +0 -67
  222. data/lib/inspec/resources/virtualization.rb +0 -255
  223. data/lib/inspec/resources/windows_feature.rb +0 -126
  224. data/lib/inspec/resources/windows_hotfix.rb +0 -37
  225. data/lib/inspec/resources/windows_registry_key.rb +0 -2
  226. data/lib/inspec/resources/windows_task.rb +0 -112
  227. data/lib/inspec/resources/wmi.rb +0 -109
  228. data/lib/inspec/resources/x509_certificate.rb +0 -143
  229. data/lib/inspec/resources/xinetd_conf.rb +0 -103
  230. data/lib/inspec/resources/xml.rb +0 -48
  231. data/lib/inspec/resources/yaml.rb +0 -42
  232. data/lib/inspec/resources/yum.rb +0 -162
  233. data/lib/inspec/resources/zfs_dataset.rb +0 -62
  234. data/lib/inspec/resources/zfs_pool.rb +0 -50
  235. data/lib/inspec/rspec_extensions.rb +0 -116
  236. data/lib/inspec/rule.rb +0 -389
  237. data/lib/inspec/runner.rb +0 -333
  238. data/lib/inspec/runner_mock.rb +0 -37
  239. data/lib/inspec/runner_rspec.rb +0 -184
  240. data/lib/inspec/runtime_profile.rb +0 -23
  241. data/lib/inspec/schema.rb +0 -245
  242. data/lib/inspec/secrets.rb +0 -15
  243. data/lib/inspec/secrets/yaml.rb +0 -29
  244. data/lib/inspec/shell.rb +0 -211
  245. data/lib/inspec/shell_detector.rb +0 -89
  246. data/lib/inspec/source_reader.rb +0 -26
  247. data/lib/inspec/ui.rb +0 -213
  248. data/lib/inspec/ui_table_helper.rb +0 -12
  249. data/lib/inspec/utils/command_wrapper.rb +0 -23
  250. data/lib/inspec/utils/convert.rb +0 -8
  251. data/lib/inspec/utils/database_helpers.rb +0 -75
  252. data/lib/inspec/utils/deprecation.rb +0 -6
  253. data/lib/inspec/utils/deprecation/config_file.rb +0 -109
  254. data/lib/inspec/utils/deprecation/deprecator.rb +0 -118
  255. data/lib/inspec/utils/deprecation/errors.rb +0 -14
  256. data/lib/inspec/utils/deprecation/global_method.rb +0 -9
  257. data/lib/inspec/utils/enumerable_delegation.rb +0 -7
  258. data/lib/inspec/utils/erlang_parser.rb +0 -190
  259. data/lib/inspec/utils/file_reader.rb +0 -24
  260. data/lib/inspec/utils/filter.rb +0 -461
  261. data/lib/inspec/utils/filter_array.rb +0 -25
  262. data/lib/inspec/utils/find_files.rb +0 -44
  263. data/lib/inspec/utils/hash.rb +0 -37
  264. data/lib/inspec/utils/json_log.rb +0 -15
  265. data/lib/inspec/utils/modulator.rb +0 -9
  266. data/lib/inspec/utils/nginx_parser.rb +0 -101
  267. data/lib/inspec/utils/object_traversal.rb +0 -47
  268. data/lib/inspec/utils/parser.rb +0 -277
  269. data/lib/inspec/utils/pkey_reader.rb +0 -17
  270. data/lib/inspec/utils/simpleconfig.rb +0 -121
  271. data/lib/inspec/utils/spdx.rb +0 -10
  272. data/lib/inspec/utils/spdx.txt +0 -383
  273. data/lib/inspec/utils/telemetry.rb +0 -3
  274. data/lib/inspec/utils/telemetry/collector.rb +0 -81
  275. data/lib/inspec/utils/telemetry/data_series.rb +0 -44
  276. data/lib/inspec/utils/telemetry/global_methods.rb +0 -22
  277. data/lib/inspec/version.rb +0 -3
  278. data/lib/matchers/matchers.rb +0 -341
  279. data/lib/plugins/README.md +0 -16
  280. data/lib/plugins/inspec-artifact/lib/inspec-artifact.rb +0 -12
  281. data/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb +0 -170
  282. data/lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb +0 -116
  283. data/lib/plugins/inspec-artifact/test/functional/inspec_artifact_test.rb +0 -50
  284. data/lib/plugins/inspec-compliance/README.md +0 -207
  285. data/lib/plugins/inspec-compliance/lib/inspec-compliance.rb +0 -12
  286. data/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb +0 -362
  287. data/lib/plugins/inspec-compliance/lib/inspec-compliance/api/login.rb +0 -198
  288. data/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb +0 -269
  289. data/lib/plugins/inspec-compliance/lib/inspec-compliance/configuration.rb +0 -103
  290. data/lib/plugins/inspec-compliance/lib/inspec-compliance/http.rb +0 -117
  291. data/lib/plugins/inspec-compliance/lib/inspec-compliance/images/cc-token.png +0 -0
  292. data/lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb +0 -34
  293. data/lib/plugins/inspec-compliance/lib/inspec-compliance/target.rb +0 -146
  294. data/lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb +0 -53
  295. data/lib/plugins/inspec-compliance/test/integration/default/cli.rb +0 -91
  296. data/lib/plugins/inspec-compliance/test/unit/api/login_test.rb +0 -190
  297. data/lib/plugins/inspec-compliance/test/unit/api_test.rb +0 -386
  298. data/lib/plugins/inspec-compliance/test/unit/target_test.rb +0 -155
  299. data/lib/plugins/inspec-habitat/Berksfile +0 -5
  300. data/lib/plugins/inspec-habitat/README.md +0 -150
  301. data/lib/plugins/inspec-habitat/kitchen.yml +0 -28
  302. data/lib/plugins/inspec-habitat/lib/inspec-habitat.rb +0 -11
  303. data/lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb +0 -41
  304. data/lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb +0 -265
  305. data/lib/plugins/inspec-habitat/templates/habitat/plan.sh.erb +0 -6
  306. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/Berksfile +0 -2
  307. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/README.md +0 -3
  308. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/files/hab_setup.exp +0 -28
  309. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/metadata.rb +0 -9
  310. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/recipes/default.rb +0 -61
  311. data/lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb +0 -34
  312. data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/README.md +0 -3
  313. data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb +0 -40
  314. data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/inspec.yml +0 -10
  315. data/lib/plugins/inspec-habitat/test/support/example_profile/README.md +0 -3
  316. data/lib/plugins/inspec-habitat/test/support/example_profile/controls/example.rb +0 -7
  317. data/lib/plugins/inspec-habitat/test/support/example_profile/inspec.yml +0 -10
  318. data/lib/plugins/inspec-habitat/test/unit/profile_test.rb +0 -242
  319. data/lib/plugins/inspec-init/README.md +0 -31
  320. data/lib/plugins/inspec-init/lib/inspec-init.rb +0 -12
  321. data/lib/plugins/inspec-init/lib/inspec-init/cli.rb +0 -15
  322. data/lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb +0 -243
  323. data/lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb +0 -47
  324. data/lib/plugins/inspec-init/lib/inspec-init/renderer.rb +0 -97
  325. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Gemfile +0 -11
  326. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/LICENSE +0 -2
  327. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/README.md +0 -28
  328. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Rakefile +0 -40
  329. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template.rb +0 -14
  330. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/cli_command.rb +0 -62
  331. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/plugin.rb +0 -53
  332. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/version.rb +0 -8
  333. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/fixtures/README.md +0 -24
  334. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/README.md +0 -12
  335. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/inspec_plugin_template_test.rb +0 -110
  336. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/helper.rb +0 -24
  337. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/README.md +0 -17
  338. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/cli_args_test.rb +0 -67
  339. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/plugin_def_test.rb +0 -51
  340. data/lib/plugins/inspec-init/templates/profiles/aws/libraries/.gitkeep +0 -0
  341. data/lib/plugins/inspec-init/templates/profiles/azure/libraries/.gitkeep +0 -0
  342. data/lib/plugins/inspec-init/templates/profiles/gcp/libraries/.gitkeep +0 -0
  343. data/lib/plugins/inspec-init/templates/profiles/os/README.md +0 -3
  344. data/lib/plugins/inspec-init/templates/profiles/os/controls/example.rb +0 -18
  345. data/lib/plugins/inspec-init/templates/profiles/os/inspec.yml +0 -10
  346. data/lib/plugins/inspec-init/templates/profiles/os/libraries/.gitkeep +0 -0
  347. data/lib/plugins/inspec-init/test/functional/inspec_init_plugin_test.rb +0 -184
  348. data/lib/plugins/inspec-init/test/functional/inspec_init_profile_test.rb +0 -121
  349. data/lib/plugins/inspec-plugin-manager-cli/README.md +0 -6
  350. data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb +0 -17
  351. data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +0 -518
  352. data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb +0 -12
  353. data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/config_dirs/empty/.gitkeep +0 -0
  354. data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette.rb +0 -2
  355. data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette/.gitkeep +0 -0
  356. data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-wrong-structure/.gitkeep +0 -0
  357. data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name.rb +0 -1
  358. data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name/.gitkeep +0 -0
  359. data/lib/plugins/inspec-plugin-manager-cli/test/functional/help_test.rb +0 -23
  360. data/lib/plugins/inspec-plugin-manager-cli/test/functional/helper.rb +0 -62
  361. data/lib/plugins/inspec-plugin-manager-cli/test/functional/install_test.rb +0 -368
  362. data/lib/plugins/inspec-plugin-manager-cli/test/functional/list_test.rb +0 -101
  363. data/lib/plugins/inspec-plugin-manager-cli/test/functional/search_test.rb +0 -129
  364. data/lib/plugins/inspec-plugin-manager-cli/test/functional/uninstall_test.rb +0 -63
  365. data/lib/plugins/inspec-plugin-manager-cli/test/functional/update_test.rb +0 -84
  366. data/lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb +0 -77
  367. data/lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb +0 -39
  368. data/lib/plugins/shared/core_plugin_test_helper.rb +0 -153
  369. data/lib/plugins/things-for-train-integration.rb +0 -14
  370. data/lib/source_readers/flat.rb +0 -36
  371. data/lib/source_readers/inspec.rb +0 -66
@@ -1,135 +0,0 @@
1
- require "inspec/cached_fetcher"
2
- require "semverse"
3
-
4
- module Inspec
5
- #
6
- # Inspec::Requirement represents a given profile dependency, where
7
- # appropriate we delegate to Inspec::Profile directly.
8
- #
9
- class Requirement
10
- def self.from_metadata(dep, cache, opts)
11
- raise "Cannot load empty dependency." if dep.nil? || dep.empty?
12
-
13
- req_path = opts[:cwd]
14
-
15
- if dep[:path]
16
- req_path = File.expand_path(dep[:path], req_path)
17
- end
18
- config = {
19
- cache: cache,
20
- cwd: req_path,
21
- }
22
-
23
- new(dep[:name],
24
- dep[:version],
25
- config,
26
- opts.merge(dep))
27
- end
28
-
29
- def self.from_lock_entry(entry, config, opts = {})
30
- resolved_source = entry[:resolved_source]
31
- .merge(backend: config[:backend])
32
- .merge(opts)
33
-
34
- req = new(entry[:name],
35
- entry[:version_constraints],
36
- config,
37
- resolved_source)
38
-
39
- locked_deps = []
40
- Array(entry[:dependencies]).each do |dep_entry|
41
- dep_config = config.dup
42
- dep_config[:parent_profile] = entry[:name]
43
- locked_deps << Inspec::Requirement.from_lock_entry(dep_entry, dep_config, opts)
44
- end
45
- req.lock_deps(locked_deps)
46
- req
47
- end
48
-
49
- attr_reader :cwd, :opts, :version_constraints
50
- def initialize(name, version_constraints, config, opts)
51
- @name = name
52
- @version_constraints = Array(version_constraints)
53
- @cache = config[:cache]
54
- @backend = opts[:backend]
55
- @opts = opts
56
- @cwd = config[:cwd]
57
- @parent_profile = config[:parent_profile]
58
- end
59
-
60
- #
61
- # A dependency can be renamed in inspec.yml/inspec.lock. Prefer
62
- # the name the user gave this dependency over the profile name.
63
- #
64
- def name
65
- @name || profile.name
66
- end
67
-
68
- def source_version
69
- profile.version
70
- end
71
-
72
- def source_satisfies_spec?
73
- return true if version_constraints.empty?
74
-
75
- # Semverse::Constraint.satisfy_all returns a list of versions that match all of the
76
- # supplied constraints. Since we're only matching against a single version, the return
77
- # of satisfy_all will be non-empty if the profile version we have satisfies the constraints.
78
- constraints = @version_constraints.map { |x| Semverse::Constraint.new(x) }
79
- !Semverse::Constraint.satisfy_all(constraints, Semverse::Version.new(profile.version)).empty?
80
- end
81
-
82
- def resolved_source
83
- @resolved_source ||= fetcher.resolved_source
84
- end
85
-
86
- def to_hash
87
- h = {
88
- "name" => name,
89
- "resolved_source" => resolved_source,
90
- "version_constraints" => version_constraints,
91
- }
92
-
93
- unless dependencies.empty?
94
- h["dependencies"] = dependencies.map(&:to_hash)
95
- end
96
-
97
- h
98
- end
99
-
100
- def lock_deps(dep_array)
101
- @dependencies = dep_array
102
- end
103
-
104
- def fetcher
105
- @fetcher ||= Inspec::CachedFetcher.new(opts, @cache)
106
- end
107
-
108
- # load dependencies of the dependency
109
- def dependencies
110
- @dependencies ||= profile.metadata.dependencies.map do |r|
111
- Inspec::Requirement.from_metadata(r, @cache, cwd: @cwd, backend: @backend)
112
- end
113
- end
114
-
115
- def to_s
116
- name
117
- end
118
-
119
- # load the profile for the requirement
120
- def profile
121
- return @profile unless @profile.nil?
122
-
123
- opts = @opts.dup
124
- opts[:backend] = @backend
125
- opts[:runner_conf] = Inspec::Config.cached
126
- if !@dependencies.nil? && !@dependencies.empty?
127
- opts[:dependencies] = Inspec::DependencySet.from_array(@dependencies, @cwd, @cache, @backend)
128
- end
129
- opts[:profile_name] = @name
130
- opts[:parent_profile] = @parent_profile
131
- @profile = Inspec::Profile.for_fetcher(fetcher, opts)
132
- @profile
133
- end
134
- end
135
- end
@@ -1,86 +0,0 @@
1
- require "inspec/log"
2
- require "inspec/errors"
3
-
4
- module Inspec
5
- #
6
- # Inspec::Resolver is a simple dependency resolver. Unlike Bundler
7
- # or Berkshelf, it does not attempt to resolve each named dependency
8
- # to a single version. Rather, it traverses down the dependency tree
9
- # and:
10
- #
11
- # - Fetches the dependency from the source
12
- # - Checks the presence of cycles, and
13
- # - Checks that the specified dependency source satisfies the
14
- # specified version constraint
15
- #
16
- # The full dependency tree is then available for the loader, which
17
- # will provide the isolation necessary to support multiple versions
18
- # of the same profile being used at runtime.
19
- #
20
- # Currently the fetching happens somewhat lazily depending on the
21
- # implementation of the fetcher being used.
22
- #
23
- class Resolver
24
- # Here deps is an Array of Hashes
25
- def self.resolve(dependencies, cache, working_dir, backend)
26
- reqs = dependencies.map do |dep|
27
- req = Inspec::Requirement.from_metadata(dep, cache, cwd: working_dir, backend: backend)
28
- req || raise("Cannot initialize dependency: #{req}")
29
- end
30
- new.resolve(reqs)
31
- end
32
-
33
- def detect_duplicates(deps, top_level, path_string)
34
- seen_items_local = []
35
- deps.each do |dep|
36
- if seen_items_local.include?(dep.name)
37
- problem_cookbook = if top_level
38
- "the inspec.yml for this profile."
39
- else
40
- "the dependency information for #{path_string.split(" ").last}"
41
- end
42
- raise Inspec::DuplicateDep, "The dependency #{dep.name} is listed twice in #{problem_cookbook}"
43
- else
44
- seen_items_local << dep.name
45
- end
46
- end
47
- end
48
-
49
- # Here deps is an Array of Inspec::Requirement
50
- def resolve(deps, top_level = true, seen_items = {}, path_string = "") # rubocop:disable Metrics/AbcSize
51
- graph = {}
52
- if top_level
53
- Inspec::Log.debug("Starting traversal of dependencies #{deps.map(&:to_s)}")
54
- else
55
- Inspec::Log.debug("Traversing dependency tree of transitive dependency #{deps.map(&:name)}")
56
- end
57
-
58
- detect_duplicates(deps, top_level, path_string)
59
- deps.each do |dep|
60
- new_seen_items = seen_items.dup
61
- new_path_string = if path_string.empty?
62
- dep.name
63
- else
64
- path_string + " -> #{dep.name}"
65
- end
66
-
67
- raise Inspec::CyclicDependencyError, "Dependency #{dep} would cause a dependency cycle (#{new_path_string})" if new_seen_items.key?(dep.resolved_source)
68
-
69
- new_seen_items[dep.resolved_source] = true
70
-
71
- unless dep.source_satisfies_spec?
72
- raise Inspec::UnsatisfiedVersionSpecification, "The profile #{dep.name} from #{dep.resolved_source} has a version #{dep.source_version} which doesn't match #{dep.version_constraints}"
73
- end
74
-
75
- Inspec::Log.debug("Adding dependency #{dep.name} (#{dep.resolved_source})")
76
- graph[dep.name] = dep
77
- unless dep.dependencies.empty?
78
- resolve(dep.dependencies, false, new_seen_items.dup, new_path_string)
79
- end
80
- end
81
-
82
- Inspec::Log.debug("Dependency traversal complete.") if top_level
83
- graph
84
- end
85
- end
86
- end
@@ -1,53 +0,0 @@
1
- require "inspec/input_dsl_helpers"
2
-
3
- module Inspec
4
- class DescribeBase
5
-
6
- include Inspec::InputDslHelpers
7
-
8
- def initialize(action)
9
- @action = action
10
- @checks = []
11
- end
12
-
13
- # Evaluate the given block and collect all checks. These will be registered
14
- # with the callback function under the 'describe.one' name.
15
- #
16
- # @param [Proc] ruby block containing checks (e.g. via describe)
17
- # @return [nil]
18
- def one(&block)
19
- return unless block_given?
20
-
21
- instance_eval(&block)
22
- @action.call("describe.one", @checks, nil)
23
- end
24
-
25
- def input(input_name, options = {})
26
- input_with_profile_id(__profile_id, input_name, options)
27
- end
28
-
29
- def input_object(name)
30
- Inspec::InputRegistry.find_or_register_input(name, __profile_id)
31
- end
32
-
33
- def method_missing(method_name, *arguments)
34
- Inspec::DSL.method_missing_resource(inspec, method_name, *arguments)
35
- end
36
-
37
- def describe(*args, &block)
38
- @checks.push(["describe", args, block])
39
- end
40
-
41
- private
42
-
43
- # While this is marked private, it gets consumed during an instance_eval,
44
- # so it is fully visible. The double underscore is there to discourage
45
- # use - this is a private API.
46
- def __profile_id
47
- # Excavate the profile ID. The action is a Method calling __add_check on
48
- # a Rule whose profile ID we want
49
- @action.receiver.instance_variable_get(:@__profile_id)
50
- end
51
-
52
- end
53
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Inspec
4
- module Dist
5
- # When referencing a product directly, like InSpec
6
- PRODUCT_NAME = "Chef InSpec"
7
-
8
- # The inspec executable
9
- EXEC_NAME = "inspec"
10
-
11
- # The name of the server product
12
- SERVER_PRODUCT_NAME = "Chef Server"
13
-
14
- # name of the automate product
15
- AUTOMATE_PRODUCT_NAME = "Chef Automate"
16
-
17
- # name of the compliance product
18
- COMPLIANCE_PRODUCT_NAME = "Chef Compliance"
19
- end
20
- end
@@ -1,115 +0,0 @@
1
- # copyright: 2015, Dominik Richter
2
- require "inspec/log"
3
- require "inspec/plugin/v2"
4
-
5
- module Inspec::DSL
6
- attr_accessor :backend
7
-
8
- def require_controls(id, &block)
9
- opts = { profile_id: id, include_all: false, backend: @backend, conf: @conf, dependencies: @dependencies }
10
- ::Inspec::DSL.load_spec_files_for_profile(self, opts, &block)
11
- end
12
-
13
- def include_controls(id, &block)
14
- opts = { profile_id: id, include_all: true, backend: @backend, conf: @conf, dependencies: @dependencies }
15
- ::Inspec::DSL.load_spec_files_for_profile(self, opts, &block)
16
- end
17
-
18
- alias require_rules require_controls
19
- alias include_rules include_controls
20
-
21
- def require_resource(options = {})
22
- raise "You must specify a specific resource name when calling require_resource()" if options[:resource].nil?
23
-
24
- from_profile = options[:profile] || profile_name
25
- target_name = options[:as] || options[:resource]
26
- res = resource_class(from_profile, options[:resource])
27
- add_resource(target_name, res)
28
- end
29
-
30
- ##
31
- # Try to load and instantiate a missing resource or raise LoadError
32
- # if unable. Requiring the resource registers it and generates a
33
- # method for it so you should only hit this once per missing
34
- # resource.
35
-
36
- def self.method_missing_resource(backend, id, *arguments)
37
- return unless backend
38
-
39
- begin
40
- require "inspec/resources/#{id}"
41
- rescue LoadError
42
- require "resources/aws/#{id}"
43
- end
44
-
45
- klass = Inspec::Resource.registry[id.to_s]
46
- klass.new(backend, id, *arguments)
47
- end
48
-
49
- # Support for Outer Profile DSL plugins
50
- # This is called when an unknown method is encountered
51
- # "bare" in a control file - outside of a control or describe block.
52
- def method_missing(method_name, *arguments, &block)
53
- # Check to see if there is a outer_profile_dsl plugin activator hook with the method name
54
- registry = Inspec::Plugin::V2::Registry.instance
55
- hook = registry.find_activators(plugin_type: :outer_profile_dsl, activator_name: method_name).first
56
- if hook
57
- # OK, load the hook if it hasn't been already. We'll then know a module,
58
- # which we can then inject into the context
59
- hook.activate
60
- # Inject the module's methods into the context
61
- # implementation_class is the field name, but this is actually a module.
62
- self.class.include(hook.implementation_class)
63
- # Now that the module is loaded, it defined one or more methods
64
- # (presumably the one we were looking for.)
65
- # We still haven't called it, so do so now.
66
- send(method_name, *arguments, &block)
67
- else
68
- begin
69
- Inspec::DSL.method_missing_resource(backend, method_name, *arguments)
70
- rescue LoadError
71
- super
72
- end
73
- end
74
- end
75
-
76
- def self.load_spec_files_for_profile(bind_context, opts, &block)
77
- dependencies = opts[:dependencies]
78
- profile_id = opts[:profile_id]
79
- dep_entry = dependencies.list[profile_id]
80
-
81
- if dep_entry.nil?
82
- raise <<~EOF
83
- Cannot load '#{profile_id}' since it is not listed as a dependency of #{bind_context.profile_name}.
84
-
85
- Dependencies available from this context are:
86
- #{dependencies.list.keys.join("\n ")}
87
- EOF
88
- end
89
-
90
- # Do not load any controls if the profile is not supported
91
- return unless dep_entry.profile.supports_platform?
92
-
93
- context = dep_entry.profile.runner_context
94
- # if we don't want all the rules, then just make 1 pass to get all rule_IDs
95
- # that we want to keep from the original
96
- filter_included_controls(context, dep_entry.profile, &block) unless opts[:include_all]
97
- # interpret the block and skip/modify as required
98
- context.load(block) if block_given?
99
- bind_context.add_subcontext(context)
100
- end
101
-
102
- def self.filter_included_controls(context, profile, &block)
103
- mock = Inspec::Backend.create(Inspec::Config.mock)
104
- include_ctx = Inspec::ProfileContext.for_profile(profile, mock)
105
- include_ctx.load(block) if block_given?
106
- # remove all rules that were not registered
107
- context.all_rules.each do |r|
108
- id = Inspec::Rule.rule_id(r)
109
- fid = Inspec::Rule.profile_id(r) + "/" + id
110
- unless include_ctx.rules[id] || include_ctx.rules[fid]
111
- context.remove_rule(fid)
112
- end
113
- end
114
- end
115
- end
@@ -1,32 +0,0 @@
1
- module Inspec
2
- #
3
- # Contains methods we would like in multiple DSL
4
- #
5
- module DSL
6
- module RequireOverride
7
- # Save the toplevel require method to load all ruby dependencies.
8
- # It is used whenever the `require 'lib'` is not in libraries.
9
- alias __ruby_require require
10
-
11
- def require(path)
12
- rbpath = path + ".rb"
13
- return __ruby_require(path) unless @require_loader.exists?(rbpath)
14
- return false if @require_loader.loaded?(rbpath)
15
-
16
- # This is equivalent to calling `require 'lib'` with lib on disk.
17
- # We cannot rely on libraries residing on disk however.
18
- # TODO: Sandboxing.
19
- content, path, line = @require_loader.load(rbpath)
20
-
21
- # If we are in the realm of libraries and the LibraryEvalContext
22
- # we should have access to the __inspec_binding, which is a Binding
23
- # context that provides the correct plane to evaluate all required files to.
24
- # It will ensure that embedded calls to `require` still call this
25
- # method and get loaded from their correct paths.
26
- return __inspec_binding.eval(content, path, line) if defined?(__inspec_binding)
27
-
28
- eval(content, TOPLEVEL_BINDING, path, line) # rubocop:disable Security/Eval
29
- end
30
- end
31
- end
32
- end
@@ -1,156 +0,0 @@
1
- require "inspec/shell_detector"
2
- require "erb"
3
- require "shellwords"
4
-
5
- module Inspec
6
- class EnvPrinter
7
- attr_reader :shell
8
-
9
- EVAL_COMMANDS = {
10
- "bash" => 'eval \"$(inspec env bash)\"',
11
- "fish" => "inspec env fish > ~/.config/fish/completions/inspec.fish",
12
- "zsh" => 'eval \"$(inspec env zsh)\"',
13
- }.freeze
14
-
15
- def initialize(command_class, shell = nil)
16
- if !shell
17
- @detected = true
18
- @shell = Inspec::ShellDetector.new.shell
19
- else
20
- @shell = shell
21
- end
22
- @command_class = command_class
23
- end
24
-
25
- def print_and_exit!
26
- exit_no_shell unless have_shell?
27
- exit_no_completion unless have_shell_completion?
28
-
29
- print_completion_for_shell
30
- print_detection_warning($stdout) if @detected
31
- print_usage_guidance
32
- exit 0
33
- end
34
-
35
- private
36
-
37
- def print_completion_for_shell
38
- erb = ERB.new(File.read(completion_template_path), nil, "-")
39
- puts erb.result(TemplateContext.new(@command_class).get_bindings)
40
- end
41
-
42
- def have_shell?
43
- !(@shell.nil? || @shell.empty?)
44
- end
45
-
46
- def have_shell_completion?
47
- File.exist?(completion_template_path)
48
- end
49
-
50
- def completion_dir
51
- File.join(File.dirname(__FILE__), "completions")
52
- end
53
-
54
- def completion_template_path
55
- File.join(completion_dir, "#{@shell}.sh.erb")
56
- end
57
-
58
- def shells_with_completions
59
- Dir.glob("#{completion_dir}/*.sh.erb").map { |f| File.basename(f, ".sh.erb") }
60
- end
61
-
62
- def print_usage_guidance
63
- puts <<~EOF
64
- # To use this, eval it in your shell
65
- #
66
- # #{EVAL_COMMANDS[shell]}
67
- #
68
- #
69
- EOF
70
- end
71
-
72
- def print_detection_warning(device)
73
- device.puts <<~EOF
74
- #
75
- # The shell #{@shell} was auto-detected. If this is incorrect, please
76
- # specify a shell explicitly by running:
77
- #
78
- # inspec env SHELLNAME
79
- #
80
- # Currently supported shells are: #{shells_with_completions.join(", ")}
81
- #
82
- EOF
83
- end
84
-
85
- def exit_no_completion
86
- $stderr.puts "# No completion script for #{@shell}!"
87
- print_detection_warning($stderr) if @detected
88
- exit 1
89
- end
90
-
91
- def exit_no_shell
92
- if @detected
93
- $stderr.puts "# Unable to automatically detect shell and no shell was provided."
94
- end
95
- $stderr.puts <<~EOF
96
- #
97
- # Please provide the name of your shell via the command line:
98
- #
99
- # inspec env SHELLNAME
100
- #
101
- # Currently supported shells are: #{shells_with_completions.join(", ")}
102
- EOF
103
- exit 1
104
- end
105
-
106
- class TemplateContext
107
- def initialize(command_class)
108
- @command_class = command_class
109
- end
110
-
111
- def get_bindings # rubocop:disable Naming/AccessorMethodName
112
- binding
113
- end
114
-
115
- #
116
- # The following functions all assume that @command_class
117
- # is something that provides a Thor-like API
118
- #
119
- def top_level_commands
120
- commands_for_thor_class(@command_class)
121
- end
122
-
123
- def top_level_commands_with_descriptions
124
- descript_lines_for_class(@command_class)
125
- end
126
-
127
- def subcommands_with_commands
128
- ret = {}
129
- @command_class.subcommand_classes.each do |k, v|
130
- ret[k] = commands_for_thor_class(v)
131
- end
132
- ret
133
- end
134
-
135
- def subcommands_with_commands_and_descriptions
136
- ret = {}
137
- @command_class.subcommand_classes.each do |k, v|
138
- ret[k] = descript_lines_for_class(v)
139
- end
140
- ret
141
- end
142
-
143
- def commands_for_thor_class(thor_class)
144
- thor_class.all_commands.values.map { |c| c.usage.split.first }
145
- end
146
-
147
- def descript_lines_for_class(thor_class)
148
- thor_class.all_commands.values.map { |c| descript_line_for_command(c) }
149
- end
150
-
151
- def descript_line_for_command(c)
152
- "#{c.usage.split.first}:#{Shellwords.escape(c.description)}"
153
- end
154
- end
155
- end
156
- end