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,31 +0,0 @@
1
- # InSpec Extension to create new profiles
2
-
3
- This extensions helps you to easily create a new profile
4
-
5
- ## Usage
6
-
7
- ```
8
- $ inspec init profile examples/new-profile
9
- Create new profile at /Users/chartmann/Development/compliance/inspec/examples/new-profile
10
- * Create directory controls
11
- * Create file controls/example.rb
12
- * Create file inspec.yml
13
- * Create directory libraries
14
- * Create file README.md
15
- * Create file libraries/.gitkeep
16
-
17
- $ inspec check examples/new-profile
18
- Summary
19
- -------
20
- Location: examples/new-profile
21
- Profile: examples/new-profile
22
- Controls: 2
23
- Timestamp: 2016-05-06T14:39:47+02:00
24
- Valid: true
25
-
26
- Errors
27
- ------
28
-
29
- Warnings
30
- --------
31
- ```
@@ -1,12 +0,0 @@
1
- module InspecPlugins
2
- module Init
3
- class Plugin < Inspec.plugin(2)
4
- plugin_name :'inspec-init'
5
-
6
- cli_command :init do
7
- require_relative "inspec-init/cli"
8
- InspecPlugins::Init::CLI
9
- end
10
- end
11
- end
12
- end
@@ -1,15 +0,0 @@
1
- require "pathname"
2
- require_relative "renderer"
3
-
4
- module InspecPlugins
5
- module Init
6
- class CLI < Inspec.plugin(2, :cli_command)
7
- subcommand_desc "init SUBCOMMAND", "Generate InSpec code"
8
-
9
- TEMPLATES_PATH = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "templates"))
10
-
11
- require_relative "cli_profile"
12
- require_relative "cli_plugin"
13
- end
14
- end
15
- end
@@ -1,243 +0,0 @@
1
- require_relative "renderer"
2
-
3
- module InspecPlugins
4
- module Init
5
- class CLI < Inspec.plugin(2, :cli_command)
6
- #-------------------------------------------------------------------#
7
- # inspec init plugin
8
- #-------------------------------------------------------------------#
9
- desc "plugin PLUGIN_NAME [options]", "Generates an InSpec plugin, which can extend the functionality of InSpec itself."
10
- # General options
11
- option :prompt, type: :boolean, default: true, desc: "Interactively prompt for information to put in your generated plugin."
12
- option :detail, type: :string, default: "full", desc: "How detailed of a plugin to generate. 'full' is a normal full gem with tests; 'core' has tests but no gemspec; 'test-fixture' is stripped down for a test fixture."
13
-
14
- # Templating vars
15
- option :author_email, type: :string, default: "you@example.com", desc: "Author Email for gemspec"
16
- option :author_name, type: :string, default: "Your Name", desc: "Author Name for gemspec"
17
- option :description, type: :string, default: "", desc: "Multi-line description of the plugin"
18
- option :summary, type: :string, default: "A plugin with a default summary", desc: "One-line summary of your plugin"
19
- option :license_name, type: :string, default: "Apache-2.0", desc: "The name of a license"
20
- option :hook, type: :array, default: ["cli_command:my_command"], desc: "A list of plugin hooks, in the form type1:name1, type2:name2, etc"
21
- # These vars have calculated defaults
22
- option :homepage, type: :string, default: nil, desc: "A URL for your project, often a GitHub link"
23
- option :module_name, type: :string, default: nil, desc: "Module Name for your plugin package. Will change plugin name to CamelCase by default."
24
- option :license_text, type: :string, default: "", hide: true
25
- option :plugin_name, type: :string, default: "", hide: true # This is here to give a uniform interface
26
- option :copyright, type: :string, default: nil, desc: "A copyright statement, to be added to LICENSE"
27
-
28
- def plugin(plugin_name)
29
- plugin_type = determine_plugin_type(plugin_name)
30
- snake_case = plugin_name.tr("-", "_")
31
-
32
- template_vars = {
33
- name: plugin_name,
34
- plugin_name: plugin_name,
35
- snake_case: snake_case,
36
- }.merge(plugin_vars_from_opts)
37
-
38
- template_path = File.join("plugins", plugin_type + "-plugin-template")
39
-
40
- render_opts = {
41
- templates_path: TEMPLATES_PATH,
42
- overwrite: options[:overwrite],
43
- file_rename_map: make_rename_map(plugin_type, plugin_name, snake_case),
44
- skip_files: make_skip_list,
45
- }
46
- renderer = InspecPlugins::Init::Renderer.new(ui, render_opts)
47
-
48
- renderer.render_with_values(template_path, plugin_type + " plugin", template_vars)
49
- end
50
-
51
- private
52
-
53
- def determine_plugin_type(plugin_name)
54
- plugin_type = plugin_name.match(/^(inspec|train)\-/)
55
- unless plugin_type
56
- ui.error("Plugin names must begin with either " + ui.emphasis("inspec") + " or " + ui.emphasis("train") + " - saw " + ui.emphasis(plugin_name))
57
- ui.exit(:usage_error)
58
- end
59
- options[:plugin_name] = plugin_name
60
-
61
- plugin_type = plugin_type[1]
62
- unless plugin_type == "inspec"
63
- ui.error("Sorry, only InSpec (inspec-) plugins are supported at this time: Train (train-) support is not implemented yet.")
64
- ui.exit(:usage_error)
65
- end
66
- plugin_type
67
- end
68
-
69
- def make_rename_map(_plugin_type, plugin_name, snake_case)
70
- {
71
- "inspec-plugin-template.gemspec" => plugin_name + ".gemspec",
72
- File.join("lib", "inspec-plugin-template") => File.join("lib", plugin_name),
73
- File.join("lib", "inspec-plugin-template.rb") => File.join("lib", plugin_name + ".rb"),
74
- File.join("lib", "inspec-plugin-template", "cli_command.rb") => File.join("lib", plugin_name, "cli_command.rb"),
75
- File.join("lib", "inspec-plugin-template", "plugin.rb") => File.join("lib", plugin_name, "plugin.rb"),
76
- File.join("lib", "inspec-plugin-template", "version.rb") => File.join("lib", plugin_name, "version.rb"),
77
- File.join("test", "functional", "inspec_plugin_template_test.rb") => File.join("test", "functional", snake_case + "_test.rb"),
78
- }
79
- end
80
-
81
- def plugin_vars_from_opts
82
- # Set dynamic default - module name is straightforward. Copyright, homepage, and license_text depend on other prompted vars.
83
- options[:module_name] ||= options[:plugin_name].sub(/^(inspec|train)\-/, "").split("-").map(&:capitalize).join("")
84
-
85
- if options[:prompt] && ui.interactive?
86
- vars = options.dup.merge(vars_from_prompts)
87
- elsif !options[:prompt]
88
- vars = options.dup.merge(vars_from_defaults)
89
-
90
- else
91
- ui.error("You requested interactive prompting for the template variables, but this does not seem to be an interactive terminal.")
92
- ui.exit(:usage_error)
93
- end
94
- vars.merge(parse_hook_option(options[:hook]))
95
- end
96
-
97
- def vars_from_defaults
98
- options[:copyright] ||= "Copyright © " + Date.today.year.to_s + " " + options[:author_name]
99
- options[:homepage] ||= "https://github.com/" + options[:author_email].split("@").first + "/" + options[:plugin_name]
100
- options[:license_text] = fetch_license_text(options[:license_name])
101
- options
102
- end
103
-
104
- def vars_from_prompts
105
- order = {
106
- author_name: {},
107
- author_email: {},
108
- summary: {},
109
- description: { mode: :multiline },
110
- module_name: {},
111
- copyright: { default_setter: proc { options[:copyright] ||= "Copyright © " + Date.today.year.to_s + " " + options[:author_name] } },
112
- license_name: {
113
- mode: :select,
114
- choices: [
115
- { name: "Apache 2.0", value: "Apache-2.0", default: true },
116
- { name: "Modified BSD", value: "BSD-3-Clause" },
117
- { name: "Proprietary (Closed Source)", value: "Proprietary" },
118
- { name: "Other (edit LICENSE yourself)", value: "Other" },
119
- ],
120
- },
121
- homepage: { default_setter: proc { options[:homepage] ||= "https://github.com/" + options[:author_email].split("@").first + "/" + options[:plugin_name] } },
122
- # TODO: Handle hooks, when we ever have more than one type of plugin
123
- }
124
-
125
- prompt_for_options(order)
126
-
127
- options[:license_text] = fetch_license_text(options[:license_name])
128
-
129
- options
130
- end
131
-
132
- def prompt_for_options(option_order) # rubocop: disable Metrics/AbcSize
133
- option_defs = self.class.all_commands["plugin"].options
134
-
135
- option_order.each do |opt_name, prompt_options|
136
- opt_def = option_defs[opt_name]
137
- prompt_options[:default_setter]&.call
138
-
139
- case prompt_options[:mode]
140
- when :select
141
- options[opt_name] = ui.prompt.select("Choose " + opt_def.description + ":", prompt_options[:choices])
142
- if opt_name == :license_name && options[opt_name] == "Other"
143
- ui.plain_line "OK, be sure to update the " + ui.emphasis("LICENSE") + " file with your license details."
144
- end
145
- when :multiline
146
- options[opt_name] = ui.prompt.multiline("Enter " + opt_def.description + ". Press Control-D to end.", default: options[opt_name])
147
- else
148
- # Assume plain ask
149
- options[opt_name] = ui.prompt.ask("Enter " + opt_def.description + ":", default: options[opt_name])
150
- end
151
- end
152
- end
153
-
154
- def parse_hook_option(raw_option)
155
- hooks_by_type = {}
156
- raw_option.each do |entry|
157
- parts = entry.split(":")
158
- type = parts.first.to_sym
159
- name = parts.last
160
- if hooks_by_type.key?(type)
161
- ui.error "The InSpec plugin generator can currently only generate one hook of each type"
162
- ui.exit(:usage_error)
163
- end
164
- hooks_by_type[type] = name
165
- end
166
-
167
- vars = { hooks: hooks_by_type }
168
- if hooks_by_type.key?(:cli_command)
169
- vars[:command_name_dashes] = hooks_by_type[:cli_command].tr("_", "-")
170
- vars[:command_name_snake] = hooks_by_type[:cli_command].tr("-", "_")
171
- end
172
- vars
173
- end
174
-
175
- def fetch_license_text(license_name)
176
- case license_name
177
- when "Proprietary"
178
- <<~EOL
179
- Proprietary software. All Rights Reserved.
180
- EOL
181
- when "Apache-2.0"
182
- <<~EOL
183
- Licensed under the Apache License, Version 2.0 (the "License");
184
- you may not use this file except in compliance with the License.
185
- You may obtain a copy of the License at
186
- http://www.apache.org/licenses/LICENSE-2.0
187
- Unless required by applicable law or agreed to in writing, software
188
- distributed under the License is distributed on an "AS IS" BASIS,
189
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
- See the License for the specific language governing permissions and
191
- limitations under the License.
192
-
193
- EOL
194
- when "BSD-3-Clause"
195
- <<~EOL
196
- Modified BSD License
197
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
198
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
199
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
200
- 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
201
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
202
- EOL
203
- else
204
- '"Other" license selected at plugin generation time - please insert your license here.'
205
- end
206
- end
207
-
208
- def make_skip_list
209
- case options[:detail]
210
- when "full"
211
- []
212
- when "core"
213
- [
214
- "Gemfile",
215
- "inspec-plugin-template.gemspec",
216
- "LICENSE",
217
- "Rakefile",
218
- ]
219
- when "test-fixture"
220
- [
221
- "Gemfile",
222
- "inspec-plugin-template.gemspec",
223
- "LICENSE",
224
- "Rakefile",
225
- File.join("test", "fixtures", "README.md"),
226
- File.join("test", "fixtures"),
227
- File.join("test", "functional", "inspec_plugin_template_test.rb"),
228
- File.join("test", "functional", "README.md"),
229
- File.join("test", "unit", "cli_args_test.rb"),
230
- File.join("test", "unit", "plugin_def_test.rb"),
231
- File.join("test", "unit", "README.md"),
232
- File.join("test", "unit"),
233
- File.join("test", "helper.rb"),
234
- File.join("test"),
235
- ]
236
- else
237
- ui.error "Unrecognized value for 'detail': #{options[:detail]} - expected one of full, core, test-fixture"
238
- ui.exit(:usage_error)
239
- end
240
- end
241
- end
242
- end
243
- end
@@ -1,47 +0,0 @@
1
- require "pathname"
2
- require_relative "renderer"
3
-
4
- module InspecPlugins
5
- module Init
6
- class CLI < Inspec.plugin(2, :cli_command)
7
- #-------------------------------------------------------------------#
8
- # inspec init profile
9
- #-------------------------------------------------------------------#
10
- def self.valid_profile_platforms
11
- # Look in the 'template/profiles' directory and detect which platforms are available.
12
- profile_templates_dir = File.join(TEMPLATES_PATH, "profiles")
13
- Dir.glob(File.join(profile_templates_dir, "*")).select { |p| File.directory?(p) }.map { |d| File.basename(d) }
14
- end
15
-
16
- no_commands do
17
- def valid_profile_platforms
18
- self.class.valid_profile_platforms
19
- end
20
- end
21
-
22
- desc "profile [OPTIONS] NAME", "Generate a new profile"
23
- option :platform, default: "os", type: :string, aliases: [:p],
24
- desc: "Which platform to generate a profile for: choose from #{valid_profile_platforms.join(", ")}"
25
- option :overwrite, type: :boolean, default: false,
26
- desc: "Overwrites existing directory"
27
- def profile(new_profile_name)
28
- unless valid_profile_platforms.include?(options[:platform])
29
- ui.error "Unable to generate profile: No template available for platform '#{options[:platform]}' (expected one of: #{valid_profile_platforms.join(", ")})"
30
- ui.exit(:usage_error)
31
- end
32
- template_path = File.join("profiles", options[:platform])
33
-
34
- render_opts = {
35
- templates_path: TEMPLATES_PATH,
36
- overwrite: options[:overwrite],
37
- }
38
- renderer = InspecPlugins::Init::Renderer.new(ui, render_opts)
39
-
40
- vars = {
41
- name: new_profile_name,
42
- }
43
- renderer.render_with_values(template_path, "profile", vars)
44
- end
45
- end
46
- end
47
- end
@@ -1,97 +0,0 @@
1
- require "fileutils"
2
- require "erb"
3
-
4
- module InspecPlugins
5
- module Init
6
- class Renderer
7
- # Creates a renderer able to render the given template type
8
- # 1. iterate over all files
9
- # 2. read content in erb
10
- # 3. write to destination path
11
-
12
- attr_reader :file_rename_map, :overwrite_mode, :skip_files, :templates_path, :ui
13
- def initialize(cli_ui, options = {})
14
- @ui = cli_ui
15
- @overwrite_mode = options[:overwrite]
16
- @templates_path ||= options[:templates_path]
17
- @file_rename_map = options[:file_rename_map] || {}
18
- @skip_files = options[:skip_files] || []
19
- end
20
-
21
- # rubocop: disable Metrics/AbcSize
22
- def render_with_values(template_subdir_path, template_type, template_values = {})
23
- # look for template directory
24
- source_dir = File.join(templates_path, template_subdir_path)
25
-
26
- # prepare glob for all subdirectories and files
27
- template_glob = File.join(source_dir, "**", "{*,.*}")
28
-
29
- # Use the name attribute to define the path to the new thing.
30
- # May contain slashes.
31
- relative_destination_path = template_values[:name]
32
-
33
- # Now reset the :name variable to be the basename.
34
- # This is important in profiles, for example.
35
- template_values[:name] = File.basename(template_values[:name])
36
-
37
- # Generate the full full_destination_path path on disk
38
- full_destination_path = Pathname.new(Dir.pwd).join(relative_destination_path)
39
-
40
- # check that the directory does not exist
41
- if File.exist?(full_destination_path) && !overwrite_mode
42
- ui.plain_line "#{ui.emphasis(full_destination_path)} exists already, use --overwrite"
43
- ui.exit(:usage_error)
44
- end
45
-
46
- ui.headline("InSpec Code Generator")
47
-
48
- ui.plain_line "Creating new #{template_type} at #{ui.emphasis(full_destination_path)}"
49
-
50
- # ensure that full_destination_root_path directory is available
51
- FileUtils.mkdir_p(full_destination_path)
52
-
53
- # iterate over files and write to full_destination_path
54
- Dir.glob(template_glob) do |source_file|
55
- relative_destination_item_path = Pathname.new(source_file).relative_path_from(Pathname.new(source_dir)).to_s
56
- next if skip_files.include? relative_destination_item_path
57
-
58
- relative_destination_item_path = file_rename_map[relative_destination_item_path] || relative_destination_item_path
59
- full_destination_item_path = Pathname.new(full_destination_path).join(relative_destination_item_path)
60
- if File.directory?(source_file)
61
- ui.list_item "Creating directory #{ui.emphasis(relative_destination_item_path)}"
62
- FileUtils.mkdir_p(full_destination_item_path)
63
- elsif File.file?(source_file)
64
- ui.list_item "Creating file #{ui.emphasis(relative_destination_item_path)}"
65
- # read & render content
66
- content = render(File.read(source_file), template_values)
67
- # write file content
68
- File.write(full_destination_item_path, content)
69
- else
70
- ui.warning "Ignoring #{ui.emphasis(source_file)}, because its not an file or directoy"
71
- end
72
- end
73
-
74
- ui.plain_line
75
- end
76
- # rubocop: enable Metrics/AbcSize
77
-
78
- # This is a render helper to bind hash values to a ERB template
79
- # ERB provides result_with_hash in ruby 2.5.0+, which does exactly this
80
- def render(template_content, hash)
81
- # create a new binding class
82
- cls = Class.new do
83
- hash.each do |key, value|
84
- define_method key.to_sym do
85
- value
86
- end
87
- end
88
- # expose binding
89
- define_method :bind do
90
- binding
91
- end
92
- end
93
- ERB.new(template_content).result(cls.new.bind)
94
- end
95
- end
96
- end
97
- end