inspec 4.18.51 → 4.18.85
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/inspec.gemspec +15 -37
- data/lib/resource_support/aws/aws_resource_mixin.rb +1 -1
- metadata +22 -709
- data/Gemfile +0 -61
- data/LICENSE +0 -14
- data/README.md +0 -474
- data/etc/deprecations.json +0 -125
- data/etc/plugin_filters.json +0 -45
- data/lib/bundles/README.md +0 -3
- data/lib/bundles/inspec-compliance/api.rb +0 -7
- data/lib/bundles/inspec-compliance/configuration.rb +0 -7
- data/lib/bundles/inspec-compliance/http.rb +0 -7
- data/lib/bundles/inspec-compliance/support.rb +0 -7
- data/lib/bundles/inspec-compliance/target.rb +0 -7
- data/lib/bundles/inspec-supermarket.rb +0 -9
- data/lib/bundles/inspec-supermarket/README.md +0 -45
- data/lib/bundles/inspec-supermarket/api.rb +0 -87
- data/lib/bundles/inspec-supermarket/cli.rb +0 -71
- data/lib/bundles/inspec-supermarket/target.rb +0 -31
- data/lib/inspec.rb +0 -30
- data/lib/inspec/archive/tar.rb +0 -25
- data/lib/inspec/archive/zip.rb +0 -15
- data/lib/inspec/backend.rb +0 -101
- data/lib/inspec/base_cli.rb +0 -318
- data/lib/inspec/cached_fetcher.rb +0 -65
- data/lib/inspec/cli.rb +0 -469
- data/lib/inspec/completions/bash.sh.erb +0 -45
- data/lib/inspec/completions/fish.sh.erb +0 -34
- data/lib/inspec/completions/zsh.sh.erb +0 -61
- data/lib/inspec/config.rb +0 -511
- data/lib/inspec/control_eval_context.rb +0 -248
- data/lib/inspec/dependencies/cache.rb +0 -74
- data/lib/inspec/dependencies/dependency_set.rb +0 -93
- data/lib/inspec/dependencies/lockfile.rb +0 -115
- data/lib/inspec/dependencies/requirement.rb +0 -135
- data/lib/inspec/dependencies/resolver.rb +0 -86
- data/lib/inspec/describe_base.rb +0 -53
- data/lib/inspec/dist.rb +0 -20
- data/lib/inspec/dsl.rb +0 -115
- data/lib/inspec/dsl_shared.rb +0 -32
- data/lib/inspec/env_printer.rb +0 -156
- data/lib/inspec/errors.rb +0 -18
- data/lib/inspec/exceptions.rb +0 -11
- data/lib/inspec/expect.rb +0 -42
- data/lib/inspec/fetcher.rb +0 -48
- data/lib/inspec/fetcher/git.rb +0 -211
- data/lib/inspec/fetcher/local.rb +0 -116
- data/lib/inspec/fetcher/mock.rb +0 -34
- data/lib/inspec/fetcher/url.rb +0 -281
- data/lib/inspec/file_provider.rb +0 -318
- data/lib/inspec/formatters.rb +0 -3
- data/lib/inspec/formatters/base.rb +0 -269
- data/lib/inspec/formatters/json_rspec.rb +0 -20
- data/lib/inspec/formatters/show_progress.rb +0 -12
- data/lib/inspec/globals.rb +0 -9
- data/lib/inspec/impact.rb +0 -36
- data/lib/inspec/input.rb +0 -421
- data/lib/inspec/input_dsl_helpers.rb +0 -26
- data/lib/inspec/input_registry.rb +0 -315
- data/lib/inspec/library_eval_context.rb +0 -55
- data/lib/inspec/log.rb +0 -7
- data/lib/inspec/metadata.rb +0 -253
- data/lib/inspec/method_source.rb +0 -20
- data/lib/inspec/objects.rb +0 -14
- data/lib/inspec/objects/control.rb +0 -85
- data/lib/inspec/objects/describe.rb +0 -106
- data/lib/inspec/objects/each_loop.rb +0 -41
- data/lib/inspec/objects/input.rb +0 -49
- data/lib/inspec/objects/list.rb +0 -15
- data/lib/inspec/objects/or_test.rb +0 -45
- data/lib/inspec/objects/ruby_helper.rb +0 -13
- data/lib/inspec/objects/tag.rb +0 -32
- data/lib/inspec/objects/test.rb +0 -94
- data/lib/inspec/objects/value.rb +0 -32
- data/lib/inspec/plugin/v1.rb +0 -2
- data/lib/inspec/plugin/v1/plugin_types/cli.rb +0 -22
- data/lib/inspec/plugin/v1/plugin_types/fetcher.rb +0 -83
- data/lib/inspec/plugin/v1/plugin_types/resource.rb +0 -176
- data/lib/inspec/plugin/v1/plugin_types/secret.rb +0 -11
- data/lib/inspec/plugin/v1/plugin_types/source_reader.rb +0 -36
- data/lib/inspec/plugin/v1/plugins.rb +0 -59
- data/lib/inspec/plugin/v1/registry.rb +0 -90
- data/lib/inspec/plugin/v2.rb +0 -46
- data/lib/inspec/plugin/v2/activator.rb +0 -40
- data/lib/inspec/plugin/v2/config_file.rb +0 -151
- data/lib/inspec/plugin/v2/filter.rb +0 -96
- data/lib/inspec/plugin/v2/installer.rb +0 -512
- data/lib/inspec/plugin/v2/loader.rb +0 -321
- data/lib/inspec/plugin/v2/plugin_base.rb +0 -112
- data/lib/inspec/plugin/v2/plugin_types/cli.rb +0 -49
- data/lib/inspec/plugin/v2/plugin_types/dsl.rb +0 -11
- data/lib/inspec/plugin/v2/plugin_types/input.rb +0 -34
- data/lib/inspec/plugin/v2/plugin_types/mock.rb +0 -12
- data/lib/inspec/plugin/v2/registry.rb +0 -98
- data/lib/inspec/plugin/v2/status.rb +0 -29
- data/lib/inspec/profile.rb +0 -658
- data/lib/inspec/profile_context.rb +0 -203
- data/lib/inspec/profile_vendor.rb +0 -84
- data/lib/inspec/reporters.rb +0 -73
- data/lib/inspec/reporters/automate.rb +0 -78
- data/lib/inspec/reporters/base.rb +0 -25
- data/lib/inspec/reporters/cli.rb +0 -370
- data/lib/inspec/reporters/json.rb +0 -113
- data/lib/inspec/reporters/json_automate.rb +0 -80
- data/lib/inspec/reporters/json_min.rb +0 -48
- data/lib/inspec/reporters/junit.rb +0 -77
- data/lib/inspec/reporters/yaml.rb +0 -20
- data/lib/inspec/require_loader.rb +0 -29
- data/lib/inspec/resource.rb +0 -114
- data/lib/inspec/resources.rb +0 -130
- data/lib/inspec/resources/aide_conf.rb +0 -153
- data/lib/inspec/resources/apache.rb +0 -47
- data/lib/inspec/resources/apache_conf.rb +0 -156
- data/lib/inspec/resources/apt.rb +0 -151
- data/lib/inspec/resources/audit_policy.rb +0 -64
- data/lib/inspec/resources/auditd.rb +0 -251
- data/lib/inspec/resources/auditd_conf.rb +0 -45
- data/lib/inspec/resources/bash.rb +0 -33
- data/lib/inspec/resources/bond.rb +0 -70
- data/lib/inspec/resources/bridge.rb +0 -125
- data/lib/inspec/resources/bsd_service.rb +0 -2
- data/lib/inspec/resources/chocolatey_package.rb +0 -82
- data/lib/inspec/resources/command.rb +0 -91
- data/lib/inspec/resources/cpan.rb +0 -58
- data/lib/inspec/resources/cran.rb +0 -64
- data/lib/inspec/resources/crontab.rb +0 -173
- data/lib/inspec/resources/csv.rb +0 -56
- data/lib/inspec/resources/dh_params.rb +0 -83
- data/lib/inspec/resources/directory.rb +0 -23
- data/lib/inspec/resources/docker.rb +0 -274
- data/lib/inspec/resources/docker_container.rb +0 -91
- data/lib/inspec/resources/docker_image.rb +0 -84
- data/lib/inspec/resources/docker_object.rb +0 -52
- data/lib/inspec/resources/docker_plugin.rb +0 -64
- data/lib/inspec/resources/docker_service.rb +0 -91
- data/lib/inspec/resources/elasticsearch.rb +0 -165
- data/lib/inspec/resources/etc_fstab.rb +0 -96
- data/lib/inspec/resources/etc_group.rb +0 -157
- data/lib/inspec/resources/etc_hosts.rb +0 -68
- data/lib/inspec/resources/etc_hosts_allow.rb +0 -2
- data/lib/inspec/resources/etc_hosts_allow_deny.rb +0 -114
- data/lib/inspec/resources/etc_hosts_deny.rb +0 -2
- data/lib/inspec/resources/file.rb +0 -339
- data/lib/inspec/resources/filesystem.rb +0 -139
- data/lib/inspec/resources/firewalld.rb +0 -148
- data/lib/inspec/resources/gem.rb +0 -80
- data/lib/inspec/resources/group.rb +0 -2
- data/lib/inspec/resources/groups.rb +0 -241
- data/lib/inspec/resources/grub_conf.rb +0 -230
- data/lib/inspec/resources/host.rb +0 -310
- data/lib/inspec/resources/http.rb +0 -275
- data/lib/inspec/resources/iis_app.rb +0 -101
- data/lib/inspec/resources/iis_app_pool.rb +0 -127
- data/lib/inspec/resources/iis_site.rb +0 -148
- data/lib/inspec/resources/iis_website.rb +0 -2
- data/lib/inspec/resources/inetd_conf.rb +0 -53
- data/lib/inspec/resources/ini.rb +0 -28
- data/lib/inspec/resources/interface.rb +0 -204
- data/lib/inspec/resources/ip6tables.rb +0 -79
- data/lib/inspec/resources/iptables.rb +0 -80
- data/lib/inspec/resources/json.rb +0 -116
- data/lib/inspec/resources/kernel_module.rb +0 -106
- data/lib/inspec/resources/kernel_parameter.rb +0 -54
- data/lib/inspec/resources/key_rsa.rb +0 -66
- data/lib/inspec/resources/ksh.rb +0 -33
- data/lib/inspec/resources/launchd_service.rb +0 -2
- data/lib/inspec/resources/limits_conf.rb +0 -45
- data/lib/inspec/resources/linux_kernel_parameter.rb +0 -2
- data/lib/inspec/resources/login_defs.rb +0 -56
- data/lib/inspec/resources/mount.rb +0 -88
- data/lib/inspec/resources/mssql_session.rb +0 -117
- data/lib/inspec/resources/mysql.rb +0 -81
- data/lib/inspec/resources/mysql_conf.rb +0 -128
- data/lib/inspec/resources/mysql_session.rb +0 -88
- data/lib/inspec/resources/nginx.rb +0 -96
- data/lib/inspec/resources/nginx_conf.rb +0 -232
- data/lib/inspec/resources/noop.rb +0 -9
- data/lib/inspec/resources/npm.rb +0 -68
- data/lib/inspec/resources/ntp_conf.rb +0 -51
- data/lib/inspec/resources/oneget.rb +0 -71
- data/lib/inspec/resources/oracledb_session.rb +0 -149
- data/lib/inspec/resources/os.rb +0 -34
- data/lib/inspec/resources/os_env.rb +0 -86
- data/lib/inspec/resources/package.rb +0 -391
- data/lib/inspec/resources/packages.rb +0 -111
- data/lib/inspec/resources/parse_config.rb +0 -112
- data/lib/inspec/resources/parse_config_file.rb +0 -2
- data/lib/inspec/resources/passwd.rb +0 -73
- data/lib/inspec/resources/pip.rb +0 -132
- data/lib/inspec/resources/platform.rb +0 -112
- data/lib/inspec/resources/port.rb +0 -791
- data/lib/inspec/resources/postfix_conf.rb +0 -35
- data/lib/inspec/resources/postgres.rb +0 -152
- data/lib/inspec/resources/postgres_conf.rb +0 -116
- data/lib/inspec/resources/postgres_hba_conf.rb +0 -86
- data/lib/inspec/resources/postgres_ident_conf.rb +0 -75
- data/lib/inspec/resources/postgres_session.rb +0 -70
- data/lib/inspec/resources/powershell.rb +0 -67
- data/lib/inspec/resources/ppa.rb +0 -2
- data/lib/inspec/resources/processes.rb +0 -219
- data/lib/inspec/resources/rabbitmq_conf.rb +0 -2
- data/lib/inspec/resources/rabbitmq_config.rb +0 -52
- data/lib/inspec/resources/registry_key.rb +0 -296
- data/lib/inspec/resources/runit_service.rb +0 -2
- data/lib/inspec/resources/script.rb +0 -1
- data/lib/inspec/resources/security_identifier.rb +0 -91
- data/lib/inspec/resources/security_policy.rb +0 -182
- data/lib/inspec/resources/service.rb +0 -820
- data/lib/inspec/resources/shadow.rb +0 -150
- data/lib/inspec/resources/ssh_config.rb +0 -98
- data/lib/inspec/resources/sshd_config.rb +0 -2
- data/lib/inspec/resources/ssl.rb +0 -99
- data/lib/inspec/resources/sys_info.rb +0 -119
- data/lib/inspec/resources/systemd_service.rb +0 -2
- data/lib/inspec/resources/sysv_service.rb +0 -2
- data/lib/inspec/resources/toml.rb +0 -30
- data/lib/inspec/resources/upstart_service.rb +0 -2
- data/lib/inspec/resources/user.rb +0 -1
- data/lib/inspec/resources/users.rb +0 -742
- data/lib/inspec/resources/vbscript.rb +0 -67
- data/lib/inspec/resources/virtualization.rb +0 -255
- data/lib/inspec/resources/windows_feature.rb +0 -126
- data/lib/inspec/resources/windows_hotfix.rb +0 -37
- data/lib/inspec/resources/windows_registry_key.rb +0 -2
- data/lib/inspec/resources/windows_task.rb +0 -112
- data/lib/inspec/resources/wmi.rb +0 -109
- data/lib/inspec/resources/x509_certificate.rb +0 -143
- data/lib/inspec/resources/xinetd_conf.rb +0 -103
- data/lib/inspec/resources/xml.rb +0 -48
- data/lib/inspec/resources/yaml.rb +0 -42
- data/lib/inspec/resources/yum.rb +0 -162
- data/lib/inspec/resources/zfs_dataset.rb +0 -62
- data/lib/inspec/resources/zfs_pool.rb +0 -50
- data/lib/inspec/rspec_extensions.rb +0 -116
- data/lib/inspec/rule.rb +0 -389
- data/lib/inspec/runner.rb +0 -333
- data/lib/inspec/runner_mock.rb +0 -37
- data/lib/inspec/runner_rspec.rb +0 -184
- data/lib/inspec/runtime_profile.rb +0 -23
- data/lib/inspec/schema.rb +0 -245
- data/lib/inspec/secrets.rb +0 -15
- data/lib/inspec/secrets/yaml.rb +0 -29
- data/lib/inspec/shell.rb +0 -211
- data/lib/inspec/shell_detector.rb +0 -89
- data/lib/inspec/source_reader.rb +0 -26
- data/lib/inspec/ui.rb +0 -213
- data/lib/inspec/ui_table_helper.rb +0 -12
- data/lib/inspec/utils/command_wrapper.rb +0 -23
- data/lib/inspec/utils/convert.rb +0 -8
- data/lib/inspec/utils/database_helpers.rb +0 -75
- data/lib/inspec/utils/deprecation.rb +0 -6
- data/lib/inspec/utils/deprecation/config_file.rb +0 -109
- data/lib/inspec/utils/deprecation/deprecator.rb +0 -118
- data/lib/inspec/utils/deprecation/errors.rb +0 -14
- data/lib/inspec/utils/deprecation/global_method.rb +0 -9
- data/lib/inspec/utils/enumerable_delegation.rb +0 -7
- data/lib/inspec/utils/erlang_parser.rb +0 -190
- data/lib/inspec/utils/file_reader.rb +0 -24
- data/lib/inspec/utils/filter.rb +0 -461
- data/lib/inspec/utils/filter_array.rb +0 -25
- data/lib/inspec/utils/find_files.rb +0 -44
- data/lib/inspec/utils/hash.rb +0 -37
- data/lib/inspec/utils/json_log.rb +0 -15
- data/lib/inspec/utils/modulator.rb +0 -9
- data/lib/inspec/utils/nginx_parser.rb +0 -101
- data/lib/inspec/utils/object_traversal.rb +0 -47
- data/lib/inspec/utils/parser.rb +0 -277
- data/lib/inspec/utils/pkey_reader.rb +0 -17
- data/lib/inspec/utils/simpleconfig.rb +0 -121
- data/lib/inspec/utils/spdx.rb +0 -10
- data/lib/inspec/utils/spdx.txt +0 -383
- data/lib/inspec/utils/telemetry.rb +0 -3
- data/lib/inspec/utils/telemetry/collector.rb +0 -81
- data/lib/inspec/utils/telemetry/data_series.rb +0 -44
- data/lib/inspec/utils/telemetry/global_methods.rb +0 -22
- data/lib/inspec/version.rb +0 -3
- data/lib/matchers/matchers.rb +0 -341
- data/lib/plugins/README.md +0 -16
- data/lib/plugins/inspec-artifact/lib/inspec-artifact.rb +0 -12
- data/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb +0 -170
- data/lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb +0 -116
- data/lib/plugins/inspec-artifact/test/functional/inspec_artifact_test.rb +0 -50
- data/lib/plugins/inspec-compliance/README.md +0 -207
- data/lib/plugins/inspec-compliance/lib/inspec-compliance.rb +0 -12
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb +0 -362
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/api/login.rb +0 -198
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb +0 -269
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/configuration.rb +0 -103
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/http.rb +0 -117
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/images/cc-token.png +0 -0
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb +0 -34
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/target.rb +0 -146
- data/lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb +0 -53
- data/lib/plugins/inspec-compliance/test/integration/default/cli.rb +0 -91
- data/lib/plugins/inspec-compliance/test/unit/api/login_test.rb +0 -190
- data/lib/plugins/inspec-compliance/test/unit/api_test.rb +0 -386
- data/lib/plugins/inspec-compliance/test/unit/target_test.rb +0 -155
- data/lib/plugins/inspec-habitat/Berksfile +0 -5
- data/lib/plugins/inspec-habitat/README.md +0 -150
- data/lib/plugins/inspec-habitat/kitchen.yml +0 -28
- data/lib/plugins/inspec-habitat/lib/inspec-habitat.rb +0 -11
- data/lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb +0 -41
- data/lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb +0 -265
- data/lib/plugins/inspec-habitat/templates/habitat/plan.sh.erb +0 -6
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/Berksfile +0 -2
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/files/hab_setup.exp +0 -28
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/metadata.rb +0 -9
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/recipes/default.rb +0 -61
- data/lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb +0 -34
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb +0 -40
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/inspec.yml +0 -10
- data/lib/plugins/inspec-habitat/test/support/example_profile/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/support/example_profile/controls/example.rb +0 -7
- data/lib/plugins/inspec-habitat/test/support/example_profile/inspec.yml +0 -10
- data/lib/plugins/inspec-habitat/test/unit/profile_test.rb +0 -242
- data/lib/plugins/inspec-init/README.md +0 -31
- data/lib/plugins/inspec-init/lib/inspec-init.rb +0 -12
- data/lib/plugins/inspec-init/lib/inspec-init/cli.rb +0 -15
- data/lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb +0 -243
- data/lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb +0 -47
- data/lib/plugins/inspec-init/lib/inspec-init/renderer.rb +0 -97
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Gemfile +0 -11
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/LICENSE +0 -2
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/README.md +0 -28
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Rakefile +0 -40
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template.rb +0 -14
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/cli_command.rb +0 -62
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/plugin.rb +0 -53
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/version.rb +0 -8
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/fixtures/README.md +0 -24
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/README.md +0 -12
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/inspec_plugin_template_test.rb +0 -110
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/helper.rb +0 -24
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/README.md +0 -17
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/cli_args_test.rb +0 -67
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/plugin_def_test.rb +0 -51
- data/lib/plugins/inspec-init/templates/profiles/aws/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/azure/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/gcp/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/os/README.md +0 -3
- data/lib/plugins/inspec-init/templates/profiles/os/controls/example.rb +0 -18
- data/lib/plugins/inspec-init/templates/profiles/os/inspec.yml +0 -10
- data/lib/plugins/inspec-init/templates/profiles/os/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/test/functional/inspec_init_plugin_test.rb +0 -184
- data/lib/plugins/inspec-init/test/functional/inspec_init_profile_test.rb +0 -121
- data/lib/plugins/inspec-plugin-manager-cli/README.md +0 -6
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb +0 -17
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +0 -518
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb +0 -12
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/config_dirs/empty/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette.rb +0 -2
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-wrong-structure/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name.rb +0 -1
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/help_test.rb +0 -23
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/helper.rb +0 -62
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/install_test.rb +0 -368
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/list_test.rb +0 -101
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/search_test.rb +0 -129
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/uninstall_test.rb +0 -63
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/update_test.rb +0 -84
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb +0 -77
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb +0 -39
- data/lib/plugins/shared/core_plugin_test_helper.rb +0 -153
- data/lib/plugins/things-for-train-integration.rb +0 -14
- data/lib/source_readers/flat.rb +0 -36
- data/lib/source_readers/inspec.rb +0 -66
data/lib/inspec/errors.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module Inspec
|
2
|
-
class Error < StandardError; end
|
3
|
-
|
4
|
-
# dependency resolution
|
5
|
-
class CyclicDependencyError < Error; end
|
6
|
-
class UnsatisfiedVersionSpecification < Error; end
|
7
|
-
class DuplicateDep < Error; end
|
8
|
-
class FetcherFailure < Error; end
|
9
|
-
class ReporterError < Error; end
|
10
|
-
class ImpactError < Error; end
|
11
|
-
|
12
|
-
# Config file loading
|
13
|
-
class ConfigError < Error; end
|
14
|
-
class ConfigError::MalformedJson < ConfigError; end
|
15
|
-
class ConfigError::Invalid < ConfigError; end
|
16
|
-
|
17
|
-
class UserInteractionRequired < Error; end
|
18
|
-
end
|
data/lib/inspec/exceptions.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# copyright: 2017, Chef Software Inc.
|
2
|
-
|
3
|
-
module Inspec
|
4
|
-
module Exceptions
|
5
|
-
class InputsFileDoesNotExist < ArgumentError; end
|
6
|
-
class InputsFileNotReadable < ArgumentError; end
|
7
|
-
class ResourceFailed < StandardError; end
|
8
|
-
class ResourceSkipped < StandardError; end
|
9
|
-
class SecretsBackendNotFound < ArgumentError; end
|
10
|
-
end
|
11
|
-
end
|
data/lib/inspec/expect.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# copyright: 2016, Chef Software Inc.
|
2
|
-
|
3
|
-
require "rspec/expectations"
|
4
|
-
|
5
|
-
module Inspec
|
6
|
-
class Expect
|
7
|
-
attr_reader :calls, :value, :block
|
8
|
-
def initialize(value, &block)
|
9
|
-
@value = value
|
10
|
-
@block = block
|
11
|
-
@calls = []
|
12
|
-
end
|
13
|
-
|
14
|
-
def to(*args, &block)
|
15
|
-
@calls.push([:to, args, block, caller])
|
16
|
-
end
|
17
|
-
|
18
|
-
def not_to(*args, &block)
|
19
|
-
@calls.push([:not_to, args, block, caller])
|
20
|
-
end
|
21
|
-
|
22
|
-
def example_group
|
23
|
-
that = self
|
24
|
-
|
25
|
-
opts = { "caller" => calls[0][3] } # TODO: this needs overhaul. no magic #s
|
26
|
-
if !calls[0][3].nil? && !calls[0][3].empty? &&
|
27
|
-
(m = calls[0][3][0].match(/^([^:]*):(\d+):/))
|
28
|
-
opts["file_path"] = m[0]
|
29
|
-
opts["line_number"] = m[1]
|
30
|
-
end
|
31
|
-
|
32
|
-
RSpec::Core::ExampleGroup.describe(that.value, opts) do
|
33
|
-
that.calls.each do |method, args, block, clr|
|
34
|
-
it(nil, caller: clr) do
|
35
|
-
x = expect(that.value, &that.block).method(method)
|
36
|
-
x.call(*args, &block)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/lib/inspec/fetcher.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
require "inspec/plugin/v1"
|
2
|
-
|
3
|
-
module Inspec
|
4
|
-
class FetcherRegistry < PluginRegistry
|
5
|
-
def resolve(target)
|
6
|
-
if fetcher_specified?(target)
|
7
|
-
super(target)
|
8
|
-
else
|
9
|
-
Inspec::Log.debug("Assuming default supermarket source for #{target}")
|
10
|
-
super(with_default_fetcher(target))
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
NON_FETCHER_KEYS = %i{name version_constraint cwd backend cache sha256}.freeze
|
15
|
-
def fetcher_specified?(target)
|
16
|
-
# Only set a default for Hash-based (i.e. from
|
17
|
-
# inspec.yml/inspec.lock) targets
|
18
|
-
|
19
|
-
return true unless target.respond_to?(:keys)
|
20
|
-
|
21
|
-
!(target.keys - NON_FETCHER_KEYS).empty?
|
22
|
-
end
|
23
|
-
|
24
|
-
def with_default_fetcher(target)
|
25
|
-
target.merge({ supermarket: target[:name] })
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
module Fetcher
|
30
|
-
Registry = FetcherRegistry.new
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.fetcher(version)
|
34
|
-
if version != 1
|
35
|
-
raise "Only fetcher version 1 is supported!"
|
36
|
-
end
|
37
|
-
|
38
|
-
Inspec::Plugins::Fetcher
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# TODO: remove. require up, not down.
|
43
|
-
require "inspec/fetcher/local"
|
44
|
-
require "inspec/fetcher/url"
|
45
|
-
require "inspec/fetcher/git"
|
46
|
-
|
47
|
-
# TODO: Remove in 4.0 when Compliance fetcher plugin is created
|
48
|
-
require "plugins/inspec-compliance/lib/inspec-compliance/api"
|
data/lib/inspec/fetcher/git.rb
DELETED
@@ -1,211 +0,0 @@
|
|
1
|
-
require "tmpdir"
|
2
|
-
require "fileutils"
|
3
|
-
require "mixlib/shellout"
|
4
|
-
require "inspec/log"
|
5
|
-
|
6
|
-
module Inspec::Fetcher
|
7
|
-
#
|
8
|
-
# The git fetcher uses the git binary to fetch remote git sources.
|
9
|
-
# Git-based sources should be specified with the `git:` key in the
|
10
|
-
# source hash. Additionally, we accept `:branch`, `:ref`, and `:tag`
|
11
|
-
# keys to allow users to pin to a particular revision.
|
12
|
-
#
|
13
|
-
# Parts of this class are derived from:
|
14
|
-
#
|
15
|
-
# https://github.com/chef/omnibus/blob/master/lib/omnibus/fetchers/git_fetcher.rb
|
16
|
-
#
|
17
|
-
# which is Copyright 2012-2014 Chef Software, Inc. and offered under
|
18
|
-
# the same Apache 2 software license as inspec.
|
19
|
-
#
|
20
|
-
# Many thanks to the omnibus authors!
|
21
|
-
#
|
22
|
-
# Note that we haven't replicated all of omnibus' features here. If
|
23
|
-
# you got to this file during debugging, you may want to look at the
|
24
|
-
# omnibus source for hints.
|
25
|
-
#
|
26
|
-
class Git < Inspec.fetcher(1)
|
27
|
-
name "git"
|
28
|
-
priority 200
|
29
|
-
|
30
|
-
def self.resolve(target, opts = {})
|
31
|
-
if target.is_a?(String)
|
32
|
-
new(target, opts) if target.start_with?("git@") || target.end_with?(".git")
|
33
|
-
elsif target.respond_to?(:has_key?) && target.key?(:git)
|
34
|
-
new(target[:git], opts.merge(target))
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def initialize(remote_url, opts = {})
|
39
|
-
@branch = opts[:branch]
|
40
|
-
@tag = opts[:tag]
|
41
|
-
@ref = opts[:ref]
|
42
|
-
@remote_url = expand_local_path(remote_url)
|
43
|
-
@repo_directory = nil
|
44
|
-
@relative_path = opts[:relative_path] if opts[:relative_path] && !opts[:relative_path].empty?
|
45
|
-
end
|
46
|
-
|
47
|
-
def expand_local_path(url_or_file_path)
|
48
|
-
# This paths to local on-disk repos, not relative paths within repos.
|
49
|
-
# This is especially needed with testing.
|
50
|
-
|
51
|
-
# We could try to do something clever with URI
|
52
|
-
# processing, but then again, if you passed a relative path
|
53
|
-
# to an on-disk repo, you probably expect it to exist.
|
54
|
-
return url_or_file_path unless File.exist?(url_or_file_path)
|
55
|
-
|
56
|
-
# It's important to expand this path, because it may be specified
|
57
|
-
# locally in the metadata files, and when we clone, we will be
|
58
|
-
# in a temp dir.
|
59
|
-
File.expand_path(url_or_file_path)
|
60
|
-
end
|
61
|
-
|
62
|
-
def fetch(destination_path)
|
63
|
-
@repo_directory = destination_path # Might be the cache, or vendoring, or something else
|
64
|
-
FileUtils.mkdir_p(destination_path) unless Dir.exist?(destination_path)
|
65
|
-
|
66
|
-
if cloned?
|
67
|
-
checkout
|
68
|
-
else
|
69
|
-
Dir.mktmpdir do |working_dir|
|
70
|
-
checkout(working_dir)
|
71
|
-
if @relative_path
|
72
|
-
perform_relative_path_fetch(destination_path, working_dir)
|
73
|
-
else
|
74
|
-
Inspec::Log.debug("Checkout of #{resolved_ref} successful. " \
|
75
|
-
"Moving checkout to #{destination_path}")
|
76
|
-
FileUtils.cp_r(working_dir + "/.", destination_path)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
@repo_directory
|
81
|
-
end
|
82
|
-
|
83
|
-
def perform_relative_path_fetch(destination_path, working_dir)
|
84
|
-
Inspec::Log.debug("Checkout of #{resolved_ref} successful. " \
|
85
|
-
"Moving #{@relative_path} to #{destination_path}")
|
86
|
-
unless File.exist?("#{working_dir}/#{@relative_path}")
|
87
|
-
# Cleanup the destination path - otherwise we'll have an empty dir
|
88
|
-
# in the cache, which is enough to confuse the cache reader
|
89
|
-
# This is a courtesy, assuming we're writing to the cache; if we're
|
90
|
-
# vendoring to something more complex, don't bother.
|
91
|
-
FileUtils.rmdir(destination_path) if Dir.empty?(destination_path)
|
92
|
-
|
93
|
-
raise Inspec::FetcherFailure, "Cannot find relative path '#{@relative_path}' " \
|
94
|
-
"within profile in git repo specified by '#{@remote_url}'"
|
95
|
-
end
|
96
|
-
FileUtils.cp_r("#{working_dir}/#{@relative_path}", destination_path)
|
97
|
-
end
|
98
|
-
|
99
|
-
def cache_key
|
100
|
-
return resolved_ref unless @relative_path
|
101
|
-
|
102
|
-
OpenSSL::Digest::SHA256.hexdigest(resolved_ref + @relative_path)
|
103
|
-
end
|
104
|
-
|
105
|
-
def archive_path
|
106
|
-
@repo_directory
|
107
|
-
end
|
108
|
-
|
109
|
-
def resolved_source
|
110
|
-
source = { git: @remote_url, ref: resolved_ref }
|
111
|
-
source[:relative_path] = @relative_path if @relative_path
|
112
|
-
source
|
113
|
-
end
|
114
|
-
|
115
|
-
private
|
116
|
-
|
117
|
-
def resolved_ref
|
118
|
-
@resolved_ref ||= if @ref
|
119
|
-
@ref
|
120
|
-
elsif @branch
|
121
|
-
resolve_ref(@branch)
|
122
|
-
elsif @tag
|
123
|
-
resolve_ref(@tag)
|
124
|
-
else
|
125
|
-
resolve_ref("master")
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
def resolve_ref(ref_name)
|
130
|
-
command_string = "git ls-remote \"#{@remote_url}\" \"#{ref_name}*\""
|
131
|
-
cmd = shellout(command_string)
|
132
|
-
raise(Inspec::FetcherFailure, "Profile git dependency failed for #{@remote_url} - error running '#{command_string}': #{cmd.stderr}") unless cmd.exitstatus == 0
|
133
|
-
|
134
|
-
ref = parse_ls_remote(cmd.stdout, ref_name)
|
135
|
-
unless ref
|
136
|
-
raise Inspec::FetcherFailure, "Profile git dependency failed - unable to resolve #{ref_name} to a specific git commit for #{@remote_url}"
|
137
|
-
end
|
138
|
-
|
139
|
-
ref
|
140
|
-
end
|
141
|
-
|
142
|
-
#
|
143
|
-
# The following comment is a minor modification of the comment in
|
144
|
-
# the omnibus source for a similar function:
|
145
|
-
#
|
146
|
-
# Dereference annotated tags.
|
147
|
-
#
|
148
|
-
# The +remote_list+ parameter is assumed to look like this:
|
149
|
-
#
|
150
|
-
# a2ed66c01f42514bcab77fd628149eccb4ecee28 refs/tags/rel-0.11.0
|
151
|
-
# f915286abdbc1907878376cce9222ac0b08b12b8 refs/tags/rel-0.11.0^{}
|
152
|
-
#
|
153
|
-
# The SHA with ^{} is the commit pointed to by an annotated
|
154
|
-
# tag. If ref isn't an annotated tag, there will not be a line
|
155
|
-
# with trailing ^{}.
|
156
|
-
#
|
157
|
-
# @param [String] output
|
158
|
-
# output from `git ls-remote origin` command
|
159
|
-
# @param [String] ref_name
|
160
|
-
# the target git ref_name
|
161
|
-
#
|
162
|
-
# @return [String]
|
163
|
-
#
|
164
|
-
def parse_ls_remote(output, ref_name)
|
165
|
-
pairs = output.lines.map { |l| l.chomp.split("\t") }
|
166
|
-
tagged_commit = pairs.find { |m| m[1].end_with?("#{ref_name}^{}") }
|
167
|
-
if tagged_commit
|
168
|
-
tagged_commit.first
|
169
|
-
else
|
170
|
-
pairs.find { |m| m[1].end_with?(ref_name.to_s) }&.first
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
def cloned?
|
175
|
-
File.directory?(File.join(@repo_directory, ".git"))
|
176
|
-
end
|
177
|
-
|
178
|
-
def clone(dir = @repo_directory)
|
179
|
-
git_cmd("clone #{@remote_url} ./", dir) unless cloned?
|
180
|
-
@repo_directory
|
181
|
-
end
|
182
|
-
|
183
|
-
def checkout(dir = @repo_directory)
|
184
|
-
clone(dir)
|
185
|
-
git_cmd("checkout #{resolved_ref}", dir)
|
186
|
-
@repo_directory
|
187
|
-
end
|
188
|
-
|
189
|
-
def git_cmd(cmd, dir = @repo_directory)
|
190
|
-
cmd = shellout("git #{cmd}", cwd: dir)
|
191
|
-
cmd.error!
|
192
|
-
cmd.status
|
193
|
-
rescue Errno::ENOENT
|
194
|
-
raise Inspec::FetcherFailure, "Profile git dependency failed for #{@remote_url} - to use git sources, you must have git installed."
|
195
|
-
end
|
196
|
-
|
197
|
-
def shellout(cmd, opts = {})
|
198
|
-
Inspec::Log.debug("Running external command: #{cmd} (#{opts})")
|
199
|
-
cmd = Mixlib::ShellOut.new(cmd, opts)
|
200
|
-
cmd.run_command
|
201
|
-
Inspec::Log.debug("External command: completed with exit status: #{cmd.exitstatus}")
|
202
|
-
Inspec::Log.debug("External command: STDOUT BEGIN")
|
203
|
-
Inspec::Log.debug(cmd.stdout)
|
204
|
-
Inspec::Log.debug("External command: STDOUT END")
|
205
|
-
Inspec::Log.debug("External command: STDERR BEGIN")
|
206
|
-
Inspec::Log.debug(cmd.stderr)
|
207
|
-
Inspec::Log.debug("External command: STDERR END")
|
208
|
-
cmd
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|
data/lib/inspec/fetcher/local.rb
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
require "openssl"
|
2
|
-
|
3
|
-
module Inspec::Fetcher
|
4
|
-
class Local < Inspec.fetcher(1)
|
5
|
-
name "local"
|
6
|
-
priority 0
|
7
|
-
|
8
|
-
def self.resolve(target)
|
9
|
-
if target.is_a?(String)
|
10
|
-
local_path = resolve_from_string(target)
|
11
|
-
new(local_path) if local_path
|
12
|
-
elsif target.is_a?(Hash)
|
13
|
-
local_path = resolve_from_hash(target)
|
14
|
-
new(local_path, target) if local_path
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.resolve_from_hash(target)
|
19
|
-
return unless target.key?(:path)
|
20
|
-
|
21
|
-
if target.key?(:cwd)
|
22
|
-
File.expand_path(target[:path], target[:cwd])
|
23
|
-
else
|
24
|
-
target[:path]
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.resolve_from_string(target)
|
29
|
-
# Support "urls" in the form of file://
|
30
|
-
if target.start_with?("file://")
|
31
|
-
target = target.gsub(%r{^file://}, "")
|
32
|
-
else
|
33
|
-
# support for windows paths
|
34
|
-
target = target.tr('\\', "/")
|
35
|
-
end
|
36
|
-
|
37
|
-
target if File.exist?(File.expand_path(target))
|
38
|
-
end
|
39
|
-
|
40
|
-
def initialize(target, opts = {})
|
41
|
-
@target = target
|
42
|
-
@backend = opts[:backend]
|
43
|
-
@archive_shasum = nil
|
44
|
-
end
|
45
|
-
|
46
|
-
def fetch(path)
|
47
|
-
# If `inspec exec` is used then we should not vendor/fetch. This makes
|
48
|
-
# local development easier and more predictable.
|
49
|
-
return @target if Inspec::BaseCLI.inspec_cli_command == :exec
|
50
|
-
|
51
|
-
# Skip vendoring if @backend is not set (example: ad hoc runners)
|
52
|
-
return @target unless @backend
|
53
|
-
|
54
|
-
if File.directory?(@target)
|
55
|
-
# Create an archive, checksum, and move to the vendor directory
|
56
|
-
Dir.mktmpdir do |tmpdir|
|
57
|
-
temp_archive = File.join(tmpdir, "#{File.basename(@target)}.tar.gz")
|
58
|
-
opts = {
|
59
|
-
backend: @backend,
|
60
|
-
output: temp_archive,
|
61
|
-
}
|
62
|
-
|
63
|
-
# Create a temporary archive at `opts[:output]`
|
64
|
-
Inspec::Profile.for_target(@target, opts).archive(opts)
|
65
|
-
|
66
|
-
checksum = perform_shasum(temp_archive)
|
67
|
-
final_path = File.join(path, checksum)
|
68
|
-
FileUtils.mkdir_p(final_path)
|
69
|
-
Inspec::FileProvider.for_path(temp_archive).extract(final_path)
|
70
|
-
end
|
71
|
-
else
|
72
|
-
# Verify profile (archive) is valid and extract to vendor directory
|
73
|
-
opts = { backend: @backend }
|
74
|
-
Inspec::Profile.for_target(@target, opts).check
|
75
|
-
Inspec::FileProvider.for_path(@target).extract(path)
|
76
|
-
end
|
77
|
-
|
78
|
-
@target
|
79
|
-
end
|
80
|
-
|
81
|
-
def archive_path
|
82
|
-
@target
|
83
|
-
end
|
84
|
-
|
85
|
-
def writable?
|
86
|
-
File.directory?(@target)
|
87
|
-
end
|
88
|
-
|
89
|
-
def cache_key
|
90
|
-
sha256.to_s
|
91
|
-
end
|
92
|
-
|
93
|
-
def sha256
|
94
|
-
if !@archive_shasum.nil?
|
95
|
-
@archive_shasum
|
96
|
-
elsif File.directory?(@target)
|
97
|
-
nil
|
98
|
-
else
|
99
|
-
perform_shasum(@target)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def perform_shasum(target)
|
104
|
-
return @archive_shasum if @archive_shasum
|
105
|
-
raise(Inspec::FetcherFailure, "Profile dependency local path '#{target}' does not exist") unless File.exist?(target)
|
106
|
-
|
107
|
-
@archive_shasum = OpenSSL::Digest::SHA256.digest(File.read(target)).unpack("H*")[0]
|
108
|
-
end
|
109
|
-
|
110
|
-
def resolved_source
|
111
|
-
h = { path: @target }
|
112
|
-
h[:sha256] = sha256 if sha256
|
113
|
-
h
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|