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,148 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "inspec/resources/command"
|
4
|
-
|
5
|
-
# check for site in IIS
|
6
|
-
# Usage:
|
7
|
-
# describe iis_site('Default Web Site') do
|
8
|
-
# it{ should exist }
|
9
|
-
# it{ should be_running }
|
10
|
-
# it{ should be_in_app_pool('Default App Pool') }
|
11
|
-
# it{ should have_path('C:\\inetpub\wwwroot\\DefaultWebSite') }
|
12
|
-
# it{ should have_binding('https :443:www.contoso.com sslFlags=0') }
|
13
|
-
# it{ should have_binding('net.pipe *') }
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# Note: this is only supported in windows 2012 and later
|
17
|
-
|
18
|
-
module Inspec::Resources
|
19
|
-
class IisSite < Inspec.resource(1)
|
20
|
-
name "iis_site"
|
21
|
-
supports platform: "windows"
|
22
|
-
desc "Tests IIS site configuration on windows. Supported in server 2012+ only"
|
23
|
-
example <<~EXAMPLE
|
24
|
-
describe iis_site('Default Web Site') do
|
25
|
-
it { should exist }
|
26
|
-
it { should be_running }
|
27
|
-
it { should have_app_pool('DefaultAppPool') }
|
28
|
-
it { should have_binding('https :443:www.contoso.com sslFlags=0') }
|
29
|
-
it { should have_binding('net.pipe *') }
|
30
|
-
it { should have_path('C:\\inetpub\\wwwroot') }
|
31
|
-
end
|
32
|
-
EXAMPLE
|
33
|
-
|
34
|
-
def initialize(site_name)
|
35
|
-
@site_name = site_name
|
36
|
-
@cache = nil
|
37
|
-
|
38
|
-
@site_provider = SiteProvider.new(inspec)
|
39
|
-
|
40
|
-
# verify that this resource is only supported on Windows
|
41
|
-
return skip_resource "The `iis_site` resource is not supported on your OS." if inspec.os[:family] != "windows"
|
42
|
-
end
|
43
|
-
|
44
|
-
def app_pool
|
45
|
-
iis_site.nil? ? nil : iis_site[:app_pool]
|
46
|
-
end
|
47
|
-
|
48
|
-
def bindings
|
49
|
-
iis_site.nil? ? nil : iis_site[:bindings]
|
50
|
-
end
|
51
|
-
|
52
|
-
def state
|
53
|
-
iis_site.nil? ? nil : iis_site[:state]
|
54
|
-
end
|
55
|
-
|
56
|
-
def path
|
57
|
-
iis_site.nil? ? nil : iis_site[:path]
|
58
|
-
end
|
59
|
-
|
60
|
-
def exists?
|
61
|
-
!iis_site.nil? && !iis_site[:name].nil?
|
62
|
-
end
|
63
|
-
|
64
|
-
def running?
|
65
|
-
iis_site.nil? ? false : (iis_site[:state] == "Started")
|
66
|
-
end
|
67
|
-
|
68
|
-
def has_app_pool?(app_pool)
|
69
|
-
iis_site.nil? ? false : iis_site[:app_pool] == app_pool
|
70
|
-
end
|
71
|
-
|
72
|
-
def has_path?(path)
|
73
|
-
iis_site.nil? ? false : iis_site[:path] == path
|
74
|
-
end
|
75
|
-
|
76
|
-
def has_binding?(binding)
|
77
|
-
iis_site.nil? ? false : (iis_site[:bindings].include? binding)
|
78
|
-
end
|
79
|
-
|
80
|
-
def to_s
|
81
|
-
"iis_site '#{@site_name}'"
|
82
|
-
end
|
83
|
-
|
84
|
-
def iis_site
|
85
|
-
return @cache unless @cache.nil?
|
86
|
-
|
87
|
-
@cache = @site_provider.iis_site(@site_name) unless @site_provider.nil?
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
class SiteProvider
|
92
|
-
attr_reader :inspec
|
93
|
-
|
94
|
-
def initialize(inspec)
|
95
|
-
@inspec = inspec
|
96
|
-
end
|
97
|
-
|
98
|
-
# want to populate everything using one powershell command here and spit it out as json
|
99
|
-
def iis_site(name)
|
100
|
-
command = "Get-Website '#{name}' | Select-Object -Property Name,State,PhysicalPath,bindings,ApplicationPool | ConvertTo-Json"
|
101
|
-
cmd = @inspec.command(command)
|
102
|
-
|
103
|
-
begin
|
104
|
-
site = JSON.parse(cmd.stdout)
|
105
|
-
rescue JSON::ParserError => _e
|
106
|
-
return nil
|
107
|
-
end
|
108
|
-
|
109
|
-
bindings_array = site["bindings"]["Collection"].map do |k|
|
110
|
-
"#{k["protocol"]} #{k["bindingInformation"]}#{k["protocol"] == "https" ? " sslFlags=#{k["sslFlags"]}" : ""}"
|
111
|
-
end
|
112
|
-
|
113
|
-
# map our values to a hash table
|
114
|
-
info = {
|
115
|
-
name: site["name"],
|
116
|
-
state: site["state"],
|
117
|
-
path: site["physicalPath"],
|
118
|
-
bindings: bindings_array,
|
119
|
-
app_pool: site["applicationPool"],
|
120
|
-
}
|
121
|
-
|
122
|
-
info
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
# for compatability with serverspec
|
127
|
-
# this is deprecated syntax and will be removed in future versions
|
128
|
-
class IisSiteServerSpec < IisSite
|
129
|
-
name "iis_website"
|
130
|
-
desc "Tests IIS site configuration on windows. Deprecated, use `iis_site` instead."
|
131
|
-
example <<~EXAMPLE
|
132
|
-
describe iis_website('Default Website') do
|
133
|
-
it{ should exist }
|
134
|
-
it{ should be_running }
|
135
|
-
it{ should be_in_app_pool('Default App Pool') }
|
136
|
-
end
|
137
|
-
EXAMPLE
|
138
|
-
|
139
|
-
def initialize(site_name)
|
140
|
-
Inspec.deprecate(:resource_iis_website, "The `iis_website` resource is deprecated. Please use `iis_site` instead.")
|
141
|
-
super(site_name)
|
142
|
-
end
|
143
|
-
|
144
|
-
def in_app_pool?(app_pool)
|
145
|
-
has_app_pool?(app_pool)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# copyright: 2015, Vulcano Security GmbH
|
2
|
-
|
3
|
-
require "inspec/utils/simpleconfig"
|
4
|
-
require "inspec/utils/file_reader"
|
5
|
-
|
6
|
-
module Inspec::Resources
|
7
|
-
class InetdConf < Inspec.resource(1)
|
8
|
-
name "inetd_conf"
|
9
|
-
supports platform: "unix"
|
10
|
-
desc "Use the inetd_conf InSpec audit resource to test if a service is enabled in the inetd.conf file on Linux and UNIX platforms. inetd---the Internet service daemon---listens on dedicated ports, and then loads the appropriate program based on a request. The inetd.conf file is typically located at /etc/inetd.conf and contains a list of Internet services associated to the ports on which that service will listen. Only enabled services may handle a request; only services that are required by the system should be enabled."
|
11
|
-
example <<~EXAMPLE
|
12
|
-
describe inetd_conf do
|
13
|
-
its('shell') { should eq nil }
|
14
|
-
its('login') { should eq nil }
|
15
|
-
its('exec') { should eq nil }
|
16
|
-
end
|
17
|
-
EXAMPLE
|
18
|
-
|
19
|
-
include FileReader
|
20
|
-
|
21
|
-
def initialize(path = nil)
|
22
|
-
@conf_path = path || "/etc/inetd.conf"
|
23
|
-
@content = read_file_content(@conf_path)
|
24
|
-
end
|
25
|
-
|
26
|
-
# overwrite exec to ensure it works with its
|
27
|
-
# TODO: this needs to be fixed in RSpec
|
28
|
-
def exec
|
29
|
-
read_params["exec"]
|
30
|
-
end
|
31
|
-
|
32
|
-
def method_missing(name)
|
33
|
-
read_params[name.to_s]
|
34
|
-
end
|
35
|
-
|
36
|
-
def read_params
|
37
|
-
return @params if defined?(@params)
|
38
|
-
|
39
|
-
# parse the file
|
40
|
-
conf = SimpleConfig.new(
|
41
|
-
@content,
|
42
|
-
assignment_regex: /^\s*(\S+?)\s+(.*?)\s+(.*?)\s+(.*?)\s+(.*?)\s+(.*?)\s+(.*?)\s*$/,
|
43
|
-
key_values: 6,
|
44
|
-
multiple_values: false
|
45
|
-
)
|
46
|
-
@params = conf.params
|
47
|
-
end
|
48
|
-
|
49
|
-
def to_s
|
50
|
-
"inetd.conf"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
data/lib/inspec/resources/ini.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require "inspec/resources/json"
|
2
|
-
require "inspec/utils/simpleconfig"
|
3
|
-
|
4
|
-
module Inspec::Resources
|
5
|
-
class IniConfig < JsonConfig
|
6
|
-
name "ini"
|
7
|
-
supports platform: "unix"
|
8
|
-
supports platform: "windows"
|
9
|
-
desc "Use the ini InSpec audit resource to test data in a INI file."
|
10
|
-
example <<~EXAMPLE
|
11
|
-
descibe ini do
|
12
|
-
its('auth_protocol') { should eq 'https' }
|
13
|
-
end
|
14
|
-
EXAMPLE
|
15
|
-
# override file load and parse hash with simple config
|
16
|
-
def parse(content)
|
17
|
-
SimpleConfig.new(content).params
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
# used by JsonConfig to build up a full to_s method
|
23
|
-
# based on whether a file path, content, or command was supplied.
|
24
|
-
def resource_base_name
|
25
|
-
"INI"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,204 +0,0 @@
|
|
1
|
-
require "inspec/resources/command"
|
2
|
-
require "inspec/utils/convert"
|
3
|
-
require "inspec/utils/simpleconfig"
|
4
|
-
|
5
|
-
module Inspec::Resources
|
6
|
-
class NetworkInterface < Inspec.resource(1)
|
7
|
-
name "interface"
|
8
|
-
supports platform: "unix"
|
9
|
-
supports platform: "windows"
|
10
|
-
desc "Use the interface InSpec audit resource to test basic network adapter properties, such as name, status, and link speed (in MB/sec)."
|
11
|
-
example <<~EXAMPLE
|
12
|
-
describe interface('eth0') do
|
13
|
-
it { should exist }
|
14
|
-
it { should be_up }
|
15
|
-
its('speed') { should eq 1000 }
|
16
|
-
its('ipv4_addresses') { should include '127.0.0.1' }
|
17
|
-
its('ipv6_cidrs') { should include '::1/128' }
|
18
|
-
end
|
19
|
-
EXAMPLE
|
20
|
-
|
21
|
-
def initialize(iface)
|
22
|
-
@iface = iface
|
23
|
-
end
|
24
|
-
|
25
|
-
def exists?
|
26
|
-
!!(interface_info && interface_info[:name])
|
27
|
-
end
|
28
|
-
|
29
|
-
def up?
|
30
|
-
!!(interface_info && interface_info[:up])
|
31
|
-
end
|
32
|
-
|
33
|
-
def name
|
34
|
-
interface_info[:name]
|
35
|
-
end
|
36
|
-
|
37
|
-
# returns link speed in Mbits/sec
|
38
|
-
def speed
|
39
|
-
interface_info && interface_info[:speed]
|
40
|
-
end
|
41
|
-
|
42
|
-
def ipv4_address?
|
43
|
-
ipv4_addresses && !ipv4_addresses.empty?
|
44
|
-
end
|
45
|
-
|
46
|
-
def ipv6_address?
|
47
|
-
ipv6_addresses && !ipv6_addresses.empty?
|
48
|
-
end
|
49
|
-
|
50
|
-
def ipv4_addresses
|
51
|
-
ipv4_cidrs.map { |i| i.split("/")[0] }
|
52
|
-
end
|
53
|
-
|
54
|
-
def ipv6_addresses
|
55
|
-
ipv6_cidrs.map { |i| i.split("/")[0] }
|
56
|
-
end
|
57
|
-
|
58
|
-
def ipv4_addresses_netmask
|
59
|
-
ipv4_cidrs.map { |i| i.split("/") }.map do |addr, netlen|
|
60
|
-
binmask = "#{"1" * netlen.to_i}#{"0" * (32 - netlen.to_i)}".to_i(2)
|
61
|
-
netmask = []
|
62
|
-
(1..4).each do |_byte|
|
63
|
-
netmask.unshift(binmask & 255)
|
64
|
-
binmask = binmask >> 8
|
65
|
-
end
|
66
|
-
"#{addr}/#{netmask.join(".")}"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def ipv4_cidrs
|
71
|
-
interface_info && Array(interface_info[:ipv4_addresses])
|
72
|
-
end
|
73
|
-
|
74
|
-
def ipv6_cidrs
|
75
|
-
interface_info && Array(interface_info[:ipv6_addresses])
|
76
|
-
end
|
77
|
-
|
78
|
-
def to_s
|
79
|
-
"Interface #{@iface}"
|
80
|
-
end
|
81
|
-
|
82
|
-
private
|
83
|
-
|
84
|
-
def interface_info
|
85
|
-
@cache ||= begin
|
86
|
-
provider = LinuxInterface.new(inspec) if inspec.os.linux?
|
87
|
-
provider = WindowsInterface.new(inspec) if inspec.os.windows?
|
88
|
-
Hash(provider && provider.interface_info(@iface))
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
class InterfaceInfo
|
94
|
-
include Converter
|
95
|
-
attr_reader :inspec
|
96
|
-
def initialize(inspec)
|
97
|
-
@inspec = inspec
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
class LinuxInterface < InterfaceInfo
|
102
|
-
def interface_info(iface)
|
103
|
-
# will return "[mtu]\n1500\n[type]\n1"
|
104
|
-
cmd = inspec.command("find /sys/class/net/#{iface}/ -maxdepth 1 -type f -exec sh -c 'echo \"[$(basename {})]\"; cat {} || echo -n' \\;")
|
105
|
-
return nil if cmd.exit_status.to_i != 0
|
106
|
-
|
107
|
-
# parse values, we only recieve values, therefore we threat them as keys
|
108
|
-
params = SimpleConfig.new(cmd.stdout.chomp).params
|
109
|
-
|
110
|
-
# abort if we got an empty result-set
|
111
|
-
return nil if params.empty?
|
112
|
-
|
113
|
-
# parse state
|
114
|
-
state = false
|
115
|
-
if params.key?("operstate")
|
116
|
-
operstate, _value = params["operstate"].first
|
117
|
-
state = operstate == "up"
|
118
|
-
end
|
119
|
-
|
120
|
-
# parse speed
|
121
|
-
speed = nil
|
122
|
-
if params.key?("speed")
|
123
|
-
speed, _value = params["speed"].first
|
124
|
-
speed = convert_to_i(speed)
|
125
|
-
end
|
126
|
-
|
127
|
-
family_addresses = addresses(iface)
|
128
|
-
{
|
129
|
-
name: iface,
|
130
|
-
up: state,
|
131
|
-
speed: speed,
|
132
|
-
ipv4_addresses: family_addresses["inet"],
|
133
|
-
ipv6_addresses: family_addresses["inet6"],
|
134
|
-
}
|
135
|
-
end
|
136
|
-
|
137
|
-
private
|
138
|
-
|
139
|
-
def addresses(iface)
|
140
|
-
addrs_by_family = { "inet6" => [], "inet" => [] }
|
141
|
-
[4, 6].each do |v|
|
142
|
-
cmd = inspec.command("/sbin/ip -br -#{v} address show dev #{iface}")
|
143
|
-
next unless cmd.exit_status.to_i == 0
|
144
|
-
|
145
|
-
family = v == 6 ? "inet6" : "inet"
|
146
|
-
|
147
|
-
cmd.stdout.each_line do |line|
|
148
|
-
_dev, _state, *addrs = line.split(/\s+/)
|
149
|
-
addrs_by_family[family] = addrs
|
150
|
-
end
|
151
|
-
end
|
152
|
-
addrs_by_family
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
class WindowsInterface < InterfaceInfo
|
157
|
-
def interface_info(iface)
|
158
|
-
# gather all network interfaces
|
159
|
-
cmd = inspec.command("Get-NetAdapter | Select-Object -Property Name, InterfaceDescription, Status, State, " \
|
160
|
-
"MacAddress, LinkSpeed, ReceiveLinkSpeed, TransmitLinkSpeed, Virtual | ConvertTo-Json")
|
161
|
-
|
162
|
-
addr_cmd = inspec.command("Get-NetIPAddress | Select-Object -Property IPv6Address, IPv4Address, InterfaceAlias," \
|
163
|
-
" PrefixLength | ConvertTo-Json")
|
164
|
-
|
165
|
-
# filter network interface
|
166
|
-
begin
|
167
|
-
net_adapter = JSON.parse(cmd.stdout)
|
168
|
-
addresses = JSON.parse(addr_cmd.stdout)
|
169
|
-
rescue JSON::ParserError => _e
|
170
|
-
return nil
|
171
|
-
end
|
172
|
-
|
173
|
-
# ensure we have an array of groups
|
174
|
-
net_adapter = [net_adapter] unless net_adapter.is_a?(Array)
|
175
|
-
addresses = [addresses] unless addresses.is_a?(Array)
|
176
|
-
|
177
|
-
# select the requested interface
|
178
|
-
adapters = net_adapter.each_with_object([]) do |adapter, adapter_collection|
|
179
|
-
# map object
|
180
|
-
info = {
|
181
|
-
name: adapter["Name"],
|
182
|
-
up: adapter["State"] == 2,
|
183
|
-
speed: adapter["ReceiveLinkSpeed"] / 1000,
|
184
|
-
ipv4_addresses: addresses_for_proto(addresses, adapter["Name"], "IPv4"),
|
185
|
-
ipv6_addresses: addresses_for_proto(addresses, adapter["Name"], "IPv6"),
|
186
|
-
}
|
187
|
-
adapter_collection.push(info) if info[:name].casecmp(iface) == 0
|
188
|
-
end
|
189
|
-
|
190
|
-
return nil if adapters.empty?
|
191
|
-
|
192
|
-
warn "[Possible Error] detected multiple network interfaces with the name #{iface}" if adapters.size > 1
|
193
|
-
adapters[0]
|
194
|
-
end
|
195
|
-
|
196
|
-
private
|
197
|
-
|
198
|
-
def addresses_for_proto(all_addresses, iface, proto)
|
199
|
-
all_addresses.select { |i| i["InterfaceAlias"] == iface }
|
200
|
-
.map { |i| "#{i["#{proto}Address"]}/#{i["PrefixLength"]}" unless i["#{proto}Address"].nil? }
|
201
|
-
.compact
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
require "inspec/resources/command"
|
2
|
-
|
3
|
-
# Usage:
|
4
|
-
# describe ip6tables do
|
5
|
-
# it { should have_rule('-P INPUT ACCEPT') }
|
6
|
-
# end
|
7
|
-
#
|
8
|
-
# The following serverspec sytax is not implemented:
|
9
|
-
# describe ip6tables do
|
10
|
-
# it { should have_rule('-P INPUT ACCEPT').with_table('mangle').with_chain('INPUT') }
|
11
|
-
# end
|
12
|
-
# Please use the new sytax:
|
13
|
-
# describe ip6tables(table:'mangle', chain: 'input') do
|
14
|
-
# it { should have_rule('-P INPUT ACCEPT') }
|
15
|
-
# end
|
16
|
-
#
|
17
|
-
# Note: Docker containers normally do not have ip6tables installed
|
18
|
-
#
|
19
|
-
# @see http://ipset.netfilter.org/ip6tables.man.html
|
20
|
-
# @see http://ipset.netfilter.org/ip6tables.man.html
|
21
|
-
module Inspec::Resources
|
22
|
-
class Ip6Tables < Inspec.resource(1)
|
23
|
-
name "ip6tables"
|
24
|
-
supports platform: "linux"
|
25
|
-
desc "Use the ip6tables InSpec audit resource to test rules that are defined in ip6tables, which maintains tables of IP packet filtering rules. There may be more than one table. Each table contains one (or more) chains (both built-in and custom). A chain is a list of rules that match packets. When the rule matches, the rule defines what target to assign to the packet."
|
26
|
-
example <<~EXAMPLE
|
27
|
-
describe ip6tables do
|
28
|
-
it { should have_rule('-P INPUT ACCEPT') }
|
29
|
-
end
|
30
|
-
EXAMPLE
|
31
|
-
|
32
|
-
def initialize(params = {})
|
33
|
-
@table = params[:table]
|
34
|
-
@chain = params[:chain]
|
35
|
-
|
36
|
-
# we're done if we are on linux
|
37
|
-
return if inspec.os.linux?
|
38
|
-
|
39
|
-
# ensures, all calls are aborted for non-supported os
|
40
|
-
@ip6tables_cache = []
|
41
|
-
skip_resource "The `ip6tables` resource is not supported on your OS yet."
|
42
|
-
end
|
43
|
-
|
44
|
-
def has_rule?(rule = nil, _table = nil, _chain = nil)
|
45
|
-
# checks if the rule is part of the ruleset
|
46
|
-
# for now, we expect an exact match
|
47
|
-
retrieve_rules.any? { |line| line.casecmp(rule) == 0 }
|
48
|
-
end
|
49
|
-
|
50
|
-
def retrieve_rules
|
51
|
-
return @ip6tables_cache if defined?(@ip6tables_cache)
|
52
|
-
|
53
|
-
# construct ip6tables command to read all rules
|
54
|
-
bin = find_ip6tables_or_error
|
55
|
-
table_cmd = "-t #{@table}" if @table
|
56
|
-
ip6tables_cmd = format("%s %s -S %s", bin, table_cmd, @chain).strip
|
57
|
-
|
58
|
-
cmd = inspec.command(ip6tables_cmd)
|
59
|
-
return [] if cmd.exit_status.to_i != 0
|
60
|
-
|
61
|
-
# split rules, returns array or rules
|
62
|
-
@ip6tables_cache = cmd.stdout.split("\n").map(&:strip)
|
63
|
-
end
|
64
|
-
|
65
|
-
def to_s
|
66
|
-
format("Ip6tables %s %s", @table && "table: #{@table}", @chain && "chain: #{@chain}").strip
|
67
|
-
end
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
def find_ip6tables_or_error
|
72
|
-
%w{/usr/sbin/ip6tables /sbin/ip6tables ip6tables}.each do |cmd|
|
73
|
-
return cmd if inspec.command(cmd).exist?
|
74
|
-
end
|
75
|
-
|
76
|
-
raise Inspec::Exceptions::ResourceFailed, "Could not find `ip6tables`"
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|