inspec 1.0.0.beta2 → 1.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -2
- data/Gemfile +4 -0
- data/Rakefile +2 -1
- data/docs/.gitignore +2 -0
- data/docs/README.md +21 -1
- data/docs/resources/apache_conf.md.erb +75 -0
- data/docs/resources/apt.md.erb +84 -0
- data/docs/resources/audit_policy.md.erb +61 -0
- data/docs/resources/auditd_conf.md.erb +79 -0
- data/docs/resources/auditd_rules.md.erb +132 -0
- data/docs/resources/bash.md.erb +84 -0
- data/docs/resources/bond.md.erb +97 -0
- data/docs/resources/bridge.md.erb +67 -0
- data/docs/resources/bsd_service.md.erb +76 -0
- data/docs/resources/command.md.erb +151 -0
- data/docs/resources/csv.md.erb +62 -0
- data/docs/resources/directory.md.erb +43 -0
- data/docs/resources/etc_group.md.erb +116 -0
- data/docs/resources/etc_passwd.md.erb +155 -0
- data/docs/resources/etc_shadow.md.erb +149 -0
- data/docs/resources/file.md.erb +460 -0
- data/docs/resources/gem.md.erb +73 -0
- data/docs/resources/group.md.erb +74 -0
- data/docs/resources/grub_conf.md.erb +115 -0
- data/docs/resources/host.md.erb +85 -0
- data/docs/resources/iis_site.md.erb +142 -0
- data/docs/resources/inetd_conf.md.erb +99 -0
- data/docs/resources/ini.md.erb +69 -0
- data/docs/resources/interface.md.erb +66 -0
- data/docs/resources/iptables.md.erb +70 -0
- data/docs/resources/json.md.erb +76 -0
- data/docs/resources/kernel_module.md.erb +60 -0
- data/docs/resources/kernel_parameter.md.erb +72 -0
- data/docs/resources/launchd_service.md.erb +76 -0
- data/docs/resources/limits_conf.md.erb +80 -0
- data/docs/resources/login_def.md.erb +77 -0
- data/docs/resources/mount.md.erb +83 -0
- data/docs/resources/mysql_conf.md.erb +102 -0
- data/docs/resources/mysql_session.md.erb +63 -0
- data/docs/resources/npm.md.erb +75 -0
- data/docs/resources/ntp_conf.md.erb +76 -0
- data/docs/resources/oneget.md.erb +67 -0
- data/docs/resources/os.md.erb +154 -0
- data/docs/resources/os_env.md.erb +98 -0
- data/docs/resources/package.md.erb +115 -0
- data/docs/resources/parse_config.md.erb +122 -0
- data/docs/resources/parse_config_file.md.erb +143 -0
- data/docs/resources/pip.md.erb +74 -0
- data/docs/resources/port.md.erb +150 -0
- data/docs/resources/postgres_conf.md.erb +90 -0
- data/docs/resources/postgres_session.md.erb +75 -0
- data/docs/resources/powershell.md.erb +116 -0
- data/docs/resources/process.md.erb +73 -0
- data/docs/resources/registry_key.md.erb +149 -0
- data/docs/resources/runit_service.md.erb +76 -0
- data/docs/resources/security_policy.md.erb +61 -0
- data/docs/resources/service.md.erb +135 -0
- data/docs/resources/ssh_config.md.erb +94 -0
- data/docs/resources/sshd_config.md.erb +97 -0
- data/docs/resources/ssl.md.erb +133 -0
- data/docs/resources/sys_info.md.erb +55 -0
- data/docs/resources/systemd_service.md.erb +76 -0
- data/docs/resources/sysv_service.md.erb +76 -0
- data/docs/resources/upstart_service.md.erb +76 -0
- data/docs/resources/user.md.erb +154 -0
- data/docs/resources/users.md.erb +140 -0
- data/docs/resources/vbscript.md.erb +69 -0
- data/docs/resources/windows_feature.md.erb +61 -0
- data/docs/resources/wmi.md.erb +95 -0
- data/docs/resources/xinetd_conf.md.erb +170 -0
- data/docs/resources/yaml.md.erb +69 -0
- data/docs/resources/yum.md.erb +103 -0
- data/docs/ruby_usage.md +154 -0
- data/docs/shared/matcher_be.md.erb +1 -0
- data/docs/shared/matcher_cmp.md.erb +45 -0
- data/docs/shared/matcher_eq.md.erb +3 -0
- data/docs/shared/matcher_include.md.erb +1 -0
- data/docs/shared/matcher_match.md.erb +1 -0
- data/lib/fetchers/url.rb +27 -29
- data/lib/inspec/cached_fetcher.rb +67 -0
- data/lib/inspec/dependencies/requirement.rb +6 -7
- data/lib/inspec/objects/each_loop.rb +5 -2
- data/lib/inspec/plugins/fetcher.rb +2 -0
- data/lib/inspec/profile.rb +9 -41
- data/lib/inspec/resource.rb +1 -1
- data/lib/inspec/rspec_json_formatter.rb +11 -5
- data/lib/inspec/version.rb +1 -1
- data/lib/resources/groups.rb +190 -0
- data/lib/resources/users.rb +3 -2
- metadata +79 -6
- data/docs/cli.rst +0 -448
- data/docs/resources.rst +0 -4836
- data/docs/ruby_usage.rst +0 -145
- data/lib/resources/group.rb +0 -137
@@ -0,0 +1,154 @@
|
|
1
|
+
---
|
2
|
+
title: About the user Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# user
|
6
|
+
|
7
|
+
Use the `user` InSpec audit resource to test user profiles for a single, known/expected local user, including the groups to which that user belongs, the frequency of required password changes, and the directory paths to home and shell.
|
8
|
+
|
9
|
+
# Syntax
|
10
|
+
|
11
|
+
A `user` resource block declares a user name, and then one (or more) matchers:
|
12
|
+
|
13
|
+
describe user('root') do
|
14
|
+
it { should exist }
|
15
|
+
its('uid') { should eq 1234 }
|
16
|
+
its('gid') { should eq 1234 }
|
17
|
+
its('group') { should eq 'root' }
|
18
|
+
its('groups') { should eq ['root', 'other']}
|
19
|
+
its('home') { should eq '/root' }
|
20
|
+
its('shell') { should eq '/bin/bash' }
|
21
|
+
its('mindays') { should eq 0 }
|
22
|
+
its('maxdays') { should eq 90 }
|
23
|
+
its('warndays') { should eq 8 }
|
24
|
+
end
|
25
|
+
|
26
|
+
where
|
27
|
+
|
28
|
+
* `('root')` is the user to be tested
|
29
|
+
* `it { should exist }` tests if the user exists
|
30
|
+
* `gid`, `group`, `groups`, `home`, `maxdays`, `mindays`, `shell`, `uid`, and `warndays` are valid matchers for this resource
|
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
|
+
## exist
|
49
|
+
|
50
|
+
The `exist` matcher tests if the named user exists:
|
51
|
+
|
52
|
+
it { should exist }
|
53
|
+
|
54
|
+
## gid
|
55
|
+
|
56
|
+
The `gid` matcher tests the group identifier:
|
57
|
+
|
58
|
+
its('gid') { should eq 1234 } }
|
59
|
+
|
60
|
+
where `1234` represents the user identifier.
|
61
|
+
|
62
|
+
## group
|
63
|
+
|
64
|
+
The `group` matcher tests the group to which the user belongs:
|
65
|
+
|
66
|
+
its('group') { should eq 'root' }
|
67
|
+
|
68
|
+
where `root` represents the group.
|
69
|
+
|
70
|
+
## groups
|
71
|
+
|
72
|
+
The `groups` matcher tests two (or more) groups to which the user belongs:
|
73
|
+
|
74
|
+
its('groups') { should eq ['root', 'other']}
|
75
|
+
|
76
|
+
## home
|
77
|
+
|
78
|
+
The `home` matcher tests the home directory path for the user:
|
79
|
+
|
80
|
+
its('home') { should eq '/root' }
|
81
|
+
|
82
|
+
## include
|
83
|
+
|
84
|
+
<%= partial "/shared/matcher_include" %>
|
85
|
+
|
86
|
+
## match
|
87
|
+
|
88
|
+
<%= partial "/shared/matcher_match" %>
|
89
|
+
|
90
|
+
## maxdays
|
91
|
+
|
92
|
+
The `maxdays` matcher tests the maximum number of days between password changes:
|
93
|
+
|
94
|
+
its('maxdays') { should eq 99 }
|
95
|
+
|
96
|
+
where `99` represents the maximum number of days.
|
97
|
+
|
98
|
+
## mindays
|
99
|
+
|
100
|
+
The `mindays` matcher tests the minimum number of days between password changes:
|
101
|
+
|
102
|
+
its('mindays') { should eq 0 }
|
103
|
+
|
104
|
+
where `0` represents the maximum number of days.
|
105
|
+
|
106
|
+
## shell
|
107
|
+
|
108
|
+
The `shell` matcher tests the path to the default shell for the user:
|
109
|
+
|
110
|
+
its('shell') { should eq '/bin/bash' }
|
111
|
+
|
112
|
+
## uid
|
113
|
+
|
114
|
+
The `uid` matcher tests the user identifier:
|
115
|
+
|
116
|
+
its('uid') { should eq 1234 } }
|
117
|
+
|
118
|
+
where `1234` represents the user identifier.
|
119
|
+
|
120
|
+
## warndays
|
121
|
+
|
122
|
+
The `warndays` matcher tests the number of days a user is warned before a password must be changed:
|
123
|
+
|
124
|
+
its('warndays') { should eq 5 }
|
125
|
+
|
126
|
+
where `5` represents the number of days a user is warned.
|
127
|
+
|
128
|
+
# Examples
|
129
|
+
|
130
|
+
The following examples show how to use this InSpec audit resource.
|
131
|
+
|
132
|
+
## Verify available users for the MySQL server
|
133
|
+
|
134
|
+
describe user('root') do
|
135
|
+
it { should exist }
|
136
|
+
it { should belong_to_group 'root' }
|
137
|
+
its('uid') { should eq 0 }
|
138
|
+
its('groups') { should eq ['root'] }
|
139
|
+
end
|
140
|
+
|
141
|
+
describe user('mysql') do
|
142
|
+
it { should_not exist }
|
143
|
+
end
|
144
|
+
|
145
|
+
## Test users on multiple platforms
|
146
|
+
|
147
|
+
The `nginx` user is typically `www-data`, but on CentOS it's `nginx`. The following example shows how to test for the `nginx` user with a single test, but accounting for all platforms:
|
148
|
+
|
149
|
+
web_user = 'www-data'
|
150
|
+
web_user = 'nginx' if os[:family] == 'centos'
|
151
|
+
|
152
|
+
describe user(web_user) do
|
153
|
+
it { should exist }
|
154
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
---
|
2
|
+
title: About the users Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# users
|
6
|
+
|
7
|
+
Use the `users` InSpec audit resource to look up all local users available on the system, and then test specific properties of those users. This resource does not return information about users that may be located on other systems, such as LDAP or Active Directory.
|
8
|
+
|
9
|
+
# Syntax
|
10
|
+
|
11
|
+
A `users` resource block declares a user name, and then one (or more) matchers:
|
12
|
+
|
13
|
+
describe users.where(uid: 0).entries do
|
14
|
+
it { should eq ['root'] }
|
15
|
+
its('uids') { should eq [1234] }
|
16
|
+
its('gids') { should eq [1234] }
|
17
|
+
end
|
18
|
+
|
19
|
+
where
|
20
|
+
|
21
|
+
* `gid`, `group`, `groups`, `home`, `maxdays`, `mindays`, `shell`, `uid`, and `warndays` are valid matchers for this resource
|
22
|
+
* `where(uid: 0).entries` represents a filter that runs the test only against matching users
|
23
|
+
|
24
|
+
For example:
|
25
|
+
|
26
|
+
describe users.where { username =~ /.*/ } do
|
27
|
+
it { should exist }
|
28
|
+
end
|
29
|
+
|
30
|
+
or:
|
31
|
+
|
32
|
+
describe users.where { uid =~ /^S-1-5-[0-9-]+-501$/ } do
|
33
|
+
it { should exist }
|
34
|
+
end
|
35
|
+
|
36
|
+
# Matchers
|
37
|
+
|
38
|
+
This InSpec audit resource has the following matchers:
|
39
|
+
|
40
|
+
## be
|
41
|
+
|
42
|
+
<%= partial "/shared/matcher_be" %>
|
43
|
+
|
44
|
+
## cmp
|
45
|
+
|
46
|
+
<%= partial "/shared/matcher_cmp" %>
|
47
|
+
|
48
|
+
## eq
|
49
|
+
|
50
|
+
<%= partial "/shared/matcher_eq" %>
|
51
|
+
|
52
|
+
## exist
|
53
|
+
|
54
|
+
The `exist` matcher tests if the named user exists:
|
55
|
+
|
56
|
+
it { should exist }
|
57
|
+
|
58
|
+
## gid
|
59
|
+
|
60
|
+
The `gid` matcher tests the group identifier:
|
61
|
+
|
62
|
+
its('gid') { should eq 1234 } }
|
63
|
+
|
64
|
+
where `1234` represents the user identifier.
|
65
|
+
|
66
|
+
## group
|
67
|
+
|
68
|
+
The `group` matcher tests the group to which the user belongs:
|
69
|
+
|
70
|
+
its('group') { should eq 'root' }
|
71
|
+
|
72
|
+
where `root` represents the group.
|
73
|
+
|
74
|
+
## groups
|
75
|
+
|
76
|
+
The `groups` matcher tests two (or more) groups to which the user belongs:
|
77
|
+
|
78
|
+
its('groups') { should eq ['root', 'other']}
|
79
|
+
|
80
|
+
## home
|
81
|
+
|
82
|
+
The `home` matcher tests the home directory path for the user:
|
83
|
+
|
84
|
+
its('home') { should eq '/root' }
|
85
|
+
|
86
|
+
## include
|
87
|
+
|
88
|
+
<%= partial "/shared/matcher_include" %>
|
89
|
+
|
90
|
+
## match
|
91
|
+
|
92
|
+
<%= partial "/shared/matcher_match" %>
|
93
|
+
|
94
|
+
## maxdays
|
95
|
+
|
96
|
+
The `maxdays` matcher tests the maximum number of days between password changes:
|
97
|
+
|
98
|
+
its('maxdays') { should eq 99 }
|
99
|
+
|
100
|
+
where `99` represents the maximum number of days.
|
101
|
+
|
102
|
+
## mindays
|
103
|
+
|
104
|
+
The `mindays` matcher tests the minimum number of days between password changes:
|
105
|
+
|
106
|
+
its('mindays') { should eq 0 }
|
107
|
+
|
108
|
+
where `0` represents the maximum number of days.
|
109
|
+
|
110
|
+
## shell
|
111
|
+
|
112
|
+
The `shell` matcher tests the path to the default shell for the user:
|
113
|
+
|
114
|
+
its('shell') { should eq '/bin/bash' }
|
115
|
+
|
116
|
+
## uid
|
117
|
+
|
118
|
+
The `uid` matcher tests the user identifier:
|
119
|
+
|
120
|
+
its('uid') { should eq 1234 } }
|
121
|
+
|
122
|
+
where `1234` represents the user identifier.
|
123
|
+
|
124
|
+
## warndays
|
125
|
+
|
126
|
+
The `warndays` matcher tests the number of days a user is warned before a password must be changed:
|
127
|
+
|
128
|
+
its('warndays') { should eq 5 }
|
129
|
+
|
130
|
+
where `5` represents the number of days a user is warned.
|
131
|
+
|
132
|
+
# Examples
|
133
|
+
|
134
|
+
The following examples show how to use this InSpec audit resource.
|
135
|
+
|
136
|
+
## Use a regular expression to find users
|
137
|
+
|
138
|
+
describe users.where { uid =~ /S\-1\-5\-21\-\d+\-\d+\-\d+\-500/ } do
|
139
|
+
it { should exist }
|
140
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
---
|
2
|
+
title: About the vbscript Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# vbscript
|
6
|
+
|
7
|
+
Use the `vbscript` InSpec audit resource to test a VBScript on the Windows platform.
|
8
|
+
|
9
|
+
# Syntax
|
10
|
+
|
11
|
+
A `vbscript` resource block tests the output of a VBScript on the Windows platform:
|
12
|
+
|
13
|
+
describe vbscript('script_name') do
|
14
|
+
its('stdout') { should eq 'output' }
|
15
|
+
end
|
16
|
+
|
17
|
+
where
|
18
|
+
|
19
|
+
* `'script_name'` is the name of the VBScript to test
|
20
|
+
* `('output')` is the expected output of the VBScript
|
21
|
+
|
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
|
+
## eq
|
36
|
+
|
37
|
+
<%= partial "/shared/matcher_eq" %>
|
38
|
+
|
39
|
+
## include
|
40
|
+
|
41
|
+
<%= partial "/shared/matcher_include" %>
|
42
|
+
|
43
|
+
## match
|
44
|
+
|
45
|
+
<%= partial "/shared/matcher_match" %>
|
46
|
+
|
47
|
+
# Examples
|
48
|
+
|
49
|
+
The following examples show how to use this InSpec audit resource.
|
50
|
+
|
51
|
+
## Test a VBScript
|
52
|
+
|
53
|
+
A VBScript file similar to:
|
54
|
+
|
55
|
+
vbscript = <<-EOH
|
56
|
+
WScript.Echo "hello"
|
57
|
+
EOH
|
58
|
+
|
59
|
+
may be tested for multiple lines:
|
60
|
+
|
61
|
+
describe vbscript(vbscript) do
|
62
|
+
its('stdout') { should eq "hello\r\n" }
|
63
|
+
end
|
64
|
+
|
65
|
+
and tested for whitespace removal from standard output:
|
66
|
+
|
67
|
+
describe vbscript(vbscript) do
|
68
|
+
its('strip') { should eq "hello" }
|
69
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
title: About the windows_feature Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# windows_feature
|
6
|
+
|
7
|
+
Use the `windows_feature` InSpec audit resource to test features on Windows via the `Get-WindowsFeature` cmdlet.
|
8
|
+
|
9
|
+
# Syntax
|
10
|
+
|
11
|
+
A `windows_feature` resource block declares the name of the Windows feature, tests if that feature is installed, and then returns information about that feature:
|
12
|
+
|
13
|
+
describe windows_feature('feature_name') do
|
14
|
+
it { should be_installed }
|
15
|
+
end
|
16
|
+
|
17
|
+
where
|
18
|
+
|
19
|
+
* `('feature_name')` must specify a Windows feature name, such as `DHCP Server` or `IIS-Webserver`
|
20
|
+
* `be_installed` is a valid matcher for this resource
|
21
|
+
|
22
|
+
|
23
|
+
# Matchers
|
24
|
+
|
25
|
+
This InSpec audit resource has the following matchers:
|
26
|
+
|
27
|
+
## be
|
28
|
+
|
29
|
+
<%= partial "/shared/matcher_be" %>
|
30
|
+
|
31
|
+
## be_installed
|
32
|
+
|
33
|
+
The `be_installed` matcher tests if the named Windows feature is installed:
|
34
|
+
|
35
|
+
it { should be_installed }
|
36
|
+
|
37
|
+
## cmp
|
38
|
+
|
39
|
+
<%= partial "/shared/matcher_cmp" %>
|
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
|
+
# Examples
|
54
|
+
|
55
|
+
The following examples show how to use this InSpec audit resource.
|
56
|
+
|
57
|
+
## Test the DHCP Server feature
|
58
|
+
|
59
|
+
describe windows_feature('DHCP Server') do
|
60
|
+
it{ should be_installed }
|
61
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
---
|
2
|
+
title: About the wmi Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# wmi
|
6
|
+
|
7
|
+
Use the `wmi` InSpec audit resource to test WMI settings on the Windows platform.
|
8
|
+
|
9
|
+
# Syntax
|
10
|
+
|
11
|
+
A `wmi` resource block tests WMI settings on the Windows platform:
|
12
|
+
|
13
|
+
describe wmi({
|
14
|
+
class: 'class_name'
|
15
|
+
namespace: 'path\\to\\setting'
|
16
|
+
filter: 'filter'
|
17
|
+
query: 'query'
|
18
|
+
}) do
|
19
|
+
its('setting_name') { should eq '' }
|
20
|
+
end
|
21
|
+
|
22
|
+
where
|
23
|
+
|
24
|
+
* `class`, `namespace`, `filter`, and `query` comprise a Ruby Hash of the WMI object
|
25
|
+
* `('class')` is the WMI class to which the setting belongs, such as `win32_service`
|
26
|
+
* `('namespace')` is path to that object, such as `root\\cimv2`
|
27
|
+
* Use `('filter')` fine-tune the information defined by the WMI class, such as to find a specific service (`filter: "name like '%winrm%'")`, to find a specific setting (`filter: 'KeyName = \'MinimumPasswordAge\' And precedence=1'`), and so on
|
28
|
+
* Use `('query')` to run a query that returns data to be tested, such as `"SELECT Setting FROM RSOP_SecuritySettingBoolean WHERE KeyName='LSAAnonymousNameLookup' AND Precedence=1"`
|
29
|
+
* `('setting_name')` is a setting in the WMI object to be tested, and then `should eq ''` is the expected value for that setting
|
30
|
+
|
31
|
+
For example, both of the following tests will verify if WinRM is present on the target node. The first tests if WinRM belongs to the list of services running under the `win32_service` class:
|
32
|
+
|
33
|
+
describe wmi({class: 'win32_service'}) do
|
34
|
+
its('DisplayName') { should include 'Windows Remote Management (WS-Management)'}
|
35
|
+
end
|
36
|
+
|
37
|
+
and the second uses a filter in the Ruby Hash to first identify WinRM, and then perform additional tests:
|
38
|
+
|
39
|
+
describe wmi({
|
40
|
+
class: 'win32_service',
|
41
|
+
filter: "name like '%winrm%'"
|
42
|
+
}) do
|
43
|
+
its('Status') { should cmp 'ok' }
|
44
|
+
its('State') { should cmp 'Running' }
|
45
|
+
its('ExitCode') { should cmp 0 }
|
46
|
+
its('DisplayName') { should eq 'Windows Remote Management (WS-Management)'}
|
47
|
+
end
|
48
|
+
|
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" %>
|
73
|
+
|
74
|
+
# Examples
|
75
|
+
|
76
|
+
The following examples show how to use this InSpec audit resource.
|
77
|
+
|
78
|
+
## Test a password expiration policy
|
79
|
+
|
80
|
+
describe wmi({
|
81
|
+
class: 'RSOP_SecuritySettingNumeric',
|
82
|
+
namespace: 'root\\rsop\\computer',
|
83
|
+
filter: 'KeyName = \'MinimumPasswordAge\' And precedence=1'
|
84
|
+
}) do
|
85
|
+
its('Setting') { should eq 1 }
|
86
|
+
end
|
87
|
+
|
88
|
+
## Test if an anonymous user can query the Local Security Authority (LSA)
|
89
|
+
|
90
|
+
describe wmi({
|
91
|
+
namespace: 'root\rsop\computer',
|
92
|
+
query: "SELECT Setting FROM RSOP_SecuritySettingBoolean WHERE KeyName='LSAAnonymousNameLookup' AND Precedence=1"
|
93
|
+
}) do
|
94
|
+
its('Setting') { should eq false }
|
95
|
+
end
|