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,149 @@
|
|
1
|
+
---
|
2
|
+
title: About the registry_key Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# registry_key
|
6
|
+
|
7
|
+
Use the `registry_key` InSpec audit resource to test key values in the Windows registry.
|
8
|
+
|
9
|
+
# Syntax
|
10
|
+
|
11
|
+
A `registry_key` resource block declares the item in the Windows registry, the path to a setting under that item, and then one (or more) name/value pairs to be tested.
|
12
|
+
|
13
|
+
Use a registry key name and path:
|
14
|
+
|
15
|
+
describe registry_key('Task Scheduler','HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Schedule') do
|
16
|
+
its('Start') { should eq 2 }
|
17
|
+
end
|
18
|
+
|
19
|
+
Use only a registry key path:
|
20
|
+
|
21
|
+
describe registry_key('Task Scheduler','HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Schedule') do
|
22
|
+
its('Start') { should eq 2 }
|
23
|
+
end
|
24
|
+
|
25
|
+
Or use a Ruby Hash:
|
26
|
+
|
27
|
+
describe registry_key({
|
28
|
+
name: 'Task Scheduler',
|
29
|
+
hive: 'HKEY_LOCAL_MACHINE',
|
30
|
+
key: ''\SYSTEM\CurrentControlSet\services\Schedule'
|
31
|
+
}) do
|
32
|
+
its('Start') { should eq 2 }
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
## Registry Key Path Separators
|
37
|
+
|
38
|
+
A Windows registry key can be used as a string in Ruby code, such as when a registry key is used as the name of a recipe. In Ruby, when a registry key is enclosed in a double-quoted string (`" "`), the same backslash character (`\`) that is used to define the registry key path separator is also used in Ruby to define an escape character. Therefore, the registry key path separators must be escaped when they are enclosed in a double-quoted string. For example, the following registry key:
|
39
|
+
|
40
|
+
HKCU\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Themes
|
41
|
+
|
42
|
+
may be encloused in a single-quoted string with a single backslash:
|
43
|
+
|
44
|
+
'HKCU\SOFTWARE\path\to\key\Themes'
|
45
|
+
|
46
|
+
or may be enclosed in a double-quoted string with an extra backslash as an escape character:
|
47
|
+
|
48
|
+
"HKCU\\SOFTWARE\\path\\to\\key\\Themes"
|
49
|
+
|
50
|
+
|
51
|
+
# Matchers
|
52
|
+
|
53
|
+
This InSpec audit resource has the following matchers:
|
54
|
+
|
55
|
+
## be
|
56
|
+
|
57
|
+
<%= partial "/shared/matcher_be" %>
|
58
|
+
|
59
|
+
## children
|
60
|
+
|
61
|
+
The `children` matcher return all of the child items of a registry key. A regular expression may be used to filter child items:
|
62
|
+
|
63
|
+
describe registry_key('Key Name', '\path\to\key').children(regex)
|
64
|
+
...
|
65
|
+
end
|
66
|
+
|
67
|
+
For example, to get all child items for a registry key:
|
68
|
+
|
69
|
+
describe registry_key('Task Scheduler','HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet').children do
|
70
|
+
it { should_not eq [] }
|
71
|
+
end
|
72
|
+
|
73
|
+
The following example shows how find a property that may exist against multiple registry keys, and then test that property for every registry key in which that property is located:
|
74
|
+
|
75
|
+
describe registry_key({
|
76
|
+
hive: HKEY_USERS
|
77
|
+
}).children(/^S-1-5-21-[0-9]+-[0-9]+-[0-9]+-[0-9]{3,}\\Software\\Policies\\Microsoft\\Windows\\Installer/).each
|
78
|
+
{ |key|
|
79
|
+
describe registry_key(key) do
|
80
|
+
its('AlwaysInstallElevated') { should eq 'value' }
|
81
|
+
end
|
82
|
+
}
|
83
|
+
|
84
|
+
## cmp
|
85
|
+
|
86
|
+
<%= partial "/shared/matcher_cmp" %>
|
87
|
+
|
88
|
+
## eq
|
89
|
+
|
90
|
+
<%= partial "/shared/matcher_eq" %>
|
91
|
+
|
92
|
+
## exist
|
93
|
+
|
94
|
+
The `exist` matcher tests if the registry key is present:
|
95
|
+
|
96
|
+
it { should exist }
|
97
|
+
|
98
|
+
## have_property
|
99
|
+
|
100
|
+
The `have_property` matcher tests if a property exists for a registry key:
|
101
|
+
|
102
|
+
it { should have_property 'value' }
|
103
|
+
|
104
|
+
## have_property_value
|
105
|
+
|
106
|
+
The `have_property_value` matcher tests if a property value exists for a registry key:
|
107
|
+
|
108
|
+
it { should have_property_value 'value' }
|
109
|
+
|
110
|
+
## have_value
|
111
|
+
|
112
|
+
The `have_value` matcher tests if a value exists for a registry key:
|
113
|
+
|
114
|
+
it { should have_value 'value' }
|
115
|
+
|
116
|
+
## include
|
117
|
+
|
118
|
+
<%= partial "/shared/matcher_include" %>
|
119
|
+
|
120
|
+
## match
|
121
|
+
|
122
|
+
<%= partial "/shared/matcher_match" %>
|
123
|
+
|
124
|
+
## name
|
125
|
+
|
126
|
+
The `name` matcher tests the value for the specified registry setting:
|
127
|
+
|
128
|
+
its('name') { should eq 'value' }
|
129
|
+
|
130
|
+
# Examples
|
131
|
+
|
132
|
+
The following examples show how to use this InSpec audit resource.
|
133
|
+
|
134
|
+
## Test the start time for the Schedule service
|
135
|
+
|
136
|
+
describe registry_key('Task Scheduler','HKEY_LOCAL_MACHINE\...\Schedule') do
|
137
|
+
its('Start') { should eq 2 }
|
138
|
+
end
|
139
|
+
|
140
|
+
where `'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Schedule'` is the full path to the setting.
|
141
|
+
|
142
|
+
## Use a regular expression in responses
|
143
|
+
|
144
|
+
describe registry_key({
|
145
|
+
hive: 'HKEY_LOCAL_MACHINE',
|
146
|
+
key: 'SOFTWARE\Microsoft\Windows NT\CurrentVersion'
|
147
|
+
}) do
|
148
|
+
its('ProductName') { should match /^[a-zA-Z0-9\(\)\s]*2012\s[rR]2[a-zA-Z0-9\(\)\s]*$/ }
|
149
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
---
|
2
|
+
title: About the runit_service Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# runit_service
|
6
|
+
|
7
|
+
Use the `runit_service` InSpec audit resource to test a service using runit.
|
8
|
+
|
9
|
+
# Syntax
|
10
|
+
|
11
|
+
A `runit_service` resource block declares the name of a service and then one (or more) matchers to test the state of the service:
|
12
|
+
|
13
|
+
describe runit_service('service_name') do
|
14
|
+
it { should be_installed }
|
15
|
+
it { should be_enabled }
|
16
|
+
it { should be_running }
|
17
|
+
end
|
18
|
+
|
19
|
+
where
|
20
|
+
|
21
|
+
* `('service_name')` must specify a service name
|
22
|
+
* `be_installed`, `be_enabled`, and `be_running` are valid matchers for this resource; all matchers available to the `service` resource may be used
|
23
|
+
|
24
|
+
The path to the service manager's control may be specified for situations where the path isn't available in the current `PATH`. For example:
|
25
|
+
|
26
|
+
describe runit_service('service_name', '/path/to/control') do
|
27
|
+
it { should be_enabled }
|
28
|
+
it { should be_installed }
|
29
|
+
it { should be_running }
|
30
|
+
end
|
31
|
+
|
32
|
+
# Matchers
|
33
|
+
|
34
|
+
This InSpec audit resource has the following matchers:
|
35
|
+
|
36
|
+
## be
|
37
|
+
|
38
|
+
<%= partial "/shared/matcher_be" %>
|
39
|
+
|
40
|
+
## be_enabled
|
41
|
+
|
42
|
+
The `be_enabled` matcher tests if the named service is enabled:
|
43
|
+
|
44
|
+
it { should be_enabled }
|
45
|
+
|
46
|
+
## be_installed
|
47
|
+
|
48
|
+
The `be_installed` matcher tests if the named service is installed:
|
49
|
+
|
50
|
+
it { should be_installed }
|
51
|
+
|
52
|
+
## be_running
|
53
|
+
|
54
|
+
The `be_running` matcher tests if the named service is running:
|
55
|
+
|
56
|
+
it { should be_running }
|
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
|
+
None.
|
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
title: About the security_policy Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# security_policy
|
6
|
+
|
7
|
+
Use the `security_policy` InSpec audit resource to test security policies on the Windows platform.
|
8
|
+
|
9
|
+
# Syntax
|
10
|
+
|
11
|
+
A `security_policy` resource block declares the name of a security policy and the value to be tested:
|
12
|
+
|
13
|
+
describe security_policy do
|
14
|
+
its('policy_name') { should eq 'value' }
|
15
|
+
end
|
16
|
+
|
17
|
+
where
|
18
|
+
|
19
|
+
* `'policy_name'` must specify a security policy
|
20
|
+
* `{ should eq 'value' }` tests the value of `policy_name` against the value declared in the test
|
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
|
+
## policy_name
|
48
|
+
|
49
|
+
The `policy_name` matcher must be the name of a security policy:
|
50
|
+
|
51
|
+
its('SeNetworkLogonRight') { should eq '*S-1-5-11' }
|
52
|
+
|
53
|
+
# Examples
|
54
|
+
|
55
|
+
The following examples show how to use this InSpec audit resource.
|
56
|
+
|
57
|
+
## Verify that only the Administrators group has remote access
|
58
|
+
|
59
|
+
describe security_policy do
|
60
|
+
its('SeRemoteInteractiveLogonRight') { should eq '*S-1-5-32-544' }
|
61
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
---
|
2
|
+
title: About the service Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# service
|
6
|
+
|
7
|
+
Use the `service` InSpec audit resource to test if the named service is installed, running and/or enabled.
|
8
|
+
|
9
|
+
Under some circumstances, it may be necessary to specify the service manager by using one of the following service manager-specific resources: `bsd_service`, `launchd_service`, `runit_service`, `systemd_service`, `sysv_service`, oe `upstart_service`. These resources are based on the `service` resource.
|
10
|
+
|
11
|
+
# Syntax
|
12
|
+
|
13
|
+
A `service` resource block declares the name of a service and then one (or more) matchers to test the state of the service:
|
14
|
+
|
15
|
+
describe service('service_name') do
|
16
|
+
it { should be_installed }
|
17
|
+
it { should be_enabled }
|
18
|
+
it { should be_running }
|
19
|
+
end
|
20
|
+
|
21
|
+
where
|
22
|
+
|
23
|
+
* `('service_name')` must specify a service name
|
24
|
+
* `be_installed`, `be_enabled`, and `be_running` are valid matchers for this resource
|
25
|
+
|
26
|
+
|
27
|
+
# Matchers
|
28
|
+
|
29
|
+
This InSpec audit resource has the following matchers:
|
30
|
+
|
31
|
+
## be
|
32
|
+
|
33
|
+
<%= partial "/shared/matcher_be" %>
|
34
|
+
|
35
|
+
## be_enabled
|
36
|
+
|
37
|
+
The `be_enabled` matcher tests if the named service is enabled:
|
38
|
+
|
39
|
+
it { should be_enabled }
|
40
|
+
|
41
|
+
## be_installed
|
42
|
+
|
43
|
+
The `be_installed` matcher tests if the named service is installed:
|
44
|
+
|
45
|
+
it { should be_installed }
|
46
|
+
|
47
|
+
## be_running
|
48
|
+
|
49
|
+
The `be_running` matcher tests if the named service is running:
|
50
|
+
|
51
|
+
it { should be_running }
|
52
|
+
|
53
|
+
## cmp
|
54
|
+
|
55
|
+
<%= partial "/shared/matcher_cmp" %>
|
56
|
+
|
57
|
+
## eq
|
58
|
+
|
59
|
+
<%= partial "/shared/matcher_eq" %>
|
60
|
+
|
61
|
+
## include
|
62
|
+
|
63
|
+
<%= partial "/shared/matcher_include" %>
|
64
|
+
|
65
|
+
## match
|
66
|
+
|
67
|
+
<%= partial "/shared/matcher_match" %>
|
68
|
+
|
69
|
+
# Examples
|
70
|
+
|
71
|
+
The following examples show how to use this InSpec audit resource.
|
72
|
+
|
73
|
+
## Test if the postgresql service is both running and enabled
|
74
|
+
|
75
|
+
describe service('postgresql') do
|
76
|
+
it { should be_enabled }
|
77
|
+
it { should be_running }
|
78
|
+
end
|
79
|
+
|
80
|
+
## Test if the mysql service is both running and enabled
|
81
|
+
|
82
|
+
describe service('mysqld') do
|
83
|
+
it { should be_enabled }
|
84
|
+
it { should be_running }
|
85
|
+
end
|
86
|
+
|
87
|
+
## Test if ClamAV (an antivirus engine) is installed and running
|
88
|
+
|
89
|
+
describe package('clamav') do
|
90
|
+
it { should be_installed }
|
91
|
+
its('version') { should eq '0.98.7' }
|
92
|
+
end
|
93
|
+
|
94
|
+
describe service('clamd') do
|
95
|
+
it { should_not be_enabled }
|
96
|
+
it { should_not be_installed }
|
97
|
+
it { should_not be_running }
|
98
|
+
end
|
99
|
+
|
100
|
+
## Test Unix System V run levels
|
101
|
+
|
102
|
+
On targets that are using SystemV services, the existing run levels can also be checked:
|
103
|
+
|
104
|
+
describe service('sshd').runlevels do
|
105
|
+
its('keys') { should include(2) }
|
106
|
+
end
|
107
|
+
|
108
|
+
describe service('sshd').runlevels(2,4) do
|
109
|
+
it { should be_enabled }
|
110
|
+
end
|
111
|
+
|
112
|
+
## Override the service manager
|
113
|
+
|
114
|
+
Under some circumstances, it may be required to override the logic in place to select the right service manager. For example, to check a service managed by Upstart:
|
115
|
+
|
116
|
+
describe upstart_service('service') do
|
117
|
+
it { should_not be_enabled }
|
118
|
+
it { should be_installed }
|
119
|
+
it { should be_running }
|
120
|
+
end
|
121
|
+
|
122
|
+
This is also possible with `systemd_service`, `runit_service`, `sysv_service`, `bsd_service`, and `launchd_service`. Provide the control command when it is not to be found at the default location. For example, if the `sv` command for services managed by runit is not in the `PATH`:
|
123
|
+
|
124
|
+
describe runit_service('service', '/opt/chef/embedded/sbin/sv') do
|
125
|
+
it { should be_enabled }
|
126
|
+
it { should be_installed }
|
127
|
+
it { should be_running }
|
128
|
+
end
|
129
|
+
|
130
|
+
## Verify that IIS is running
|
131
|
+
|
132
|
+
describe service('W3SVC') do
|
133
|
+
it { should be_installed }
|
134
|
+
it { should be_running }
|
135
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
---
|
2
|
+
title: About the ssh_config Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# ssh_config
|
6
|
+
|
7
|
+
Use the `ssh_config` InSpec audit resource to test OpenSSH client configuration data located at `/etc/ssh/ssh_config` on Linux and Unix platforms.
|
8
|
+
|
9
|
+
# Syntax
|
10
|
+
|
11
|
+
An `ssh_config` resource block declares the client OpenSSH configuration data to be tested:
|
12
|
+
|
13
|
+
describe ssh_config('path') do
|
14
|
+
its('name') { should include('foo') }
|
15
|
+
end
|
16
|
+
|
17
|
+
where
|
18
|
+
|
19
|
+
* `name` is a configuration setting in `ssh_config`
|
20
|
+
* `('path')` is the non-default `/path/to/ssh_config`
|
21
|
+
* `{ should include('foo') }` tests the value of `name` as read from `ssh_config` versus the value declared in the test
|
22
|
+
|
23
|
+
|
24
|
+
# Matchers
|
25
|
+
|
26
|
+
This InSpec audit resource has the following matchers:
|
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
|
+
## include
|
41
|
+
|
42
|
+
<%= partial "/shared/matcher_include" %>
|
43
|
+
|
44
|
+
## match
|
45
|
+
|
46
|
+
<%= partial "/shared/matcher_match" %>
|
47
|
+
|
48
|
+
## name
|
49
|
+
|
50
|
+
The `name` matcher tests the value of `name` as read from `ssh_config` versus the value declared in the test:
|
51
|
+
|
52
|
+
its('name') { should eq 'foo' }
|
53
|
+
|
54
|
+
or:
|
55
|
+
|
56
|
+
its('name') { should include('bar') }
|
57
|
+
|
58
|
+
# Examples
|
59
|
+
|
60
|
+
The following examples show how to use this InSpec audit resource.
|
61
|
+
|
62
|
+
## Test SSH configuration settings
|
63
|
+
|
64
|
+
describe ssh_config do
|
65
|
+
its('cipher') { should contain '3des' }
|
66
|
+
its('port') { should eq '22' }
|
67
|
+
its('hostname') { should include('example.com') }
|
68
|
+
end
|
69
|
+
|
70
|
+
## Test which variables from the local environment are sent to the server
|
71
|
+
|
72
|
+
only_if do
|
73
|
+
command('sshd').exist? or command('ssh').exists?
|
74
|
+
end
|
75
|
+
|
76
|
+
describe ssh_config do
|
77
|
+
its('SendEnv') { should include('GORDON_CLIENT') }
|
78
|
+
end
|
79
|
+
|
80
|
+
## Test owner and group permissions
|
81
|
+
|
82
|
+
describe ssh_config do
|
83
|
+
its('owner') { should eq 'root' }
|
84
|
+
its('mode') { should cmp '0644' }
|
85
|
+
end
|
86
|
+
|
87
|
+
## Test SSH configuration
|
88
|
+
|
89
|
+
describe ssh_config do
|
90
|
+
its('Host') { should eq '*' }
|
91
|
+
its('Tunnel') { should eq nil }
|
92
|
+
its('SendEnv') { should eq 'LANG LC_*' }
|
93
|
+
its('HashKnownHosts') { should eq 'yes' }
|
94
|
+
end
|