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,139 +0,0 @@
1
- require "inspec/resources/command"
2
-
3
- module Inspec::Resources
4
- class FileSystemResource < Inspec.resource(1)
5
- name "filesystem"
6
- supports platform: "linux"
7
- supports platform: "windows"
8
- desc "Use the filesystem InSpec resource to test file system"
9
- example <<~EXAMPLE
10
- describe filesystem('/') do
11
- its('size_kb') { should be >= 32000 }
12
- its('free_kb') { should be >= 3200 }
13
- its('type') { should cmp 'ext4' }
14
- its('percent_free') { should be >= 20 }
15
- end
16
- describe filesystem('c:') do
17
- its('size_kb') { should be >= 9000 }
18
- its('free_kb') { should be >= 3200 }
19
- its('type') { should cmp 'NTFS' }
20
- its('percent_free') { should be >= 20 }
21
- end
22
- EXAMPLE
23
- attr_reader :partition
24
-
25
- def initialize(partition)
26
- @partition = partition
27
- @cache = nil
28
- # select file system manager
29
- @fsman = nil
30
-
31
- os = inspec.os
32
- if os.linux?
33
- @fsman = LinuxFileSystemResource.new(inspec)
34
- elsif os.windows?
35
- @fsman = WindowsFileSystemResource.new(inspec)
36
- else
37
- raise Inspec::Exceptions::ResourceSkipped, "The `filesystem` resource is not supported on your OS yet."
38
- end
39
- end
40
-
41
- def info
42
- return @cache unless @cache.nil?
43
- return {} if @fsman.nil?
44
-
45
- @cache = @fsman.info(@partition)
46
- end
47
-
48
- def to_s
49
- "FileSystem #{@partition}"
50
- end
51
-
52
- def size_kb
53
- info = @fsman.info(@partition)
54
- info[:size_kb]
55
- end
56
-
57
- def size
58
- Inspec.deprecate(:property_filesystem_size, "The `size` property did not reliably use the correct units. Please use `size_kb` instead.")
59
- if inspec.os.windows?
60
- # On windows, we had a bug prior to #3767 in which the
61
- # 'size' value was be scaled to GB in powershell.
62
- # We now collect it in KB.
63
- (size_kb / (1024 * 1024)).to_i
64
- else
65
- size_kb
66
- end
67
- end
68
-
69
- def free_kb
70
- info = @fsman.info(@partition)
71
- info[:free_kb]
72
- end
73
-
74
- def percent_free
75
- 100 * free_kb / size_kb
76
- end
77
-
78
- def type
79
- info = @fsman.info(@partition)
80
- info[:type]
81
- end
82
-
83
- def name
84
- info = @fsman.info(@partition)
85
- info[:name]
86
- end
87
- end
88
-
89
- class FsManagement
90
- attr_reader :inspec
91
- def initialize(inspec)
92
- @inspec = inspec
93
- end
94
- end
95
-
96
- class LinuxFileSystemResource < FsManagement
97
- def info(partition)
98
- cmd = inspec.command("df #{partition} -PT")
99
- if cmd.stdout.nil? || cmd.stdout.empty? || cmd.exit_status != 0
100
- raise Inspec::Exceptions::ResourceFailed,
101
- "Unable to get available space for partition #{partition}"
102
- end
103
- value = cmd.stdout.split(/\n/)[1].strip.split(" ")
104
- {
105
- name: partition,
106
- size_kb: value[2].to_i,
107
- free_kb: value[4].to_i,
108
- type: value[1].to_s,
109
- }
110
- end
111
- end
112
-
113
- class WindowsFileSystemResource < FsManagement
114
- def info(partition)
115
- cmd = inspec.command <<-EOF.gsub(/^\s*/, "")
116
- $disk = Get-WmiObject Win32_LogicalDisk -Filter "DeviceID='#{partition}'"
117
- $disk.Size = $disk.Size / 1KB
118
- $disk.FreeSpace = $disk.FreeSpace / 1KB
119
- $disk | select -property DeviceID,Size,FileSystem,FreeSpace | ConvertTo-Json
120
- EOF
121
-
122
- raise Inspec::Exceptions::ResourceSkipped, "Unable to get available space for partition #{partition}" if cmd.stdout == "" || cmd.exit_status.to_i != 0
123
-
124
- begin
125
- fs = JSON.parse(cmd.stdout)
126
- rescue JSON::ParserError => e
127
- raise Inspec::Exceptions::ResourceFailed,
128
- "Failed to parse JSON from Powershell. " \
129
- "Error: #{e}"
130
- end
131
- {
132
- name: fs["DeviceID"],
133
- size_kb: fs["Size"].to_i,
134
- free_kb: fs["FreeSpace"].to_i,
135
- type: fs["FileSystem"],
136
- }
137
- end
138
- end
139
- end
@@ -1,148 +0,0 @@
1
- require "inspec/resources/command"
2
-
3
- module Inspec::Resources
4
- class FirewallD < Inspec.resource(1)
5
- ###
6
- # This recourse assumes that the file sudo vim /etc/polkit-1/rules.d/49-nopasswd_global.rules has been
7
- # set to allow users in group "wheel" to perform any commands without authentication.
8
- ###
9
-
10
- name "firewalld"
11
- supports platform: "linux"
12
- desc "Use the firewalld resource to check and see if firewalld is configured to grand or deny access to specific hosts or services"
13
- example <<~EXAMPLE
14
- describe firewalld do
15
- it { should be_running }
16
- its('default_zone') { should eq 'public' }
17
- it { should have_service_enabled_in_zone('ssh', 'public') }
18
- it { should have_rule_enabled('rule family=ipv4 source address=192.168.0.14 accept', 'public') }
19
- end
20
-
21
- describe firewalld.where { zone == 'public' } do
22
- its('interfaces') { should cmp ['enp0s3', 'eno2'] }
23
- its('sources') { should cmp ['ssh', 'icmp'] }
24
- its('services') { should cmp ['192.168.1.0/24', '192.168.1.2'] }
25
- end
26
- EXAMPLE
27
-
28
- attr_reader :params
29
-
30
- filter = FilterTable.create
31
- filter.register_column(:zone, field: "zone")
32
- .register_column(:interfaces, field: "interfaces")
33
- .register_column(:sources, field: "sources")
34
- .register_column(:services, field: "services")
35
-
36
- filter.install_filter_methods_on_resource(self, :params)
37
-
38
- def initialize
39
- @params = parse_active_zones(active_zones)
40
- end
41
-
42
- def installed?
43
- inspec.command("firewall-cmd").exist?
44
- end
45
-
46
- def has_zone?(query_zone)
47
- return false unless installed?
48
-
49
- result = firewalld_command("--get-zones").split(" ")
50
- result.include?(query_zone)
51
- end
52
-
53
- def running?
54
- return false unless installed?
55
-
56
- result = firewalld_command("--state")
57
- result =~ /^running/ ? true : false
58
- end
59
-
60
- def default_zone
61
- # return: word associated with the name of the default zone
62
- # example: 'public'
63
- firewalld_command("--get-default-zone")
64
- end
65
-
66
- def has_service_enabled_in_zone?(query_service, query_zone = default_zone)
67
- firewalld_command("--zone=#{query_zone} --query-service=#{query_service}") == "yes"
68
- end
69
-
70
- def service_ports_enabled_in_zone(query_service, query_zone = default_zone)
71
- # return: String of ports open
72
- # example: ['22/tcp', '4722/tcp']
73
- firewalld_command("--zone=#{query_zone} --service=#{query_service} --get-ports --permanent").split(" ")
74
- end
75
-
76
- def service_protocols_enabled_in_zone(query_service, query_zone = default_zone)
77
- # return: String of protocoals open
78
- # example: ['icmp', 'ipv4', 'igmp']
79
- firewalld_command("--zone=#{query_zone} --service=#{query_service} --get-protocols --permanent").split(" ")
80
- end
81
-
82
- def has_port_enabled_in_zone?(query_port, query_zone = default_zone)
83
- firewalld_command("--zone=#{query_zone} --query-port=#{query_port}") == "yes"
84
- end
85
-
86
- def has_rule_enabled?(rule, query_zone = default_zone)
87
- rule = "rule #{rule}" unless rule.start_with?("rule")
88
- firewalld_command("--zone=#{query_zone} --query-rich-rule='#{rule}'") == "yes"
89
- end
90
-
91
- def to_s
92
- "Firewall Rules"
93
- end
94
-
95
- private
96
-
97
- def active_zones
98
- # return syntax:
99
- # [default-zone-name]
100
- # interfaces: [open interfases]
101
- #
102
- # example:
103
- # public
104
- # interfaces: enp0s3
105
- firewalld_command("--get-active-zones")
106
- end
107
-
108
- def parse_active_zones(content)
109
- # Split by every second line, which contains the zone and the interfaces.
110
- content = content.split(/\n/).each_slice(2).map { |slice| slice.join("\n") }
111
- content.map do |line|
112
- parse_line(line)
113
- end.compact
114
- end
115
-
116
- def parse_line(line)
117
- zone = line.split("\n")[0]
118
- {
119
- "zone" => zone,
120
- "interfaces" => line.split(":")[1].split(" "),
121
- "services" => services_bound(zone),
122
- "sources" => sources_bound(zone),
123
- }
124
- end
125
-
126
- def sources_bound(query_zone)
127
- # result: a list containing either an ip address or ip address with a mask, or a ipset or an ipset with the ipset prefix.
128
- # example: ['192.168.0.4', '192.168.0.0/16', '2111:DB28:ABC:12::', '2111:db89:ab3d:0112::0/64']
129
- firewalld_command("--zone=#{query_zone} --list-sources").split(" ")
130
- end
131
-
132
- def services_bound(query_zone)
133
- # result: a list of services bound to a zone.
134
- # example: ['ssh', 'dhcpv6-client']
135
- firewalld_command("--zone=#{query_zone} --list-services").split(" ")
136
- end
137
-
138
- def firewalld_command(command)
139
- command = "firewall-cmd #{command}"
140
- result = inspec.command(command)
141
- if result.stderr != ""
142
- return "Error on command #{command}: #{result.stderr}"
143
- end
144
-
145
- result.stdout.strip
146
- end
147
- end
148
- end
@@ -1,80 +0,0 @@
1
- # circular: require "inspec/resource"
2
- # but... already being included by inspec/resource.rb
3
-
4
- module Inspec::Resources
5
- class GemPackage < Inspec.resource(1)
6
- name "gem" # TODO: rename to "rubygem" and provide alias
7
- supports platform: "unix"
8
- supports platform: "windows"
9
- desc "Use the gem InSpec audit resource to test if a global gem package is installed."
10
- example <<~EXAMPLE
11
- describe gem('rubocop') do
12
- it { should be_installed }
13
- its('version') { should eq '0.33.0' }
14
- end
15
- EXAMPLE
16
-
17
- attr_reader :gem_binary
18
-
19
- def initialize(package_name, gem_binary = nil)
20
- @package_name = package_name
21
- @gem_binary = case gem_binary # TODO: no. this is not right
22
- when nil
23
- "gem"
24
- when :chef
25
- if inspec.os.windows?
26
- # TODO: what about chef-dk or other installs?
27
- 'c:\opscode\chef\embedded\bin\gem.bat'
28
- else
29
- "/opt/chef/embedded/bin/gem"
30
- end
31
- when :chef_server
32
- "/opt/opscode/embedded/bin/gem"
33
- else
34
- gem_binary
35
- end
36
- skip_resource "Unable to retrieve gem information" if info.empty?
37
- end
38
-
39
- def info
40
- return @info if defined?(@info)
41
-
42
- require "inspec/resources/command"
43
-
44
- cmd = inspec.command("#{@gem_binary} list --local -a -q \^#{@package_name}\$")
45
- return {} unless cmd.exit_status == 0
46
-
47
- # extract package name and version
48
- # parses data like winrm (1.3.4, 1.3.3)
49
- params = /^\s*([^\(]*?)\s*\((.*?)\)\s*$/.match(cmd.stdout.chomp)
50
- @info = {
51
- installed: !params.nil?,
52
- type: "gem",
53
- }
54
- return @info unless @info[:installed]
55
-
56
- versions = params[2].split(",").map(&:strip)
57
- @info[:name] = params[1]
58
- @info[:version] = versions[0]
59
- @info[:versions] = versions
60
- @info
61
- end
62
-
63
- def installed?
64
- info[:installed] == true
65
- end
66
-
67
- def version
68
- info[:version]
69
- end
70
-
71
- # this returns an array of strings
72
- def versions
73
- info[:versions]
74
- end
75
-
76
- def to_s
77
- "gem package #{@package_name}"
78
- end
79
- end
80
- end
@@ -1,2 +0,0 @@
1
- # This is just here to make the dynamic loader happy.
2
- require "inspec/resources/groups"
@@ -1,241 +0,0 @@
1
- require "inspec/resources/etc_group"
2
- require "inspec/resources/powershell"
3
- require "inspec/resources/parse_config"
4
- require "inspec/utils/filter"
5
-
6
- module Inspec::Resources
7
- # This file contains two resources, the `group` and `groups` resource.
8
- # The `group` resource is optimized for requests that verify specific groups
9
- # that you know upfront for testing. If you need to query all groups or search
10
- # specific groups with certain properties, use the `groups` resource.
11
- module GroupManagementSelector
12
- # select group provider based on the operating system
13
- # returns nil, if no group manager was found for the operating system
14
- def select_group_manager(os)
15
- @group_provider = if os.darwin?
16
- DarwinGroup.new(inspec)
17
- elsif os.unix?
18
- UnixGroup.new(inspec)
19
- elsif os.windows?
20
- WindowsGroup.new(inspec)
21
- end
22
- end
23
- end
24
-
25
- class Groups < Inspec.resource(1)
26
- include GroupManagementSelector
27
-
28
- name "groups"
29
- supports platform: "unix"
30
- supports platform: "windows"
31
- desc "Use the group InSpec audit resource to test groups on the system. Groups can be filtered."
32
- example <<~EXAMPLE
33
- describe groups.where { name == 'root'} do
34
- its('names') { should eq ['root'] }
35
- its('gids') { should eq [0] }
36
- end
37
-
38
- describe groups.where { name == 'Administrators'} do
39
- its('names') { should eq ['Administrators'] }
40
- its('gids') { should eq ['S-1-5-32-544'] }
41
- end
42
- EXAMPLE
43
-
44
- def initialize
45
- # select group manager
46
- @group_provider = select_group_manager(inspec.os)
47
- return skip_resource "The `groups` resource is not supported on your OS yet." if @group_provider.nil?
48
- end
49
-
50
- filter = FilterTable.create
51
- filter.register_custom_matcher(:exists?) { |x| !x.entries.empty? }
52
- filter.register_column(:names, field: "name")
53
- .register_column(:gids, field: "gid")
54
- .register_column(:domains, field: "domain")
55
- .register_column(:members, field: "members", style: :simple)
56
- filter.install_filter_methods_on_resource(self, :collect_group_details)
57
-
58
- def to_s
59
- "Groups"
60
- end
61
-
62
- private
63
-
64
- # collects information about every group
65
- def collect_group_details
66
- return @groups_cache ||= @group_provider.groups unless @group_provider.nil?
67
-
68
- []
69
- end
70
- end
71
-
72
- # Usage:
73
- # describe group('root') do
74
- # it { should exist }
75
- # its('gid') { should eq 0 }
76
- # end
77
- #
78
- class Group < Inspec.resource(1)
79
- include GroupManagementSelector
80
-
81
- name "group"
82
- supports platform: "unix"
83
- supports platform: "windows"
84
- desc "Use the group InSpec audit resource to test groups on the system."
85
- example <<~EXAMPLE
86
- describe group('root') do
87
- it { should exist }
88
- its('gid') { should eq 0 }
89
- end
90
-
91
- describe group('Administrators') do
92
- its('members') { should include 'Administrator' }
93
- end
94
- EXAMPLE
95
-
96
- def initialize(groupname)
97
- @group = groupname
98
-
99
- # select group manager
100
- @group_provider = select_group_manager(inspec.os)
101
- return skip_resource "The `group` resource is not supported on your OS yet." if @group_provider.nil?
102
- end
103
-
104
- # verifies if a group exists
105
- def exists?
106
- !group_info.entries.empty?
107
- end
108
-
109
- def gid
110
- flatten_entry(group_info, "gid")
111
- end
112
-
113
- def members
114
- flatten_entry(group_info, "members")
115
- end
116
-
117
- def local
118
- # at this point the implementation only returns local groups
119
- true
120
- end
121
-
122
- def to_s
123
- "Group #{@group}"
124
- end
125
-
126
- private
127
-
128
- def flatten_entry(group_info, prop)
129
- entries = group_info.entries
130
- if entries.empty?
131
- nil
132
- elsif entries.size == 1
133
- entries.first.send(prop)
134
- else
135
- raise "found more than one group with the same name, please use `groups` resource"
136
- end
137
- end
138
-
139
- def group_info
140
- # we need a local copy for the block
141
- group = @group.dup
142
- @groups_cache ||= inspec.groups.where { name == group }
143
- end
144
- end
145
-
146
- class GroupInfo
147
- attr_reader :inspec
148
- def initialize(inspec)
149
- @inspec = inspec
150
- end
151
-
152
- def groups
153
- raise "group provider must implement the `groups` method"
154
- end
155
- end
156
-
157
- # implements generic unix groups via /etc/group
158
- class UnixGroup < GroupInfo
159
- def groups
160
- inspec.etc_group.entries
161
- end
162
- end
163
-
164
- # OSX uses opendirectory for groups, so `/etc/group` may not be fully accurate
165
- # This uses `dscacheutil` to get the group info instead of `etc_group`
166
- class DarwinGroup < GroupInfo
167
- def runmap(cmd, &blk)
168
- hashmap(inspec.command(cmd).stdout.lines, &blk)
169
- end
170
-
171
- def hashmap(enum, &blk)
172
- enum.map(&blk).to_h
173
- end
174
-
175
- def groups
176
- group_by_id = runmap("dscl . -list /Groups PrimaryGroupID") { |l| name, id = l.split; [id.to_i, name] }
177
- userss = runmap("dscl . -list /Users PrimaryGroupID") { |l| name, id = l.split; [name, id.to_i] }
178
- membership = runmap("dscl . -list /Groups GroupMembership") { |l| key, *vs = l.split; [key, vs] }
179
- membership.default_proc = ->(h, k) { h[k] = [] }
180
-
181
- users_by_group = hashmap(userss.keys.group_by { |k| userss[k] }) { |k, vs| [group_by_id[k], vs] }
182
- users_by_group.each do |name, users|
183
- membership[name].concat users
184
- end
185
-
186
- group_info = inspec.command("dscacheutil -q group").stdout.split("\n\n").uniq
187
-
188
- regex = /^([^:]*?)\s*:\s(.*?)\s*$/
189
- groups = group_info.map do |data|
190
- inspec.parse_config(data, assignment_regex: regex).params
191
- end
192
-
193
- # Convert the `dscacheutil` groups to match `inspec.etc_group.entries`
194
- groups.each { |g| g["gid"] = g["gid"].to_i }
195
- groups.each do |g|
196
- users = g.delete("users") || ""
197
- users = users.split
198
- users += Array(users_by_group[g["name"]])
199
- g["members"] = users
200
- g["members"].sort.join ","
201
- end
202
- end
203
- end
204
-
205
- class WindowsGroup < GroupInfo
206
- # returns all local groups
207
- def groups
208
- script = <<-EOH
209
- Function ConvertTo-SID { Param([byte[]]$BinarySID)
210
- (New-Object System.Security.Principal.SecurityIdentifier($BinarySID,0)).Value
211
- }
212
- $Computername = $Env:Computername
213
- $adsi = [ADSI]"WinNT://$Computername"
214
- $groups = $adsi.Children | where {$_.SchemaClassName -eq 'group'} | ForEach {
215
- $name = $_.Name[0]
216
- $sid = ConvertTo-SID -BinarySID $_.ObjectSID[0]
217
- $group =[ADSI]$_.Path
218
- $members = $_.Members() | Foreach-Object { $_.GetType().InvokeMember('Name', 'GetProperty', $null, $_, $null) }
219
- # An empty collection of these objects isn't properly converted to an empty array by ConvertTo-Json
220
- if(-not [bool]$members) {
221
- $members = @()
222
- }
223
- new-object psobject -property @{name = $group.Name[0]; gid = $sid; domain = $Computername; members = $members}
224
- }
225
- $groups | ConvertTo-Json -Depth 3
226
- EOH
227
- cmd = inspec.powershell(script)
228
- # cannot rely on exit code for now, successful command returns exit code 1
229
- # return nil if cmd.exit_status != 0, try to parse json
230
- begin
231
- groups = JSON.parse(cmd.stdout)
232
- rescue JSON::ParserError => _e
233
- return []
234
- end
235
-
236
- # ensure we have an array of groups
237
- groups = [groups] unless groups.is_a?(Array)
238
- groups
239
- end
240
- end
241
- end