inspec 2.3.10 → 2.3.23
Sign up to get free protection for your applications and to get access to all the features.
- 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/host.md.erb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: About the host Resource
|
3
|
-
platform: os
|
4
|
-
---
|
5
|
-
|
6
|
-
# host
|
7
|
-
|
8
|
-
Use the `host` InSpec audit resource to test the name used to refer to a specific host and its availability, including the Internet protocols and ports over which that host name should be available.
|
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 `host` resource block declares a host name, and then (depending on what is to be tested) a port and/or a protocol:
|
25
|
-
|
26
|
-
describe host('example.com', port: 80, protocol: 'tcp') do
|
27
|
-
it { should be_reachable }
|
28
|
-
it { should be_resolvable }
|
29
|
-
its('ipaddress') { should include '12.34.56.78' }
|
30
|
-
end
|
31
|
-
|
32
|
-
where
|
33
|
-
|
34
|
-
* `host()` must specify a host name and may specify a port number and/or a protocol
|
35
|
-
* `'example.com'` is the host name
|
36
|
-
* `port:` is the port number
|
37
|
-
* `protocol: 'name'` is the Internet protocol: TCP (`protocol: 'tcp'`), UDP (`protocol: 'udp'` or ICMP (`protocol: 'icmp'`))
|
38
|
-
|
39
|
-
<br>
|
40
|
-
|
41
|
-
## Resource Properties
|
42
|
-
|
43
|
-
* `connection`, `ipaddress`, `protocol`, `socket`
|
44
|
-
|
45
|
-
<br>
|
46
|
-
|
47
|
-
## Resource Examples
|
48
|
-
|
49
|
-
The following examples show how to use this InSpec audit resource.
|
50
|
-
|
51
|
-
### ipaddress
|
52
|
-
|
53
|
-
The `ipaddress` matcher tests if a host name is resolvable to a specific IP address:
|
54
|
-
|
55
|
-
describe host('example.com') do
|
56
|
-
its('ipaddress') { should include '93.184.216.34' }
|
57
|
-
end
|
58
|
-
|
59
|
-
### Verify host name is reachable over a specific protocol and port number
|
60
|
-
|
61
|
-
describe host('example.com', port: 80, protocol: 'tcp') do
|
62
|
-
it { should be_reachable }
|
63
|
-
end
|
64
|
-
|
65
|
-
### Verify that a specific IP address can be resolved
|
66
|
-
|
67
|
-
describe host('example.com') do
|
68
|
-
it { should be_resolvable }
|
69
|
-
its('ipaddress') { should include '93.184.216.34' }
|
70
|
-
end
|
71
|
-
|
72
|
-
### Review the connection setup and socket contents when checking reachability
|
73
|
-
|
74
|
-
describe host('example.com', port: 12345, protocol: 'tcp') do
|
75
|
-
it { should be_reachable }
|
76
|
-
its('connection') { should_not match /connection refused/ }
|
77
|
-
its('socket') { should match /STATUS_OK/ }
|
78
|
-
end
|
79
|
-
|
80
|
-
<br>
|
81
|
-
|
82
|
-
## Matchers
|
83
|
-
|
84
|
-
This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
85
|
-
|
86
|
-
### be_reachable
|
87
|
-
|
88
|
-
The `be_reachable` matcher tests if the host name is available:
|
89
|
-
|
90
|
-
it { should be_reachable }
|
91
|
-
|
92
|
-
### be_resolvable
|
93
|
-
|
94
|
-
The `be_resolvable` matcher tests for host name resolution, i.e. "resolvable to an IP address":
|
95
|
-
|
96
|
-
it { should be_resolvable }
|
data/docs/resources/http.md.erb
DELETED
@@ -1,207 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: About the http Resource
|
3
|
-
platform: linux
|
4
|
-
---
|
5
|
-
|
6
|
-
# http
|
7
|
-
|
8
|
-
Use the `http` InSpec audit resource to test an http endpoint.
|
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.10.0 of InSpec.
|
21
|
-
|
22
|
-
## Syntax
|
23
|
-
|
24
|
-
An `http` resource block declares the configuration settings to be tested:
|
25
|
-
|
26
|
-
describe http('url', auth: {user: 'user', pass: 'test'}, params: {params}, method: 'method', headers: {headers}, data: data, open_timeout: 60, read_timeout: 60, ssl_verify: true) do
|
27
|
-
its('status') { should eq number }
|
28
|
-
its('body') { should eq 'body' }
|
29
|
-
its('headers.name') { should eq 'header' }
|
30
|
-
end
|
31
|
-
|
32
|
-
where
|
33
|
-
|
34
|
-
* `('url')` is the url to test
|
35
|
-
* `auth: { user: 'user', pass: 'test' }` may be specified for basic auth request
|
36
|
-
* `{params}` may be specified for http request parameters
|
37
|
-
* `'method'` may be specified for http request method (default to 'GET')
|
38
|
-
* `{headers}` may be specified for http request headers
|
39
|
-
* `data` may be specified for http request body
|
40
|
-
* `open_timeout` may be specified for a timeout for opening connections (default to 60)
|
41
|
-
* `read_timeout` may be specified for a timeout for reading connections (default to 60)
|
42
|
-
* `ssl_verify` may be specified to enable or disable verification of SSL certificates (default to `true`)
|
43
|
-
|
44
|
-
<br>
|
45
|
-
|
46
|
-
## Example
|
47
|
-
|
48
|
-
The following examples show how to use this InSpec audit resource. An `http` resource block declares the configuration settings to be tested:
|
49
|
-
|
50
|
-
### Simple http test
|
51
|
-
|
52
|
-
For example, a service is listening on default http port can be tested like this:
|
53
|
-
|
54
|
-
describe http('http://localhost') do
|
55
|
-
its('status') { should cmp 200 }
|
56
|
-
end
|
57
|
-
|
58
|
-
### Complex http test
|
59
|
-
|
60
|
-
describe http('http://localhost:8080/ping',
|
61
|
-
auth: {user: 'user', pass: 'test'},
|
62
|
-
params: {format: 'html'},
|
63
|
-
method: 'POST',
|
64
|
-
headers: {'Content-Type' => 'application/json'},
|
65
|
-
data: '{"data":{"a":"1","b":"five"}}') do
|
66
|
-
its('status') { should cmp 200 }
|
67
|
-
its('body') { should cmp 'pong' }
|
68
|
-
its('headers.Content-Type') { should cmp 'text/html' }
|
69
|
-
end
|
70
|
-
|
71
|
-
<br>
|
72
|
-
|
73
|
-
## Local vs. Remote
|
74
|
-
|
75
|
-
Beginning with InSpec 1.41, you can enable the ability to have the HTTP test execute on the remote target:
|
76
|
-
|
77
|
-
describe http('http://www.example.com', enable_remote_worker: true) do
|
78
|
-
its('body') { should cmp 'awesome' }
|
79
|
-
end
|
80
|
-
|
81
|
-
In InSpec 2.0, the HTTP test will automatically execute remotely whenever InSpec is testing a remote node.
|
82
|
-
|
83
|
-
<br>
|
84
|
-
|
85
|
-
## Parameters
|
86
|
-
|
87
|
-
* `url`, `auth`, `params`, `method`, `headers`, `data`, `open_timeout`, `read_timeout`, `ssl_verify`
|
88
|
-
|
89
|
-
## Parameter Examples
|
90
|
-
|
91
|
-
### url
|
92
|
-
|
93
|
-
`('url')` is the url to test.
|
94
|
-
|
95
|
-
describe http('http://localhost:8080/ping') do
|
96
|
-
...
|
97
|
-
end
|
98
|
-
|
99
|
-
### auth
|
100
|
-
|
101
|
-
`auth: { user: 'user', pass: 'test' }` may be specified for basic auth request.
|
102
|
-
|
103
|
-
describe http('http://localhost:8080/ping',
|
104
|
-
auth: {user: 'user', pass: 'test'}) do
|
105
|
-
...
|
106
|
-
end
|
107
|
-
|
108
|
-
### params
|
109
|
-
|
110
|
-
`{params}` may be specified for http request parameters.
|
111
|
-
|
112
|
-
describe http('http://localhost:8080/ping',
|
113
|
-
params: {format: 'html'}) do
|
114
|
-
...
|
115
|
-
end
|
116
|
-
|
117
|
-
### method
|
118
|
-
|
119
|
-
`'method'` may be specified for http request method (default to 'GET').
|
120
|
-
|
121
|
-
describe http('http://localhost:8080/ping',
|
122
|
-
method: 'POST') do
|
123
|
-
...
|
124
|
-
end
|
125
|
-
|
126
|
-
### headers
|
127
|
-
|
128
|
-
`{headers}` may be specified for http request headers.
|
129
|
-
|
130
|
-
describe http('http://localhost:8080/ping',
|
131
|
-
headers: {'Content-Type' => 'application/json'}) do
|
132
|
-
...
|
133
|
-
end
|
134
|
-
|
135
|
-
### data
|
136
|
-
|
137
|
-
`data` may be specified for http request body.
|
138
|
-
|
139
|
-
describe http('http://localhost:8080/ping',
|
140
|
-
data: '{"data":{"a":"1","b":"five"}}') do
|
141
|
-
...
|
142
|
-
end
|
143
|
-
|
144
|
-
### open_timeout
|
145
|
-
|
146
|
-
`open_timeout` may be specified for a timeout for opening connections (default to 60).
|
147
|
-
|
148
|
-
describe http('http://localhost:8080/ping',
|
149
|
-
open_timeout: '90') do
|
150
|
-
...
|
151
|
-
end
|
152
|
-
|
153
|
-
### read_timeout
|
154
|
-
|
155
|
-
`read_timeout` may be specified for a timeout for reading connections (default to 60).
|
156
|
-
|
157
|
-
describe http('http://localhost:8080/ping',
|
158
|
-
read_timeout: '90') do
|
159
|
-
...
|
160
|
-
end
|
161
|
-
|
162
|
-
### ssl_verify
|
163
|
-
|
164
|
-
`ssl_verify` may be specified to enable or disable verification of SSL certificates (default to `true`).
|
165
|
-
|
166
|
-
describe http('http://localhost:8080/ping',
|
167
|
-
ssl_verify: true) do
|
168
|
-
...
|
169
|
-
end
|
170
|
-
|
171
|
-
<br>
|
172
|
-
|
173
|
-
## Properties
|
174
|
-
|
175
|
-
* `body`, `headers`, `http_method`, `status`,
|
176
|
-
|
177
|
-
<br>
|
178
|
-
|
179
|
-
## Property Examples
|
180
|
-
|
181
|
-
### body
|
182
|
-
|
183
|
-
The `body` matcher tests body content of http response:
|
184
|
-
|
185
|
-
its('body') { should eq 'hello\n' }
|
186
|
-
|
187
|
-
### headers
|
188
|
-
|
189
|
-
The `headers` matcher returns an hash of all http headers:
|
190
|
-
|
191
|
-
its('headers') { should eq {} }
|
192
|
-
|
193
|
-
Individual headers can be tested via:
|
194
|
-
|
195
|
-
its('headers.Content-Type') { should cmp 'text/html' }
|
196
|
-
|
197
|
-
### status
|
198
|
-
|
199
|
-
The `status` matcher tests status of the http response:
|
200
|
-
|
201
|
-
its('status') { should eq 200 }
|
202
|
-
|
203
|
-
<br>
|
204
|
-
|
205
|
-
## Matchers
|
206
|
-
|
207
|
-
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
@@ -1,132 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: About the iis_app Resource
|
3
|
-
platform: windows
|
4
|
-
---
|
5
|
-
|
6
|
-
# iis_app
|
7
|
-
|
8
|
-
Use the `iis_app` InSpec audit resource to test the state of IIS on Windows Server 2012 (and later).
|
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.28.0 of InSpec.
|
21
|
-
|
22
|
-
## Syntax
|
23
|
-
|
24
|
-
An `iis_app` resource block declares details about the named site:
|
25
|
-
|
26
|
-
describe iis_app('application_path', 'site_name') do
|
27
|
-
it { should exist }
|
28
|
-
it { should have_application_pool('application_pool') }
|
29
|
-
it { should have_protocols('protocol') }
|
30
|
-
it { should have_site_name('site') }
|
31
|
-
it { should have_physical_path('physical_path') }
|
32
|
-
it { should have_path('application_path') }
|
33
|
-
end
|
34
|
-
|
35
|
-
where
|
36
|
-
|
37
|
-
* `'application_path'` is the path to the application, such as `'/myapp'`
|
38
|
-
* `'site_name'` is the name of the site, such as `'Default Web Site'`
|
39
|
-
* `('application_pool')` is the name of the application pool in which the site's root application is run, such as `'DefaultAppPool'`
|
40
|
-
* `('protocols')` is a binding for the site, such as `'http'`. A site may have multiple bindings; therefore, use a `have_protocol` matcher for each site protocol to be tested
|
41
|
-
* `('physical_path')` is the physical path to the application, such as `'C:\\inetpub\\wwwroot\\myapp'`
|
42
|
-
|
43
|
-
For example:
|
44
|
-
|
45
|
-
describe iis_app('/myapp', 'Default Web Site') do
|
46
|
-
it { should exist }
|
47
|
-
it { should have_application_pool('MyAppPool') }
|
48
|
-
it { should have_protocols('http') }
|
49
|
-
it { should have_site_name('Default Web Site') }
|
50
|
-
it { should have_physical_path('C:\\inetpub\\wwwroot\\myapp') }
|
51
|
-
it { should have_path('\\My Application') }
|
52
|
-
end
|
53
|
-
|
54
|
-
<br>
|
55
|
-
|
56
|
-
## Properties
|
57
|
-
application\_pool, path, physical\_path, protocols, site\_name
|
58
|
-
|
59
|
-
<br>
|
60
|
-
|
61
|
-
## Resource Examples
|
62
|
-
|
63
|
-
The following examples show how to use this InSpec audit resource.
|
64
|
-
|
65
|
-
### Test a default IIS web application
|
66
|
-
|
67
|
-
describe iis_app('Default Web Site') do
|
68
|
-
it { should exist }
|
69
|
-
it { should be_running }
|
70
|
-
it { should have_app_pool('DefaultAppPool') }
|
71
|
-
it { should have_binding('http *:80:') }
|
72
|
-
it { should have_path('%SystemDrive%\\inetpub\\wwwroot') }
|
73
|
-
end
|
74
|
-
|
75
|
-
### Test if IIS service is running
|
76
|
-
|
77
|
-
describe service('W3SVC') do
|
78
|
-
it { should be_installed }
|
79
|
-
it { should be_running }
|
80
|
-
end
|
81
|
-
|
82
|
-
<br>
|
83
|
-
|
84
|
-
## Matchers
|
85
|
-
|
86
|
-
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
87
|
-
|
88
|
-
### exist
|
89
|
-
|
90
|
-
The `exist` matcher tests if the site exists:
|
91
|
-
|
92
|
-
it { should exist }
|
93
|
-
|
94
|
-
### have\_application\_pool
|
95
|
-
|
96
|
-
The `have_application_pool` matcher tests if the named application pool exists for the web application:
|
97
|
-
|
98
|
-
it { should have_application_pool('DefaultAppPool') }
|
99
|
-
|
100
|
-
### have_protocol
|
101
|
-
|
102
|
-
The `have_protocol` matcher tests if the specified protocol exists for the web application:
|
103
|
-
|
104
|
-
it { should have_protocol('http') }
|
105
|
-
|
106
|
-
or:
|
107
|
-
|
108
|
-
it { should have_protocol('https') }
|
109
|
-
|
110
|
-
A web application may have multiple bindings; use a `have_protocol` matcher for each unique web application binding to be tested.
|
111
|
-
|
112
|
-
##### Protocol Attributes
|
113
|
-
|
114
|
-
The `have_protocol` matcher can also test attributes that are defined for a web application enabledProtocols.
|
115
|
-
|
116
|
-
it { should have_protocol('http') }
|
117
|
-
|
118
|
-
For example, testing a site that doesn't have https enabled:
|
119
|
-
|
120
|
-
it { should_not have_protocol('https') }
|
121
|
-
it { should have_protocol('http') }
|
122
|
-
|
123
|
-
Testing a web application with https enabled and http enabled:
|
124
|
-
|
125
|
-
it { should have_protocol('https') }
|
126
|
-
it { should have_protocol('http') }
|
127
|
-
|
128
|
-
### have\_physical\_path
|
129
|
-
|
130
|
-
The `have_physical_path` matcher tests if the named path is defined for the web application:
|
131
|
-
|
132
|
-
it { should have_physical_path('C:\\inetpub\\wwwroot') }
|
@@ -1,145 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: About the iis_site Resource
|
3
|
-
platform: windows
|
4
|
-
---
|
5
|
-
|
6
|
-
# iis_site
|
7
|
-
|
8
|
-
Use the `iis_site` InSpec audit resource to test the state of IIS on Windows Server 2012 (and later).
|
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
|
-
An `iis_site` resource block declares details about the named site:
|
25
|
-
|
26
|
-
describe iis_site('site_name') do
|
27
|
-
it { should exist }
|
28
|
-
it { should be_running }
|
29
|
-
it { should have_app_pool('app_pool_name') }
|
30
|
-
it { should have_binding('binding_details') }
|
31
|
-
it { should have_path('path_to_site') }
|
32
|
-
end
|
33
|
-
|
34
|
-
where
|
35
|
-
|
36
|
-
* `'site_name'` is the name of the site, such as `'Default Web Site'`
|
37
|
-
* `('app_pool_name')` is the name of the application pool in which the site's root application is run, such as `'DefaultAppPool'`
|
38
|
-
* `('binding_details')` is a binding for the site, such as `'net.pipe *'`. A site may have multiple bindings; therefore, use a `have_binding` matcher for each site binding to be tested
|
39
|
-
* `('path_to_site')` is the path to the site, such as `'C:\\inetpub\\wwwroot'`
|
40
|
-
|
41
|
-
For example:
|
42
|
-
|
43
|
-
describe iis_site('Default Web Site') do
|
44
|
-
it { should exist }
|
45
|
-
it { should be_running }
|
46
|
-
it { should have_app_pool('DefaultAppPool') }
|
47
|
-
it { should have_binding('https :443:www.contoso.com sslFlags=0') }
|
48
|
-
it { should have_binding('net.pipe *') }
|
49
|
-
it { should have_path('C:\\inetpub\\wwwroot') }
|
50
|
-
end
|
51
|
-
|
52
|
-
<br>
|
53
|
-
|
54
|
-
## Properties
|
55
|
-
|
56
|
-
app\_pool, bindings, path, state
|
57
|
-
|
58
|
-
<br>
|
59
|
-
|
60
|
-
## Property Examples
|
61
|
-
|
62
|
-
The following examples show how to use this InSpec audit resource.
|
63
|
-
|
64
|
-
### Test a default IIS site
|
65
|
-
|
66
|
-
describe iis_site('Default Web Site') do
|
67
|
-
it { should exist }
|
68
|
-
it { should be_running }
|
69
|
-
it { should have_app_pool('DefaultAppPool') }
|
70
|
-
it { should have_binding('http *:80:') }
|
71
|
-
it { should have_path('%SystemDrive%\\inetpub\\wwwroot') }
|
72
|
-
end
|
73
|
-
|
74
|
-
### Test if IIS service is running
|
75
|
-
|
76
|
-
describe service('W3SVC') do
|
77
|
-
it { should be_installed }
|
78
|
-
it { should be_running }
|
79
|
-
end
|
80
|
-
|
81
|
-
<br>
|
82
|
-
|
83
|
-
## Matchers
|
84
|
-
|
85
|
-
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
86
|
-
|
87
|
-
### be_running
|
88
|
-
|
89
|
-
The `be_running` matcher tests if the site is running:
|
90
|
-
|
91
|
-
it { should be_running }
|
92
|
-
|
93
|
-
### exist
|
94
|
-
|
95
|
-
The `exist` matcher tests if the site exists:
|
96
|
-
|
97
|
-
it { should exist }
|
98
|
-
|
99
|
-
### have\_app\_pool
|
100
|
-
|
101
|
-
The `have_app_pool` matcher tests if the named application pool exists for the site:
|
102
|
-
|
103
|
-
it { should have_app_pool('DefaultAppPool') }
|
104
|
-
|
105
|
-
For example, testing if a site's application pool inherits the settings of the parent application pool:
|
106
|
-
|
107
|
-
it { should have_app_pool('/') }
|
108
|
-
|
109
|
-
### have_binding
|
110
|
-
|
111
|
-
The `have_binding` matcher tests if the specified binding exists for the site:
|
112
|
-
|
113
|
-
it { should have_binding('http :80:*') }
|
114
|
-
|
115
|
-
or:
|
116
|
-
|
117
|
-
it { should have_binding('net.pipe *') }
|
118
|
-
|
119
|
-
A site may have multiple bindings; use a `have_binding` matcher for each unique site binding to be tested.
|
120
|
-
|
121
|
-
##### Binding Attributes
|
122
|
-
|
123
|
-
The `have_binding` matcher can also test attributes that are defined for a site binding. For example, the `sslFlags` attribute defines if SSL is enabled, and (when enabled) what level of SSL is applied to the site.
|
124
|
-
|
125
|
-
Testing a site with SSL disabled:
|
126
|
-
|
127
|
-
it { should have_binding('https :443:www.contoso.com sslFlags=0') }
|
128
|
-
|
129
|
-
Testing a site with SSL enabled:
|
130
|
-
|
131
|
-
it { should have_binding('https :443:www.contoso.com sslFlags=Ssl') }
|
132
|
-
|
133
|
-
Testing a site with certificate mapping authentication enabled:
|
134
|
-
|
135
|
-
it { should have_binding('https :443:www.contoso.com sslFlags=SslMapCert') }
|
136
|
-
|
137
|
-
Testing a site with 128-bit SSL enabled:
|
138
|
-
|
139
|
-
it { should have_binding('https :443:www.contoso.com sslFlags=Ssl128') }
|
140
|
-
|
141
|
-
### have_path
|
142
|
-
|
143
|
-
The `have_path` matcher tests if the named path is defined for the site:
|
144
|
-
|
145
|
-
it { should have_path('C:\\inetpub\\wwwroot') }
|