inspec 1.31.0 → 1.45.9
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/.rubocop.yml +3 -0
- data/CHANGELOG.md +2599 -1
- data/Gemfile +0 -1
- data/README.md +24 -34
- data/Rakefile +0 -31
- data/docs/dsl_inspec.md +10 -0
- data/docs/matchers.md +29 -0
- data/docs/plugin_kitchen_inspec.md +18 -24
- data/docs/profiles.md +101 -81
- data/docs/resources/aide_conf.md.erb +71 -0
- data/docs/resources/apache_conf.md.erb +19 -33
- data/docs/resources/apt.md.erb +22 -36
- data/docs/resources/audit_policy.md.erb +9 -24
- data/docs/resources/auditd.md.erb +78 -0
- data/docs/resources/auditd_conf.md.erb +20 -34
- data/docs/resources/auditd_rules.md.erb +8 -24
- data/docs/resources/bash.md.erb +4 -26
- data/docs/resources/bond.md.erb +25 -40
- data/docs/resources/bridge.md.erb +5 -25
- data/docs/resources/bsd_service.md.erb +5 -25
- data/docs/resources/command.md.erb +35 -50
- data/docs/resources/cpan.md.erb +62 -0
- data/docs/resources/cran.md.erb +54 -0
- data/docs/resources/crontab.md.erb +9 -23
- data/docs/resources/csv.md.erb +12 -27
- data/docs/resources/dh_params.md +1 -0
- data/docs/resources/directory.md.erb +5 -25
- data/docs/resources/docker.md.erb +61 -58
- data/docs/resources/docker_container.md.erb +23 -19
- data/docs/resources/docker_image.md.erb +20 -16
- data/docs/resources/elasticsearch.md.erb +245 -0
- data/docs/resources/etc_fstab.md.erb +120 -0
- data/docs/resources/etc_group.md.erb +29 -45
- data/docs/resources/etc_hosts.md.erb +68 -0
- data/docs/resources/etc_hosts_allow.md.erb +68 -0
- data/docs/resources/etc_hosts_deny.md.erb +68 -0
- data/docs/resources/file.md.erb +227 -216
- data/docs/resources/firewalld.md.erb +104 -0
- data/docs/resources/gem.md.erb +21 -35
- data/docs/resources/group.md.erb +16 -30
- data/docs/resources/grub_conf.md.erb +9 -24
- data/docs/resources/host.md.erb +32 -49
- data/docs/resources/http.md.erb +38 -44
- data/docs/resources/iis_app.md.erb +25 -35
- data/docs/resources/iis_site.md.erb +26 -40
- data/docs/resources/inetd_conf.md.erb +27 -42
- data/docs/resources/ini.md.erb +9 -23
- data/docs/resources/interface.md.erb +5 -25
- data/docs/resources/iptables.md.erb +15 -29
- data/docs/resources/json.md.erb +12 -27
- data/docs/resources/kernel_module.md.erb +47 -61
- data/docs/resources/kernel_parameter.md.erb +15 -29
- data/docs/resources/key_rsa.md.erb +3 -0
- data/docs/resources/launchd_service.md.erb +5 -25
- data/docs/resources/limits_conf.md.erb +15 -29
- data/docs/resources/login_def.md.erb +15 -30
- data/docs/resources/mount.md.erb +18 -33
- data/docs/resources/mssql_session.md.erb +9 -12
- data/docs/resources/mysql_conf.md.erb +28 -32
- data/docs/resources/mysql_session.md.erb +15 -29
- data/docs/resources/nginx.md.erb +78 -0
- data/docs/resources/nginx_conf.md.erb +127 -0
- data/docs/resources/npm.md.erb +19 -35
- data/docs/resources/ntp_conf.md.erb +20 -37
- data/docs/resources/oneget.md.erb +15 -30
- data/docs/resources/oracledb_session.md.erb +9 -11
- data/docs/resources/os.md.erb +29 -43
- data/docs/resources/os_env.md.erb +23 -44
- data/docs/resources/package.md.erb +34 -36
- data/docs/resources/parse_config.md.erb +5 -25
- data/docs/resources/parse_config_file.md.erb +31 -43
- data/docs/resources/{etc_passwd.md.erb → passwd.md.erb} +24 -39
- data/docs/resources/pip.md.erb +20 -35
- data/docs/resources/port.md.erb +43 -57
- data/docs/resources/postgres_conf.md.erb +17 -31
- data/docs/resources/postgres_hba_conf.md.erb +26 -38
- data/docs/resources/postgres_ident_conf.md.erb +25 -37
- data/docs/resources/postgres_session.md.erb +15 -29
- data/docs/resources/powershell.md.erb +27 -42
- data/docs/resources/processes.md.erb +17 -33
- data/docs/resources/rabbitmq_config.md.erb +9 -24
- data/docs/resources/registry_key.md.erb +27 -42
- data/docs/resources/runit_service.md.erb +5 -25
- data/docs/resources/security_policy.md.erb +12 -27
- data/docs/resources/service.md.erb +27 -42
- data/docs/resources/{etc_shadow.md.erb → shadow.md.erb} +41 -47
- data/docs/resources/ssh_config.md.erb +19 -34
- data/docs/resources/sshd_config.md.erb +19 -34
- data/docs/resources/ssl.md.erb +39 -54
- data/docs/resources/sys_info.md.erb +12 -26
- data/docs/resources/systemd_service.md.erb +5 -25
- data/docs/resources/sysv_service.md.erb +5 -25
- data/docs/resources/upstart_service.md.erb +5 -25
- data/docs/resources/user.md.erb +29 -44
- data/docs/resources/users.md.erb +12 -26
- data/docs/resources/vbscript.md.erb +9 -24
- data/docs/resources/virtualization.md.erb +8 -23
- data/docs/resources/windows_feature.md.erb +15 -30
- data/docs/resources/windows_hotfix.md.erb +50 -0
- data/docs/resources/windows_task.md.erb +12 -26
- data/docs/resources/wmi.md.erb +9 -24
- data/docs/resources/x509_certificate.md.erb +4 -0
- data/docs/resources/xinetd_conf.md.erb +65 -80
- data/docs/resources/xml.md.erb +61 -0
- data/docs/resources/yaml.md.erb +12 -27
- data/docs/resources/yum.md.erb +37 -51
- data/docs/resources/zfs_dataset.md.erb +15 -26
- data/docs/resources/zfs_pool.md.erb +9 -20
- data/docs/ruby_usage.md +0 -1
- data/examples/meta-profile/README.md +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 +3 -3
- data/lib/bundles/inspec-artifact/cli.rb +5 -5
- data/lib/bundles/inspec-compliance/README.md +24 -22
- data/lib/bundles/inspec-compliance/api/login.rb +152 -0
- data/lib/bundles/inspec-compliance/api.rb +46 -16
- data/lib/bundles/inspec-compliance/cli.rb +58 -165
- data/lib/bundles/inspec-compliance/target.rb +2 -3
- data/lib/bundles/inspec-habitat/cli.rb +7 -2
- data/lib/bundles/inspec-habitat/profile.rb +44 -20
- data/lib/bundles/inspec-init/templates/profile/README.md +1 -1
- data/lib/bundles/inspec-init/templates/profile/controls/example.rb +1 -1
- data/lib/bundles/inspec-supermarket/api.rb +1 -1
- data/lib/inspec/backend.rb +8 -0
- data/lib/inspec/cli.rb +1 -1
- data/lib/inspec/control_eval_context.rb +16 -6
- data/lib/inspec/dependencies/requirement.rb +22 -8
- data/lib/inspec/dependencies/resolver.rb +1 -1
- data/lib/inspec/exceptions.rb +4 -0
- data/lib/inspec/file_provider.rb +38 -9
- data/lib/inspec/metadata.rb +17 -3
- data/lib/inspec/objects/attribute.rb +16 -7
- data/lib/inspec/objects/control.rb +10 -2
- data/lib/inspec/plugins/resource.rb +34 -5
- data/lib/inspec/profile.rb +10 -1
- data/lib/inspec/profile_context.rb +3 -1
- data/lib/inspec/resource.rb +17 -5
- data/lib/inspec/rspec_json_formatter.rb +48 -14
- data/lib/inspec/rule.rb +4 -0
- data/lib/inspec/runner.rb +72 -30
- data/lib/inspec/shell.rb +24 -19
- data/lib/inspec/version.rb +1 -1
- data/lib/matchers/matchers.rb +40 -0
- data/lib/resources/aide_conf.rb +162 -0
- data/lib/resources/auditd.rb +231 -0
- data/lib/resources/auditd_rules.rb +3 -1
- data/lib/resources/command.rb +1 -1
- data/lib/resources/cpan.rb +60 -0
- data/lib/resources/cran.rb +66 -0
- data/lib/resources/docker.rb +8 -1
- data/lib/resources/docker_container.rb +19 -2
- data/lib/resources/elasticsearch.rb +172 -0
- data/lib/resources/etc_fstab.rb +102 -0
- data/lib/resources/etc_group.rb +1 -1
- data/lib/resources/etc_hosts.rb +81 -0
- data/lib/resources/etc_hosts_allow_deny.rb +122 -0
- data/lib/resources/file.rb +87 -10
- data/lib/resources/firewalld.rb +144 -0
- data/lib/resources/groups.rb +0 -1
- data/lib/resources/host.rb +30 -15
- data/lib/resources/http.rb +178 -22
- data/lib/resources/mssql_session.rb +3 -3
- data/lib/resources/mysql_conf.rb +10 -0
- data/lib/resources/mysql_session.rb +1 -1
- data/lib/resources/nginx.rb +97 -0
- data/lib/resources/nginx_conf.rb +134 -1
- data/lib/resources/oracledb_session.rb +9 -8
- data/lib/resources/os_env.rb +7 -4
- data/lib/resources/package.rb +14 -2
- data/lib/resources/packages.rb +1 -1
- data/lib/resources/pip.rb +28 -20
- data/lib/resources/port.rb +251 -3
- data/lib/resources/postgres.rb +1 -1
- data/lib/resources/postgres_session.rb +1 -1
- data/lib/resources/processes.rb +106 -20
- data/lib/resources/registry_key.rb +11 -2
- data/lib/resources/service.rb +5 -24
- data/lib/resources/ssh_conf.rb +1 -1
- data/lib/resources/ssl.rb +4 -3
- data/lib/resources/toml.rb +2 -2
- data/lib/resources/windows_hotfix.rb +35 -0
- data/lib/resources/xinetd.rb +4 -6
- data/lib/resources/xml.rb +27 -0
- data/lib/source_readers/inspec.rb +3 -3
- data/lib/utils/find_files.rb +2 -1
- data/lib/utils/nginx_parser.rb +10 -1
- data/lib/utils/object_traversal.rb +35 -10
- data/lib/utils/parser.rb +21 -3
- metadata +48 -18
- data/docs/cli.md +0 -392
data/docs/resources/group.md.erb
CHANGED
|
@@ -6,6 +6,8 @@ title: About the group Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `group` InSpec audit resource to test groups on the system.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `group` resource block declares a group, and then the details to be tested, such as if the group is a local group, the group identifier, or if the group exists:
|
|
@@ -20,27 +22,30 @@ where
|
|
|
20
22
|
* `'group_name'` must specify the name of a group on the system
|
|
21
23
|
* `exist` and `'gid'` are valid matchers for this resource
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
<br>
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
## Examples
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
The following examples show how to use this InSpec audit resource.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
### Test the group identifier for the root group
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
describe group('root') do
|
|
34
|
+
it { should exist }
|
|
35
|
+
its('gid') { should eq 0 }
|
|
36
|
+
end
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
<br>
|
|
34
39
|
|
|
35
|
-
|
|
40
|
+
## Matchers
|
|
36
41
|
|
|
37
|
-
|
|
42
|
+
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
### be_local
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
The `be_local` matcher tests if the group is a local group:
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
it { should be_local }
|
|
44
49
|
|
|
45
50
|
### exist
|
|
46
51
|
|
|
@@ -53,22 +58,3 @@ The `exist` matcher tests if the named user exists:
|
|
|
53
58
|
The `gid` matcher tests the named group identifier:
|
|
54
59
|
|
|
55
60
|
its('gid') { should eq 1234 }
|
|
56
|
-
|
|
57
|
-
### include
|
|
58
|
-
|
|
59
|
-
<%= partial "/shared/matcher_include" %>
|
|
60
|
-
|
|
61
|
-
### match
|
|
62
|
-
|
|
63
|
-
<%= partial "/shared/matcher_match" %>
|
|
64
|
-
|
|
65
|
-
## Examples
|
|
66
|
-
|
|
67
|
-
The following examples show how to use this InSpec audit resource.
|
|
68
|
-
|
|
69
|
-
### Test the group identifier for the root group
|
|
70
|
-
|
|
71
|
-
describe group('root') do
|
|
72
|
-
it { should exist }
|
|
73
|
-
its('gid') { should eq 0 }
|
|
74
|
-
end
|
|
@@ -6,6 +6,8 @@ title: About the grub_conf Resource
|
|
|
6
6
|
|
|
7
7
|
Grub is a boot loader on the Linux platform used to load and then transfer control to an operating system kernel, after which that kernel initializes the rest of the operating system. Use the `grub_conf` InSpec audit resource to test boot loader configuration settings that are defined in the `grub.conf` configuration file.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `grub_conf` resource block declares a list of settings in a `grub.conf` file:
|
|
@@ -28,30 +30,7 @@ where
|
|
|
28
30
|
* `'kernel'` specifies the default kernel (by using `'default'`) or a specific kernel; `'default'` defines the position in the list of kernels at which the default kernel is defined, i.e. `should eq '0'` for the first kernel listed or `'path', 'default'` to use the default kernel as specified in the `grub.conf` file
|
|
29
31
|
* `'value'` is the value that is expected
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
## Matchers
|
|
33
|
-
|
|
34
|
-
This InSpec audit resource has the following matchers:
|
|
35
|
-
|
|
36
|
-
### be
|
|
37
|
-
|
|
38
|
-
<%= partial "/shared/matcher_be" %>
|
|
39
|
-
|
|
40
|
-
### cmp
|
|
41
|
-
|
|
42
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
43
|
-
|
|
44
|
-
### eq
|
|
45
|
-
|
|
46
|
-
<%= partial "/shared/matcher_eq" %>
|
|
47
|
-
|
|
48
|
-
### include
|
|
49
|
-
|
|
50
|
-
<%= partial "/shared/matcher_include" %>
|
|
51
|
-
|
|
52
|
-
### match
|
|
53
|
-
|
|
54
|
-
<%= partial "/shared/matcher_match" %>
|
|
33
|
+
<br>
|
|
55
34
|
|
|
56
35
|
## Examples
|
|
57
36
|
|
|
@@ -113,3 +92,9 @@ The following test verifies the `ramdisk_size` for the non-deault kernel:
|
|
|
113
92
|
grub_conf('/etc/grub.conf', 'CentOS (2.6.32-573.12.1.el6.x86_64)') do
|
|
114
93
|
its('kernel') { should include 'audit=1' }
|
|
115
94
|
end
|
|
95
|
+
|
|
96
|
+
<br>
|
|
97
|
+
|
|
98
|
+
## Matchers
|
|
99
|
+
|
|
100
|
+
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
data/docs/resources/host.md.erb
CHANGED
|
@@ -6,17 +6,17 @@ 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
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `host` resource block declares a host name, and then (depending on what is to be tested) a port and/or a protocol:
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
its('ipaddress') { should include '12.34.56.78' }
|
|
19
|
-
end
|
|
15
|
+
describe host('example.com', port: 80, protocol: 'tcp') do
|
|
16
|
+
it { should be_reachable }
|
|
17
|
+
it { should be_resolvable }
|
|
18
|
+
its('ipaddress') { should include '12.34.56.78' }
|
|
19
|
+
end
|
|
20
20
|
|
|
21
21
|
where
|
|
22
22
|
|
|
@@ -25,48 +25,7 @@ where
|
|
|
25
25
|
* `port:` is the port number
|
|
26
26
|
* `protocol: 'name'` is the Internet protocol: TCP (`protocol: 'tcp'`), UDP (`protocol: 'udp'` or ICMP (`protocol: 'icmp'`))
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
## Matchers
|
|
30
|
-
|
|
31
|
-
This InSpec audit resource has the following matchers:
|
|
32
|
-
|
|
33
|
-
### be
|
|
34
|
-
|
|
35
|
-
<%= partial "/shared/matcher_be" %>
|
|
36
|
-
|
|
37
|
-
### be_reachable
|
|
38
|
-
|
|
39
|
-
The `be_reachable` matcher tests if the host name is available:
|
|
40
|
-
|
|
41
|
-
it { should be_reachable }
|
|
42
|
-
|
|
43
|
-
### be_resolvable
|
|
44
|
-
|
|
45
|
-
The `be_resolvable` matcher tests for host name resolution, i.e. "resolvable to an IP address":
|
|
46
|
-
|
|
47
|
-
it { should be_resolvable }
|
|
48
|
-
|
|
49
|
-
### cmp
|
|
50
|
-
|
|
51
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
52
|
-
|
|
53
|
-
### eq
|
|
54
|
-
|
|
55
|
-
<%= partial "/shared/matcher_eq" %>
|
|
56
|
-
|
|
57
|
-
### include
|
|
58
|
-
|
|
59
|
-
<%= partial "/shared/matcher_include" %>
|
|
60
|
-
|
|
61
|
-
### ipaddress
|
|
62
|
-
|
|
63
|
-
The `ipaddress` matcher tests if a host name is resolvable to a specific IP address:
|
|
64
|
-
|
|
65
|
-
its('ipaddress') { should include '93.184.216.34' }
|
|
66
|
-
|
|
67
|
-
### match
|
|
68
|
-
|
|
69
|
-
<%= partial "/shared/matcher_match" %>
|
|
28
|
+
<br>
|
|
70
29
|
|
|
71
30
|
## Examples
|
|
72
31
|
|
|
@@ -92,3 +51,27 @@ The following examples show how to use this InSpec audit resource.
|
|
|
92
51
|
its('connection') { should_not match /connection refused/ }
|
|
93
52
|
its('socket') { should match /STATUS_OK/ }
|
|
94
53
|
end
|
|
54
|
+
|
|
55
|
+
<br>
|
|
56
|
+
|
|
57
|
+
## Matchers
|
|
58
|
+
|
|
59
|
+
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
60
|
+
|
|
61
|
+
### be_reachable
|
|
62
|
+
|
|
63
|
+
The `be_reachable` matcher tests if the host name is available:
|
|
64
|
+
|
|
65
|
+
it { should be_reachable }
|
|
66
|
+
|
|
67
|
+
### be_resolvable
|
|
68
|
+
|
|
69
|
+
The `be_resolvable` matcher tests for host name resolution, i.e. "resolvable to an IP address":
|
|
70
|
+
|
|
71
|
+
it { should be_resolvable }
|
|
72
|
+
|
|
73
|
+
### ipaddress
|
|
74
|
+
|
|
75
|
+
The `ipaddress` matcher tests if a host name is resolvable to a specific IP address:
|
|
76
|
+
|
|
77
|
+
its('ipaddress') { should include '93.184.216.34' }
|
data/docs/resources/http.md.erb
CHANGED
|
@@ -6,9 +6,14 @@ title: About the http Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `http` InSpec audit resource to test an http endpoint.
|
|
8
8
|
|
|
9
|
-
<p class="warning">
|
|
9
|
+
<p class="warning">In InSpec 1.40 and earlier, 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
|
+
Beginning with InSpec 1.41, you can enable the ability to have the HTTP test execute on the remote target, provided <code>curl</code> is available. See the "Local vs. Remote" section below.<br>
|
|
12
|
+
<br>
|
|
13
|
+
Executing the HTTP test on the remote target will be the default behavior in InSpec 2.0.
|
|
14
|
+
</p>
|
|
15
|
+
|
|
10
16
|
<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
17
|
|
|
13
18
|
## Syntax
|
|
14
19
|
|
|
@@ -32,51 +37,16 @@ where
|
|
|
32
37
|
* `read_timeout` may be specified for a timeout for reading connections (default to 60)
|
|
33
38
|
* `ssl_verify` may be specified to enable or disable verification of SSL certificates (default to `true`)
|
|
34
39
|
|
|
35
|
-
|
|
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" %>
|
|
40
|
+
<br>
|
|
41
|
+
## Local vs. Remote
|
|
74
42
|
|
|
75
|
-
|
|
43
|
+
Beginning with InSpec 1.41, you can enable the ability to have the HTTP test execute on the remote target:
|
|
76
44
|
|
|
77
|
-
|
|
45
|
+
describe http('http://www.example.com', enable_remote_worker: true) do
|
|
46
|
+
its('body') { should cmp 'awesome' }
|
|
47
|
+
end
|
|
78
48
|
|
|
79
|
-
|
|
49
|
+
In InSpec 2.0, the HTTP test will automatically execute remotely whenever InSpec is testing a remote node.
|
|
80
50
|
|
|
81
51
|
## Examples
|
|
82
52
|
|
|
@@ -102,3 +72,27 @@ For example, a service is listening on default http port can be tested like this
|
|
|
102
72
|
its('body') { should cmp 'pong' }
|
|
103
73
|
its('headers.Content-Type') { should cmp 'text/html' }
|
|
104
74
|
end
|
|
75
|
+
|
|
76
|
+
<br>
|
|
77
|
+
|
|
78
|
+
### body
|
|
79
|
+
|
|
80
|
+
The `body` matcher tests body content of http response:
|
|
81
|
+
|
|
82
|
+
its('body') { should eq 'hello\n' }
|
|
83
|
+
|
|
84
|
+
### headers
|
|
85
|
+
|
|
86
|
+
The `headers` matcher returns an hash of all http headers:
|
|
87
|
+
|
|
88
|
+
its('headers') { should eq {} }
|
|
89
|
+
|
|
90
|
+
Individual headers can be tested via:
|
|
91
|
+
|
|
92
|
+
its('headers.Content-Type') { should cmp 'text/html' }
|
|
93
|
+
|
|
94
|
+
### status
|
|
95
|
+
|
|
96
|
+
The `status` matcher tests status of the http response:
|
|
97
|
+
|
|
98
|
+
its('status') { should eq 200 }
|
|
@@ -6,6 +6,8 @@ title: About the iis_app Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `iis_app` InSpec audit resource to test the state of IIS on Windows Server 2012 (and later).
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
An `iis_app` resource block declares details about the named site:
|
|
@@ -38,17 +40,34 @@ For example:
|
|
|
38
40
|
it { should have_path('\\My Application') }
|
|
39
41
|
end
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
<br>
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
The following examples show how to use this InSpec audit resource.
|
|
48
|
+
|
|
49
|
+
### Test a default IIS web application
|
|
50
|
+
|
|
51
|
+
describe iis_app('Default Web Site') do
|
|
52
|
+
it { should exist }
|
|
53
|
+
it { should be_running }
|
|
54
|
+
it { should have_app_pool('DefaultAppPool') }
|
|
55
|
+
it { should have_binding('http *:80:') }
|
|
56
|
+
it { should have_path('%SystemDrive%\\inetpub\\wwwroot') }
|
|
57
|
+
end
|
|
42
58
|
|
|
43
|
-
|
|
59
|
+
### Test if IIS service is running
|
|
44
60
|
|
|
45
|
-
|
|
61
|
+
describe service('W3SVC') do
|
|
62
|
+
it { should be_installed }
|
|
63
|
+
it { should be_running }
|
|
64
|
+
end
|
|
46
65
|
|
|
47
|
-
|
|
66
|
+
<br>
|
|
48
67
|
|
|
49
|
-
|
|
68
|
+
## Matchers
|
|
50
69
|
|
|
51
|
-
|
|
70
|
+
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
52
71
|
|
|
53
72
|
### exist
|
|
54
73
|
|
|
@@ -95,32 +114,3 @@ Testing a web application with https enabled and http enabled:
|
|
|
95
114
|
The `have_physical_path` matcher tests if the named path is defined for the web application:
|
|
96
115
|
|
|
97
116
|
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,6 +6,8 @@ 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
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
An `iis_site` resource block declares details about the named site:
|
|
@@ -36,27 +38,40 @@ For example:
|
|
|
36
38
|
it { should have_path('C:\\inetpub\\wwwroot') }
|
|
37
39
|
end
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
<br>
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
## Examples
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
The following examples show how to use this InSpec audit resource.
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
### Test a default IIS site
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
describe iis_site('Default Web Site') do
|
|
50
|
+
it { should exist }
|
|
51
|
+
it { should be_running }
|
|
52
|
+
it { should have_app_pool('DefaultAppPool') }
|
|
53
|
+
it { should have_binding('http *:80:') }
|
|
54
|
+
it { should have_path('%SystemDrive%\\inetpub\\wwwroot') }
|
|
55
|
+
end
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
### Test if IIS service is running
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
describe service('W3SVC') do
|
|
60
|
+
it { should be_installed }
|
|
61
|
+
it { should be_running }
|
|
62
|
+
end
|
|
52
63
|
|
|
53
|
-
|
|
64
|
+
<br>
|
|
54
65
|
|
|
55
|
-
|
|
66
|
+
## Matchers
|
|
67
|
+
|
|
68
|
+
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
69
|
+
|
|
70
|
+
### be_running
|
|
56
71
|
|
|
57
|
-
|
|
72
|
+
The `be_running` matcher tests if the site is running:
|
|
58
73
|
|
|
59
|
-
|
|
74
|
+
it { should be_running }
|
|
60
75
|
|
|
61
76
|
### exist
|
|
62
77
|
|
|
@@ -111,32 +126,3 @@ Testing a site with 128-bit SSL enabled:
|
|
|
111
126
|
The `have_path` matcher tests if the named path is defined for the site:
|
|
112
127
|
|
|
113
128
|
it { should have_path('C:\\inetpub\\wwwroot') }
|
|
114
|
-
|
|
115
|
-
### include
|
|
116
|
-
|
|
117
|
-
<%= partial "/shared/matcher_include" %>
|
|
118
|
-
|
|
119
|
-
### match
|
|
120
|
-
|
|
121
|
-
<%= partial "/shared/matcher_match" %>
|
|
122
|
-
|
|
123
|
-
## Examples
|
|
124
|
-
|
|
125
|
-
The following examples show how to use this InSpec audit resource.
|
|
126
|
-
|
|
127
|
-
### Test a default IIS site
|
|
128
|
-
|
|
129
|
-
describe iis_site('Default Web Site') do
|
|
130
|
-
it { should exist }
|
|
131
|
-
it { should be_running }
|
|
132
|
-
it { should have_app_pool('DefaultAppPool') }
|
|
133
|
-
it { should have_binding('http *:80:') }
|
|
134
|
-
it { should have_path('%SystemDrive%\\inetpub\\wwwroot') }
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
### Test if IIS service is running
|
|
138
|
-
|
|
139
|
-
describe service('W3SVC') do
|
|
140
|
-
it { should be_installed }
|
|
141
|
-
it { should be_running }
|
|
142
|
-
end
|
|
@@ -6,6 +6,8 @@ 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
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
An `inetd_conf` resource block declares the list of services that are enabled in the `inetd.conf` file:
|
|
@@ -20,48 +22,7 @@ where
|
|
|
20
22
|
* `('path')` is the non-default path to the `inetd.conf` file
|
|
21
23
|
* `should eq 'value'` is the value that is expected
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
## Matchers
|
|
25
|
-
|
|
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
|
-
|
|
28
|
-
its('shell') { should eq nil }
|
|
29
|
-
|
|
30
|
-
or:
|
|
31
|
-
|
|
32
|
-
its('netstat') { should eq nil }
|
|
33
|
-
|
|
34
|
-
or:
|
|
35
|
-
|
|
36
|
-
its('systat') { should eq nil }
|
|
37
|
-
|
|
38
|
-
For example:
|
|
39
|
-
|
|
40
|
-
describe inetd_conf do
|
|
41
|
-
its('shell') { should eq nil }
|
|
42
|
-
its('login') { should eq nil }
|
|
43
|
-
its('exec') { should eq nil }
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
### be
|
|
47
|
-
|
|
48
|
-
<%= partial "/shared/matcher_be" %>
|
|
49
|
-
|
|
50
|
-
### cmp
|
|
51
|
-
|
|
52
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
53
|
-
|
|
54
|
-
### eq
|
|
55
|
-
|
|
56
|
-
<%= partial "/shared/matcher_eq" %>
|
|
57
|
-
|
|
58
|
-
### include
|
|
59
|
-
|
|
60
|
-
<%= partial "/shared/matcher_include" %>
|
|
61
|
-
|
|
62
|
-
### match
|
|
63
|
-
|
|
64
|
-
<%= partial "/shared/matcher_match" %>
|
|
25
|
+
<br>
|
|
65
26
|
|
|
66
27
|
## Examples
|
|
67
28
|
|
|
@@ -97,3 +58,27 @@ then the same test will return `false` for `ftp` and the entire test will fail.
|
|
|
97
58
|
describe inetd_conf do
|
|
98
59
|
its('telnet') { should eq nil }
|
|
99
60
|
end
|
|
61
|
+
|
|
62
|
+
<br>
|
|
63
|
+
|
|
64
|
+
## Matchers
|
|
65
|
+
|
|
66
|
+
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`. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
67
|
+
|
|
68
|
+
its('shell') { should eq nil }
|
|
69
|
+
|
|
70
|
+
or:
|
|
71
|
+
|
|
72
|
+
its('netstat') { should eq nil }
|
|
73
|
+
|
|
74
|
+
or:
|
|
75
|
+
|
|
76
|
+
its('systat') { should eq nil }
|
|
77
|
+
|
|
78
|
+
For example:
|
|
79
|
+
|
|
80
|
+
describe inetd_conf do
|
|
81
|
+
its('shell') { should eq nil }
|
|
82
|
+
its('login') { should eq nil }
|
|
83
|
+
its('exec') { should eq nil }
|
|
84
|
+
end
|
data/docs/resources/ini.md.erb
CHANGED
|
@@ -6,6 +6,8 @@ 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
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
An `ini` resource block declares the configuration settings to be tested:
|
|
@@ -27,29 +29,7 @@ For example:
|
|
|
27
29
|
its('server') { should eq '192.0.2.62' }
|
|
28
30
|
end
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
This InSpec audit resource has the following matchers:
|
|
33
|
-
|
|
34
|
-
### be
|
|
35
|
-
|
|
36
|
-
<%= partial "/shared/matcher_be" %>
|
|
37
|
-
|
|
38
|
-
### cmp
|
|
39
|
-
|
|
40
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
41
|
-
|
|
42
|
-
### eq
|
|
43
|
-
|
|
44
|
-
<%= partial "/shared/matcher_eq" %>
|
|
45
|
-
|
|
46
|
-
### include
|
|
47
|
-
|
|
48
|
-
<%= partial "/shared/matcher_include" %>
|
|
49
|
-
|
|
50
|
-
### match
|
|
51
|
-
|
|
52
|
-
<%= partial "/shared/matcher_match" %>
|
|
32
|
+
<br>
|
|
53
33
|
|
|
54
34
|
## Examples
|
|
55
35
|
|
|
@@ -67,3 +47,9 @@ and can be tested like this:
|
|
|
67
47
|
describe ini(/etc/php5/apache2/php.ini) do
|
|
68
48
|
its('smtp_port') { should eq('465') }
|
|
69
49
|
end
|
|
50
|
+
|
|
51
|
+
<br>
|
|
52
|
+
|
|
53
|
+
## Matchers
|
|
54
|
+
|
|
55
|
+
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
@@ -9,6 +9,8 @@ Use the `interface` InSpec audit resource to test basic network adapter properti
|
|
|
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
|
+
<br>
|
|
13
|
+
|
|
12
14
|
## Syntax
|
|
13
15
|
|
|
14
16
|
An `interface` resource block declares network interface properties to be tested:
|
|
@@ -19,13 +21,11 @@ An `interface` resource block declares network interface properties to be tested
|
|
|
19
21
|
its('name') { should eq eth0 }
|
|
20
22
|
end
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
This InSpec audit resource has the following matchers:
|
|
24
|
+
<br>
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
## Matchers
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
29
29
|
|
|
30
30
|
### be_up
|
|
31
31
|
|
|
@@ -33,22 +33,6 @@ The `be_up` matcher tests if the network interface is available:
|
|
|
33
33
|
|
|
34
34
|
it { should be_up }
|
|
35
35
|
|
|
36
|
-
### cmp
|
|
37
|
-
|
|
38
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
39
|
-
|
|
40
|
-
### eq
|
|
41
|
-
|
|
42
|
-
<%= partial "/shared/matcher_eq" %>
|
|
43
|
-
|
|
44
|
-
### include
|
|
45
|
-
|
|
46
|
-
<%= partial "/shared/matcher_include" %>
|
|
47
|
-
|
|
48
|
-
### match
|
|
49
|
-
|
|
50
|
-
<%= partial "/shared/matcher_match" %>
|
|
51
|
-
|
|
52
36
|
### name
|
|
53
37
|
|
|
54
38
|
The `name` matcher tests if the named network interface exists:
|
|
@@ -60,7 +44,3 @@ The `name` matcher tests if the named network interface exists:
|
|
|
60
44
|
The `speed` matcher tests the speed of the network interface, in MB/sec:
|
|
61
45
|
|
|
62
46
|
its('speed') { should eq 1000 }
|
|
63
|
-
|
|
64
|
-
## Examples
|
|
65
|
-
|
|
66
|
-
None.
|