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
@@ -1,81 +0,0 @@
|
|
1
|
-
require "inspec/config"
|
2
|
-
require "inspec/utils/telemetry/data_series"
|
3
|
-
require "singleton"
|
4
|
-
|
5
|
-
module Inspec::Telemetry
|
6
|
-
# A Singleton collection of data series objects.
|
7
|
-
class Collector
|
8
|
-
include Singleton
|
9
|
-
|
10
|
-
attr_reader :config
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
@data_series = []
|
14
|
-
@telemetry_toggled_off = false
|
15
|
-
load_config
|
16
|
-
end
|
17
|
-
|
18
|
-
# Allow loading a configuration, useful when testing.
|
19
|
-
def load_config(config = Inspec::Config.cached)
|
20
|
-
@config = config
|
21
|
-
end
|
22
|
-
|
23
|
-
# Add a data series to the collection.
|
24
|
-
# @return [True]
|
25
|
-
def add_data_series(data_series)
|
26
|
-
@data_series << data_series
|
27
|
-
end
|
28
|
-
|
29
|
-
# The loaded configuration should have a option to configure
|
30
|
-
# telemetry, if not default to false.
|
31
|
-
# @return [True, False]
|
32
|
-
def telemetry_enabled?
|
33
|
-
if @telemetry_toggled_off
|
34
|
-
false
|
35
|
-
else
|
36
|
-
config_telemetry_options.fetch("enable_telemetry", false)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# A way to disable the telemetry system.
|
41
|
-
def disable_telemetry
|
42
|
-
@telemetry_toggled_off = true
|
43
|
-
end
|
44
|
-
|
45
|
-
# The entire data series collection.
|
46
|
-
# @return [Array]
|
47
|
-
def list_data_series
|
48
|
-
@data_series
|
49
|
-
end
|
50
|
-
|
51
|
-
# Finds the data series object with the specified name and returns it.
|
52
|
-
# If it does not exist then creates a new data series with that name
|
53
|
-
# and returns it.
|
54
|
-
# @return [Inspec::Telemetry::DataSeries]
|
55
|
-
def find_or_create_data_series(name)
|
56
|
-
ds = @data_series.select { |data_series| data_series.name.eql?(name) }
|
57
|
-
if ds.empty?
|
58
|
-
new_data_series = Inspec::Telemetry::DataSeries.new(name)
|
59
|
-
@data_series << new_data_series
|
60
|
-
new_data_series
|
61
|
-
else
|
62
|
-
ds.first
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# Blanks the contents of the data series collection.
|
67
|
-
# Reset telemetry toggle
|
68
|
-
# @return [True]
|
69
|
-
def reset!
|
70
|
-
@data_series = []
|
71
|
-
@telemetry_toggled_off = false
|
72
|
-
end
|
73
|
-
|
74
|
-
private
|
75
|
-
|
76
|
-
# Minimize exposure of Inspec::Config interface
|
77
|
-
def config_telemetry_options
|
78
|
-
config.telemetry_options
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require "json"
|
2
|
-
|
3
|
-
module Inspec; end
|
4
|
-
|
5
|
-
# A minimal Dataseries Object
|
6
|
-
# Stores the name of the data series and an array of data.
|
7
|
-
# Stored data should be a object that supports #to_s
|
8
|
-
module Inspec::Telemetry
|
9
|
-
class DataSeries
|
10
|
-
def initialize(name)
|
11
|
-
@name = name
|
12
|
-
@enabled = true
|
13
|
-
@data ||= []
|
14
|
-
end
|
15
|
-
|
16
|
-
attr_reader :data, :name
|
17
|
-
|
18
|
-
# This needs to also be set by configuration.
|
19
|
-
def enabled?
|
20
|
-
@enabled
|
21
|
-
end
|
22
|
-
|
23
|
-
def disable
|
24
|
-
@enabled = false
|
25
|
-
end
|
26
|
-
|
27
|
-
def <<(appending_data)
|
28
|
-
data << appending_data
|
29
|
-
end
|
30
|
-
|
31
|
-
alias push <<
|
32
|
-
|
33
|
-
def to_h
|
34
|
-
{
|
35
|
-
name: @name,
|
36
|
-
data: @data,
|
37
|
-
}
|
38
|
-
end
|
39
|
-
|
40
|
-
def to_json
|
41
|
-
to_h.to_json
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require "inspec/utils/telemetry/collector"
|
2
|
-
|
3
|
-
module Inspec
|
4
|
-
# A Global method to add a data series object to the Telemetry Collection.
|
5
|
-
# `data_series_name`s are unique, so `:dependency_group` will always return
|
6
|
-
# the same object.
|
7
|
-
# `data_point` is optional, you may also supply a block with several data points.
|
8
|
-
# All data points should allow #to_s
|
9
|
-
def self.record_telemetry_data(data_series_name, data_point = nil)
|
10
|
-
coll = Inspec::Telemetry::Collector.instance
|
11
|
-
return unless coll.telemetry_enabled?
|
12
|
-
|
13
|
-
ds = coll.find_or_create_data_series(data_series_name)
|
14
|
-
return unless ds.enabled?
|
15
|
-
|
16
|
-
if block_given?
|
17
|
-
ds << yield
|
18
|
-
else
|
19
|
-
ds << data_point
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/lib/inspec/version.rb
DELETED
data/lib/matchers/matchers.rb
DELETED
@@ -1,341 +0,0 @@
|
|
1
|
-
# copyright: 2015, Vulcano Security GmbH
|
2
|
-
|
3
|
-
require "rspec/matchers"
|
4
|
-
|
5
|
-
RSpec::Matchers.define :be_readable do
|
6
|
-
match do |file|
|
7
|
-
file.readable?(@by, @by_user)
|
8
|
-
end
|
9
|
-
|
10
|
-
chain :by do |by|
|
11
|
-
@by = by
|
12
|
-
end
|
13
|
-
|
14
|
-
chain :by_user do |by_user|
|
15
|
-
@by_user = by_user
|
16
|
-
end
|
17
|
-
|
18
|
-
description do
|
19
|
-
res = "be readable"
|
20
|
-
res += " by #{@by}" unless @by.nil?
|
21
|
-
res += " by user #{@by_user}" unless @by_user.nil?
|
22
|
-
res
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
RSpec::Matchers.define :be_writable do
|
27
|
-
match do |file|
|
28
|
-
file.writable?(@by, @by_user)
|
29
|
-
end
|
30
|
-
|
31
|
-
chain :by do |by|
|
32
|
-
@by = by
|
33
|
-
end
|
34
|
-
|
35
|
-
chain :by_user do |by_user|
|
36
|
-
@by_user = by_user
|
37
|
-
end
|
38
|
-
|
39
|
-
description do
|
40
|
-
res = "be writable"
|
41
|
-
res += " by #{@by}" unless @by.nil?
|
42
|
-
res += " by user #{@by_user}" unless @by_user.nil?
|
43
|
-
res
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
RSpec::Matchers.define :be_executable do
|
48
|
-
match do |file|
|
49
|
-
file.executable?(@by, @by_user)
|
50
|
-
end
|
51
|
-
|
52
|
-
chain :by do |by|
|
53
|
-
@by = by
|
54
|
-
end
|
55
|
-
|
56
|
-
chain :by_user do |by_user|
|
57
|
-
@by_user = by_user
|
58
|
-
end
|
59
|
-
|
60
|
-
description do
|
61
|
-
res = "be executable"
|
62
|
-
res += " by #{@by}" unless @by.nil?
|
63
|
-
res += " by user #{@by_user}" unless @by_user.nil?
|
64
|
-
res
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
RSpec::Matchers.define :contain_duplicates do
|
69
|
-
match do |arr|
|
70
|
-
dup = arr.select { |element| arr.count(element) > 1 }
|
71
|
-
!dup.uniq.empty?
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
# for packages
|
76
|
-
RSpec::Matchers.define :be_installed do
|
77
|
-
match do |package|
|
78
|
-
package.installed? == true
|
79
|
-
end
|
80
|
-
|
81
|
-
failure_message do |package|
|
82
|
-
"expected that `#{package}` is installed"
|
83
|
-
end
|
84
|
-
|
85
|
-
chain :by do
|
86
|
-
raise "[UNSUPPORTED] Please use the new resources 'gem', 'npm' or 'pip'."
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
# for services
|
91
|
-
RSpec::Matchers.define :be_enabled do
|
92
|
-
match do |service|
|
93
|
-
service.enabled? == true
|
94
|
-
end
|
95
|
-
|
96
|
-
chain :with_level do |_level|
|
97
|
-
raise "[UNSUPPORTED] with level is not supported"
|
98
|
-
end
|
99
|
-
|
100
|
-
failure_message do |service|
|
101
|
-
"expected that `#{service}` is enabled"
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
# service resource matcher for serverspec compatibility
|
106
|
-
# Deprecated: You should not use this matcher anymore
|
107
|
-
RSpec::Matchers.define :be_running do
|
108
|
-
match do |service|
|
109
|
-
service.running? == true
|
110
|
-
end
|
111
|
-
|
112
|
-
chain :under do |_under|
|
113
|
-
raise "[UNSUPPORTED] under is not supported"
|
114
|
-
end
|
115
|
-
|
116
|
-
failure_message do |service|
|
117
|
-
"expected that `#{service}` is running"
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
# matcher to check if host is reachable
|
122
|
-
RSpec::Matchers.define :be_reachable do
|
123
|
-
match do |host|
|
124
|
-
host.reachable? == true
|
125
|
-
end
|
126
|
-
|
127
|
-
chain :with do |_attr|
|
128
|
-
raise "[UNSUPPORTED] `with` is not supported in combination with `be_reachable`"
|
129
|
-
end
|
130
|
-
|
131
|
-
failure_message do |host|
|
132
|
-
"expected that host #{host} is reachable"
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
# matcher to check if host is resolvable
|
137
|
-
RSpec::Matchers.define :be_resolvable do
|
138
|
-
match do |host|
|
139
|
-
host.resolvable? == true
|
140
|
-
end
|
141
|
-
|
142
|
-
chain :by do |_type|
|
143
|
-
raise "[UNSUPPORTED] `by` is not supported in combination with `be_resolvable`. Please use the following syntax `host('example.com', port: 53, proto: 'udp')`."
|
144
|
-
end
|
145
|
-
|
146
|
-
failure_message do |host|
|
147
|
-
"expected that host #{host} is resolvable"
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
# matcher for iptables and ip6tables
|
152
|
-
RSpec::Matchers.define :have_rule do |rule|
|
153
|
-
match do |tables|
|
154
|
-
tables.has_rule?(rule)
|
155
|
-
end
|
156
|
-
|
157
|
-
chain :with_table do |_table|
|
158
|
-
raise "[UNSUPPORTED] `with_table` is not supported in combination with `have_rule`. Please use the following syntax `iptables(table:'mangle', chain: 'input')`."
|
159
|
-
end
|
160
|
-
|
161
|
-
chain :with_chain do |_chain|
|
162
|
-
raise "[UNSUPPORTED] `with_table` is not supported in combination with `with_chain`. Please use the following syntax `iptables(table:'mangle', chain: 'input')`."
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
# `be_in` matcher
|
167
|
-
# You can use it in the following cases:
|
168
|
-
# - check if an item or array is included in a given array
|
169
|
-
# eg:
|
170
|
-
# describe nginx do
|
171
|
-
# its('user') { should be_in AUTHORIZED_USER_LIST }
|
172
|
-
# end
|
173
|
-
# describe nginx do
|
174
|
-
# its('module_list') { should be_in AUTHORIZED_MODULE_LIST }
|
175
|
-
# end
|
176
|
-
RSpec::Matchers.define :be_in do |list|
|
177
|
-
match do |item|
|
178
|
-
# Handle both single item and array
|
179
|
-
item.is_a?(Array) ? (item - list).empty? : list.include?(item)
|
180
|
-
end
|
181
|
-
|
182
|
-
match_when_negated do |item|
|
183
|
-
# Handle both single item and array
|
184
|
-
item.is_a?(Array) ? (item & list).empty? : !list.include?(item)
|
185
|
-
end
|
186
|
-
|
187
|
-
failure_message do |item|
|
188
|
-
if item.is_a?(Array)
|
189
|
-
"expected `#{item}` to be in the list: `#{list}` \nDiff:\n #{(item - list)}"
|
190
|
-
else
|
191
|
-
"expected `#{item}` to be in the list: `#{list}`"
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
failure_message_when_negated do |item|
|
196
|
-
if item.is_a?(Array)
|
197
|
-
"expected `#{item}` not to be in the list: `#{list}` \nComm:\n #{(item & list)}"
|
198
|
-
else
|
199
|
-
"expected `#{item}` not to be in the list: `#{list}`"
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
# This matcher implements a compare feature that cannot be covered by the default
|
205
|
-
# `eq` matcher
|
206
|
-
# You can use it in the following cases:
|
207
|
-
# - compare strings case-insensitive
|
208
|
-
# - you expect a number (strings will be converted if possible)
|
209
|
-
#
|
210
|
-
RSpec::Matchers.define :cmp do |first_expected| # rubocop:disable Metrics/BlockLength
|
211
|
-
|
212
|
-
def integer?(value)
|
213
|
-
!(value =~ /\A-?0+\Z|\A-?[1-9]\d*\Z/).nil?
|
214
|
-
end
|
215
|
-
|
216
|
-
def float?(value)
|
217
|
-
Float(value)
|
218
|
-
true
|
219
|
-
rescue ArgumentError, TypeError
|
220
|
-
false
|
221
|
-
end
|
222
|
-
|
223
|
-
def octal?(value)
|
224
|
-
return false unless value.is_a?(String)
|
225
|
-
|
226
|
-
!(value =~ /\A0+[0-7]+\Z/).nil?
|
227
|
-
end
|
228
|
-
|
229
|
-
def boolean?(value)
|
230
|
-
%w{true false}.include?(value.downcase)
|
231
|
-
end
|
232
|
-
|
233
|
-
def version?(value)
|
234
|
-
Gem::Version.new(value)
|
235
|
-
true
|
236
|
-
rescue ArgumentError => _ex
|
237
|
-
false
|
238
|
-
end
|
239
|
-
|
240
|
-
# expects that the values have been checked with boolean?
|
241
|
-
def to_boolean(value)
|
242
|
-
value.casecmp("true") == 0
|
243
|
-
end
|
244
|
-
|
245
|
-
def try_match(actual, op, expected) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
|
246
|
-
# if actual and expected are strings
|
247
|
-
if expected.is_a?(String) && actual.is_a?(String)
|
248
|
-
return actual.casecmp(expected) == 0 if op == :==
|
249
|
-
return Gem::Version.new(actual).send(op, Gem::Version.new(expected)) if
|
250
|
-
version?(expected) && version?(actual)
|
251
|
-
elsif expected.is_a?(Regexp) && (actual.is_a?(String) || actual.is_a?(Integer))
|
252
|
-
return !actual.to_s.match(expected).nil?
|
253
|
-
elsif expected.is_a?(String) && integer?(expected) && actual.is_a?(Integer)
|
254
|
-
return actual.send(op, expected.to_i)
|
255
|
-
elsif expected.is_a?(String) && boolean?(expected) && [true, false].include?(actual)
|
256
|
-
return actual.send(op, to_boolean(expected))
|
257
|
-
elsif expected.is_a?(Integer) && actual.is_a?(String) && integer?(actual)
|
258
|
-
return actual.to_i.send(op, expected)
|
259
|
-
elsif expected.is_a?(Float) && float?(actual)
|
260
|
-
return actual.to_f.send(op, expected)
|
261
|
-
elsif actual.is_a?(Symbol) && expected.is_a?(String)
|
262
|
-
return try_match(actual.to_s, op, expected)
|
263
|
-
elsif octal?(expected) && actual.is_a?(Integer)
|
264
|
-
return actual.send(op, expected.to_i(8))
|
265
|
-
end
|
266
|
-
|
267
|
-
# fallback to simple operation
|
268
|
-
actual.send(op, expected)
|
269
|
-
rescue NameError => _
|
270
|
-
false
|
271
|
-
rescue ArgumentError
|
272
|
-
false
|
273
|
-
end
|
274
|
-
|
275
|
-
match do |actual|
|
276
|
-
@operation ||= :==
|
277
|
-
@expected ||= first_expected
|
278
|
-
return actual === @expected if @operation == :=== # rubocop:disable Style/CaseEquality
|
279
|
-
|
280
|
-
actual = actual[0] if actual.is_a?(Array) && !@expected.is_a?(Array) && actual.length == 1
|
281
|
-
try_match(actual, @operation, @expected)
|
282
|
-
end
|
283
|
-
|
284
|
-
%i{== != < <= >= > === =~}.each do |op|
|
285
|
-
chain(op) do |x|
|
286
|
-
@operation = op
|
287
|
-
@expected = x
|
288
|
-
end
|
289
|
-
end
|
290
|
-
|
291
|
-
def format_expectation(negate)
|
292
|
-
return "expected: " + @expected.inspect if @operation == :== && !negate
|
293
|
-
|
294
|
-
negate_str = negate ? "not " : ""
|
295
|
-
"expected it #{negate_str}to be #{@operation} #{@expected.inspect}"
|
296
|
-
end
|
297
|
-
|
298
|
-
failure_message do |actual|
|
299
|
-
actual = ("0" + actual.to_s(8)) if octal?(@expected)
|
300
|
-
"\n" + format_expectation(false) + "\n got: #{actual.inspect}\n\n(compared using `cmp` matcher)\n"
|
301
|
-
end
|
302
|
-
|
303
|
-
failure_message_when_negated do |actual|
|
304
|
-
actual = ("0" + actual.to_s(8)).inspect if octal?(@expected)
|
305
|
-
"\n" + format_expectation(true) + "\n got: #{actual.inspect}\n\n(compared using `cmp` matcher)\n"
|
306
|
-
end
|
307
|
-
|
308
|
-
description do
|
309
|
-
"cmp #{@operation} #{@expected.inspect}"
|
310
|
-
end
|
311
|
-
end
|
312
|
-
|
313
|
-
# user resource matcher for serverspec compatibility
|
314
|
-
# This matcher will be deprecated in future
|
315
|
-
RSpec::Matchers.define :be_mounted do
|
316
|
-
match do |path|
|
317
|
-
if !@options.nil?
|
318
|
-
path.mounted?(@options, @identical)
|
319
|
-
else
|
320
|
-
path.mounted?
|
321
|
-
end
|
322
|
-
end
|
323
|
-
|
324
|
-
chain :with do |attr|
|
325
|
-
@options = attr
|
326
|
-
@identical = false
|
327
|
-
end
|
328
|
-
|
329
|
-
chain :only_with do |attr|
|
330
|
-
@options = attr
|
331
|
-
@identical = true
|
332
|
-
end
|
333
|
-
|
334
|
-
failure_message do |path|
|
335
|
-
if !@options.nil?
|
336
|
-
"\n#{path} is not mounted with the options\n expected: #{@options}\n got: #{path.mount_options}\n"
|
337
|
-
else
|
338
|
-
"\n#{path} is not mounted\n"
|
339
|
-
end
|
340
|
-
end
|
341
|
-
end
|