inspec 1.0.0 → 1.35.1
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/CHANGELOG.md +933 -101
- data/Gemfile +8 -17
- data/MAINTAINERS.md +2 -1
- data/MAINTAINERS.toml +9 -4
- data/README.md +49 -28
- data/Rakefile +54 -39
- data/bin/inspec +1 -1
- data/docs/dsl_inspec.md +17 -4
- data/docs/dsl_resource.md +1 -1
- data/docs/habitat.md +192 -0
- data/docs/inspec_and_friends.md +4 -2
- data/docs/matchers.md +11 -0
- data/docs/migration.md +293 -0
- data/docs/profiles.md +124 -76
- data/docs/resources/aide_conf.md.erb +81 -0
- data/docs/resources/apache_conf.md.erb +10 -10
- data/docs/resources/apt.md.erb +13 -13
- data/docs/resources/audit_policy.md.erb +10 -10
- data/docs/resources/auditd_conf.md.erb +10 -10
- data/docs/resources/auditd_rules.md.erb +11 -11
- data/docs/resources/bash.md.erb +12 -12
- data/docs/resources/bond.md.erb +15 -15
- data/docs/resources/bridge.md.erb +11 -11
- data/docs/resources/bsd_service.md.erb +11 -11
- data/docs/resources/command.md.erb +23 -23
- data/docs/resources/crontab.md.erb +84 -0
- data/docs/resources/csv.md.erb +10 -10
- data/docs/resources/dh_params.md +191 -0
- data/docs/resources/directory.md.erb +8 -8
- data/docs/resources/docker.md.erb +160 -0
- data/docs/resources/docker_container.md.erb +89 -0
- data/docs/resources/docker_image.md.erb +86 -0
- data/docs/resources/etc_group.md.erb +16 -16
- data/docs/resources/etc_hosts.md.erb +62 -0
- data/docs/resources/file.md.erb +80 -58
- data/docs/resources/gem.md.erb +32 -13
- data/docs/resources/group.md.erb +12 -12
- data/docs/resources/grub_conf.md.erb +11 -11
- data/docs/resources/host.md.erb +27 -18
- data/docs/resources/http.md.erb +104 -0
- data/docs/resources/iis_app.md.erb +126 -0
- data/docs/resources/iis_site.md.erb +17 -17
- data/docs/resources/inetd_conf.md.erb +10 -10
- data/docs/resources/ini.md.erb +9 -9
- data/docs/resources/interface.md.erb +13 -13
- data/docs/resources/iptables.md.erb +21 -14
- data/docs/resources/json.md.erb +11 -11
- data/docs/resources/kernel_module.md.erb +73 -12
- data/docs/resources/kernel_parameter.md.erb +12 -12
- data/docs/resources/key_rsa.md.erb +70 -0
- data/docs/resources/launchd_service.md.erb +11 -11
- data/docs/resources/limits_conf.md.erb +10 -10
- data/docs/resources/login_def.md.erb +12 -12
- data/docs/resources/mount.md.erb +14 -14
- data/docs/resources/mssql_session.md.erb +62 -0
- data/docs/resources/mysql_conf.md.erb +14 -14
- data/docs/resources/mysql_session.md.erb +22 -10
- data/docs/resources/npm.md.erb +13 -13
- data/docs/resources/ntp_conf.md.erb +9 -9
- data/docs/resources/oneget.md.erb +11 -11
- data/docs/resources/oracledb_session.md.erb +53 -0
- data/docs/resources/os.md.erb +17 -17
- data/docs/resources/os_env.md.erb +12 -12
- data/docs/resources/package.md.erb +29 -16
- data/docs/resources/parse_config.md.erb +18 -18
- data/docs/resources/parse_config_file.md.erb +29 -23
- data/docs/resources/{etc_passwd.md.erb → passwd.md.erb} +17 -17
- data/docs/resources/pip.md.erb +15 -15
- data/docs/resources/port.md.erb +23 -23
- data/docs/resources/postgres_conf.md.erb +15 -13
- data/docs/resources/postgres_hba_conf.md.erb +104 -0
- data/docs/resources/postgres_ident_conf.md.erb +87 -0
- data/docs/resources/postgres_session.md.erb +28 -21
- data/docs/resources/powershell.md.erb +14 -14
- data/docs/resources/processes.md.erb +123 -0
- data/docs/resources/rabbitmq_config.md.erb +55 -0
- data/docs/resources/registry_key.md.erb +44 -21
- data/docs/resources/runit_service.md.erb +11 -11
- data/docs/resources/security_policy.md.erb +10 -10
- data/docs/resources/service.md.erb +18 -18
- data/docs/resources/{etc_shadow.md.erb → shadow.md.erb} +19 -19
- data/docs/resources/ssh_config.md.erb +13 -13
- data/docs/resources/sshd_config.md.erb +15 -15
- data/docs/resources/ssl.md.erb +13 -13
- data/docs/resources/sys_info.md.erb +10 -10
- data/docs/resources/systemd_service.md.erb +11 -11
- data/docs/resources/sysv_service.md.erb +11 -11
- data/docs/resources/upstart_service.md.erb +11 -11
- data/docs/resources/user.md.erb +20 -20
- data/docs/resources/users.md.erb +19 -19
- data/docs/resources/vbscript.md.erb +13 -13
- data/docs/resources/virtualization.md.erb +71 -0
- data/docs/resources/windows_feature.md.erb +10 -10
- data/docs/resources/windows_task.md.erb +103 -0
- data/docs/resources/wmi.md.erb +10 -10
- data/docs/resources/x509_certificate.md.erb +146 -0
- data/docs/resources/xinetd_conf.md.erb +17 -17
- data/docs/resources/xml.md.erb +75 -0
- data/docs/resources/yaml.md.erb +25 -11
- data/docs/resources/yum.md.erb +24 -16
- data/docs/resources/zfs_dataset.md.erb +63 -0
- data/docs/resources/zfs_pool.md.erb +57 -0
- data/docs/ruby_usage.md +50 -0
- data/docs/shared/matcher_cmp.md.erb +4 -6
- data/examples/inheritance/README.md +49 -3
- data/examples/inheritance/controls/example.rb +4 -1
- data/examples/inheritance/inspec.yml +3 -1
- data/examples/meta-profile/README.md +29 -3
- data/examples/meta-profile/controls/example.rb +10 -5
- data/examples/meta-profile/inspec.yml +4 -8
- data/examples/profile/README.md +1 -1
- data/examples/profile/controls/example.rb +0 -1
- data/examples/profile/controls/gordon.rb +0 -1
- data/examples/profile/inspec.yml +1 -1
- data/examples/profile-attribute/inspec.yml +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 +10 -2
- data/lib/bundles/inspec-artifact/README.md +1 -0
- data/lib/bundles/inspec-artifact/cli.rb +284 -0
- data/lib/bundles/inspec-artifact.rb +7 -0
- data/lib/bundles/inspec-compliance/README.md +44 -15
- data/lib/bundles/inspec-compliance/api.rb +135 -29
- data/lib/bundles/inspec-compliance/cli.rb +128 -21
- data/lib/bundles/inspec-compliance/configuration.rb +8 -0
- data/lib/bundles/inspec-compliance/http.rb +26 -19
- data/lib/bundles/inspec-compliance/target.rb +50 -25
- data/lib/bundles/inspec-habitat/cli.rb +31 -0
- data/lib/bundles/inspec-habitat/log.rb +10 -0
- data/lib/bundles/inspec-habitat/profile.rb +372 -0
- data/lib/bundles/inspec-habitat.rb +12 -0
- data/lib/bundles/inspec-init/templates/profile/controls/example.rb +0 -1
- data/lib/bundles/inspec-init/templates/profile/inspec.yml +1 -1
- data/lib/bundles/inspec-supermarket/api.rb +7 -5
- data/lib/bundles/inspec-supermarket/cli.rb +2 -2
- data/lib/fetchers/git.rb +4 -2
- data/lib/fetchers/local.rb +4 -1
- data/lib/fetchers/url.rb +64 -10
- data/lib/inspec/archive/tar.rb +1 -1
- data/lib/inspec/backend.rb +26 -3
- data/lib/inspec/base_cli.rb +44 -7
- data/lib/inspec/cached_fetcher.rb +2 -2
- data/lib/inspec/cli.rb +34 -12
- data/lib/inspec/completions/fish.sh.erb +34 -0
- data/lib/inspec/control_eval_context.rb +0 -2
- data/lib/inspec/dependencies/cache.rb +0 -1
- data/lib/inspec/dependencies/dependency_set.rb +2 -2
- data/lib/inspec/dependencies/lockfile.rb +13 -6
- data/lib/inspec/dependencies/requirement.rb +6 -6
- data/lib/inspec/dependencies/resolver.rb +4 -4
- data/lib/inspec/dsl.rb +3 -5
- data/lib/inspec/env_printer.rb +9 -1
- data/lib/inspec/exceptions.rb +8 -0
- data/lib/inspec/fetcher.rb +1 -1
- data/lib/inspec/file_provider.rb +47 -11
- data/lib/inspec/library_eval_context.rb +1 -1
- data/lib/inspec/metadata.rb +62 -18
- data/lib/inspec/method_source.rb +24 -0
- data/lib/inspec/objects/attribute.rb +21 -0
- data/lib/inspec/objects/control.rb +21 -3
- data/lib/inspec/objects/each_loop.rb +2 -1
- data/lib/inspec/objects/list.rb +1 -1
- data/lib/inspec/objects/or_test.rb +17 -2
- data/lib/inspec/objects/tag.rb +27 -0
- data/lib/inspec/objects/test.rb +9 -8
- data/lib/inspec/objects.rb +1 -0
- data/lib/inspec/plugins/fetcher.rb +4 -5
- data/lib/inspec/plugins/resource.rb +1 -2
- data/lib/inspec/plugins/source_reader.rb +3 -3
- data/lib/inspec/plugins.rb +1 -1
- data/lib/inspec/polyfill.rb +0 -1
- data/lib/inspec/profile.rb +92 -23
- data/lib/inspec/profile_context.rb +1 -1
- data/lib/inspec/profile_vendor.rb +66 -0
- data/lib/inspec/resource.rb +29 -3
- data/lib/inspec/rspec_json_formatter.rb +672 -285
- data/lib/inspec/rule.rb +12 -16
- data/lib/inspec/runner.rb +26 -15
- data/lib/inspec/runner_rspec.rb +1 -0
- data/lib/inspec/runtime_profile.rb +26 -0
- data/lib/inspec/schema.rb +185 -0
- data/lib/inspec/secrets/yaml.rb +8 -1
- data/lib/inspec/secrets.rb +1 -1
- data/lib/inspec/shell.rb +92 -22
- data/lib/inspec/source_reader.rb +1 -1
- data/lib/inspec/version.rb +1 -1
- data/lib/inspec.rb +1 -1
- data/lib/matchers/matchers.rb +67 -17
- data/lib/resources/aide_conf.rb +162 -0
- data/lib/resources/apache.rb +0 -1
- data/lib/resources/apache_conf.rb +3 -3
- data/lib/resources/apt.rb +2 -1
- data/lib/resources/audit_policy.rb +0 -1
- data/lib/resources/auditd_conf.rb +1 -2
- data/lib/resources/auditd_rules.rb +5 -5
- data/lib/resources/bond.rb +1 -1
- data/lib/resources/bridge.rb +1 -1
- data/lib/resources/command.rb +5 -3
- data/lib/resources/crontab.rb +102 -0
- data/lib/resources/csv.rb +18 -1
- data/lib/resources/dh_params.rb +84 -0
- data/lib/resources/directory.rb +7 -3
- data/lib/resources/docker.rb +198 -0
- data/lib/resources/docker_container.rb +114 -0
- data/lib/resources/docker_image.rb +96 -0
- data/lib/resources/etc_group.rb +2 -3
- data/lib/resources/etc_hosts.rb +81 -0
- data/lib/resources/file.rb +88 -30
- data/lib/resources/gem.rb +26 -6
- data/lib/resources/groups.rb +4 -5
- data/lib/resources/grub_conf.rb +3 -4
- data/lib/resources/host.rb +175 -35
- data/lib/resources/http.rb +73 -0
- data/lib/resources/iis_app.rb +103 -0
- data/lib/resources/iis_site.rb +23 -0
- data/lib/resources/inetd_conf.rb +9 -4
- data/lib/resources/interface.rb +4 -3
- data/lib/resources/json.rb +37 -14
- data/lib/resources/kernel_module.rb +77 -10
- data/lib/resources/kernel_parameter.rb +0 -1
- data/lib/resources/key_rsa.rb +67 -0
- data/lib/resources/limits_conf.rb +3 -4
- data/lib/resources/login_def.rb +2 -3
- data/lib/resources/mount.rb +34 -4
- data/lib/resources/mssql_session.rb +81 -12
- data/lib/resources/mysql.rb +0 -1
- data/lib/resources/mysql_conf.rb +1 -2
- data/lib/resources/mysql_session.rb +18 -7
- data/lib/resources/nginx_conf.rb +95 -0
- data/lib/resources/ntp_conf.rb +2 -3
- data/lib/resources/oracledb_session.rb +138 -0
- data/lib/resources/os_env.rb +7 -5
- data/lib/resources/package.rb +70 -13
- data/lib/resources/packages.rb +111 -0
- data/lib/resources/parse_config.rb +3 -4
- data/lib/resources/passwd.rb +4 -5
- data/lib/resources/pip.rb +29 -21
- data/lib/resources/port.rb +133 -14
- data/lib/resources/postgres.rb +53 -43
- data/lib/resources/postgres_conf.rb +40 -13
- data/lib/resources/postgres_hba_conf.rb +101 -0
- data/lib/resources/postgres_ident_conf.rb +79 -0
- data/lib/resources/postgres_session.rb +28 -20
- data/lib/resources/powershell.rb +2 -2
- data/lib/resources/processes.rb +61 -26
- data/lib/resources/rabbitmq_conf.rb +53 -0
- data/lib/resources/registry_key.rb +34 -11
- data/lib/resources/security_policy.rb +2 -2
- data/lib/resources/service.rb +17 -7
- data/lib/resources/ssh_conf.rb +17 -6
- data/lib/resources/ssl.rb +3 -4
- data/lib/resources/sys_info.rb +1 -1
- data/lib/resources/toml.rb +26 -0
- data/lib/resources/users.rb +41 -41
- data/lib/resources/virtualization.rb +252 -0
- data/lib/resources/windows_task.rb +106 -0
- data/lib/resources/x509_certificate.rb +143 -0
- data/lib/resources/xinetd.rb +18 -2
- data/lib/resources/xml.rb +27 -0
- data/lib/resources/yaml.rb +10 -2
- data/lib/resources/yum.rb +25 -7
- data/lib/resources/zfs_dataset.rb +60 -0
- data/lib/resources/zfs_pool.rb +49 -0
- data/lib/source_readers/flat.rb +2 -1
- data/lib/source_readers/inspec.rb +30 -11
- data/lib/utils/command_wrapper.rb +3 -3
- data/lib/utils/database_helpers.rb +77 -0
- data/lib/utils/erlang_parser.rb +192 -0
- data/lib/utils/filter.rb +2 -1
- data/lib/utils/filter_array.rb +0 -1
- data/lib/utils/find_files.rb +1 -2
- data/lib/utils/latest_version.rb +21 -0
- data/lib/utils/nginx_parser.rb +76 -0
- data/lib/utils/object_traversal.rb +5 -4
- data/lib/utils/parser.rb +23 -4
- data/lib/utils/plugin_registry.rb +3 -3
- data/lib/utils/simpleconfig.rb +25 -8
- data/lib/utils/spdx.rb +13 -0
- data/lib/utils/spdx.txt +344 -0
- metadata +168 -22
- data/docs/cli.md +0 -342
- data/docs/resources/process.md.erb +0 -73
- /data/docs/{plugin_kitchen_inspec.html.md → plugin_kitchen_inspec.md} +0 -0
|
@@ -6,7 +6,7 @@ title: About the bsd_service Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `bsd_service` InSpec audit resource to test a service using a Berkeley OS-style `init` on the FreeBSD platform.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `bsd_service` resource block declares the name of a service and then one (or more) matchers to test the state of the service:
|
|
12
12
|
|
|
@@ -29,48 +29,48 @@ The path to the service manager's control may be specified for situations where
|
|
|
29
29
|
it { should be_running }
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
## Matchers
|
|
33
33
|
|
|
34
34
|
This InSpec audit resource has the following matchers:
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
### be
|
|
37
37
|
|
|
38
38
|
<%= partial "/shared/matcher_be" %>
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
### be_enabled
|
|
41
41
|
|
|
42
42
|
The `be_enabled` matcher tests if the named service is enabled:
|
|
43
43
|
|
|
44
44
|
it { should be_enabled }
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
### be_installed
|
|
47
47
|
|
|
48
48
|
The `be_installed` matcher tests if the named service is installed:
|
|
49
49
|
|
|
50
50
|
it { should be_installed }
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
### be_running
|
|
53
53
|
|
|
54
54
|
The `be_running` matcher tests if the named service is running:
|
|
55
55
|
|
|
56
56
|
it { should be_running }
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
### cmp
|
|
59
59
|
|
|
60
60
|
<%= partial "/shared/matcher_cmp" %>
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
### eq
|
|
63
63
|
|
|
64
64
|
<%= partial "/shared/matcher_eq" %>
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
### include
|
|
67
67
|
|
|
68
68
|
<%= partial "/shared/matcher_include" %>
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
### match
|
|
71
71
|
|
|
72
72
|
<%= partial "/shared/matcher_match" %>
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
## Examples
|
|
75
75
|
|
|
76
76
|
None.
|
|
@@ -6,7 +6,7 @@ title: About the command Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `command` InSpec audit resource to test an arbitrary command that is run on the system.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `command` resource block declares a command to be run, one (or more) expected outputs, and the location to which that output is sent:
|
|
12
12
|
|
|
@@ -22,49 +22,49 @@ where
|
|
|
22
22
|
* `'output'` tests the output of the command run on the system versus the output value stated in the test
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
## Matchers
|
|
26
26
|
|
|
27
27
|
This InSpec audit resource has the following matchers:
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
### be
|
|
30
30
|
|
|
31
31
|
<%= partial "/shared/matcher_be" %>
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
### cmp
|
|
34
34
|
|
|
35
35
|
<%= partial "/shared/matcher_cmp" %>
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
### eq
|
|
38
38
|
|
|
39
39
|
<%= partial "/shared/matcher_eq" %>
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
### exist
|
|
42
42
|
|
|
43
43
|
The `exist` matcher tests if a command may be run on the system:
|
|
44
44
|
|
|
45
45
|
it { should exist }
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
### exit_status
|
|
48
48
|
|
|
49
49
|
The `exit_status` matcher tests the exit status for the command:
|
|
50
50
|
|
|
51
51
|
its('exit_status') { should eq 123 }
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
### include
|
|
54
54
|
|
|
55
55
|
<%= partial "/shared/matcher_include" %>
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
### match
|
|
58
58
|
|
|
59
59
|
<%= partial "/shared/matcher_match" %>
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
### stderr
|
|
62
62
|
|
|
63
63
|
The `stderr` matcher tests results of the command as returned in standard error (stderr):
|
|
64
64
|
|
|
65
65
|
its('stderr') { should eq 'error' }
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
### stdout
|
|
68
68
|
|
|
69
69
|
The `stdout` matcher tests results of the command as returned in standard output (stdout). The following example shows matching output using a regular expression:
|
|
70
70
|
|
|
@@ -72,11 +72,11 @@ The `stdout` matcher tests results of the command as returned in standard output
|
|
|
72
72
|
its('stdout') { should match (/[0-9]/) }
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
## Examples
|
|
76
76
|
|
|
77
77
|
The following examples show how to use this InSpec audit resource.
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
### Test for PostgreSQL database running a RC, development, or beta release
|
|
80
80
|
|
|
81
81
|
describe command('psql -V') do
|
|
82
82
|
its('stdout') { should eq '/RC/' }
|
|
@@ -84,23 +84,23 @@ The following examples show how to use this InSpec audit resource.
|
|
|
84
84
|
its('stdout') { should_not eq '/BETA/' }
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
### Test standard output (stdout)
|
|
88
88
|
|
|
89
89
|
describe command('echo hello') do
|
|
90
|
-
its('stdout') { should eq
|
|
90
|
+
its('stdout') { should eq "hello\n" }
|
|
91
91
|
its('stderr') { should eq '' }
|
|
92
92
|
its('exit_status') { should eq 0 }
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
### Test standard error (stderr)
|
|
96
96
|
|
|
97
97
|
describe command('>&2 echo error') do
|
|
98
98
|
its('stdout') { should eq '' }
|
|
99
|
-
its('stderr') { should eq
|
|
99
|
+
its('stderr') { should eq "error\n" }
|
|
100
100
|
its('exit_status') { should eq 0 }
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
### Test an exit status code
|
|
104
104
|
|
|
105
105
|
describe command('exit 123') do
|
|
106
106
|
its('stdout') { should eq '' }
|
|
@@ -108,19 +108,19 @@ The following examples show how to use this InSpec audit resource.
|
|
|
108
108
|
its('exit_status') { should eq 123 }
|
|
109
109
|
end
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
### Test if the command shell exists
|
|
112
112
|
|
|
113
113
|
describe command('/bin/sh').exist? do
|
|
114
114
|
it { should eq true }
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
### Test for a command that should not exist
|
|
118
118
|
|
|
119
119
|
describe command('this is not existing').exist? do
|
|
120
120
|
it { should eq false }
|
|
121
121
|
end
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
### Verify NTP
|
|
124
124
|
|
|
125
125
|
The following example shows how to use the `file` audit resource to verify if the `ntp.conf` and `leap-seconds` files are present, and then the `command` resource to verify if NTP is installed and running:
|
|
126
126
|
|
|
@@ -136,7 +136,7 @@ The following example shows how to use the `file` audit resource to verify if th
|
|
|
136
136
|
its('exit_status') { should eq 0 }
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
### Verify WiX
|
|
140
140
|
|
|
141
141
|
Wix includes serveral tools -- such as `candle` (preprocesses and compiles source files into object files), `light` (links and binds object files to an installer database), and `heat` (harvests files from various input formats). The following example uses a whitespace array and the `file` audit resource to verify if these three tools are present:
|
|
142
142
|
|
|
@@ -145,7 +145,7 @@ Wix includes serveral tools -- such as `candle` (preprocesses and compiles sourc
|
|
|
145
145
|
heat.exe
|
|
146
146
|
light.exe
|
|
147
147
|
).each do |utility|
|
|
148
|
-
describe file("C:/wix
|
|
148
|
+
describe file("C:/wix/##{utility}") do
|
|
149
149
|
it { should be_file }
|
|
150
150
|
end
|
|
151
151
|
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: About the crontab Resource
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# crontab
|
|
6
|
+
|
|
7
|
+
Use the `crontab` InSpec audit resource to test the crontab entries for a particular user on the system. It recognizes special time strings (@yearly, @weekly, etc).
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
A `crontab` resource block declares a user (which defaults to the current user, if not specified), and then the details to be tested, such as the schedule elements for each crontab entry or the commands itself:
|
|
12
|
+
|
|
13
|
+
describe crontab do
|
|
14
|
+
its('commands') { should include '/some/scheduled/task.sh' }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
## Matchers
|
|
18
|
+
|
|
19
|
+
This InSpec audit resource has the following matchers:
|
|
20
|
+
|
|
21
|
+
### be
|
|
22
|
+
|
|
23
|
+
<%= partial "/shared/matcher_be" %>
|
|
24
|
+
|
|
25
|
+
### cmp
|
|
26
|
+
|
|
27
|
+
<%= partial "/shared/matcher_cmp" %>
|
|
28
|
+
|
|
29
|
+
### eq
|
|
30
|
+
|
|
31
|
+
<%= partial "/shared/matcher_eq" %>
|
|
32
|
+
|
|
33
|
+
### include
|
|
34
|
+
|
|
35
|
+
<%= partial "/shared/matcher_include" %>
|
|
36
|
+
|
|
37
|
+
### match
|
|
38
|
+
|
|
39
|
+
<%= partial "/shared/matcher_match" %>
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
The following examples show how to use this InSpec audit resource.
|
|
44
|
+
|
|
45
|
+
### Test that root's crontab has a particular command
|
|
46
|
+
|
|
47
|
+
describe crontab('root') do
|
|
48
|
+
its('commands') { should include '/path/to/some/script' }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
### Test that myuser's crontab entry for command '/home/myuser/build.sh' runs every minute
|
|
52
|
+
|
|
53
|
+
describe crontab('myuser').commands('/home/myuser/build.sh') do
|
|
54
|
+
its('hours') { should cmp '*' }
|
|
55
|
+
its('minutes') { should cmp '*' }
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
### Test that the logged-in user's crontab has no tasks set to run on every hour and every minute
|
|
59
|
+
|
|
60
|
+
describe crontab.where({'hour' => '*', 'minute' => '*'}) do
|
|
61
|
+
its('entries.length') { should cmp '0' }
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
### Test that the logged-in user's crontab contains a single command that matches a mattern
|
|
65
|
+
|
|
66
|
+
describe crontab.where { command =~ /a partial command string/ } do
|
|
67
|
+
its('entries.length') { should cmp 1 }
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
### Test a special time string (i.e., @yearly /root/anual_report.sh)
|
|
71
|
+
|
|
72
|
+
describe crontab.commands('/root/anual_report.sh') do
|
|
73
|
+
its('hours') { should cmp '0' }
|
|
74
|
+
its('minutes') { should cmp '0' }
|
|
75
|
+
its('days') { should cmp '1' }
|
|
76
|
+
its('months') { should cmp '1' }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
### Test @reboot case
|
|
80
|
+
|
|
81
|
+
describe crontab.commands('/root/reboot.sh') do
|
|
82
|
+
its('hours') { should cmp '-1' }
|
|
83
|
+
its('minutes') { should cmp '-1' }
|
|
84
|
+
end
|
data/docs/resources/csv.md.erb
CHANGED
|
@@ -6,7 +6,7 @@ title: About the csv Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `csv` InSpec audit resource to test configuration data in a CSV file.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `csv` resource block declares the configuration data to be tested:
|
|
12
12
|
|
|
@@ -21,41 +21,41 @@ where
|
|
|
21
21
|
* `should eq 'foo'` tests a value of `name` as read from a CSV file versus the value declared in the test
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
## Matchers
|
|
25
25
|
|
|
26
26
|
This InSpec audit resource has the following matchers:
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
### be
|
|
29
29
|
|
|
30
30
|
<%= partial "/shared/matcher_be" %>
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
### cmp
|
|
33
33
|
|
|
34
34
|
<%= partial "/shared/matcher_cmp" %>
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
### eq
|
|
37
37
|
|
|
38
38
|
<%= partial "/shared/matcher_eq" %>
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
### include
|
|
41
41
|
|
|
42
42
|
<%= partial "/shared/matcher_include" %>
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
### match
|
|
45
45
|
|
|
46
46
|
<%= partial "/shared/matcher_match" %>
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
### name
|
|
49
49
|
|
|
50
50
|
The `name` matcher tests the value of `name` as read from a CSV file versus the value declared in the test:
|
|
51
51
|
|
|
52
52
|
its('name') { should eq 'foo' }
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
## Examples
|
|
55
55
|
|
|
56
56
|
The following examples show how to use this InSpec audit resource.
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
### Test a CSV file
|
|
59
59
|
|
|
60
60
|
describe csv('some_file.csv') do
|
|
61
61
|
its('setting') { should eq 1 }
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The dh_params Resource
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# dh_params
|
|
6
|
+
|
|
7
|
+
Use the `dh_params` InSpec audit resource to test Diffie-Hellman (DH) parameters.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Syntax
|
|
11
|
+
|
|
12
|
+
A `dh_params` resource block declares a parameter file to be tested.
|
|
13
|
+
|
|
14
|
+
describe dh_params('/path/to/file.dh_pem') do
|
|
15
|
+
it { should be_dh_params }
|
|
16
|
+
it { should be_valid }
|
|
17
|
+
its('generator') { should eq 2 }
|
|
18
|
+
its('modulus') { should eq '00:91:a0:15:89:e5:bc:38:93:12:02:fc:...' }
|
|
19
|
+
its('prime_length') { should eq 2048 }
|
|
20
|
+
its('pem') { should eq '-----BEGIN DH PARAMETERS...' }
|
|
21
|
+
its('text') { should eq 'PKCS#3 DH Parameters: (2048 bit)...' }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Supported Properties
|
|
26
|
+
|
|
27
|
+
### dh_params?
|
|
28
|
+
|
|
29
|
+
Verify whether file contains DH parameters:
|
|
30
|
+
|
|
31
|
+
describe dh_params('/path/to/file.dh_pem') do
|
|
32
|
+
it { should be_dh_params }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
### valid?
|
|
36
|
+
|
|
37
|
+
Verify whether DH parameters are valid:
|
|
38
|
+
|
|
39
|
+
describe dh_params('/path/to/file.dh_pem') do
|
|
40
|
+
it { should be_valid }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
### generator (Integer)
|
|
44
|
+
|
|
45
|
+
Verify generator used for the Diffie-Hellman operation:
|
|
46
|
+
|
|
47
|
+
describe dh_params('/path/to/file.dh_pem') do
|
|
48
|
+
its('generator') { should eq 2 }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
### modulus (String)
|
|
52
|
+
|
|
53
|
+
Verify prime modulus used for the Diffie-Hellman operation:
|
|
54
|
+
|
|
55
|
+
describe dh_params('/path/to/file.dh_pem') do
|
|
56
|
+
its('modulus') { should eq '00:91:a0:15:89:e5:bc:38:93:12:02:fc:...' }
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
Example using multi-line string:
|
|
60
|
+
|
|
61
|
+
describe dh_params('/path/to/file.dh_pem') do
|
|
62
|
+
its('modulus') do
|
|
63
|
+
# regex removes all whitespace
|
|
64
|
+
should eq <<-EOF.gsub(/[[:space:]]+/, '')
|
|
65
|
+
00:91:a0:15:89:e5:bc:38:93:12:02:fc:91:a2:85:
|
|
66
|
+
f7:f7:29:63:2e:d3:4e:7a:86:f7:ee:84:fe:42:d0:
|
|
67
|
+
48:bc:9c:91:d5:54:f8:78:1d:c0:41:78:a2:c4:ac:
|
|
68
|
+
1a:24:8b:9d:88:55:98:0b:ac:a7:23:eb:c2:aa:2b:
|
|
69
|
+
2e:a9:f9:af:d4:8e:4e:11:bc:7f:35:a2:ac:da:3a:
|
|
70
|
+
ef:f0:25:6c:9a:a4:fd:00:28:76:86:2c:57:87:67:
|
|
71
|
+
30:5d:b1:d6:5b:22:8f:72:a1:ea:de:8b:ef:9e:33:
|
|
72
|
+
1a:40:92:68:85:02:54:02:09:fa:c0:60:c1:3c:4e:
|
|
73
|
+
28:26:db:ed:25:8e:38:21:56:40:dc:c0:c0:66:1f:
|
|
74
|
+
2b:32:c3:b4:78:a9:26:94:ea:f7:41:28:b2:f5:5b:
|
|
75
|
+
01:38:0c:46:09:85:26:4d:69:12:8d:95:0f:35:e2:
|
|
76
|
+
e6:4e:47:3a:86:dd:8a:b2:fe:45:15:27:d8:59:c2:
|
|
77
|
+
3c:f4:62:ff:5f:74:e9:77:92:50:47:36:2b:05:57:
|
|
78
|
+
60:ee:7b:a1:60:cc:1c:7a:2b:77:18:8a:37:f7:c7:
|
|
79
|
+
31:3e:15:cb:15:7f:7b:66:96:fb:c6:be:7d:d6:03:
|
|
80
|
+
5e:0d:60:75:2b:5b:62:2a:a3:37:b6:34:f9:fe:96:
|
|
81
|
+
4c:f6:c5:e3:a1:52:af:01:c1:4f:c7:42:a0:be:ed:
|
|
82
|
+
cd:13
|
|
83
|
+
EOF
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
### prime_length (Integer)
|
|
88
|
+
|
|
89
|
+
Verify length of prime modulus used for the Diffie-Hellman operation:
|
|
90
|
+
|
|
91
|
+
describe dh_params('/path/to/file.dh_pem') do
|
|
92
|
+
its('prime_length') { should eq 2048 }
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
### pem (String)
|
|
96
|
+
|
|
97
|
+
Verify `pem` output of DH parameters:
|
|
98
|
+
|
|
99
|
+
describe dh_params('/path/to/file.dh_pem') do
|
|
100
|
+
its('pem') { should eq '-----BEGIN DH PARAMETERS...' }
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
Example using multi-line string:
|
|
104
|
+
|
|
105
|
+
its('pem') do
|
|
106
|
+
# regex removes all leading spaces
|
|
107
|
+
should eq <<-EOF.gsub(/^[[:blank:]]+/, '')
|
|
108
|
+
-----BEGIN DH PARAMETERS-----
|
|
109
|
+
MIIBCAKCAQEAkaAVieW8OJMSAvyRooX39yljLtNOeob37oT+QtBIvJyR1VT4eB3A
|
|
110
|
+
QXiixKwaJIudiFWYC6ynI+vCqisuqfmv1I5OEbx/NaKs2jrv8CVsmqT9ACh2hixX
|
|
111
|
+
h2cwXbHWWyKPcqHq3ovvnjMaQJJohQJUAgn6wGDBPE4oJtvtJY44IVZA3MDAZh8r
|
|
112
|
+
MsO0eKkmlOr3QSiy9VsBOAxGCYUmTWkSjZUPNeLmTkc6ht2Ksv5FFSfYWcI89GL/
|
|
113
|
+
X3Tpd5JQRzYrBVdg7nuhYMwceit3GIo398cxPhXLFX97Zpb7xr591gNeDWB1K1ti
|
|
114
|
+
KqM3tjT5/pZM9sXjoVKvAcFPx0Kgvu3NEwIBAg==
|
|
115
|
+
-----END DH PARAMETERS-----
|
|
116
|
+
EOF
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
Verify via `openssl dhparam` command:
|
|
120
|
+
|
|
121
|
+
$ openssl dhparam -in /path/to/file.dh_pem
|
|
122
|
+
-----BEGIN DH PARAMETERS-----
|
|
123
|
+
MIIBCAKCAQEAkaAVieW8OJMSAvyRooX39yljLtNOeob37oT+QtBIvJyR1VT4eB3A
|
|
124
|
+
QXiixKwaJIudiFWYC6ynI+vCqisuqfmv1I5OEbx/NaKs2jrv8CVsmqT9ACh2hixX
|
|
125
|
+
h2cwXbHWWyKPcqHq3ovvnjMaQJJohQJUAgn6wGDBPE4oJtvtJY44IVZA3MDAZh8r
|
|
126
|
+
MsO0eKkmlOr3QSiy9VsBOAxGCYUmTWkSjZUPNeLmTkc6ht2Ksv5FFSfYWcI89GL/
|
|
127
|
+
X3Tpd5JQRzYrBVdg7nuhYMwceit3GIo398cxPhXLFX97Zpb7xr591gNeDWB1K1ti
|
|
128
|
+
KqM3tjT5/pZM9sXjoVKvAcFPx0Kgvu3NEwIBAg==
|
|
129
|
+
-----END DH PARAMETERS-----
|
|
130
|
+
|
|
131
|
+
### text (String)
|
|
132
|
+
|
|
133
|
+
Verify human-readable text output of DH parameters:
|
|
134
|
+
|
|
135
|
+
describe dh_params('/path/to/file.dh_pem') do
|
|
136
|
+
its('text') { should eq 'PKCS#3 DH Parameters: (2048 bit)...' }
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
Example using multi-line string:
|
|
140
|
+
|
|
141
|
+
its('text') do
|
|
142
|
+
# regex removes 2 leading spaces
|
|
143
|
+
should eq <<-EOF.gsub(/^[[:blank:]]{2}/, '')
|
|
144
|
+
PKCS#3 DH Parameters: (2048 bit)
|
|
145
|
+
prime:
|
|
146
|
+
00:91:a0:15:89:e5:bc:38:93:12:02:fc:91:a2:85:
|
|
147
|
+
f7:f7:29:63:2e:d3:4e:7a:86:f7:ee:84:fe:42:d0:
|
|
148
|
+
48:bc:9c:91:d5:54:f8:78:1d:c0:41:78:a2:c4:ac:
|
|
149
|
+
1a:24:8b:9d:88:55:98:0b:ac:a7:23:eb:c2:aa:2b:
|
|
150
|
+
2e:a9:f9:af:d4:8e:4e:11:bc:7f:35:a2:ac:da:3a:
|
|
151
|
+
ef:f0:25:6c:9a:a4:fd:00:28:76:86:2c:57:87:67:
|
|
152
|
+
30:5d:b1:d6:5b:22:8f:72:a1:ea:de:8b:ef:9e:33:
|
|
153
|
+
1a:40:92:68:85:02:54:02:09:fa:c0:60:c1:3c:4e:
|
|
154
|
+
28:26:db:ed:25:8e:38:21:56:40:dc:c0:c0:66:1f:
|
|
155
|
+
2b:32:c3:b4:78:a9:26:94:ea:f7:41:28:b2:f5:5b:
|
|
156
|
+
01:38:0c:46:09:85:26:4d:69:12:8d:95:0f:35:e2:
|
|
157
|
+
e6:4e:47:3a:86:dd:8a:b2:fe:45:15:27:d8:59:c2:
|
|
158
|
+
3c:f4:62:ff:5f:74:e9:77:92:50:47:36:2b:05:57:
|
|
159
|
+
60:ee:7b:a1:60:cc:1c:7a:2b:77:18:8a:37:f7:c7:
|
|
160
|
+
31:3e:15:cb:15:7f:7b:66:96:fb:c6:be:7d:d6:03:
|
|
161
|
+
5e:0d:60:75:2b:5b:62:2a:a3:37:b6:34:f9:fe:96:
|
|
162
|
+
4c:f6:c5:e3:a1:52:af:01:c1:4f:c7:42:a0:be:ed:
|
|
163
|
+
cd:13
|
|
164
|
+
generator: 2 (0x2)
|
|
165
|
+
EOF
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
Verify via `openssl dhparam` command:
|
|
169
|
+
|
|
170
|
+
$ openssl dhparam -in /path/to/file.dh_pem -noout -text
|
|
171
|
+
PKCS#3 DH Parameters: (2048 bit)
|
|
172
|
+
prime:
|
|
173
|
+
00:91:a0:15:89:e5:bc:38:93:12:02:fc:91:a2:85:
|
|
174
|
+
f7:f7:29:63:2e:d3:4e:7a:86:f7:ee:84:fe:42:d0:
|
|
175
|
+
48:bc:9c:91:d5:54:f8:78:1d:c0:41:78:a2:c4:ac:
|
|
176
|
+
1a:24:8b:9d:88:55:98:0b:ac:a7:23:eb:c2:aa:2b:
|
|
177
|
+
2e:a9:f9:af:d4:8e:4e:11:bc:7f:35:a2:ac:da:3a:
|
|
178
|
+
ef:f0:25:6c:9a:a4:fd:00:28:76:86:2c:57:87:67:
|
|
179
|
+
30:5d:b1:d6:5b:22:8f:72:a1:ea:de:8b:ef:9e:33:
|
|
180
|
+
1a:40:92:68:85:02:54:02:09:fa:c0:60:c1:3c:4e:
|
|
181
|
+
28:26:db:ed:25:8e:38:21:56:40:dc:c0:c0:66:1f:
|
|
182
|
+
2b:32:c3:b4:78:a9:26:94:ea:f7:41:28:b2:f5:5b:
|
|
183
|
+
01:38:0c:46:09:85:26:4d:69:12:8d:95:0f:35:e2:
|
|
184
|
+
e6:4e:47:3a:86:dd:8a:b2:fe:45:15:27:d8:59:c2:
|
|
185
|
+
3c:f4:62:ff:5f:74:e9:77:92:50:47:36:2b:05:57:
|
|
186
|
+
60:ee:7b:a1:60:cc:1c:7a:2b:77:18:8a:37:f7:c7:
|
|
187
|
+
31:3e:15:cb:15:7f:7b:66:96:fb:c6:be:7d:d6:03:
|
|
188
|
+
5e:0d:60:75:2b:5b:62:2a:a3:37:b6:34:f9:fe:96:
|
|
189
|
+
4c:f6:c5:e3:a1:52:af:01:c1:4f:c7:42:a0:be:ed:
|
|
190
|
+
cd:13
|
|
191
|
+
generator: 2 (0x2)
|
|
@@ -6,7 +6,7 @@ title: About the directory Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `directory` InSpec audit resource to test if the file type is a directory. This is equivalent to using the `file` resource and the `be_directory` matcher, but provides a simpler and more direct way to test directories. All of the matchers available to `file` may be used with `directory`.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `directory` resource block declares the location of the directory to be tested, and then one (or more) matchers:
|
|
12
12
|
|
|
@@ -14,30 +14,30 @@ A `directory` resource block declares the location of the directory to be tested
|
|
|
14
14
|
it { should MATCHER 'value' }
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Matchers
|
|
18
18
|
|
|
19
19
|
This resource may use any of the matchers available to the `file` resource that may be useful when testing a directory.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
### be
|
|
22
22
|
|
|
23
23
|
<%= partial "/shared/matcher_be" %>
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
### cmp
|
|
26
26
|
|
|
27
27
|
<%= partial "/shared/matcher_cmp" %>
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
### eq
|
|
30
30
|
|
|
31
31
|
<%= partial "/shared/matcher_eq" %>
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
### include
|
|
34
34
|
|
|
35
35
|
<%= partial "/shared/matcher_include" %>
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
### match
|
|
38
38
|
|
|
39
39
|
<%= partial "/shared/matcher_match" %>
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
## Examples
|
|
42
42
|
|
|
43
43
|
None.
|