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,203 +0,0 @@
1
- require "inspec/log"
2
- require "inspec/rule"
3
- require "inspec/resource"
4
- require "inspec/library_eval_context"
5
- require "inspec/control_eval_context"
6
- require "inspec/require_loader"
7
- require "securerandom"
8
- require "inspec/input_registry"
9
-
10
- module Inspec
11
- class ProfileContext
12
- def self.for_profile(profile, backend)
13
- new(profile.name, backend, { "profile" => profile, "check_mode" => profile.check_mode })
14
- end
15
-
16
- attr_reader :backend, :profile_name, :profile_id, :resource_registry
17
- attr_accessor :rules
18
- def initialize(profile_id, backend, conf)
19
- if backend.nil?
20
- raise "ProfileContext is initiated with a backend == nil. " \
21
- "This is a backend error which must be fixed upstream."
22
- end
23
- @profile_id = profile_id
24
- @backend = backend
25
- @conf = conf.dup
26
- @profile_name = @conf.key?("profile") ? @conf["profile"].profile_name : @profile_id
27
- @skip_only_if_eval = @conf["check_mode"]
28
- @rules = {}
29
- @control_subcontexts = []
30
- @lib_subcontexts = []
31
- @require_loader = ::Inspec::RequireLoader.new
32
- Inspec::InputRegistry.register_profile_alias(@profile_id, @profile_name) if @profile_id != @profile_name
33
- # TODO: consider polling input source plugins; this is a bulk fetch opportunity
34
-
35
- # A local resource registry that only contains resources defined
36
- # in the transitive dependency tree of the loaded profile.
37
- @resource_registry = Inspec::Resource.new_registry
38
- @library_eval_context = Inspec::LibraryEvalContext.create(@resource_registry, @require_loader)
39
- @current_load = nil
40
- end
41
-
42
- def attributes
43
- Inspec::AttributeRegistry.list_attributes_for_profile(@profile_id)
44
- end
45
-
46
- def dependencies
47
- if @conf["profile"].nil?
48
- {}
49
- else
50
- @conf["profile"].locked_dependencies
51
- end
52
- end
53
-
54
- def to_resources_dsl
55
- Inspec::Resource.create_dsl(self)
56
- end
57
-
58
- def control_eval_context
59
- @control_eval_context ||= begin
60
- ctx = Inspec::ControlEvalContext.create(self, to_resources_dsl)
61
- ctx.new(@backend, @conf, dependencies, @require_loader, @skip_only_if_eval)
62
- end
63
- end
64
-
65
- def reload_dsl
66
- @control_eval_context = nil
67
- end
68
-
69
- def profile_supports_platform?
70
- return true if @conf["profile"].nil?
71
-
72
- @conf["profile"].supports_platform?
73
- end
74
-
75
- def profile_supports_inspec_version?
76
- return true if @conf["profile"].nil?
77
-
78
- @conf["profile"].supports_runtime?
79
- end
80
-
81
- def remove_rule(id)
82
- @rules[id] = nil if @rules.key?(id)
83
- @control_subcontexts.each do |c|
84
- c.remove_rule(id)
85
- end
86
- end
87
-
88
- def all_controls
89
- ret = @rules.values
90
- ret += @control_subcontexts.map(&:all_rules).flatten
91
- ret
92
- end
93
- alias all_rules all_controls
94
-
95
- def subcontext_by_name(name)
96
- found = @lib_subcontexts.find { |c| c.profile_id == name }
97
- unless found
98
- @lib_subcontexts.each do |c|
99
- found = c.subcontext_by_name(name)
100
- break if found
101
- end
102
- end
103
-
104
- found
105
- end
106
-
107
- def add_resources(context)
108
- @resource_registry.merge!(context.resource_registry)
109
- control_eval_context.add_resources(context)
110
- @lib_subcontexts << context
111
- reload_dsl
112
- end
113
-
114
- def add_subcontext(context)
115
- @control_subcontexts << context
116
- end
117
-
118
- def load_libraries(libs)
119
- lib_prefix = "libraries" + File::SEPARATOR
120
- autoloads = []
121
-
122
- libs.sort_by! { |l| l[1] } # Sort on source path so load order is deterministic
123
- libs.each do |content, source, line|
124
- path = source
125
- if source.start_with?(lib_prefix)
126
- path = source.sub(lib_prefix, "")
127
- autoloads.push(path) if File.dirname(path) == "."
128
- end
129
-
130
- @require_loader.add(path, content, source, line)
131
- end
132
-
133
- # load all files directly that are flat inside the libraries folder
134
- autoloads.each do |path|
135
- next unless path.end_with?(".rb")
136
-
137
- load_library_file(*@require_loader.load(path)) unless @require_loader.loaded?(path)
138
- end
139
- reload_dsl
140
- end
141
-
142
- def load_control_file(*args)
143
- # Set `skip_file` to `false` between file loads to prevent skips from spanning multiple control files
144
- control_eval_context.skip_file = false
145
- load_with_context(control_eval_context, *args)
146
- end
147
- alias load load_control_file
148
-
149
- def load_library_file(*args)
150
- load_with_context(@library_eval_context, *args)
151
- end
152
-
153
- def load_with_context(context, content, source = nil, line = nil)
154
- Inspec::Log.debug("Loading #{source || "<anonymous content>"} into #{self}")
155
- @current_load = { file: source }
156
- if content.is_a? Proc
157
- context.instance_eval(&content)
158
- elsif source.nil? && line.nil?
159
- context.instance_eval(content)
160
- else
161
- context.instance_eval(content, source || "unknown", line || 1)
162
- end
163
- end
164
-
165
- def unregister_rule(id)
166
- @rules.delete(full_id(@profile_id, id))
167
- end
168
-
169
- attr_reader :current_load
170
-
171
- def register_rule(r)
172
- # get the full ID
173
- file = if @current_load.nil?
174
- "unknown"
175
- else
176
- @current_load[:file] || "unknown"
177
- end
178
- r.instance_variable_set(:@__file, file)
179
- r.instance_variable_set(:@__group_title, current_load[:title])
180
-
181
- # add the rule to the registry
182
- fid = full_id(Inspec::Rule.profile_id(r), Inspec::Rule.rule_id(r))
183
- existing = @rules[fid]
184
- if existing.nil?
185
- @rules[fid] = r
186
- else
187
- Inspec::Rule.merge(existing, r)
188
- end
189
- end
190
-
191
- def set_header(field, val)
192
- @current_load[field] = val
193
- end
194
-
195
- private
196
-
197
- def full_id(pid, rid)
198
- return rid.to_s if pid.to_s.empty?
199
-
200
- pid.to_s + "/" + rid.to_s
201
- end
202
- end
203
- end
@@ -1,84 +0,0 @@
1
- require "inspec/profile"
2
- require "inspec/config"
3
-
4
- module Inspec
5
- class ProfileVendor
6
- attr_reader :profile_path
7
-
8
- def initialize(path)
9
- @profile_path = Pathname.new(File.expand_path(path))
10
- end
11
-
12
- def vendor!
13
- vendor_dependencies
14
- end
15
-
16
- # The URL fetcher uses a Tempfile to retrieve the vendored
17
- # profile, which creates a file that is only readable by
18
- # the current user. In most circumstances, this is likely OK.
19
- # However, in environments like a Habitat package, these files
20
- # need to be readable by all users or the Habitat Supervisor
21
- # may not be able to start InSpec correctly.
22
- #
23
- # This method makes sure all vendored files are mode 644 for this
24
- # use case. This method is not called by default - the caller
25
- # vendoring the profile must make the decision as to whether this
26
- # is necessary.
27
- def make_readable
28
- Dir.glob("#{cache_path}/**/*") do |e|
29
- FileUtils.chmod(0644, e) if File.file?(e)
30
- end
31
- end
32
-
33
- def cache_path
34
- profile_path.join("vendor")
35
- end
36
-
37
- def lockfile
38
- profile_path.join("inspec.lock")
39
- end
40
-
41
- private
42
-
43
- def profile
44
- @profile ||= Inspec::Profile.for_target(profile_path.to_s, profile_opts)
45
- end
46
-
47
- def profile_opts
48
- {
49
- vendor_cache: Inspec::Cache.new(cache_path.to_s),
50
- backend: Inspec::Backend.create(Inspec::Config.mock),
51
- }
52
- end
53
-
54
- def vendor_dependencies
55
- delete_vendored_data
56
- File.write(lockfile, profile.generate_lockfile.to_yaml)
57
- extract_archives
58
- end
59
-
60
- def delete_vendored_data
61
- FileUtils.rm_rf(cache_path) if cache_path.exist?
62
- File.delete(lockfile) if lockfile.exist?
63
- end
64
-
65
- def extract_archives
66
- Dir.glob(File.join(cache_path, "*")).each do |filepath|
67
- # Get SHA without extension
68
- # We use split since '.' is not valid in a SHA checksum
69
- destination_dir_name = File.basename(filepath).split(".")[0]
70
- destination_path = File.join(cache_path, destination_dir_name)
71
-
72
- provider = FileProvider.for_path(filepath)
73
-
74
- next unless provider.is_a?(ZipProvider) || provider.is_a?(TarProvider)
75
-
76
- Inspec::Log.debug("Extracting '#{filepath}' to '#{destination_path}'")
77
- provider.extract(destination_path)
78
-
79
- Inspec::Log.debug("Deleting archive '#{filepath}'")
80
- File.delete(filepath)
81
- end
82
- end
83
- end
84
- end
@@ -1,73 +0,0 @@
1
- require "inspec/reporters/base"
2
- require "inspec/reporters/cli"
3
- require "inspec/reporters/json"
4
- require "inspec/reporters/json_automate"
5
- require "inspec/reporters/json_min"
6
- require "inspec/reporters/junit"
7
- require "inspec/reporters/automate"
8
- require "inspec/reporters/yaml"
9
-
10
- module Inspec::Reporters
11
- # rubocop:disable Metrics/CyclomaticComplexity
12
- def self.render(reporter, run_data)
13
- name, config = reporter.dup
14
- config[:run_data] = run_data
15
- case name
16
- when "cli"
17
- reporter = Inspec::Reporters::CLI.new(config)
18
- when "json"
19
- reporter = Inspec::Reporters::Json.new(config)
20
- # This reporter is only used for Chef internal. We reserve the
21
- # right to introduce breaking changes to this reporter at any time.
22
- when "json-automate"
23
- reporter = Inspec::Reporters::JsonAutomate.new(config)
24
- when "json-min"
25
- reporter = Inspec::Reporters::JsonMin.new(config)
26
- when "junit"
27
- reporter = Inspec::Reporters::Junit.new(config)
28
- when "automate"
29
- reporter = Inspec::Reporters::Automate.new(config)
30
- when "yaml"
31
- reporter = Inspec::Reporters::Yaml.new(config)
32
- else
33
- raise NotImplementedError, "'#{name}' is not a valid reporter type."
34
- end
35
-
36
- # optional send_report method on reporter
37
- return reporter.send_report if defined?(reporter.send_report)
38
-
39
- reporter.render
40
- output = reporter.rendered_output
41
-
42
- if config["file"]
43
- # create destination directory if it does not exist
44
- dirname = File.dirname(config["file"])
45
- FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
46
-
47
- File.write(config["file"], output)
48
- elsif config["stdout"] == true
49
- print output
50
- $stdout.flush
51
- end
52
- end
53
-
54
- def self.report(reporter, run_data)
55
- name, config = reporter.dup
56
- config[:run_data] = run_data
57
- case name
58
- when "json"
59
- reporter = Inspec::Reporters::Json.new(config)
60
- when "json-min"
61
- reporter = Inspec::Reporters::JsonMin.new(config)
62
- when "json-automate"
63
- reporter = Inspec::Reporters::JsonAutomate.new(config)
64
- when "yaml"
65
- reporter = Inspec::Reporters::Yaml.new(config)
66
- else
67
- # use base run_data hash for any other report
68
- return run_data
69
- end
70
-
71
- reporter.report
72
- end
73
- end
@@ -1,78 +0,0 @@
1
- require "json"
2
- require "net/http"
3
-
4
- module Inspec::Reporters
5
- class Automate < JsonAutomate
6
- def initialize(config)
7
- super(config)
8
-
9
- # allow the insecure flag
10
- @config["verify_ssl"] = !@config["insecure"] if @config.key?("insecure")
11
-
12
- # default to not verifying ssl for sending reports
13
- @config["verify_ssl"] = @config["verify_ssl"] || false
14
- end
15
-
16
- def enriched_report
17
- # grab the report from the parent class
18
- final_report = report
19
-
20
- # Label this content as an inspec_report
21
- final_report[:type] = "inspec_report"
22
-
23
- final_report[:end_time] = Time.now.utc.strftime("%FT%TZ")
24
- final_report[:node_uuid] = @config["node_uuid"] || @config["target_id"]
25
- raise Inspec::ReporterError, "Cannot find a UUID for your node. Please specify one via json-config." if final_report[:node_uuid].nil?
26
-
27
- final_report[:report_uuid] = @config["report_uuid"] || uuid_from_string(final_report[:end_time] + final_report[:node_uuid])
28
-
29
- final_report
30
- end
31
-
32
- def send_report
33
- headers = { "Content-Type" => "application/json" }
34
- headers["x-data-collector-token"] = @config["token"]
35
- headers["x-data-collector-auth"] = "version=1.0"
36
-
37
- uri = URI(@config["url"])
38
- req = Net::HTTP::Post.new(uri.path, headers)
39
- req.body = enriched_report.to_json
40
- begin
41
- Inspec::Log.debug "Posting report to Chef Automate: #{uri.path}"
42
- http = Net::HTTP.new(uri.hostname, uri.port)
43
- http.use_ssl = uri.scheme == "https"
44
- if @config["verify_ssl"] == true
45
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
46
- else
47
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
48
- end
49
-
50
- res = http.request(req)
51
- if res.is_a?(Net::HTTPSuccess)
52
- return true
53
- else
54
- Inspec::Log.error "send_report: POST to #{uri.path} returned: #{res.body}"
55
- return false
56
- end
57
- rescue => e
58
- Inspec::Log.error "send_report: POST to #{uri.path} returned: #{e.message}"
59
- return false
60
- end
61
- end
62
-
63
- private
64
-
65
- # This hashes the passed string into SHA1.
66
- # Then it downgrades the 160bit SHA1 to a 128bit
67
- # then we format it as a valid UUIDv5.
68
- def uuid_from_string(string)
69
- hash = Digest::SHA1.new
70
- hash.update(string)
71
- ary = hash.digest.unpack("NnnnnN")
72
- ary[2] = (ary[2] & 0x0FFF) | (5 << 12)
73
- ary[3] = (ary[3] & 0x3FFF) | 0x8000
74
- # rubocop:disable Style/FormatString
75
- "%08x-%04x-%04x-%04x-%04x%08x" % ary
76
- end
77
- end
78
- end
@@ -1,25 +0,0 @@
1
- module Inspec::Reporters
2
- class Base
3
- attr_reader :run_data
4
-
5
- def initialize(config)
6
- @config = config
7
- @run_data = config[:run_data]
8
- @output = ""
9
- end
10
-
11
- def output(str, newline = true)
12
- @output << str
13
- @output << "\n" if newline
14
- end
15
-
16
- def rendered_output
17
- @output
18
- end
19
-
20
- # each reporter must implement #render
21
- def render
22
- raise NotImplementedError, "#{self.class} must implement a `#render` method to format its output."
23
- end
24
- end
25
- end