inspec 1.40.0 → 1.41.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -9
- data/docs/matchers.md +18 -0
- data/docs/plugin_kitchen_inspec.md +18 -24
- data/docs/profiles.md +39 -2
- data/docs/resources/aide_conf.md.erb +18 -28
- 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 +9 -24
- 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/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 +60 -57
- data/docs/resources/docker_container.md.erb +23 -19
- data/docs/resources/docker_image.md.erb +20 -16
- data/docs/resources/etc_fstab.md.erb +5 -2
- data/docs/resources/etc_group.md.erb +29 -45
- data/docs/resources/etc_hosts.md.erb +6 -0
- data/docs/resources/etc_hosts_allow.md.erb +6 -2
- data/docs/resources/etc_hosts_deny.md.erb +6 -2
- data/docs/resources/file.md.erb +198 -212
- data/docs/resources/firewalld.md.erb +7 -1
- 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 +17 -32
- data/docs/resources/mysql_session.md.erb +15 -29
- data/docs/resources/nginx.md.erb +6 -0
- data/docs/resources/nginx_conf.md.erb +25 -20
- 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 +29 -44
- data/docs/resources/package.md.erb +33 -42
- data/docs/resources/parse_config.md.erb +5 -25
- data/docs/resources/parse_config_file.md.erb +31 -43
- data/docs/resources/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/shadow.md.erb +20 -35
- 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 +15 -9
- 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 +12 -26
- 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/lib/inspec/backend.rb +8 -0
- data/lib/inspec/profile.rb +9 -1
- data/lib/inspec/shell.rb +13 -13
- data/lib/inspec/version.rb +1 -1
- data/lib/matchers/matchers.rb +2 -0
- data/lib/resources/etc_hosts.rb +1 -1
- data/lib/resources/host.rb +4 -1
- data/lib/resources/http.rb +173 -23
- data/lib/resources/processes.rb +106 -20
- data/lib/resources/ssh_conf.rb +1 -1
- data/lib/resources/ssl.rb +4 -3
- data/lib/utils/object_traversal.rb +35 -10
- metadata +2 -2
@@ -6,6 +6,8 @@ title: About the os_env Resource
|
|
6
6
|
|
7
7
|
Use the `os_env` InSpec audit resource to test the environment variables for the platform on which the system is running.
|
8
8
|
|
9
|
+
<br>
|
10
|
+
|
9
11
|
## Syntax
|
10
12
|
|
11
13
|
A `os_env` resource block declares an environment variable, and then declares its value:
|
@@ -19,50 +21,7 @@ where
|
|
19
21
|
* `('VARIABLE')` must specify an environment variable, such as `PATH`
|
20
22
|
* `matcher` is a valid matcher for this resource
|
21
23
|
|
22
|
-
|
23
|
-
## Matchers
|
24
|
-
|
25
|
-
This InSpec audit resource has the following matchers:
|
26
|
-
|
27
|
-
### be
|
28
|
-
|
29
|
-
<%= partial "/shared/matcher_be" %>
|
30
|
-
|
31
|
-
### cmp
|
32
|
-
|
33
|
-
<%= partial "/shared/matcher_cmp" %>
|
34
|
-
|
35
|
-
### content
|
36
|
-
|
37
|
-
The `content` matcher return the value of the environment variable:
|
38
|
-
|
39
|
-
its('content') { should eq '/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin' }
|
40
|
-
|
41
|
-
### eq
|
42
|
-
|
43
|
-
<%= partial "/shared/matcher_eq" %>
|
44
|
-
|
45
|
-
### include
|
46
|
-
|
47
|
-
<%= partial "/shared/matcher_include" %>
|
48
|
-
|
49
|
-
### match
|
50
|
-
|
51
|
-
<%= partial "/shared/matcher_match" %>
|
52
|
-
|
53
|
-
### split
|
54
|
-
|
55
|
-
The `split` splits the content with the `:` deliminator:
|
56
|
-
|
57
|
-
its('split') { should include (':') }
|
58
|
-
|
59
|
-
or:
|
60
|
-
|
61
|
-
its('split') { should_not include ('.') }
|
62
|
-
|
63
|
-
Use `-1` to test for cases where there is a trailing colon (`:`), such as `dir1::dir2:`:
|
64
|
-
|
65
|
-
its('split') { should include ('-1') }
|
24
|
+
<br>
|
66
25
|
|
67
26
|
## Examples
|
68
27
|
|
@@ -96,3 +55,29 @@ Habitat uses the `os_env` resource to test environment variables. The environmen
|
|
96
55
|
its('content') { should eq nil }
|
97
56
|
end
|
98
57
|
end
|
58
|
+
|
59
|
+
<br>
|
60
|
+
|
61
|
+
## Matchers
|
62
|
+
|
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/).
|
64
|
+
|
65
|
+
### content
|
66
|
+
|
67
|
+
The `content` matcher return the value of the environment variable:
|
68
|
+
|
69
|
+
its('content') { should eq '/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin' }
|
70
|
+
|
71
|
+
### split
|
72
|
+
|
73
|
+
The `split` splits the content with the `:` deliminator:
|
74
|
+
|
75
|
+
its('split') { should include (':') }
|
76
|
+
|
77
|
+
or:
|
78
|
+
|
79
|
+
its('split') { should_not include ('.') }
|
80
|
+
|
81
|
+
Use `-1` to test for cases where there is a trailing colon (`:`), such as `dir1::dir2:`:
|
82
|
+
|
83
|
+
its('split') { should include ('-1') }
|
@@ -6,6 +6,7 @@ title: About the package Resource
|
|
6
6
|
|
7
7
|
Use the `package` InSpec audit resource to test if the named package and/or package version is installed on the system.
|
8
8
|
|
9
|
+
<br>
|
9
10
|
|
10
11
|
## Syntax
|
11
12
|
|
@@ -20,48 +21,7 @@ where
|
|
20
21
|
* `('name')` must specify the name of a package, such as `'nginx'`
|
21
22
|
* `be_installed` is a valid matcher for this resource
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
This InSpec audit resource has the following matchers:
|
26
|
-
|
27
|
-
### be
|
28
|
-
|
29
|
-
<%= partial "/shared/matcher_be" %>
|
30
|
-
|
31
|
-
### be_held
|
32
|
-
|
33
|
-
The `be_held` matcher tests if the named package is "held". On dpkg platforms, a "held" package
|
34
|
-
will not be upgraded to a later version.
|
35
|
-
|
36
|
-
it { should be_held }
|
37
|
-
|
38
|
-
### be_installed
|
39
|
-
|
40
|
-
The `be_installed` matcher tests if the named package is installed on the system:
|
41
|
-
|
42
|
-
it { should be_installed }
|
43
|
-
|
44
|
-
### cmp
|
45
|
-
|
46
|
-
<%= partial "/shared/matcher_cmp" %>
|
47
|
-
|
48
|
-
### eq
|
49
|
-
|
50
|
-
<%= partial "/shared/matcher_eq" %>
|
51
|
-
|
52
|
-
### include
|
53
|
-
|
54
|
-
<%= partial "/shared/matcher_include" %>
|
55
|
-
|
56
|
-
### match
|
57
|
-
|
58
|
-
<%= partial "/shared/matcher_match" %>
|
59
|
-
|
60
|
-
### version
|
61
|
-
|
62
|
-
The `version` matcher tests if the named package version is on the system:
|
63
|
-
|
64
|
-
its('version') { should eq '1.2.3' }
|
24
|
+
<br>
|
65
25
|
|
66
26
|
## Examples
|
67
27
|
|
@@ -126,3 +86,34 @@ Memcached is an in-memory key-value store that helps improve the performance of
|
|
126
86
|
describe port(11_211) do
|
127
87
|
it { should be_listening }
|
128
88
|
end
|
89
|
+
|
90
|
+
<br>
|
91
|
+
|
92
|
+
## Matchers
|
93
|
+
|
94
|
+
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/).
|
95
|
+
|
96
|
+
### be_held
|
97
|
+
|
98
|
+
The `be_held` matcher tests if the named package is "held". On dpkg platforms, a "held" package
|
99
|
+
will not be upgraded to a later version.
|
100
|
+
|
101
|
+
it { should be_held }
|
102
|
+
|
103
|
+
### be_installed
|
104
|
+
|
105
|
+
The `be_installed` matcher tests if the named package is installed on the system:
|
106
|
+
|
107
|
+
it { should be_installed }
|
108
|
+
|
109
|
+
### version
|
110
|
+
|
111
|
+
The `version` matcher tests if the named package version is on the system:
|
112
|
+
|
113
|
+
its('version') { should eq '1.2.3' }
|
114
|
+
|
115
|
+
You can also use the `cmp OPERATOR` matcher to perform comparisions using the version attribute:
|
116
|
+
|
117
|
+
its('version') { should cmp >= '7.35.0-1ubuntu3.10' }
|
118
|
+
|
119
|
+
`cmp` understands version numbers using Gem::Version, and can use the operators `==, <, <=, >=, and >`. It will compare versions by each segment, not as a string - so '7.4' is smaller than '7.30', for example.
|
@@ -6,6 +6,8 @@ title: About the parse_config Resource
|
|
6
6
|
|
7
7
|
Use the `parse_config` InSpec audit resource to test arbitrary configuration files.
|
8
8
|
|
9
|
+
<br>
|
10
|
+
|
9
11
|
## Syntax
|
10
12
|
|
11
13
|
A `parse_config` resource block declares the location of the configuration setting to be tested, and then what value is to be tested. Because this resource relies on arbitrary configuration files, the test itself is often arbitrary and relies on custom Ruby code:
|
@@ -35,9 +37,11 @@ where each test
|
|
35
37
|
* May run a command to `stdout`, and then run the test against that output
|
36
38
|
* May use options to define how configuration data is to be parsed
|
37
39
|
|
40
|
+
<br>
|
41
|
+
|
38
42
|
## Matchers
|
39
43
|
|
40
|
-
This InSpec audit resource has the following matchers
|
44
|
+
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/).
|
41
45
|
|
42
46
|
### assignment_regex
|
43
47
|
|
@@ -49,28 +53,12 @@ may be tested using the following regular expression, which determines assignmen
|
|
49
53
|
|
50
54
|
assignment_regex: /^\s*([^=]*?)\s*=\s*(.*?)\s*$/
|
51
55
|
|
52
|
-
### be
|
53
|
-
|
54
|
-
<%= partial "/shared/matcher_be" %>
|
55
|
-
|
56
|
-
### cmp
|
57
|
-
|
58
|
-
<%= partial "/shared/matcher_cmp" %>
|
59
|
-
|
60
56
|
### comment_char
|
61
57
|
|
62
58
|
Use `comment_char` to test for comments in a configuration file:
|
63
59
|
|
64
60
|
comment_char: '#'
|
65
61
|
|
66
|
-
### eq
|
67
|
-
|
68
|
-
<%= partial "/shared/matcher_eq" %>
|
69
|
-
|
70
|
-
### include
|
71
|
-
|
72
|
-
<%= partial "/shared/matcher_include" %>
|
73
|
-
|
74
62
|
### key_values
|
75
63
|
|
76
64
|
Use `key_values` to test how many values a key contains:
|
@@ -81,10 +69,6 @@ contains three values. To test that value to ensure it only contains one, use:
|
|
81
69
|
|
82
70
|
key_values: 1
|
83
71
|
|
84
|
-
### match
|
85
|
-
|
86
|
-
<%= partial "/shared/matcher_match" %>
|
87
|
-
|
88
72
|
### multiple_values
|
89
73
|
|
90
74
|
Use `multiple_values` if the source file uses the same key multiple times. All values will be aggregated in an array:
|
@@ -116,7 +100,3 @@ Use `standalone_comments: false`, to parse the following:
|
|
116
100
|
|
117
101
|
'key = value # comment'
|
118
102
|
params['key'] = 'value'
|
119
|
-
|
120
|
-
## Examples
|
121
|
-
|
122
|
-
None.
|
@@ -6,6 +6,8 @@ title: About the parse_config_file Resource
|
|
6
6
|
|
7
7
|
Use the `parse_config_file` InSpec audit resource to test arbitrary configuration files. It works in the same way as `parse_config`. Instead of using a command output, this resource works with files.
|
8
8
|
|
9
|
+
<br>
|
10
|
+
|
9
11
|
## Syntax
|
10
12
|
|
11
13
|
A `parse_config_file` InSpec audit resource block declares the location of the configuration file to be tested, and then which settings in that file are to be tested.
|
@@ -32,6 +34,8 @@ where each test
|
|
32
34
|
* May run a command to `stdout`, and then run the test against that output
|
33
35
|
* May use options to define how configuration data is to be parsed
|
34
36
|
|
37
|
+
<br>
|
38
|
+
|
35
39
|
## Options
|
36
40
|
|
37
41
|
This resource supports the following options for parsing configuration data. Use them in an `options` block stated outside of (and immediately before) the actual test:
|
@@ -44,9 +48,35 @@ This resource supports the following options for parsing configuration data. Use
|
|
44
48
|
its('setting') { should eq 1 }
|
45
49
|
end
|
46
50
|
|
51
|
+
<br>
|
52
|
+
|
53
|
+
## Examples
|
54
|
+
|
55
|
+
The following examples show how to use this InSpec audit resource.
|
56
|
+
|
57
|
+
### Test a configuration setting
|
58
|
+
|
59
|
+
describe parse_config_file('/path/to/file.conf') do
|
60
|
+
its('PARAM_X') { should eq 'Y' }
|
61
|
+
end
|
62
|
+
|
63
|
+
### Use options, and then test a configuration setting
|
64
|
+
|
65
|
+
describe parse_config_file('/path/to/file.conf', { multiple_values: true }) do
|
66
|
+
its('PARAM_X') { should include 'Y' }
|
67
|
+
end
|
68
|
+
|
69
|
+
## Test a file with an ini-like structure (such as a yum.conf)
|
70
|
+
|
71
|
+
describe parse_config_file('/path/to/yum.conf') do
|
72
|
+
its('main') { should include('gpgcheck' => '1') }
|
73
|
+
end
|
74
|
+
|
75
|
+
<br>
|
76
|
+
|
47
77
|
## Matchers
|
48
78
|
|
49
|
-
This InSpec audit resource has the following matchers
|
79
|
+
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/).
|
50
80
|
|
51
81
|
### assignment_regex
|
52
82
|
|
@@ -58,28 +88,12 @@ may be tested using the following regular expression, which determines assignmen
|
|
58
88
|
|
59
89
|
assignment_regex: /^\s*([^=]*?)\s*=\s*(.*?)\s*$/
|
60
90
|
|
61
|
-
### be
|
62
|
-
|
63
|
-
<%= partial "/shared/matcher_be" %>
|
64
|
-
|
65
|
-
### cmp
|
66
|
-
|
67
|
-
<%= partial "/shared/matcher_cmp" %>
|
68
|
-
|
69
91
|
### comment_char
|
70
92
|
|
71
93
|
Use `comment_char` to test for comments in a configuration file:
|
72
94
|
|
73
95
|
comment_char: '#'
|
74
96
|
|
75
|
-
### eq
|
76
|
-
|
77
|
-
<%= partial "/shared/matcher_eq" %>
|
78
|
-
|
79
|
-
### include
|
80
|
-
|
81
|
-
<%= partial "/shared/matcher_include" %>
|
82
|
-
|
83
97
|
### key_values
|
84
98
|
|
85
99
|
Use `key_values` to test how many values a key contains:
|
@@ -90,10 +104,6 @@ contains three values. To test that value to ensure it only contains one, use:
|
|
90
104
|
|
91
105
|
key_values: 1
|
92
106
|
|
93
|
-
### match
|
94
|
-
|
95
|
-
<%= partial "/shared/matcher_match" %>
|
96
|
-
|
97
107
|
### multiple_values
|
98
108
|
|
99
109
|
Use `multiple_values` if the source file uses the same key multiple times. All values will be aggregated in an array:
|
@@ -125,25 +135,3 @@ Use `standalone_comments: false`, to parse the following:
|
|
125
135
|
|
126
136
|
'key = value # comment'
|
127
137
|
params['key'] = 'value'
|
128
|
-
|
129
|
-
## Examples
|
130
|
-
|
131
|
-
The following examples show how to use this InSpec audit resource.
|
132
|
-
|
133
|
-
### Test a configuration setting
|
134
|
-
|
135
|
-
describe parse_config_file('/path/to/file.conf') do
|
136
|
-
its('PARAM_X') { should eq 'Y' }
|
137
|
-
end
|
138
|
-
|
139
|
-
### Use options, and then test a configuration setting
|
140
|
-
|
141
|
-
describe parse_config_file('/path/to/file.conf', { multiple_values: true }) do
|
142
|
-
its('PARAM_X') { should include 'Y' }
|
143
|
-
end
|
144
|
-
|
145
|
-
## Test a file with an ini-like structure (such as a yum.conf)
|
146
|
-
|
147
|
-
describe parse_config_file('/path/to/yum.conf') do
|
148
|
-
its('main') { should include('gpgcheck' => '1') }
|
149
|
-
end
|
@@ -18,6 +18,8 @@ These entries are defined as a colon-delimited row in the file, one row per user
|
|
18
18
|
|
19
19
|
root:x:1234:5678:additional_info:/home/dir/:/bin/bash
|
20
20
|
|
21
|
+
<br>
|
22
|
+
|
21
23
|
## Syntax
|
22
24
|
|
23
25
|
A `passwd` resource block declares one (or more) users and associated user information to be tested:
|
@@ -37,22 +39,36 @@ where
|
|
37
39
|
* `filter` one (or more) arguments, for example: `passwd.users(/name/)` used to define filtering
|
38
40
|
* `filter` may take any of the following arguments: `count` (retrieves the number of entries), `lines` (provides raw `passwd` lines), and `params` (returns an array of maps for all entries)
|
39
41
|
|
42
|
+
<br>
|
40
43
|
|
41
|
-
##
|
44
|
+
## Examples
|
45
|
+
|
46
|
+
The following examples show how to use this InSpec audit resource.
|
47
|
+
|
48
|
+
### Test usernames and UIDs
|
42
49
|
|
43
|
-
|
50
|
+
describe passwd do
|
51
|
+
its('users') { should eq ['root', 'www-data'] }
|
52
|
+
its('uids') { should eq [0, 33] }
|
53
|
+
end
|
44
54
|
|
45
|
-
###
|
55
|
+
### Select one user and test for multiple occurrences
|
46
56
|
|
47
|
-
|
57
|
+
describe passwd.uids(0) do
|
58
|
+
its('users') { should cmp 'root' }
|
59
|
+
its('count') { should eq 1 }
|
60
|
+
end
|
48
61
|
|
49
|
-
|
62
|
+
describe passwd.filter(user: 'www-data') do
|
63
|
+
its('uids') { should cmp 33 }
|
64
|
+
its('count') { should eq 1 }
|
65
|
+
end
|
50
66
|
|
51
|
-
|
67
|
+
<br>
|
52
68
|
|
53
|
-
|
69
|
+
## Matchers
|
54
70
|
|
55
|
-
|
71
|
+
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
72
|
|
57
73
|
### gids
|
58
74
|
|
@@ -67,10 +83,6 @@ The `homes` matcher tests the absolute path to a user's home directory:
|
|
67
83
|
|
68
84
|
its('home') { should eq '/' }
|
69
85
|
|
70
|
-
### include
|
71
|
-
|
72
|
-
<%= partial "/shared/matcher_include" %>
|
73
|
-
|
74
86
|
### length
|
75
87
|
|
76
88
|
The `length` matcher tests the length of a password that appears in `/etc/passwd`:
|
@@ -83,10 +95,6 @@ This matcher is best used in conjunction with filters. For example:
|
|
83
95
|
its('length') { should_not be < 16 }
|
84
96
|
end
|
85
97
|
|
86
|
-
### match
|
87
|
-
|
88
|
-
<%= partial "/shared/matcher_match" %>
|
89
|
-
|
90
98
|
### passwords
|
91
99
|
|
92
100
|
The `passwords` matcher tests if passwords are
|
@@ -130,26 +138,3 @@ or:
|
|
130
138
|
The `users` matcher tests if the user names in the test match user names in `/etc/passwd`:
|
131
139
|
|
132
140
|
its('users') { should eq ['root', 'www-data'] }
|
133
|
-
|
134
|
-
## Examples
|
135
|
-
|
136
|
-
The following examples show how to use this InSpec audit resource.
|
137
|
-
|
138
|
-
### Test usernames and UIDs
|
139
|
-
|
140
|
-
describe passwd do
|
141
|
-
its('users') { should eq ['root', 'www-data'] }
|
142
|
-
its('uids') { should eq [0, 33] }
|
143
|
-
end
|
144
|
-
|
145
|
-
### Select one user and test for multiple occurrences
|
146
|
-
|
147
|
-
describe passwd.uids(0) do
|
148
|
-
its('users') { should cmp 'root' }
|
149
|
-
its('count') { should eq 1 }
|
150
|
-
end
|
151
|
-
|
152
|
-
describe passwd.filter(user: 'www-data') do
|
153
|
-
its('uids') { should cmp 33 }
|
154
|
-
its('count') { should eq 1 }
|
155
|
-
end
|