inspec 1.0.0 → 1.35.1
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 +933 -101
- data/Gemfile +8 -17
- data/MAINTAINERS.md +2 -1
- data/MAINTAINERS.toml +9 -4
- data/README.md +49 -28
- data/Rakefile +54 -39
- data/bin/inspec +1 -1
- data/docs/dsl_inspec.md +17 -4
- data/docs/dsl_resource.md +1 -1
- data/docs/habitat.md +192 -0
- data/docs/inspec_and_friends.md +4 -2
- data/docs/matchers.md +11 -0
- data/docs/migration.md +293 -0
- data/docs/profiles.md +124 -76
- data/docs/resources/aide_conf.md.erb +81 -0
- data/docs/resources/apache_conf.md.erb +10 -10
- data/docs/resources/apt.md.erb +13 -13
- data/docs/resources/audit_policy.md.erb +10 -10
- data/docs/resources/auditd_conf.md.erb +10 -10
- data/docs/resources/auditd_rules.md.erb +11 -11
- data/docs/resources/bash.md.erb +12 -12
- data/docs/resources/bond.md.erb +15 -15
- data/docs/resources/bridge.md.erb +11 -11
- data/docs/resources/bsd_service.md.erb +11 -11
- data/docs/resources/command.md.erb +23 -23
- data/docs/resources/crontab.md.erb +84 -0
- data/docs/resources/csv.md.erb +10 -10
- data/docs/resources/dh_params.md +191 -0
- data/docs/resources/directory.md.erb +8 -8
- data/docs/resources/docker.md.erb +160 -0
- data/docs/resources/docker_container.md.erb +89 -0
- data/docs/resources/docker_image.md.erb +86 -0
- data/docs/resources/etc_group.md.erb +16 -16
- data/docs/resources/etc_hosts.md.erb +62 -0
- data/docs/resources/file.md.erb +80 -58
- data/docs/resources/gem.md.erb +32 -13
- data/docs/resources/group.md.erb +12 -12
- data/docs/resources/grub_conf.md.erb +11 -11
- data/docs/resources/host.md.erb +27 -18
- data/docs/resources/http.md.erb +104 -0
- data/docs/resources/iis_app.md.erb +126 -0
- data/docs/resources/iis_site.md.erb +17 -17
- data/docs/resources/inetd_conf.md.erb +10 -10
- data/docs/resources/ini.md.erb +9 -9
- data/docs/resources/interface.md.erb +13 -13
- data/docs/resources/iptables.md.erb +21 -14
- data/docs/resources/json.md.erb +11 -11
- data/docs/resources/kernel_module.md.erb +73 -12
- data/docs/resources/kernel_parameter.md.erb +12 -12
- data/docs/resources/key_rsa.md.erb +70 -0
- data/docs/resources/launchd_service.md.erb +11 -11
- data/docs/resources/limits_conf.md.erb +10 -10
- data/docs/resources/login_def.md.erb +12 -12
- data/docs/resources/mount.md.erb +14 -14
- data/docs/resources/mssql_session.md.erb +62 -0
- data/docs/resources/mysql_conf.md.erb +14 -14
- data/docs/resources/mysql_session.md.erb +22 -10
- data/docs/resources/npm.md.erb +13 -13
- data/docs/resources/ntp_conf.md.erb +9 -9
- data/docs/resources/oneget.md.erb +11 -11
- data/docs/resources/oracledb_session.md.erb +53 -0
- data/docs/resources/os.md.erb +17 -17
- data/docs/resources/os_env.md.erb +12 -12
- data/docs/resources/package.md.erb +29 -16
- data/docs/resources/parse_config.md.erb +18 -18
- data/docs/resources/parse_config_file.md.erb +29 -23
- data/docs/resources/{etc_passwd.md.erb → passwd.md.erb} +17 -17
- data/docs/resources/pip.md.erb +15 -15
- data/docs/resources/port.md.erb +23 -23
- data/docs/resources/postgres_conf.md.erb +15 -13
- data/docs/resources/postgres_hba_conf.md.erb +104 -0
- data/docs/resources/postgres_ident_conf.md.erb +87 -0
- data/docs/resources/postgres_session.md.erb +28 -21
- data/docs/resources/powershell.md.erb +14 -14
- data/docs/resources/processes.md.erb +123 -0
- data/docs/resources/rabbitmq_config.md.erb +55 -0
- data/docs/resources/registry_key.md.erb +44 -21
- data/docs/resources/runit_service.md.erb +11 -11
- data/docs/resources/security_policy.md.erb +10 -10
- data/docs/resources/service.md.erb +18 -18
- data/docs/resources/{etc_shadow.md.erb → shadow.md.erb} +19 -19
- data/docs/resources/ssh_config.md.erb +13 -13
- data/docs/resources/sshd_config.md.erb +15 -15
- data/docs/resources/ssl.md.erb +13 -13
- data/docs/resources/sys_info.md.erb +10 -10
- data/docs/resources/systemd_service.md.erb +11 -11
- data/docs/resources/sysv_service.md.erb +11 -11
- data/docs/resources/upstart_service.md.erb +11 -11
- data/docs/resources/user.md.erb +20 -20
- data/docs/resources/users.md.erb +19 -19
- data/docs/resources/vbscript.md.erb +13 -13
- data/docs/resources/virtualization.md.erb +71 -0
- data/docs/resources/windows_feature.md.erb +10 -10
- data/docs/resources/windows_task.md.erb +103 -0
- data/docs/resources/wmi.md.erb +10 -10
- data/docs/resources/x509_certificate.md.erb +146 -0
- data/docs/resources/xinetd_conf.md.erb +17 -17
- data/docs/resources/xml.md.erb +75 -0
- data/docs/resources/yaml.md.erb +25 -11
- data/docs/resources/yum.md.erb +24 -16
- data/docs/resources/zfs_dataset.md.erb +63 -0
- data/docs/resources/zfs_pool.md.erb +57 -0
- data/docs/ruby_usage.md +50 -0
- data/docs/shared/matcher_cmp.md.erb +4 -6
- data/examples/inheritance/README.md +49 -3
- data/examples/inheritance/controls/example.rb +4 -1
- data/examples/inheritance/inspec.yml +3 -1
- data/examples/meta-profile/README.md +29 -3
- data/examples/meta-profile/controls/example.rb +10 -5
- data/examples/meta-profile/inspec.yml +4 -8
- data/examples/profile/README.md +1 -1
- data/examples/profile/controls/example.rb +0 -1
- data/examples/profile/controls/gordon.rb +0 -1
- data/examples/profile/inspec.yml +1 -1
- data/examples/profile-attribute/inspec.yml +1 -1
- data/examples/profile-sensitive/README.md +29 -0
- data/examples/profile-sensitive/controls/sensitive-failures.rb +9 -0
- data/examples/profile-sensitive/controls/sensitive.rb +9 -0
- data/examples/profile-sensitive/inspec.yml +8 -0
- data/inspec.gemspec +10 -2
- data/lib/bundles/inspec-artifact/README.md +1 -0
- data/lib/bundles/inspec-artifact/cli.rb +284 -0
- data/lib/bundles/inspec-artifact.rb +7 -0
- data/lib/bundles/inspec-compliance/README.md +44 -15
- data/lib/bundles/inspec-compliance/api.rb +135 -29
- data/lib/bundles/inspec-compliance/cli.rb +128 -21
- data/lib/bundles/inspec-compliance/configuration.rb +8 -0
- data/lib/bundles/inspec-compliance/http.rb +26 -19
- data/lib/bundles/inspec-compliance/target.rb +50 -25
- data/lib/bundles/inspec-habitat/cli.rb +31 -0
- data/lib/bundles/inspec-habitat/log.rb +10 -0
- data/lib/bundles/inspec-habitat/profile.rb +372 -0
- data/lib/bundles/inspec-habitat.rb +12 -0
- data/lib/bundles/inspec-init/templates/profile/controls/example.rb +0 -1
- data/lib/bundles/inspec-init/templates/profile/inspec.yml +1 -1
- data/lib/bundles/inspec-supermarket/api.rb +7 -5
- data/lib/bundles/inspec-supermarket/cli.rb +2 -2
- data/lib/fetchers/git.rb +4 -2
- data/lib/fetchers/local.rb +4 -1
- data/lib/fetchers/url.rb +64 -10
- data/lib/inspec/archive/tar.rb +1 -1
- data/lib/inspec/backend.rb +26 -3
- data/lib/inspec/base_cli.rb +44 -7
- data/lib/inspec/cached_fetcher.rb +2 -2
- data/lib/inspec/cli.rb +34 -12
- data/lib/inspec/completions/fish.sh.erb +34 -0
- data/lib/inspec/control_eval_context.rb +0 -2
- data/lib/inspec/dependencies/cache.rb +0 -1
- data/lib/inspec/dependencies/dependency_set.rb +2 -2
- data/lib/inspec/dependencies/lockfile.rb +13 -6
- data/lib/inspec/dependencies/requirement.rb +6 -6
- data/lib/inspec/dependencies/resolver.rb +4 -4
- data/lib/inspec/dsl.rb +3 -5
- data/lib/inspec/env_printer.rb +9 -1
- data/lib/inspec/exceptions.rb +8 -0
- data/lib/inspec/fetcher.rb +1 -1
- data/lib/inspec/file_provider.rb +47 -11
- data/lib/inspec/library_eval_context.rb +1 -1
- data/lib/inspec/metadata.rb +62 -18
- data/lib/inspec/method_source.rb +24 -0
- data/lib/inspec/objects/attribute.rb +21 -0
- data/lib/inspec/objects/control.rb +21 -3
- data/lib/inspec/objects/each_loop.rb +2 -1
- data/lib/inspec/objects/list.rb +1 -1
- data/lib/inspec/objects/or_test.rb +17 -2
- data/lib/inspec/objects/tag.rb +27 -0
- data/lib/inspec/objects/test.rb +9 -8
- data/lib/inspec/objects.rb +1 -0
- data/lib/inspec/plugins/fetcher.rb +4 -5
- data/lib/inspec/plugins/resource.rb +1 -2
- data/lib/inspec/plugins/source_reader.rb +3 -3
- data/lib/inspec/plugins.rb +1 -1
- data/lib/inspec/polyfill.rb +0 -1
- data/lib/inspec/profile.rb +92 -23
- data/lib/inspec/profile_context.rb +1 -1
- data/lib/inspec/profile_vendor.rb +66 -0
- data/lib/inspec/resource.rb +29 -3
- data/lib/inspec/rspec_json_formatter.rb +672 -285
- data/lib/inspec/rule.rb +12 -16
- data/lib/inspec/runner.rb +26 -15
- data/lib/inspec/runner_rspec.rb +1 -0
- data/lib/inspec/runtime_profile.rb +26 -0
- data/lib/inspec/schema.rb +185 -0
- data/lib/inspec/secrets/yaml.rb +8 -1
- data/lib/inspec/secrets.rb +1 -1
- data/lib/inspec/shell.rb +92 -22
- data/lib/inspec/source_reader.rb +1 -1
- data/lib/inspec/version.rb +1 -1
- data/lib/inspec.rb +1 -1
- data/lib/matchers/matchers.rb +67 -17
- data/lib/resources/aide_conf.rb +162 -0
- data/lib/resources/apache.rb +0 -1
- data/lib/resources/apache_conf.rb +3 -3
- data/lib/resources/apt.rb +2 -1
- data/lib/resources/audit_policy.rb +0 -1
- data/lib/resources/auditd_conf.rb +1 -2
- data/lib/resources/auditd_rules.rb +5 -5
- data/lib/resources/bond.rb +1 -1
- data/lib/resources/bridge.rb +1 -1
- data/lib/resources/command.rb +5 -3
- data/lib/resources/crontab.rb +102 -0
- data/lib/resources/csv.rb +18 -1
- data/lib/resources/dh_params.rb +84 -0
- data/lib/resources/directory.rb +7 -3
- data/lib/resources/docker.rb +198 -0
- data/lib/resources/docker_container.rb +114 -0
- data/lib/resources/docker_image.rb +96 -0
- data/lib/resources/etc_group.rb +2 -3
- data/lib/resources/etc_hosts.rb +81 -0
- data/lib/resources/file.rb +88 -30
- data/lib/resources/gem.rb +26 -6
- data/lib/resources/groups.rb +4 -5
- data/lib/resources/grub_conf.rb +3 -4
- data/lib/resources/host.rb +175 -35
- data/lib/resources/http.rb +73 -0
- data/lib/resources/iis_app.rb +103 -0
- data/lib/resources/iis_site.rb +23 -0
- data/lib/resources/inetd_conf.rb +9 -4
- data/lib/resources/interface.rb +4 -3
- data/lib/resources/json.rb +37 -14
- data/lib/resources/kernel_module.rb +77 -10
- data/lib/resources/kernel_parameter.rb +0 -1
- data/lib/resources/key_rsa.rb +67 -0
- data/lib/resources/limits_conf.rb +3 -4
- data/lib/resources/login_def.rb +2 -3
- data/lib/resources/mount.rb +34 -4
- data/lib/resources/mssql_session.rb +81 -12
- data/lib/resources/mysql.rb +0 -1
- data/lib/resources/mysql_conf.rb +1 -2
- data/lib/resources/mysql_session.rb +18 -7
- data/lib/resources/nginx_conf.rb +95 -0
- data/lib/resources/ntp_conf.rb +2 -3
- data/lib/resources/oracledb_session.rb +138 -0
- data/lib/resources/os_env.rb +7 -5
- data/lib/resources/package.rb +70 -13
- data/lib/resources/packages.rb +111 -0
- data/lib/resources/parse_config.rb +3 -4
- data/lib/resources/passwd.rb +4 -5
- data/lib/resources/pip.rb +29 -21
- data/lib/resources/port.rb +133 -14
- data/lib/resources/postgres.rb +53 -43
- data/lib/resources/postgres_conf.rb +40 -13
- data/lib/resources/postgres_hba_conf.rb +101 -0
- data/lib/resources/postgres_ident_conf.rb +79 -0
- data/lib/resources/postgres_session.rb +28 -20
- data/lib/resources/powershell.rb +2 -2
- data/lib/resources/processes.rb +61 -26
- data/lib/resources/rabbitmq_conf.rb +53 -0
- data/lib/resources/registry_key.rb +34 -11
- data/lib/resources/security_policy.rb +2 -2
- data/lib/resources/service.rb +17 -7
- data/lib/resources/ssh_conf.rb +17 -6
- data/lib/resources/ssl.rb +3 -4
- data/lib/resources/sys_info.rb +1 -1
- data/lib/resources/toml.rb +26 -0
- data/lib/resources/users.rb +41 -41
- data/lib/resources/virtualization.rb +252 -0
- data/lib/resources/windows_task.rb +106 -0
- data/lib/resources/x509_certificate.rb +143 -0
- data/lib/resources/xinetd.rb +18 -2
- data/lib/resources/xml.rb +27 -0
- data/lib/resources/yaml.rb +10 -2
- data/lib/resources/yum.rb +25 -7
- data/lib/resources/zfs_dataset.rb +60 -0
- data/lib/resources/zfs_pool.rb +49 -0
- data/lib/source_readers/flat.rb +2 -1
- data/lib/source_readers/inspec.rb +30 -11
- data/lib/utils/command_wrapper.rb +3 -3
- data/lib/utils/database_helpers.rb +77 -0
- data/lib/utils/erlang_parser.rb +192 -0
- data/lib/utils/filter.rb +2 -1
- data/lib/utils/filter_array.rb +0 -1
- data/lib/utils/find_files.rb +1 -2
- data/lib/utils/latest_version.rb +21 -0
- data/lib/utils/nginx_parser.rb +76 -0
- data/lib/utils/object_traversal.rb +5 -4
- data/lib/utils/parser.rb +23 -4
- data/lib/utils/plugin_registry.rb +3 -3
- data/lib/utils/simpleconfig.rb +25 -8
- data/lib/utils/spdx.rb +13 -0
- data/lib/utils/spdx.txt +344 -0
- metadata +168 -22
- data/docs/cli.md +0 -342
- data/docs/resources/process.md.erb +0 -73
- /data/docs/{plugin_kitchen_inspec.html.md → plugin_kitchen_inspec.md} +0 -0
data/docs/resources/host.md.erb
CHANGED
|
@@ -6,14 +6,16 @@ title: About the host Resource
|
|
|
6
6
|
|
|
7
7
|
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.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `host` resource block declares a host name, and then (depending on what is to be tested) a port and/or a protocol:
|
|
12
12
|
|
|
13
13
|
.. code-block:: ruby
|
|
14
14
|
|
|
15
|
-
describe host('example.com', port: 80,
|
|
15
|
+
describe host('example.com', port: 80, protocol: 'tcp') do
|
|
16
16
|
it { should be_reachable }
|
|
17
|
+
it { should be_resolvable }
|
|
18
|
+
its('ipaddress') { should include '12.34.56.78' }
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
where
|
|
@@ -21,65 +23,72 @@ where
|
|
|
21
23
|
* `host()` must specify a host name and may specify a port number and/or a protocol
|
|
22
24
|
* `'example.com'` is the host name
|
|
23
25
|
* `port:` is the port number
|
|
24
|
-
* `
|
|
25
|
-
* `be_reachable` is a valid matcher for this resource
|
|
26
|
+
* `protocol: 'name'` is the Internet protocol: TCP (`protocol: 'tcp'`), UDP (`protocol: 'udp'` or ICMP (`protocol: 'icmp'`))
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
## Matchers
|
|
29
30
|
|
|
30
31
|
This InSpec audit resource has the following matchers:
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
### be
|
|
33
34
|
|
|
34
35
|
<%= partial "/shared/matcher_be" %>
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
### be_reachable
|
|
37
38
|
|
|
38
39
|
The `be_reachable` matcher tests if the host name is available:
|
|
39
40
|
|
|
40
41
|
it { should be_reachable }
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
### be_resolvable
|
|
43
44
|
|
|
44
45
|
The `be_resolvable` matcher tests for host name resolution, i.e. "resolvable to an IP address":
|
|
45
46
|
|
|
46
47
|
it { should be_resolvable }
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
### cmp
|
|
49
50
|
|
|
50
51
|
<%= partial "/shared/matcher_cmp" %>
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
### eq
|
|
53
54
|
|
|
54
55
|
<%= partial "/shared/matcher_eq" %>
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
### include
|
|
57
58
|
|
|
58
59
|
<%= partial "/shared/matcher_include" %>
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
### ipaddress
|
|
61
62
|
|
|
62
63
|
The `ipaddress` matcher tests if a host name is resolvable to a specific IP address:
|
|
63
64
|
|
|
64
65
|
its('ipaddress') { should include '93.184.216.34' }
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
### match
|
|
67
68
|
|
|
68
69
|
<%= partial "/shared/matcher_match" %>
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
## Examples
|
|
71
72
|
|
|
72
73
|
The following examples show how to use this InSpec audit resource.
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
### Verify host name is reachable over a specific protocol and port number
|
|
75
76
|
|
|
76
|
-
describe host('example.com', port:
|
|
77
|
+
describe host('example.com', port: 80, protocol: 'tcp') do
|
|
77
78
|
it { should be_reachable }
|
|
78
79
|
end
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
### Verify that a specific IP address can be resolved
|
|
81
82
|
|
|
82
|
-
describe host('example.com'
|
|
83
|
+
describe host('example.com') do
|
|
83
84
|
it { should be_resolvable }
|
|
84
85
|
its('ipaddress') { should include '192.168.1.1' }
|
|
85
86
|
end
|
|
87
|
+
|
|
88
|
+
### Review the connection setup and socket contents when checking reachability
|
|
89
|
+
|
|
90
|
+
describe host('example.com', port: 12345, protocol: 'tcp') do
|
|
91
|
+
it { should be_reachable }
|
|
92
|
+
its('connection') { should_not match /connection refused/ }
|
|
93
|
+
its('socket') { should match /STATUS_OK/ }
|
|
94
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: About the http Resource
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# http
|
|
6
|
+
|
|
7
|
+
Use the `http` InSpec audit resource to test an http endpoint.
|
|
8
|
+
|
|
9
|
+
<p class="warning">Currently, this resource always executes on the host on which <code>inspec exec</code> is run, even if you use the <code>--target</code> option to remotely scan a different host.<br>
|
|
10
|
+
<br>
|
|
11
|
+
This will be corrected in a future version of InSpec. New InSpec releases are posted in the <a href="https://discourse.chef.io/c/chef-release" target="_blank">Release Announcements Category in Discourse</a>.</p>
|
|
12
|
+
|
|
13
|
+
## Syntax
|
|
14
|
+
|
|
15
|
+
An `http` resource block declares the configuration settings to be tested:
|
|
16
|
+
|
|
17
|
+
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
|
|
18
|
+
its('status') { should eq number }
|
|
19
|
+
its('body') { should eq 'body' }
|
|
20
|
+
its('headers.name') { should eq 'header' }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
where
|
|
24
|
+
|
|
25
|
+
* `('url')` is the url to test
|
|
26
|
+
* `auth: { user: 'user', pass: 'test' }` may be specified for basic auth request
|
|
27
|
+
* `{params}` may be specified for http request parameters
|
|
28
|
+
* `'method'` may be specified for http request method (default to 'GET')
|
|
29
|
+
* `{headers}` may be specified for http request headers
|
|
30
|
+
* `data` may be specified for http request body
|
|
31
|
+
* `open_timeout` may be specified for a timeout for opening connections (default to 60)
|
|
32
|
+
* `read_timeout` may be specified for a timeout for reading connections (default to 60)
|
|
33
|
+
* `ssl_verify` may be specified to enable or disable verification of SSL certificates (default to `true`)
|
|
34
|
+
|
|
35
|
+
## Matchers
|
|
36
|
+
|
|
37
|
+
This InSpec audit resource has the following matchers:
|
|
38
|
+
|
|
39
|
+
### be
|
|
40
|
+
|
|
41
|
+
<%= partial "/shared/matcher_be" %>
|
|
42
|
+
|
|
43
|
+
### body
|
|
44
|
+
|
|
45
|
+
The `body` matcher tests body content of http response:
|
|
46
|
+
|
|
47
|
+
its('body') { should eq 'hello\n' }
|
|
48
|
+
|
|
49
|
+
### cmp
|
|
50
|
+
|
|
51
|
+
<%= partial "/shared/matcher_cmp" %>
|
|
52
|
+
|
|
53
|
+
### eq
|
|
54
|
+
|
|
55
|
+
<%= partial "/shared/matcher_eq" %>
|
|
56
|
+
|
|
57
|
+
### headers
|
|
58
|
+
|
|
59
|
+
The `headers` matcher returns an hash of all http headers:
|
|
60
|
+
|
|
61
|
+
its('headers') { should eq {} }
|
|
62
|
+
|
|
63
|
+
Individual headers can be tested via:
|
|
64
|
+
|
|
65
|
+
its('headers.Content-Type') { should cmp 'text/html' }
|
|
66
|
+
|
|
67
|
+
### include
|
|
68
|
+
|
|
69
|
+
<%= partial "/shared/matcher_include" %>
|
|
70
|
+
|
|
71
|
+
### match
|
|
72
|
+
|
|
73
|
+
<%= partial "/shared/matcher_match" %>
|
|
74
|
+
|
|
75
|
+
### status
|
|
76
|
+
|
|
77
|
+
The `status` matcher tests status of the http response:
|
|
78
|
+
|
|
79
|
+
its('status') { should eq 200 }
|
|
80
|
+
|
|
81
|
+
## Examples
|
|
82
|
+
|
|
83
|
+
The following examples show how to use this InSpec audit resource.
|
|
84
|
+
|
|
85
|
+
### Simple http test
|
|
86
|
+
|
|
87
|
+
For example, a service is listening on default http port can be tested like this:
|
|
88
|
+
|
|
89
|
+
describe http('http://localhost') do
|
|
90
|
+
its('status') { should cmp 200 }
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
### Complex http test
|
|
94
|
+
|
|
95
|
+
describe http('http://localhost:8080/ping',
|
|
96
|
+
auth: {user: 'user', pass: 'test'},
|
|
97
|
+
params: {format: 'html'},
|
|
98
|
+
method: 'POST',
|
|
99
|
+
headers: {'Content-Type' => 'application/json'},
|
|
100
|
+
data: '{"data":{"a":"1","b":"five"}}') do
|
|
101
|
+
its('status') { should cmp 200 }
|
|
102
|
+
its('body') { should cmp 'pong' }
|
|
103
|
+
its('headers.Content-Type') { should cmp 'text/html' }
|
|
104
|
+
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: About the iis_app Resource
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# iis_app
|
|
6
|
+
|
|
7
|
+
Use the `iis_app` InSpec audit resource to test the state of IIS on Windows Server 2012 (and later).
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
An `iis_app` resource block declares details about the named site:
|
|
12
|
+
|
|
13
|
+
describe iis_app('application_path', 'site_name') do
|
|
14
|
+
it { should exist }
|
|
15
|
+
it { should have_application_pool('application_pool') }
|
|
16
|
+
it { should have_protocols('protocol') }
|
|
17
|
+
it { should have_site_name('site') }
|
|
18
|
+
it { should have_physical_path('physical_path') }
|
|
19
|
+
it { should have_path('application_path') }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
where
|
|
23
|
+
|
|
24
|
+
* `'application_path'` is the path to the application, such as `'/myapp'`
|
|
25
|
+
* `'site_name'` is the name of the site, such as `'Default Web Site'`
|
|
26
|
+
* `('application_pool')` is the name of the application pool in which the site's root application is run, such as `'DefaultAppPool'`
|
|
27
|
+
* `('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
|
|
28
|
+
* `('physical_path') is the physical path to the application, such as `'C:\\inetpub\\wwwroot\\myapp'`
|
|
29
|
+
|
|
30
|
+
For example:
|
|
31
|
+
|
|
32
|
+
describe iis_app('/myapp', 'Default Web Site') do
|
|
33
|
+
it { should exist }
|
|
34
|
+
it { should have_application_pool('MyAppPool') }
|
|
35
|
+
it { should have_protocols('http') }
|
|
36
|
+
it { should have_site_name('Default Web Site') }
|
|
37
|
+
it { should have_physical_path('C:\\inetpub\\wwwroot\\myapp') }
|
|
38
|
+
it { should have_path('\\My Application') }
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
## Matchers
|
|
42
|
+
|
|
43
|
+
This InSpec audit resource has the following matchers:
|
|
44
|
+
|
|
45
|
+
### cmp
|
|
46
|
+
|
|
47
|
+
<%= partial "/shared/matcher_cmp" %>
|
|
48
|
+
|
|
49
|
+
### eq
|
|
50
|
+
|
|
51
|
+
<%= partial "/shared/matcher_eq" %>
|
|
52
|
+
|
|
53
|
+
### exist
|
|
54
|
+
|
|
55
|
+
The `exist` matcher tests if the site exists:
|
|
56
|
+
|
|
57
|
+
it { should exist }
|
|
58
|
+
|
|
59
|
+
### have\_application\_pool
|
|
60
|
+
|
|
61
|
+
The `have_application_pool` matcher tests if the named application pool exists for the web application:
|
|
62
|
+
|
|
63
|
+
it { should have_application_pool('DefaultAppPool') }
|
|
64
|
+
|
|
65
|
+
### have_protocol
|
|
66
|
+
|
|
67
|
+
The `have_protocol` matcher tests if the specified protocol exists for the web application:
|
|
68
|
+
|
|
69
|
+
it { should have_protocol('http') }
|
|
70
|
+
|
|
71
|
+
or:
|
|
72
|
+
|
|
73
|
+
it { should have_protocol('https') }
|
|
74
|
+
|
|
75
|
+
A web application may have multiple bindings; use a `have_protocol` matcher for each unique web application binding to be tested.
|
|
76
|
+
|
|
77
|
+
##### Protocol Attributes
|
|
78
|
+
|
|
79
|
+
The `have_protocol` matcher can also test attributes that are defined for a web application enabledProtocols.
|
|
80
|
+
|
|
81
|
+
it { should have_protocol('http') }
|
|
82
|
+
|
|
83
|
+
For example, testing a site that doesn't have https enabled:
|
|
84
|
+
|
|
85
|
+
it { should_not have_protocol('https') }
|
|
86
|
+
it { should have_protocol('http') }
|
|
87
|
+
|
|
88
|
+
Testing a web application with https enabled and http enabled:
|
|
89
|
+
|
|
90
|
+
it { should have_protocol('https') }
|
|
91
|
+
it { should have_protocol('http') }
|
|
92
|
+
|
|
93
|
+
### have_physical_path
|
|
94
|
+
|
|
95
|
+
The `have_physical_path` matcher tests if the named path is defined for the web application:
|
|
96
|
+
|
|
97
|
+
it { should have_physical_path('C:\\inetpub\\wwwroot') }
|
|
98
|
+
|
|
99
|
+
### include
|
|
100
|
+
|
|
101
|
+
<%= partial "/shared/matcher_include" %>
|
|
102
|
+
|
|
103
|
+
### match
|
|
104
|
+
|
|
105
|
+
<%= partial "/shared/matcher_match" %>
|
|
106
|
+
|
|
107
|
+
## Examples
|
|
108
|
+
|
|
109
|
+
The following examples show how to use this InSpec audit resource.
|
|
110
|
+
|
|
111
|
+
### Test a default IIS web application
|
|
112
|
+
|
|
113
|
+
describe iis_app('Default Web Site') do
|
|
114
|
+
it { should exist }
|
|
115
|
+
it { should be_running }
|
|
116
|
+
it { should have_app_pool('DefaultAppPool') }
|
|
117
|
+
it { should have_binding('http *:80:') }
|
|
118
|
+
it { should have_path('%SystemDrive%\\inetpub\\wwwroot') }
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
### Test if IIS service is running
|
|
122
|
+
|
|
123
|
+
describe service('W3SVC') do
|
|
124
|
+
it { should be_installed }
|
|
125
|
+
it { should be_running }
|
|
126
|
+
end
|
|
@@ -6,7 +6,7 @@ title: About the iis_site Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `iis_site` InSpec audit resource to test the state of IIS on Windows Server 2012 (and later).
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
An `iis_site` resource block declares details about the named site:
|
|
12
12
|
|
|
@@ -36,35 +36,35 @@ For example:
|
|
|
36
36
|
it { should have_path('C:\\inetpub\\wwwroot') }
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
## Matchers
|
|
40
40
|
|
|
41
41
|
This InSpec audit resource has the following matchers:
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
### be
|
|
44
44
|
|
|
45
45
|
<%= partial "/shared/matcher_be" %>
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
### be_running
|
|
48
48
|
|
|
49
49
|
The `be_running` matcher tests if the site is running:
|
|
50
50
|
|
|
51
51
|
it { should be_running }
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
### cmp
|
|
54
54
|
|
|
55
55
|
<%= partial "/shared/matcher_cmp" %>
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
### eq
|
|
58
58
|
|
|
59
59
|
<%= partial "/shared/matcher_eq" %>
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
### exist
|
|
62
62
|
|
|
63
63
|
The `exist` matcher tests if the site exists:
|
|
64
64
|
|
|
65
65
|
it { should exist }
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
### have\_app\_pool
|
|
68
68
|
|
|
69
69
|
The `have_app_pool` matcher tests if the named application pool exists for the site:
|
|
70
70
|
|
|
@@ -74,7 +74,7 @@ For example, testing if a site's application pool inherits the settings of the p
|
|
|
74
74
|
|
|
75
75
|
it { should have_app_pool('/') }
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
### have_binding
|
|
78
78
|
|
|
79
79
|
The `have_binding` matcher tests if the specified binding exists for the site:
|
|
80
80
|
|
|
@@ -86,7 +86,7 @@ or:
|
|
|
86
86
|
|
|
87
87
|
A site may have multiple bindings; use a `have_binding` matcher for each unique site binding to be tested.
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
##### Binding Attributes
|
|
90
90
|
|
|
91
91
|
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.
|
|
92
92
|
|
|
@@ -106,35 +106,35 @@ Testing a site with 128-bit SSL enabled:
|
|
|
106
106
|
|
|
107
107
|
it { should have_binding('https :443:www.contoso.com sslFlags=Ssl128') }
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
### have_path
|
|
110
110
|
|
|
111
111
|
The `have_path` matcher tests if the named path is defined for the site:
|
|
112
112
|
|
|
113
113
|
it { should have_path('C:\\inetpub\\wwwroot') }
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
### include
|
|
116
116
|
|
|
117
117
|
<%= partial "/shared/matcher_include" %>
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
### match
|
|
120
120
|
|
|
121
121
|
<%= partial "/shared/matcher_match" %>
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
## Examples
|
|
124
124
|
|
|
125
125
|
The following examples show how to use this InSpec audit resource.
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
### Test a default IIS site
|
|
128
128
|
|
|
129
129
|
describe iis_site('Default Web Site') do
|
|
130
130
|
it { should exist }
|
|
131
131
|
it { should be_running }
|
|
132
132
|
it { should have_app_pool('DefaultAppPool') }
|
|
133
133
|
it { should have_binding('http *:80:') }
|
|
134
|
-
it { should have_path('%SystemDrive%\\inetpub\\wwwroot
|
|
134
|
+
it { should have_path('%SystemDrive%\\inetpub\\wwwroot') }
|
|
135
135
|
end
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
### Test if IIS service is running
|
|
138
138
|
|
|
139
139
|
describe service('W3SVC') do
|
|
140
140
|
it { should be_installed }
|
|
@@ -6,7 +6,7 @@ title: About the inetd_conf Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `inetd_conf` InSpec audit resource to test if a service is listed 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.`
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
An `inetd_conf` resource block declares the list of services that are enabled in the `inetd.conf` file:
|
|
12
12
|
|
|
@@ -21,7 +21,7 @@ where
|
|
|
21
21
|
* `should eq 'value'` is the value that is expected
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
## Matchers
|
|
25
25
|
|
|
26
26
|
This resource matches any service that is listed in the `inetd.conf` file. You may want to ensure that specific services do not listen via `inetd.conf`:
|
|
27
27
|
|
|
@@ -43,31 +43,31 @@ For example:
|
|
|
43
43
|
its('exec') { should eq nil }
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
### be
|
|
47
47
|
|
|
48
48
|
<%= partial "/shared/matcher_be" %>
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
### cmp
|
|
51
51
|
|
|
52
52
|
<%= partial "/shared/matcher_cmp" %>
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
### eq
|
|
55
55
|
|
|
56
56
|
<%= partial "/shared/matcher_eq" %>
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
### include
|
|
59
59
|
|
|
60
60
|
<%= partial "/shared/matcher_include" %>
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
### match
|
|
63
63
|
|
|
64
64
|
<%= partial "/shared/matcher_match" %>
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
## Examples
|
|
67
67
|
|
|
68
68
|
The following examples show how to use this InSpec audit resource.
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
### Verify that FTP is disabled
|
|
71
71
|
|
|
72
72
|
The contents if the `inetd.conf` file contain the following:
|
|
73
73
|
|
|
@@ -88,7 +88,7 @@ Because both the `ftp` and `telnet` Internet services are commented out (`#`), b
|
|
|
88
88
|
|
|
89
89
|
then the same test will return `false` for `ftp` and the entire test will fail.
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
### Test if telnet is installed
|
|
92
92
|
|
|
93
93
|
describe package('telnetd') do
|
|
94
94
|
it { should_not be_installed }
|
data/docs/resources/ini.md.erb
CHANGED
|
@@ -6,7 +6,7 @@ title: About the ini Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `ini` InSpec audit resource to test settings in an INI file.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
An `ini` resource block declares the configuration settings to be tested:
|
|
12
12
|
|
|
@@ -27,35 +27,35 @@ For example:
|
|
|
27
27
|
its('server') { should eq '192.0.2.62' }
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
## Matchers
|
|
31
31
|
|
|
32
32
|
This InSpec audit resource has the following matchers:
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
### be
|
|
35
35
|
|
|
36
36
|
<%= partial "/shared/matcher_be" %>
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
### cmp
|
|
39
39
|
|
|
40
40
|
<%= partial "/shared/matcher_cmp" %>
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
### eq
|
|
43
43
|
|
|
44
44
|
<%= partial "/shared/matcher_eq" %>
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
### include
|
|
47
47
|
|
|
48
48
|
<%= partial "/shared/matcher_include" %>
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
### match
|
|
51
51
|
|
|
52
52
|
<%= partial "/shared/matcher_match" %>
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
## Examples
|
|
55
55
|
|
|
56
56
|
The following examples show how to use this InSpec audit resource.
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
### Test SMTP settings in a PHP INI file
|
|
59
59
|
|
|
60
60
|
For example, a PHP INI file located at contains the following settings:
|
|
61
61
|
|
|
@@ -4,63 +4,63 @@ title: About the interface Resource
|
|
|
4
4
|
|
|
5
5
|
# interface
|
|
6
6
|
|
|
7
|
-
Use the `interface` InSpec audit resource to test basic network adapter properties, such as name, status,
|
|
7
|
+
Use the `interface` InSpec audit resource to test basic network adapter properties, such as name, status, and link speed (in MB/sec).
|
|
8
8
|
|
|
9
9
|
* On Linux platforms, `/sys/class/net/#{iface}` is used as source
|
|
10
10
|
* On the Windows platform, the `Get-NetAdapter` cmdlet is used as source
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Syntax
|
|
13
13
|
|
|
14
14
|
An `interface` resource block declares network interface properties to be tested:
|
|
15
15
|
|
|
16
|
-
describe interface do
|
|
16
|
+
describe interface('eth0') do
|
|
17
17
|
it { should be_up }
|
|
18
18
|
its('speed') { should eq 1000 }
|
|
19
19
|
its('name') { should eq eth0 }
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
## Matchers
|
|
23
23
|
|
|
24
24
|
This InSpec audit resource has the following matchers:
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
### be
|
|
27
27
|
|
|
28
28
|
<%= partial "/shared/matcher_be" %>
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
### be_up
|
|
31
31
|
|
|
32
32
|
The `be_up` matcher tests if the network interface is available:
|
|
33
33
|
|
|
34
34
|
it { should be_up }
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
### cmp
|
|
37
37
|
|
|
38
38
|
<%= partial "/shared/matcher_cmp" %>
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
### eq
|
|
41
41
|
|
|
42
42
|
<%= partial "/shared/matcher_eq" %>
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
### include
|
|
45
45
|
|
|
46
46
|
<%= partial "/shared/matcher_include" %>
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
### match
|
|
49
49
|
|
|
50
50
|
<%= partial "/shared/matcher_match" %>
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
### name
|
|
53
53
|
|
|
54
54
|
The `name` matcher tests if the named network interface exists:
|
|
55
55
|
|
|
56
56
|
its('name') { should eq eth0 }
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
### speed
|
|
59
59
|
|
|
60
60
|
The `speed` matcher tests the speed of the network interface, in MB/sec:
|
|
61
61
|
|
|
62
62
|
its('speed') { should eq 1000 }
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
## Examples
|
|
65
65
|
|
|
66
66
|
None.
|