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/wmi.md.erb
CHANGED
|
@@ -6,6 +6,8 @@ title: About the wmi Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `wmi` InSpec audit resource to test WMI settings on the Windows platform.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `wmi` resource block tests WMI settings on the Windows platform:
|
|
@@ -46,30 +48,7 @@ and the second uses a filter in the Ruby Hash to first identify WinRM, and then
|
|
|
46
48
|
its('DisplayName') { should eq 'Windows Remote Management (WS-Management)'}
|
|
47
49
|
end
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
## Matchers
|
|
51
|
-
|
|
52
|
-
This InSpec audit resource has the following matchers:
|
|
53
|
-
|
|
54
|
-
### be
|
|
55
|
-
|
|
56
|
-
<%= partial "/shared/matcher_be" %>
|
|
57
|
-
|
|
58
|
-
### cmp
|
|
59
|
-
|
|
60
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
61
|
-
|
|
62
|
-
### eq
|
|
63
|
-
|
|
64
|
-
<%= partial "/shared/matcher_eq" %>
|
|
65
|
-
|
|
66
|
-
### include
|
|
67
|
-
|
|
68
|
-
<%= partial "/shared/matcher_include" %>
|
|
69
|
-
|
|
70
|
-
### match
|
|
71
|
-
|
|
72
|
-
<%= partial "/shared/matcher_match" %>
|
|
51
|
+
<br>
|
|
73
52
|
|
|
74
53
|
## Examples
|
|
75
54
|
|
|
@@ -93,3 +72,9 @@ The following examples show how to use this InSpec audit resource.
|
|
|
93
72
|
}) do
|
|
94
73
|
its('Setting') { should eq false }
|
|
95
74
|
end
|
|
75
|
+
|
|
76
|
+
<br>
|
|
77
|
+
|
|
78
|
+
## Matchers
|
|
79
|
+
|
|
80
|
+
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
@@ -12,6 +12,8 @@ or communications over a network. They may also be used for authentication.
|
|
|
12
12
|
Examples include SSL certificates, S/MIME certificates and VPN authentication
|
|
13
13
|
certificates.
|
|
14
14
|
|
|
15
|
+
<br>
|
|
16
|
+
|
|
15
17
|
## Syntax
|
|
16
18
|
|
|
17
19
|
An `x509_certificate` resource block declares a certificate `key file` to be tested.
|
|
@@ -20,6 +22,8 @@ An `x509_certificate` resource block declares a certificate `key file` to be tes
|
|
|
20
22
|
its('validity_in_days') { should be > 30 }
|
|
21
23
|
end
|
|
22
24
|
|
|
25
|
+
<br>
|
|
26
|
+
|
|
23
27
|
## Supported Properties
|
|
24
28
|
|
|
25
29
|
### subject.XX
|
|
@@ -6,6 +6,8 @@ title: About the xinetd_conf Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `xinetd_conf` InSpec audit resource to test services under `/etc/xinet.d` on Linux and Unix platforms. xinetd---the extended Internet service daemon---listens on all ports, and then loads the appropriate program based on a request. The `xinetd.conf` file is typically located at `/etc/xinetd.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 `xinetd_conf` resource block declares settings found in a `xinetd.conf` file for the named service:
|
|
@@ -21,28 +23,80 @@ where
|
|
|
21
23
|
* `('setting')` is a setting in the `xinetd.conf` file
|
|
22
24
|
* `should eq 'value'` is the value that is expected
|
|
23
25
|
|
|
26
|
+
<br>
|
|
24
27
|
|
|
25
|
-
##
|
|
28
|
+
## Examples
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
The following examples show how to use this InSpec audit resource.
|
|
28
31
|
|
|
29
|
-
###
|
|
32
|
+
### Test a socket_type
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
The network socket type: `dgram` (a datagram-based service), `raw` (a service that requires direct access to an IP address), `stream` (a stream-based service), or `seqpacket` (a service that requires a sequenced packet).
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
describe xinetd_conf.services('service_name') do
|
|
37
|
+
its('socket_types') { should include 'dgram' }
|
|
38
|
+
end
|
|
34
39
|
|
|
35
|
-
|
|
40
|
+
### Test a service type
|
|
36
41
|
|
|
37
|
-
|
|
42
|
+
The type of service: `INTERNAL` (a service provided by xinetd), `RPC` (an RPC-based service), `TCPMUX` (a service that is started on a well-known TPCMUX port), or `UNLISTED` (a service that is not listed in a standard system file location).
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
describe xinetd_conf.services('service_name') do
|
|
45
|
+
its('type') { should include 'RPC' }
|
|
46
|
+
end
|
|
40
47
|
|
|
41
|
-
|
|
48
|
+
### Test the telnet service
|
|
49
|
+
|
|
50
|
+
For example, a `telnet` file under `/etc/xinet.d` contains the following settings:
|
|
51
|
+
|
|
52
|
+
service telnet
|
|
53
|
+
{
|
|
54
|
+
disable = yes
|
|
55
|
+
flags = REUSE
|
|
56
|
+
socket_type = stream
|
|
57
|
+
wait = no
|
|
58
|
+
user = root
|
|
59
|
+
server = /usr/sbin/in.telnetd
|
|
60
|
+
log_on_failure += USERID
|
|
61
|
+
}
|
|
42
62
|
|
|
43
|
-
|
|
63
|
+
Some examples of tests that can be run against that file include:
|
|
44
64
|
|
|
45
|
-
|
|
65
|
+
describe xinetd_conf.services('telnet') do
|
|
66
|
+
it { should be_disabled }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
and
|
|
70
|
+
|
|
71
|
+
describe xinetd_conf.services('telnet') do
|
|
72
|
+
its('socket_type') { should include 'stream' }
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
and
|
|
76
|
+
|
|
77
|
+
describe xinetd_conf.services('telnet') do
|
|
78
|
+
its('wait') { should eq 'no' }
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
All three settings can be tested in the same block as well:
|
|
82
|
+
|
|
83
|
+
describe xinetd_conf.services('telnet') do
|
|
84
|
+
it { should be_disabled }
|
|
85
|
+
its('socket_type') { should include 'stream' }
|
|
86
|
+
its('wait') { should eq 'no' }
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
<br>
|
|
90
|
+
|
|
91
|
+
## Matchers
|
|
92
|
+
|
|
93
|
+
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/).
|
|
94
|
+
|
|
95
|
+
### be_enabed
|
|
96
|
+
|
|
97
|
+
The `be_enabled` matcher tests if a service listed under `/etc/xinet.d` is enabled:
|
|
98
|
+
|
|
99
|
+
it { should be_enabled }
|
|
46
100
|
|
|
47
101
|
### ids
|
|
48
102
|
|
|
@@ -54,14 +108,6 @@ For example:
|
|
|
54
108
|
|
|
55
109
|
its('ids') { should include 'chargen-stream chargen-dgram'}
|
|
56
110
|
|
|
57
|
-
### include
|
|
58
|
-
|
|
59
|
-
<%= partial "/shared/matcher_include" %>
|
|
60
|
-
|
|
61
|
-
### match
|
|
62
|
-
|
|
63
|
-
<%= partial "/shared/matcher_match" %>
|
|
64
|
-
|
|
65
111
|
### services
|
|
66
112
|
|
|
67
113
|
The `services` matcher tests if the named service is listed under `/etc/xinet.d`:
|
|
@@ -107,64 +153,3 @@ For TCP (`stream`) socket types the `wait` matcher should test for `no`:
|
|
|
107
153
|
|
|
108
154
|
its('socket_types') { should eq 'stream' }
|
|
109
155
|
its('wait') { should eq 'no' }
|
|
110
|
-
|
|
111
|
-
## Examples
|
|
112
|
-
|
|
113
|
-
The following examples show how to use this InSpec audit resource.
|
|
114
|
-
|
|
115
|
-
### Test a socket_type
|
|
116
|
-
|
|
117
|
-
The network socket type: `dgram` (a datagram-based service), `raw` (a service that requires direct access to an IP address), `stream` (a stream-based service), or `seqpacket` (a service that requires a sequenced packet).
|
|
118
|
-
|
|
119
|
-
describe xinetd_conf.services('service_name') do
|
|
120
|
-
its('socket_types') { should include 'dgram' }
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
### Test a service type
|
|
124
|
-
|
|
125
|
-
The type of service: `INTERNAL` (a service provided by xinetd), `RPC` (an RPC-based service), `TCPMUX` (a service that is started on a well-known TPCMUX port), or `UNLISTED` (a service that is not listed in a standard system file location).
|
|
126
|
-
|
|
127
|
-
describe xinetd_conf.services('service_name') do
|
|
128
|
-
its('type') { should include 'RPC' }
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
### Test the telnet service
|
|
132
|
-
|
|
133
|
-
For example, a `telnet` file under `/etc/xinet.d` contains the following settings:
|
|
134
|
-
|
|
135
|
-
service telnet
|
|
136
|
-
{
|
|
137
|
-
disable = yes
|
|
138
|
-
flags = REUSE
|
|
139
|
-
socket_type = stream
|
|
140
|
-
wait = no
|
|
141
|
-
user = root
|
|
142
|
-
server = /usr/sbin/in.telnetd
|
|
143
|
-
log_on_failure += USERID
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
Some examples of tests that can be run against that file include:
|
|
147
|
-
|
|
148
|
-
describe xinetd_conf.services('telnet') do
|
|
149
|
-
it { should be_disabled }
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
and
|
|
153
|
-
|
|
154
|
-
describe xinetd_conf.services('telnet') do
|
|
155
|
-
its('socket_type') { should include 'stream' }
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
and
|
|
159
|
-
|
|
160
|
-
describe xinetd_conf.services('telnet') do
|
|
161
|
-
its('wait') { should eq 'no' }
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
All three settings can be tested in the same block as well:
|
|
165
|
-
|
|
166
|
-
describe xinetd_conf.services('telnet') do
|
|
167
|
-
it { should be_disabled }
|
|
168
|
-
its('socket_type') { should include 'stream' }
|
|
169
|
-
its('wait') { should eq 'no' }
|
|
170
|
-
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: About the xml Resource
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# xml
|
|
6
|
+
|
|
7
|
+
Use the `xml` InSpec audit resource to test data in an XML file.
|
|
8
|
+
|
|
9
|
+
<br>
|
|
10
|
+
|
|
11
|
+
## Syntax
|
|
12
|
+
|
|
13
|
+
An `xml` resource block declares the data to be tested. Assume the following XML file:
|
|
14
|
+
|
|
15
|
+
<root>
|
|
16
|
+
<name>hello</name>
|
|
17
|
+
<meta>
|
|
18
|
+
<creator>John Doe</creator>
|
|
19
|
+
</meta>
|
|
20
|
+
<array>
|
|
21
|
+
<element>one</element>
|
|
22
|
+
<element>two</element>
|
|
23
|
+
</array>
|
|
24
|
+
</root>
|
|
25
|
+
|
|
26
|
+
This file can be queried using:
|
|
27
|
+
|
|
28
|
+
describe xml('/path/to/name.xml') do
|
|
29
|
+
its('root/name') { should eq ['hello'] }
|
|
30
|
+
its('root/meta/creator') { should eq ['John Doe'] }
|
|
31
|
+
its('root/array[2]/element]) { should eq ['two'] }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
where
|
|
35
|
+
|
|
36
|
+
* `root/name` is an XPath expression
|
|
37
|
+
* `should eq ['foo']` tests a value of `root/name` as read from an XML file versus the value declared in the test
|
|
38
|
+
|
|
39
|
+
<br>
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
The following examples show how to use this InSpec audit resource.
|
|
44
|
+
|
|
45
|
+
### Test an AppPool's presence in an applicationHost.config file
|
|
46
|
+
|
|
47
|
+
describe xml('applicationHost.config') do
|
|
48
|
+
its('configuration/system.applicationHost/applicationPools/add@name') { should contain('my_pool') }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
<br>
|
|
52
|
+
|
|
53
|
+
## Matchers
|
|
54
|
+
|
|
55
|
+
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/).
|
|
56
|
+
|
|
57
|
+
### name
|
|
58
|
+
|
|
59
|
+
The `name` matcher tests the value of `name` as read from a JSON file versus the value declared in the test:
|
|
60
|
+
|
|
61
|
+
its('name') { should eq 'foo' }
|
data/docs/resources/yaml.md.erb
CHANGED
|
@@ -6,6 +6,8 @@ title: About the yaml Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `yaml` InSpec audit resource to test configuration data in a Yaml file.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `yaml` resource block declares the configuration data to be tested. Assume the following Yaml file:
|
|
@@ -41,43 +43,26 @@ Like the `json` resource, the `yaml` resource can read a file, run a command, or
|
|
|
41
43
|
its('key2') { should cmp 'value2' }
|
|
42
44
|
end
|
|
43
45
|
|
|
46
|
+
<br>
|
|
44
47
|
|
|
45
|
-
##
|
|
46
|
-
|
|
47
|
-
This InSpec audit resource has the following matchers:
|
|
48
|
-
|
|
49
|
-
### be
|
|
50
|
-
|
|
51
|
-
<%= partial "/shared/matcher_be" %>
|
|
52
|
-
|
|
53
|
-
### cmp
|
|
54
|
-
|
|
55
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
48
|
+
## Examples
|
|
56
49
|
|
|
57
|
-
|
|
50
|
+
The following examples show how to use this InSpec audit resource.
|
|
58
51
|
|
|
59
|
-
|
|
52
|
+
### Test a kitchen.yml file driver
|
|
60
53
|
|
|
61
|
-
|
|
54
|
+
describe yaml('.kitchen.yaml') do
|
|
55
|
+
its('driver.name') { should eq('vagrant') }
|
|
56
|
+
end
|
|
62
57
|
|
|
63
|
-
|
|
58
|
+
<br>
|
|
64
59
|
|
|
65
|
-
|
|
60
|
+
## Matchers
|
|
66
61
|
|
|
67
|
-
|
|
62
|
+
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/).
|
|
68
63
|
|
|
69
64
|
### name
|
|
70
65
|
|
|
71
66
|
The `name` matcher tests the value of `name` as read from a Yaml file versus the value declared in the test:
|
|
72
67
|
|
|
73
68
|
its('name') { should eq 'foo' }
|
|
74
|
-
|
|
75
|
-
## Examples
|
|
76
|
-
|
|
77
|
-
The following examples show how to use this InSpec audit resource.
|
|
78
|
-
|
|
79
|
-
### Test a kitchen.yml file driver
|
|
80
|
-
|
|
81
|
-
describe yaml('.kitchen.yaml') do
|
|
82
|
-
its('driver.name') { should eq('vagrant') }
|
|
83
|
-
end
|
data/docs/resources/yum.md.erb
CHANGED
|
@@ -6,6 +6,8 @@ title: About the yum Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `yum` InSpec audit resource to test packages in the Yum repository.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `yum` resource block declares a package repo, tests if the package repository is present, and if it that package repository is a valid package source (i.e. "is enabled"):
|
|
@@ -19,41 +21,58 @@ where
|
|
|
19
21
|
|
|
20
22
|
* `repo('name')` is the (optional) name of a package repo, using either a full identifier (`'updates/7/x86_64'`) or a short identifier (`'updates'`)
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
<br>
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
## Examples
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
The following examples show how to use this InSpec audit resource.
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
### Test if the yum repo exists
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
describe yum do
|
|
33
|
+
its('repos') { should exist }
|
|
34
|
+
end
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
### Test if the 'base/7/x86_64' repo exists and is enabled
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
describe yum do
|
|
39
|
+
its('repos') { should include 'base/7/x86_64' }
|
|
40
|
+
its('epel') { should exist }
|
|
41
|
+
its('epel') { should be_enabled }
|
|
42
|
+
end
|
|
35
43
|
|
|
36
|
-
###
|
|
44
|
+
### Test if a specific yum repo exists
|
|
37
45
|
|
|
38
|
-
|
|
46
|
+
describe yum.repo('epel') do
|
|
47
|
+
it { should exist }
|
|
48
|
+
it { should be_enabled }
|
|
49
|
+
end
|
|
39
50
|
|
|
40
|
-
###
|
|
51
|
+
### Test a particular repository configuration, such as its Base URL
|
|
41
52
|
|
|
42
|
-
|
|
53
|
+
describe yum.repo('mycompany-artifacts') do
|
|
54
|
+
it { should exist }
|
|
55
|
+
it { should be_enabled }
|
|
56
|
+
its('baseurl') { should include 'mycompany.biz' }
|
|
57
|
+
end
|
|
43
58
|
|
|
44
|
-
|
|
59
|
+
<br>
|
|
45
60
|
|
|
46
|
-
|
|
61
|
+
## Matchers
|
|
47
62
|
|
|
48
|
-
|
|
63
|
+
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/).
|
|
49
64
|
|
|
50
|
-
###
|
|
65
|
+
### be_enabled
|
|
51
66
|
|
|
52
|
-
|
|
67
|
+
The `be_enabled` matcher tests if the package repository is a valid package source:
|
|
53
68
|
|
|
54
|
-
|
|
69
|
+
it { should be_enabled }
|
|
55
70
|
|
|
56
|
-
|
|
71
|
+
### exist
|
|
72
|
+
|
|
73
|
+
The `exist` matcher tests if the package repository exists:
|
|
74
|
+
|
|
75
|
+
it { should exist }
|
|
57
76
|
|
|
58
77
|
### repo('name')
|
|
59
78
|
|
|
@@ -76,36 +95,3 @@ The `shortname` matcher names a specific package repository's group identifier.
|
|
|
76
95
|
describe yum.repo('Directory Server') do
|
|
77
96
|
its('shortname') { should eq 'directory-server' }
|
|
78
97
|
end
|
|
79
|
-
|
|
80
|
-
## Examples
|
|
81
|
-
|
|
82
|
-
The following examples show how to use this InSpec audit resource.
|
|
83
|
-
|
|
84
|
-
### Test if the yum repo exists
|
|
85
|
-
|
|
86
|
-
describe yum do
|
|
87
|
-
its('repos') { should exist }
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
### Test if the 'base/7/x86_64' repo exists and is enabled
|
|
91
|
-
|
|
92
|
-
describe yum do
|
|
93
|
-
its('repos') { should include 'base/7/x86_64' }
|
|
94
|
-
its('epel') { should exist }
|
|
95
|
-
its('epel') { should be_enabled }
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
### Test if a specific yum repo exists
|
|
99
|
-
|
|
100
|
-
describe yum.repo('epel') do
|
|
101
|
-
it { should exist }
|
|
102
|
-
it { should be_enabled }
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
### Test a particular repository configuration, such as its Base URL
|
|
106
|
-
|
|
107
|
-
describe yum.repo('mycompany-artifacts') do
|
|
108
|
-
it { should exist }
|
|
109
|
-
it { should be_enabled }
|
|
110
|
-
its('baseurl') { should include 'mycompany.biz' }
|
|
111
|
-
end
|
|
@@ -6,6 +6,8 @@ title: About the zfs_dataset Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `zfs_dataset` InSpec audit resource to test the ZFS datasets on FreeBSD systems.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `zfs_dataset` resource block declares the ZFS dataset properties that should be tested:
|
|
@@ -20,32 +22,7 @@ where
|
|
|
20
22
|
* `MATCHER` is a valid matcher for this resource
|
|
21
23
|
* `'value'` is the value to be tested
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
## Matchers
|
|
25
|
-
|
|
26
|
-
This InSpec audit resource has the matchers listed below, in addition to dynamically exposing all ZFS dataset properties available (see: `man zfs` for the list of supported properties.)
|
|
27
|
-
|
|
28
|
-
### be
|
|
29
|
-
|
|
30
|
-
<%= partial "/shared/matcher_be" %>
|
|
31
|
-
|
|
32
|
-
### be_mounted
|
|
33
|
-
|
|
34
|
-
The `be_mounted` matcher tests if the dataset is accessible from the file system:
|
|
35
|
-
|
|
36
|
-
it { should be_mounted }
|
|
37
|
-
|
|
38
|
-
### cmp
|
|
39
|
-
|
|
40
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
41
|
-
|
|
42
|
-
### eq
|
|
43
|
-
|
|
44
|
-
<%= partial "/shared/matcher_eq" %>
|
|
45
|
-
|
|
46
|
-
### match
|
|
47
|
-
|
|
48
|
-
<%= partial "/shared/matcher_match" %>
|
|
25
|
+
<br>
|
|
49
26
|
|
|
50
27
|
## Examples
|
|
51
28
|
|
|
@@ -61,3 +38,15 @@ The following examples show how to use this InSpec audit resource.
|
|
|
61
38
|
its('readonly') { should eq 'off' }
|
|
62
39
|
its('setuid') { should eq 'off' }
|
|
63
40
|
end
|
|
41
|
+
|
|
42
|
+
<br>
|
|
43
|
+
|
|
44
|
+
## Matchers
|
|
45
|
+
|
|
46
|
+
This InSpec audit resource has the matchers listed below, in addition to dynamically exposing all ZFS dataset properties available (see: `man zfs` for the list of supported properties). For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
47
|
+
|
|
48
|
+
### be_mounted
|
|
49
|
+
|
|
50
|
+
The `be_mounted` matcher tests if the dataset is accessible from the file system:
|
|
51
|
+
|
|
52
|
+
it { should be_mounted }
|
|
@@ -6,6 +6,8 @@ title: About the zfs_pool Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `zfs_pool` InSpec audit resource to test the ZFS pools on FreeBSD systems.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `zfs_pool` resource block declares the ZFS pool properties that should be tested:
|
|
@@ -20,26 +22,7 @@ where
|
|
|
20
22
|
* `MATCHER` is a valid matcher for this resource
|
|
21
23
|
* `'value'` is the value to be tested
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
## Matchers
|
|
25
|
-
|
|
26
|
-
This InSpec audit resource has the matchers listed below, in addition to dynamically exposing all ZFS pool properties available (see: `man zpool` for the list of supported properties.)
|
|
27
|
-
|
|
28
|
-
### be
|
|
29
|
-
|
|
30
|
-
<%= partial "/shared/matcher_be" %>
|
|
31
|
-
|
|
32
|
-
### cmp
|
|
33
|
-
|
|
34
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
35
|
-
|
|
36
|
-
### eq
|
|
37
|
-
|
|
38
|
-
<%= partial "/shared/matcher_eq" %>
|
|
39
|
-
|
|
40
|
-
### match
|
|
41
|
-
|
|
42
|
-
<%= partial "/shared/matcher_match" %>
|
|
25
|
+
<br>
|
|
43
26
|
|
|
44
27
|
## Examples
|
|
45
28
|
|
|
@@ -55,3 +38,9 @@ The following examples show how to use this InSpec audit resource.
|
|
|
55
38
|
its('listsnapshots') { should eq 'off' }
|
|
56
39
|
its('readonly') { should eq 'off' }
|
|
57
40
|
end
|
|
41
|
+
|
|
42
|
+
<br>
|
|
43
|
+
|
|
44
|
+
## Matchers
|
|
45
|
+
|
|
46
|
+
This InSpec audit resource dynamically exposes all ZFS pool properties available (see: `man zpool` for the list of supported properties). For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
data/docs/ruby_usage.md
CHANGED
|
@@ -114,7 +114,6 @@ methods available, etc. For the above example:
|
|
|
114
114
|
[3] pry> ls perl_out
|
|
115
115
|
Inspec::Plugins::Resource#methods: inspect
|
|
116
116
|
Inspec::Resources::Cmd#methods: command exist? exit_status result stderr stdout to_s
|
|
117
|
-
Inspec::Plugins::ResourceCommon#methods: resource_skipped skip_resource
|
|
118
117
|
Inspec::Resource::Registry::Command#methods: inspec
|
|
119
118
|
instance variables: @__backend_runner__ @__resource_name__ @command @result
|
|
120
119
|
[4] pry> perl_out.stdout.partition('@INC:').last.strip.split("\n")
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Example InSpec Profile with Sensitive failures
|
|
2
|
+
|
|
3
|
+
This profile demostrates resources flagged as sensitive
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
$ inspec exec examples/profile-sensitive
|
|
9
|
+
....
|
|
10
|
+
|
|
11
|
+
bob should
|
|
12
|
+
∅ eq "billy"
|
|
13
|
+
|
|
14
|
+
expected: "billy"
|
|
15
|
+
got: "bob"
|
|
16
|
+
|
|
17
|
+
(compared using ==)
|
|
18
|
+
|
|
19
|
+
sensitivepassword should
|
|
20
|
+
∅ eq "secret"
|
|
21
|
+
*** sensitive output suppressed ***
|
|
22
|
+
bob should
|
|
23
|
+
✔ eq "bob"
|
|
24
|
+
sensitivepassword should
|
|
25
|
+
✔ eq "sensitivepassword"
|
|
26
|
+
|
|
27
|
+
Test Summary: 2 successful, 2 failures, 0 skipped
|
|
28
|
+
|
|
29
|
+
```
|