inspec 2.3.10 → 2.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -13
- data/etc/plugin_filters.json +25 -0
- data/inspec.gemspec +3 -3
- data/lib/bundles/inspec-compliance/api.rb +3 -0
- data/lib/bundles/inspec-compliance/configuration.rb +3 -0
- data/lib/bundles/inspec-compliance/http.rb +3 -0
- data/lib/bundles/inspec-compliance/support.rb +3 -0
- data/lib/bundles/inspec-compliance/target.rb +3 -0
- data/lib/inspec/objects/attribute.rb +3 -0
- data/lib/inspec/plugin/v2.rb +3 -0
- data/lib/inspec/plugin/v2/filter.rb +62 -0
- data/lib/inspec/plugin/v2/installer.rb +21 -1
- data/lib/inspec/plugin/v2/loader.rb +4 -0
- data/lib/inspec/profile.rb +3 -1
- data/lib/inspec/version.rb +1 -1
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +25 -3
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb +65 -11
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb +5 -1
- data/lib/resources/package.rb +1 -1
- metadata +5 -253
- data/MAINTAINERS.toml +0 -52
- data/docs/.gitignore +0 -2
- data/docs/README.md +0 -41
- data/docs/dev/control-eval.md +0 -62
- data/docs/dev/filtertable-internals.md +0 -353
- data/docs/dev/filtertable-usage.md +0 -533
- data/docs/dev/integration-testing.md +0 -31
- data/docs/dev/plugins.md +0 -323
- data/docs/dsl_inspec.md +0 -354
- data/docs/dsl_resource.md +0 -100
- data/docs/glossary.md +0 -381
- data/docs/habitat.md +0 -193
- data/docs/inspec_and_friends.md +0 -114
- data/docs/matchers.md +0 -161
- data/docs/migration.md +0 -293
- data/docs/platforms.md +0 -119
- data/docs/plugin_kitchen_inspec.md +0 -60
- data/docs/plugins.md +0 -57
- data/docs/profiles.md +0 -576
- data/docs/reporters.md +0 -170
- data/docs/resources/aide_conf.md.erb +0 -86
- data/docs/resources/apache.md.erb +0 -77
- data/docs/resources/apache_conf.md.erb +0 -78
- data/docs/resources/apt.md.erb +0 -81
- data/docs/resources/audit_policy.md.erb +0 -57
- data/docs/resources/auditd.md.erb +0 -89
- data/docs/resources/auditd_conf.md.erb +0 -78
- data/docs/resources/aws_cloudtrail_trail.md.erb +0 -165
- data/docs/resources/aws_cloudtrail_trails.md.erb +0 -96
- data/docs/resources/aws_cloudwatch_alarm.md.erb +0 -101
- data/docs/resources/aws_cloudwatch_log_metric_filter.md.erb +0 -164
- data/docs/resources/aws_config_delivery_channel.md.erb +0 -111
- data/docs/resources/aws_config_recorder.md.erb +0 -96
- data/docs/resources/aws_ebs_volume.md.erb +0 -76
- data/docs/resources/aws_ebs_volumes.md.erb +0 -86
- data/docs/resources/aws_ec2_instance.md.erb +0 -122
- data/docs/resources/aws_ec2_instances.md.erb +0 -89
- data/docs/resources/aws_elb.md.erb +0 -154
- data/docs/resources/aws_elbs.md.erb +0 -252
- data/docs/resources/aws_flow_log.md.erb +0 -128
- data/docs/resources/aws_iam_access_key.md.erb +0 -139
- data/docs/resources/aws_iam_access_keys.md.erb +0 -214
- data/docs/resources/aws_iam_group.md.erb +0 -74
- data/docs/resources/aws_iam_groups.md.erb +0 -92
- data/docs/resources/aws_iam_password_policy.md.erb +0 -92
- data/docs/resources/aws_iam_policies.md.erb +0 -97
- data/docs/resources/aws_iam_policy.md.erb +0 -264
- data/docs/resources/aws_iam_role.md.erb +0 -79
- data/docs/resources/aws_iam_root_user.md.erb +0 -86
- data/docs/resources/aws_iam_user.md.erb +0 -130
- data/docs/resources/aws_iam_users.md.erb +0 -289
- data/docs/resources/aws_kms_key.md.erb +0 -187
- data/docs/resources/aws_kms_keys.md.erb +0 -99
- data/docs/resources/aws_rds_instance.md.erb +0 -76
- data/docs/resources/aws_route_table.md.erb +0 -63
- data/docs/resources/aws_route_tables.md.erb +0 -65
- data/docs/resources/aws_s3_bucket.md.erb +0 -156
- data/docs/resources/aws_s3_bucket_object.md.erb +0 -99
- data/docs/resources/aws_s3_buckets.md.erb +0 -69
- data/docs/resources/aws_security_group.md.erb +0 -323
- data/docs/resources/aws_security_groups.md.erb +0 -107
- data/docs/resources/aws_sns_subscription.md.erb +0 -140
- data/docs/resources/aws_sns_topic.md.erb +0 -79
- data/docs/resources/aws_sns_topics.md.erb +0 -68
- data/docs/resources/aws_subnet.md.erb +0 -150
- data/docs/resources/aws_subnets.md.erb +0 -142
- data/docs/resources/aws_vpc.md.erb +0 -135
- data/docs/resources/aws_vpcs.md.erb +0 -135
- data/docs/resources/azure_generic_resource.md.erb +0 -183
- data/docs/resources/azure_resource_group.md.erb +0 -294
- data/docs/resources/azure_virtual_machine.md.erb +0 -357
- data/docs/resources/azure_virtual_machine_data_disk.md.erb +0 -234
- data/docs/resources/bash.md.erb +0 -85
- data/docs/resources/bond.md.erb +0 -100
- data/docs/resources/bridge.md.erb +0 -67
- data/docs/resources/bsd_service.md.erb +0 -77
- data/docs/resources/chocolatey_package.md.erb +0 -68
- data/docs/resources/command.md.erb +0 -176
- data/docs/resources/cpan.md.erb +0 -89
- data/docs/resources/cran.md.erb +0 -74
- data/docs/resources/crontab.md.erb +0 -103
- data/docs/resources/csv.md.erb +0 -64
- data/docs/resources/dh_params.md.erb +0 -221
- data/docs/resources/directory.md.erb +0 -40
- data/docs/resources/docker.md.erb +0 -240
- data/docs/resources/docker_container.md.erb +0 -113
- data/docs/resources/docker_image.md.erb +0 -104
- data/docs/resources/docker_plugin.md.erb +0 -80
- data/docs/resources/docker_service.md.erb +0 -124
- data/docs/resources/elasticsearch.md.erb +0 -252
- data/docs/resources/etc_fstab.md.erb +0 -135
- data/docs/resources/etc_group.md.erb +0 -85
- data/docs/resources/etc_hosts.md.erb +0 -88
- data/docs/resources/etc_hosts_allow.md.erb +0 -84
- data/docs/resources/etc_hosts_deny.md.erb +0 -84
- data/docs/resources/file.md.erb +0 -543
- data/docs/resources/filesystem.md.erb +0 -51
- data/docs/resources/firewalld.md.erb +0 -117
- data/docs/resources/gem.md.erb +0 -108
- data/docs/resources/group.md.erb +0 -71
- data/docs/resources/grub_conf.md.erb +0 -111
- data/docs/resources/host.md.erb +0 -96
- data/docs/resources/http.md.erb +0 -207
- data/docs/resources/iis_app.md.erb +0 -132
- data/docs/resources/iis_site.md.erb +0 -145
- data/docs/resources/inetd_conf.md.erb +0 -104
- data/docs/resources/ini.md.erb +0 -86
- data/docs/resources/interface.md.erb +0 -68
- data/docs/resources/iptables.md.erb +0 -74
- data/docs/resources/json.md.erb +0 -73
- data/docs/resources/kernel_module.md.erb +0 -130
- data/docs/resources/kernel_parameter.md.erb +0 -63
- data/docs/resources/key_rsa.md.erb +0 -95
- data/docs/resources/launchd_service.md.erb +0 -67
- data/docs/resources/limits_conf.md.erb +0 -85
- data/docs/resources/login_defs.md.erb +0 -81
- data/docs/resources/mount.md.erb +0 -79
- data/docs/resources/mssql_session.md.erb +0 -78
- data/docs/resources/mysql_conf.md.erb +0 -109
- data/docs/resources/mysql_session.md.erb +0 -84
- data/docs/resources/nginx.md.erb +0 -89
- data/docs/resources/nginx_conf.md.erb +0 -148
- data/docs/resources/npm.md.erb +0 -78
- data/docs/resources/ntp_conf.md.erb +0 -70
- data/docs/resources/oneget.md.erb +0 -63
- data/docs/resources/oracledb_session.md.erb +0 -103
- data/docs/resources/os.md.erb +0 -153
- data/docs/resources/os_env.md.erb +0 -101
- data/docs/resources/package.md.erb +0 -130
- data/docs/resources/packages.md.erb +0 -77
- data/docs/resources/parse_config.md.erb +0 -113
- data/docs/resources/parse_config_file.md.erb +0 -148
- data/docs/resources/passwd.md.erb +0 -151
- data/docs/resources/pip.md.erb +0 -77
- data/docs/resources/port.md.erb +0 -147
- data/docs/resources/postgres_conf.md.erb +0 -89
- data/docs/resources/postgres_hba_conf.md.erb +0 -103
- data/docs/resources/postgres_ident_conf.md.erb +0 -86
- data/docs/resources/postgres_session.md.erb +0 -79
- data/docs/resources/powershell.md.erb +0 -112
- data/docs/resources/processes.md.erb +0 -119
- data/docs/resources/rabbitmq_config.md.erb +0 -51
- data/docs/resources/registry_key.md.erb +0 -197
- data/docs/resources/runit_service.md.erb +0 -67
- data/docs/resources/security_policy.md.erb +0 -57
- data/docs/resources/service.md.erb +0 -131
- data/docs/resources/shadow.md.erb +0 -267
- data/docs/resources/ssh_config.md.erb +0 -83
- data/docs/resources/sshd_config.md.erb +0 -93
- data/docs/resources/ssl.md.erb +0 -129
- data/docs/resources/sys_info.md.erb +0 -52
- data/docs/resources/systemd_service.md.erb +0 -67
- data/docs/resources/sysv_service.md.erb +0 -67
- data/docs/resources/upstart_service.md.erb +0 -67
- data/docs/resources/user.md.erb +0 -150
- data/docs/resources/users.md.erb +0 -137
- data/docs/resources/vbscript.md.erb +0 -65
- data/docs/resources/virtualization.md.erb +0 -67
- data/docs/resources/windows_feature.md.erb +0 -69
- data/docs/resources/windows_hotfix.md.erb +0 -63
- data/docs/resources/windows_task.md.erb +0 -95
- data/docs/resources/wmi.md.erb +0 -91
- data/docs/resources/x509_certificate.md.erb +0 -161
- data/docs/resources/xinetd_conf.md.erb +0 -166
- data/docs/resources/xml.md.erb +0 -95
- data/docs/resources/yaml.md.erb +0 -79
- data/docs/resources/yum.md.erb +0 -108
- data/docs/resources/zfs_dataset.md.erb +0 -63
- data/docs/resources/zfs_pool.md.erb +0 -57
- data/docs/shared/matcher_be.md.erb +0 -1
- data/docs/shared/matcher_cmp.md.erb +0 -43
- data/docs/shared/matcher_eq.md.erb +0 -3
- data/docs/shared/matcher_include.md.erb +0 -1
- data/docs/shared/matcher_match.md.erb +0 -1
- data/docs/shell.md +0 -217
- data/docs/style.md +0 -178
- data/examples/README.md +0 -8
- data/examples/custom-resource/README.md +0 -3
- data/examples/custom-resource/controls/example.rb +0 -7
- data/examples/custom-resource/inspec.yml +0 -8
- data/examples/custom-resource/libraries/batsignal.rb +0 -20
- data/examples/custom-resource/libraries/gordon.rb +0 -21
- data/examples/inheritance/README.md +0 -65
- data/examples/inheritance/controls/example.rb +0 -14
- data/examples/inheritance/inspec.yml +0 -16
- data/examples/kitchen-ansible/.kitchen.yml +0 -25
- data/examples/kitchen-ansible/Gemfile +0 -19
- data/examples/kitchen-ansible/README.md +0 -53
- data/examples/kitchen-ansible/files/nginx.repo +0 -6
- data/examples/kitchen-ansible/tasks/main.yml +0 -16
- data/examples/kitchen-ansible/test/integration/default/default.yml +0 -5
- data/examples/kitchen-ansible/test/integration/default/web_spec.rb +0 -28
- data/examples/kitchen-chef/.kitchen.yml +0 -20
- data/examples/kitchen-chef/Berksfile +0 -3
- data/examples/kitchen-chef/Gemfile +0 -19
- data/examples/kitchen-chef/README.md +0 -27
- data/examples/kitchen-chef/metadata.rb +0 -7
- data/examples/kitchen-chef/recipes/default.rb +0 -6
- data/examples/kitchen-chef/recipes/nginx.rb +0 -30
- data/examples/kitchen-chef/test/integration/default/web_spec.rb +0 -28
- data/examples/kitchen-puppet/.kitchen.yml +0 -23
- data/examples/kitchen-puppet/Gemfile +0 -20
- data/examples/kitchen-puppet/Puppetfile +0 -25
- data/examples/kitchen-puppet/README.md +0 -53
- data/examples/kitchen-puppet/manifests/site.pp +0 -33
- data/examples/kitchen-puppet/metadata.json +0 -11
- data/examples/kitchen-puppet/modules/.gitkeep +0 -0
- data/examples/kitchen-puppet/test/integration/default/web_spec.rb +0 -28
- data/examples/meta-profile/README.md +0 -37
- data/examples/meta-profile/controls/example.rb +0 -13
- data/examples/meta-profile/inspec.yml +0 -13
- data/examples/plugins/inspec-resource-lister/Gemfile +0 -12
- data/examples/plugins/inspec-resource-lister/LICENSE +0 -13
- data/examples/plugins/inspec-resource-lister/README.md +0 -62
- data/examples/plugins/inspec-resource-lister/Rakefile +0 -40
- data/examples/plugins/inspec-resource-lister/inspec-resource-lister.gemspec +0 -45
- data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister.rb +0 -16
- data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/cli_command.rb +0 -70
- data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/plugin.rb +0 -55
- data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/version.rb +0 -10
- data/examples/plugins/inspec-resource-lister/test/fixtures/README.md +0 -24
- data/examples/plugins/inspec-resource-lister/test/functional/README.md +0 -18
- data/examples/plugins/inspec-resource-lister/test/functional/inspec_resource_lister_test.rb +0 -110
- data/examples/plugins/inspec-resource-lister/test/helper.rb +0 -26
- data/examples/plugins/inspec-resource-lister/test/unit/README.md +0 -17
- data/examples/plugins/inspec-resource-lister/test/unit/cli_args_test.rb +0 -64
- data/examples/plugins/inspec-resource-lister/test/unit/plugin_def_test.rb +0 -51
- data/examples/profile-attribute.yml +0 -2
- data/examples/profile-attribute/README.md +0 -14
- data/examples/profile-attribute/controls/example.rb +0 -11
- data/examples/profile-attribute/inspec.yml +0 -8
- data/examples/profile-aws/controls/iam_password_policy_expiration.rb +0 -8
- data/examples/profile-aws/controls/iam_password_policy_max_age.rb +0 -8
- data/examples/profile-aws/controls/iam_root_user_mfa.rb +0 -8
- data/examples/profile-aws/controls/iam_users_access_key_age.rb +0 -8
- data/examples/profile-aws/controls/iam_users_console_users_mfa.rb +0 -8
- data/examples/profile-aws/inspec.yml +0 -11
- data/examples/profile-azure/controls/azure_resource_group_example.rb +0 -24
- data/examples/profile-azure/controls/azure_vm_example.rb +0 -29
- data/examples/profile-azure/inspec.yml +0 -11
- data/examples/profile-sensitive/README.md +0 -29
- data/examples/profile-sensitive/controls/sensitive-failures.rb +0 -9
- data/examples/profile-sensitive/controls/sensitive.rb +0 -9
- data/examples/profile-sensitive/inspec.yml +0 -8
- data/examples/profile/README.md +0 -48
- data/examples/profile/controls/example.rb +0 -24
- data/examples/profile/controls/gordon.rb +0 -36
- data/examples/profile/controls/meta.rb +0 -36
- data/examples/profile/inspec.yml +0 -11
- data/examples/profile/libraries/gordon_config.rb +0 -59
data/docs/resources/yum.md.erb
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: About the yum Resource
|
|
3
|
-
platform: linux
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# yum
|
|
7
|
-
|
|
8
|
-
Use the `yum` InSpec audit resource to test packages in the Yum repository.
|
|
9
|
-
|
|
10
|
-
<br>
|
|
11
|
-
|
|
12
|
-
## Availability
|
|
13
|
-
|
|
14
|
-
### Installation
|
|
15
|
-
|
|
16
|
-
This resource is distributed along with InSpec itself. You can use it automatically.
|
|
17
|
-
|
|
18
|
-
### Version
|
|
19
|
-
|
|
20
|
-
This resource first became available in v1.0.0 of InSpec.
|
|
21
|
-
|
|
22
|
-
## Syntax
|
|
23
|
-
|
|
24
|
-
A `yum` resource block declares a package repo, tests if the package repository is present, and if it that package repository is a valid package source (i.e. "is enabled"):
|
|
25
|
-
|
|
26
|
-
describe yum.repo('name') do
|
|
27
|
-
it { should exist }
|
|
28
|
-
it { should be_enabled }
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
where
|
|
32
|
-
|
|
33
|
-
* `repo('name')` is the (optional) name of a package repo, using either a full identifier (`'updates/7/x86_64'`) or a short identifier (`'updates'`)
|
|
34
|
-
|
|
35
|
-
<br>
|
|
36
|
-
|
|
37
|
-
## Examples
|
|
38
|
-
|
|
39
|
-
The following examples show how to use this InSpec audit resource.
|
|
40
|
-
|
|
41
|
-
### Test if the yum repo exists
|
|
42
|
-
|
|
43
|
-
describe yum do
|
|
44
|
-
its('repos') { should exist }
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
### Test if the 'base/7/x86_64' repo exists and is enabled
|
|
48
|
-
|
|
49
|
-
describe yum do
|
|
50
|
-
its('repos') { should include 'base/7/x86_64' }
|
|
51
|
-
its('epel') { should exist }
|
|
52
|
-
its('epel') { should be_enabled }
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
### Test if a specific yum repo exists
|
|
56
|
-
|
|
57
|
-
describe yum.repo('epel') do
|
|
58
|
-
it { should exist }
|
|
59
|
-
it { should be_enabled }
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
### Test a particular repository configuration, such as its Base URL
|
|
63
|
-
|
|
64
|
-
describe yum.repo('mycompany-artifacts') do
|
|
65
|
-
it { should exist }
|
|
66
|
-
it { should be_enabled }
|
|
67
|
-
its('baseurl') { should include 'mycompany.biz' }
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
<br>
|
|
71
|
-
|
|
72
|
-
## Matchers
|
|
73
|
-
|
|
74
|
-
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
75
|
-
|
|
76
|
-
### be_enabled
|
|
77
|
-
|
|
78
|
-
The `be_enabled` matcher tests if the package repository is a valid package source:
|
|
79
|
-
|
|
80
|
-
it { should be_enabled }
|
|
81
|
-
|
|
82
|
-
### exist
|
|
83
|
-
|
|
84
|
-
The `exist` matcher tests if the package repository exists:
|
|
85
|
-
|
|
86
|
-
it { should exist }
|
|
87
|
-
|
|
88
|
-
### repo('name')
|
|
89
|
-
|
|
90
|
-
The `repo('name')` matcher names a specific package repository:
|
|
91
|
-
|
|
92
|
-
describe yum.repo('epel') do
|
|
93
|
-
...
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
### repos
|
|
97
|
-
|
|
98
|
-
The `repos` matcher tests if a named repo, using either a full identifier (`'updates/7/x86_64'`) or a short identifier (`'updates'`), is included in the Yum repo:
|
|
99
|
-
|
|
100
|
-
its('repos') { should include 'some_repo' }
|
|
101
|
-
|
|
102
|
-
### shortname
|
|
103
|
-
|
|
104
|
-
The `shortname` matcher names a specific package repository's group identifier. For example, if a repository's group name is "Directory Server", the corresponding group identifier is typically "directory-server":
|
|
105
|
-
|
|
106
|
-
describe yum.repo('Directory Server') do
|
|
107
|
-
its('shortname') { should eq 'directory-server' }
|
|
108
|
-
end
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: About the zfs_dataset Resource
|
|
3
|
-
platform: linux
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# zfs_dataset
|
|
7
|
-
|
|
8
|
-
Use the `zfs_dataset` InSpec audit resource to test the ZFS datasets on FreeBSD systems.
|
|
9
|
-
|
|
10
|
-
<br>
|
|
11
|
-
|
|
12
|
-
## Availability
|
|
13
|
-
|
|
14
|
-
### Installation
|
|
15
|
-
|
|
16
|
-
This resource is distributed along with InSpec itself. You can use it automatically.
|
|
17
|
-
|
|
18
|
-
### Version
|
|
19
|
-
|
|
20
|
-
This resource first became available in v1.16.0 of InSpec.
|
|
21
|
-
|
|
22
|
-
## Syntax
|
|
23
|
-
|
|
24
|
-
A `zfs_dataset` resource block declares the ZFS dataset properties that should be tested:
|
|
25
|
-
|
|
26
|
-
describe zfs_dataset('dataset') do
|
|
27
|
-
it { should MATCHER 'value' }
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
where
|
|
31
|
-
|
|
32
|
-
* `('dataset')` is the name of the ZFS dataset (eg: `'tank/tmp'`)
|
|
33
|
-
* `MATCHER` is a valid matcher for this resource
|
|
34
|
-
* `'value'` is the value to be tested
|
|
35
|
-
|
|
36
|
-
<br>
|
|
37
|
-
|
|
38
|
-
## Examples
|
|
39
|
-
|
|
40
|
-
The following examples show how to use this InSpec audit resource.
|
|
41
|
-
|
|
42
|
-
### Test a dataset of 'tank/tmp'
|
|
43
|
-
|
|
44
|
-
describe zfs_dataset('tank/tmp') do
|
|
45
|
-
it { should be_mounted }
|
|
46
|
-
its('atime') { should eq 'on' }
|
|
47
|
-
its('compression') { should eq 'lz4' }
|
|
48
|
-
its('exec') { should eq 'off' }
|
|
49
|
-
its('readonly') { should eq 'off' }
|
|
50
|
-
its('setuid') { should eq 'off' }
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
<br>
|
|
54
|
-
|
|
55
|
-
## Matchers
|
|
56
|
-
|
|
57
|
-
This InSpec audit resource has the matchers listed below, in addition to dynamically exposing all ZFS dataset properties available (see: `man zfs` for the list of supported properties). For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
58
|
-
|
|
59
|
-
### be_mounted
|
|
60
|
-
|
|
61
|
-
The `be_mounted` matcher tests if the dataset is accessible from the file system:
|
|
62
|
-
|
|
63
|
-
it { should be_mounted }
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: About the zfs_pool Resource
|
|
3
|
-
platform: linux
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# zfs_pool
|
|
7
|
-
|
|
8
|
-
Use the `zfs_pool` InSpec audit resource to test the ZFS pools on FreeBSD systems.
|
|
9
|
-
|
|
10
|
-
<br>
|
|
11
|
-
|
|
12
|
-
## Availability
|
|
13
|
-
|
|
14
|
-
### Installation
|
|
15
|
-
|
|
16
|
-
This resource is distributed along with InSpec itself. You can use it automatically.
|
|
17
|
-
|
|
18
|
-
### Version
|
|
19
|
-
|
|
20
|
-
This resource first became available in v1.16.0 of InSpec.
|
|
21
|
-
|
|
22
|
-
## Syntax
|
|
23
|
-
|
|
24
|
-
A `zfs_pool` resource block declares the ZFS pool properties that should be tested:
|
|
25
|
-
|
|
26
|
-
describe zfs_pool('pool') do
|
|
27
|
-
it { should MATCHER 'value' }
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
where
|
|
31
|
-
|
|
32
|
-
* `('pool')` is the name of the ZFS pool (eg: `'tank'`)
|
|
33
|
-
* `MATCHER` is a valid matcher for this resource
|
|
34
|
-
* `'value'` is the value to be tested
|
|
35
|
-
|
|
36
|
-
<br>
|
|
37
|
-
|
|
38
|
-
## Examples
|
|
39
|
-
|
|
40
|
-
The following examples show how to use this InSpec audit resource.
|
|
41
|
-
|
|
42
|
-
### Test a pool of 'tank'
|
|
43
|
-
|
|
44
|
-
describe zfs_pool('tank') do
|
|
45
|
-
its('autoexpand') { should eq 'off' }
|
|
46
|
-
its('failmode') { should eq 'continue' }
|
|
47
|
-
its('feature@lz4_compress') { should eq 'active' }
|
|
48
|
-
its('health') { should eq 'ONLINE' }
|
|
49
|
-
its('listsnapshots') { should eq 'off' }
|
|
50
|
-
its('readonly') { should eq 'off' }
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
<br>
|
|
54
|
-
|
|
55
|
-
## Matchers
|
|
56
|
-
|
|
57
|
-
This InSpec audit resource dynamically exposes all ZFS pool properties available (see: `man zpool` for the list of supported properties). For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Use the `be` matcher to use a comparison operator---`=` (equal to), `>` (greater than), `<` (less than), `>=` (greater than or equal to), and `<=` (less than or equal to)---to compare two values: `its('value') { should be >= value }`, `its('value') { should be < value }`, and so on.
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
Use the `cmp` matcher compare two values, such as comparing strings to numbers, comparing a single value to an array of values, comparing an array of strings to a regular expression, improving the printing of octal values, and comparing while ignoring case sensitivity.
|
|
2
|
-
|
|
3
|
-
Compare a single value to an array:
|
|
4
|
-
|
|
5
|
-
describe some_resource do
|
|
6
|
-
its('users') { should cmp 'root' }
|
|
7
|
-
its('users') { should cmp ['root'] }
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
Compare strings and regular expressions:
|
|
11
|
-
|
|
12
|
-
describe some_resource do
|
|
13
|
-
its('setting') { should cmp /raw/i }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
Compare strings and numbers:
|
|
17
|
-
|
|
18
|
-
describe some_resource do
|
|
19
|
-
its('setting') { should eq '2' }
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
vs:
|
|
23
|
-
|
|
24
|
-
describe some_resource do
|
|
25
|
-
its('setting') { should cmp '2' }
|
|
26
|
-
its('setting') { should cmp 2 }
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
Ignoring case sensitivity:
|
|
30
|
-
|
|
31
|
-
describe some_resource do
|
|
32
|
-
its('setting') { should cmp 'raw' }
|
|
33
|
-
its('setting') { should cmp 'RAW' }
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
Printing octal values:
|
|
37
|
-
|
|
38
|
-
describe some_resource('/proc/cpuinfo') do
|
|
39
|
-
its('mode') { should cmp '0345' }
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
expected: 0345
|
|
43
|
-
got: 0444
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Use the `include` matcher to verify that a string value is included in a list: `its('list') { should include 'string' }`.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Use the `match` matcher to check if a string matches a regular expression: `its('string') { should_not match /regex/ }`.
|
data/docs/shell.md
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: InSpec Shell
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# InSpec Shell
|
|
6
|
-
|
|
7
|
-
The InSpec interactive shell is a pry based REPL that can be used to
|
|
8
|
-
quickly run InSpec controls and tests without having to write it to a
|
|
9
|
-
file. Its functionality is similar to [chef-shell](https://docs.chef.io/chef_shell.html) as it provides a way
|
|
10
|
-
to exercise the InSpec DSL, its resources, tests, and plugins without
|
|
11
|
-
having to create a profile or write a test file. See
|
|
12
|
-
[http://pryrepl.org/](http://pryrepl.org/) for an introduction to what pry is and what it can
|
|
13
|
-
do.
|
|
14
|
-
|
|
15
|
-
See [Explore InSpec resources](https://learn.chef.io/modules/explore-inspec-resources#/) on Learn Chef Rally for a hands-on example that uses InSpec shell.
|
|
16
|
-
|
|
17
|
-
## Launching the shell
|
|
18
|
-
|
|
19
|
-
If you are using InSpec from a platform-specific package (rpm, msi,
|
|
20
|
-
etc.) or from a chef prepared shell in ChefDK, you can directly launch
|
|
21
|
-
InSpec shell against your local machine using the following. See
|
|
22
|
-
<https://docs.chef.io/install_dk.html#set-system-ruby> for details.
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
$ inspec shell
|
|
26
|
-
$ inspec help shell # This will describe inspec shell usage
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
If you wish to connect to a remote machine (called a target within
|
|
30
|
-
InSpec), you can use the `-t` flag. We support connecting using SSH,
|
|
31
|
-
WinRM and docker. If no target is provided, we implicitly support the
|
|
32
|
-
"local" target - i.e. tests running on the current machine running
|
|
33
|
-
InSpec. For an SSH connection, use `-i` for specifying SSH key files,
|
|
34
|
-
and the `--sudo*` commands for requesting a privilege escalation after
|
|
35
|
-
logging in. For a WinRM connection, use `--path` to change the login
|
|
36
|
-
path, `--ssl` to use SSL for transport layer encryption.
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
$ inspec shell -t ssh://root@192.168.64.2:11022 # Login to remote machine using ssh as root.
|
|
40
|
-
$ inspec shell -t ssh://user@hostname:1234 -i /path/to/user_key # Login to hostname on port 1234 as user using given ssh key.
|
|
41
|
-
$ inspec shell -t winrm://UserName:Password@windowsmachine:1234 # Login to windowsmachine over WinRM as UserName.
|
|
42
|
-
$ inspec shell -t docker://container_id # Login to a Docker container.
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Resource Packs
|
|
46
|
-
|
|
47
|
-
Use resource packs to share custom resources with other InSpec users.
|
|
48
|
-
A resource pack is an InSpec profile that contains only custom resources and no other controls or tests.
|
|
49
|
-
|
|
50
|
-
For example, the profile in [`examples/profile`](https://github.com/chef/inspec/tree/master/examples/profile)in the InSpec git repo defines a [`gordon_config` resource](https://github.com/chef/inspec/blob/master/examples/profile/controls/gordon.rb). To use these resources within the InSpec shell, you will need to download and specify them as a dependency.
|
|
51
|
-
|
|
52
|
-
Once you have local access to the profile, you can use the `gordon_config` custom resource provided in the `examples/profile` GitHub repo in your local environment :
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
inspec shell --depends examples/profile
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Once inside the shell your resource will be available:
|
|
59
|
-
|
|
60
|
-
```ruby
|
|
61
|
-
inspec> gordon_config
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Using Ruby in InSpec shell
|
|
65
|
-
|
|
66
|
-
Since InSpec shell is pry based, you may treat the shell as an
|
|
67
|
-
interactive Ruby session. You may write Ruby expressions and evaluate
|
|
68
|
-
them. Source high-lighting, automatic indentation and command history
|
|
69
|
-
(using the up and down arrow keys) are available to make your experience
|
|
70
|
-
more delightful. You can exit the shell using `exit`.
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
$ inspec shell
|
|
74
|
-
Welcome to the interactive InSpec Shell
|
|
75
|
-
To find out how to use it, type: help
|
|
76
|
-
|
|
77
|
-
inspec> 1 + 2
|
|
78
|
-
=> 3
|
|
79
|
-
inspec> exit
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Using InSpec DSL in InSpec shell
|
|
83
|
-
|
|
84
|
-
InSpec shell will automatically evaluate the result of every command as
|
|
85
|
-
if it were a test file. If you type in a Ruby command that is not an
|
|
86
|
-
InSpec control or test, the shell will evaluate it as if it were a
|
|
87
|
-
regular ruby command.
|
|
88
|
-
|
|
89
|
-
Bare InSpec resources are instantiated and their help text is presented.
|
|
90
|
-
You may also access the resource contents or other matchers that they
|
|
91
|
-
define. Run `help <resource>` to get more help on using a particular
|
|
92
|
-
resource or see the InSpec resources documentation online.
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
$ inspec shell
|
|
96
|
-
Welcome to the interactive InSpec Shell
|
|
97
|
-
To find out how to use it, type: help
|
|
98
|
-
|
|
99
|
-
inspec> file('/Users/myuser').directory?
|
|
100
|
-
=> true
|
|
101
|
-
inspec> os_env('HOME')
|
|
102
|
-
=> Environment variable HOME
|
|
103
|
-
inspec> os_env('HOME').content
|
|
104
|
-
=> /Users/myuser
|
|
105
|
-
inspec> exit
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
InSpec tests are immediately executed.
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
inspec> describe file('/Users') # Empty test.
|
|
112
|
-
Summary: 0 successful, 0 failures, 0 skipped
|
|
113
|
-
inspec> describe file('/Users') do # Test with one check.
|
|
114
|
-
inspec> it { should exist }
|
|
115
|
-
inspec> end
|
|
116
|
-
✔ File /Users should exist
|
|
117
|
-
|
|
118
|
-
Summary: 1 successful, 0 failures, 0 skipped
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
All tests in a control are immediately executed as well. If a control is
|
|
122
|
-
redefined in the shell, the old control's tests are destroyed and
|
|
123
|
-
replaced with the redefinition and the control is re-run.
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
inspec> control 'my_control' do
|
|
127
|
-
inspec> describe os_env('HOME') do
|
|
128
|
-
inspec> its('content') { should eq '/Users/myuser' }
|
|
129
|
-
inspec> end
|
|
130
|
-
inspec> end
|
|
131
|
-
✔ my_control: Environment variable HOME content should eq "/Users/myuser"
|
|
132
|
-
|
|
133
|
-
Summary: 1 successful, 0 failures, 0 skipped
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Syntax errors are illegal tests are also detected and reported.
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
inspec> control 'foo' do
|
|
140
|
-
inspec> thisisnonsense
|
|
141
|
-
inspec> end
|
|
142
|
-
NameError: undefined local variable or method `thisisnonsense' for #<#<Class:0x007fd63b571f98>:0x007fd639825cc8>
|
|
143
|
-
from /usr/local/lib/ruby/gems/2.3.0/gems/rspec-expectations-3.5.0/lib/rspec/matchers.rb:967:in `method_missing'
|
|
144
|
-
inspec> control 'foo' do
|
|
145
|
-
inspec> describe file('wut') do
|
|
146
|
-
inspec> its('thismakesnosense') { should cmp 'fail' }
|
|
147
|
-
inspec> end
|
|
148
|
-
inspec> end
|
|
149
|
-
✖ foo: File wut thismakesnosense (undefined method `thismakesnosense' for File wut:Inspec::Resource::Registry::File)
|
|
150
|
-
|
|
151
|
-
Summary: 0 successful, 1 failures, 0 skipped
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
## Running a single InSpec command
|
|
155
|
-
|
|
156
|
-
If you wish to run a single InSpec command and fetch its results, you
|
|
157
|
-
may use the `-c` flag. This is similar to using `bash -c`.
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
$ inspec shell -c 'describe file("/Users/myuser") do it { should exist } end'
|
|
161
|
-
Target: local://
|
|
162
|
-
|
|
163
|
-
✔ File /Users/myuser should exist
|
|
164
|
-
|
|
165
|
-
Summary: 1 successful, 0 failures, 0 skipped
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
$ inspec shell --format json -c 'describe file("/Users/test") do it { should exist } end'
|
|
170
|
-
{
|
|
171
|
-
"version": "1.49.2",
|
|
172
|
-
"controls": [{
|
|
173
|
-
"status": "passed",
|
|
174
|
-
"code_desc": "File /Users/test should exist",
|
|
175
|
-
"run_time": 0.002374,
|
|
176
|
-
"start_time": "2018-01-06 18:32:38 -0500"
|
|
177
|
-
}],
|
|
178
|
-
"other_checks": [],
|
|
179
|
-
"profiles": [{
|
|
180
|
-
"name": "inspec-shell",
|
|
181
|
-
"supports": [],
|
|
182
|
-
"controls": [{
|
|
183
|
-
"title": null,
|
|
184
|
-
"desc": null,
|
|
185
|
-
"impact": 0.5,
|
|
186
|
-
"refs": [],
|
|
187
|
-
"tags": {},
|
|
188
|
-
"code": "",
|
|
189
|
-
"source_location": {
|
|
190
|
-
"ref": "/usr/local/lib/ruby/gems/2.4.0/gems/inspec-1.49.2/lib/inspec/control_eval_context.rb",
|
|
191
|
-
"line": 89
|
|
192
|
-
},
|
|
193
|
-
"id": "(generated from (eval):1 7b6f82c2cc5e4205b3e2c97c8e855f2d)",
|
|
194
|
-
"results": [{
|
|
195
|
-
"status": "passed",
|
|
196
|
-
"code_desc": "File /Users/test should exist",
|
|
197
|
-
"run_time": 0.002374,
|
|
198
|
-
"start_time": "2018-01-06 18:32:38 -0500"
|
|
199
|
-
}]
|
|
200
|
-
}],
|
|
201
|
-
"groups": [{
|
|
202
|
-
"title": null,
|
|
203
|
-
"controls": ["(generated from (eval):1 7b6f82c2cc5e4205b3e2c97c8e855f2d)"],
|
|
204
|
-
"id": "unknown"
|
|
205
|
-
}],
|
|
206
|
-
"attributes": [],
|
|
207
|
-
"sha256": "29c070a90b7e3521babf618215573284a790d92907783d5b2c138f411bfd2e74"
|
|
208
|
-
}],
|
|
209
|
-
"platform": {
|
|
210
|
-
"name": "mac_os_x",
|
|
211
|
-
"release": "17.3.0"
|
|
212
|
-
},
|
|
213
|
-
"statistics": {
|
|
214
|
-
"duration": 0.003171
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
```
|