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
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: About the aide_conf Resource
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# aide_conf
|
|
6
|
+
|
|
7
|
+
Use the `aide_conf` InSpec audit resource to test the rules established for the file integrity tool AIDE. Controlled by the aide.conf file typically at /etc/aide.conf.
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
An `aide_conf` resource block can be used to determine if the selection lines contain one (or more) directories whose files should be added to the aide database:
|
|
12
|
+
|
|
13
|
+
describe aide_conf('path') do
|
|
14
|
+
its('selection_lines') { should include '/sbin' }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
where
|
|
18
|
+
|
|
19
|
+
* `'selection_lines'` refers to all selection lines found in the aide.conf file
|
|
20
|
+
* `('path')` is the non-default path to the `aide.conf` file (optional)
|
|
21
|
+
* `should include 'value'` is the value that is expected
|
|
22
|
+
|
|
23
|
+
Use the where clause to match a selection_line to one rule or a particular set of rules found in the aide.conf file:
|
|
24
|
+
|
|
25
|
+
describe aide_conf.where { selection_line == '/bin' } do
|
|
26
|
+
its('rules.flatten') { should include 'r' }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe aide_conf.where { selection_line == '/sbin' } do
|
|
30
|
+
its('rules') { should include ['p', 'i', 'l', 'n', 'u', 'g', 'sha512'] }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
## Matchers
|
|
34
|
+
|
|
35
|
+
This InSpec audit resource has the following matchers:
|
|
36
|
+
|
|
37
|
+
### be
|
|
38
|
+
|
|
39
|
+
<%= partial "/shared/matcher_be" %>
|
|
40
|
+
|
|
41
|
+
### cmp
|
|
42
|
+
|
|
43
|
+
<%= partial "/shared/matcher_cmp" %>
|
|
44
|
+
|
|
45
|
+
### eq
|
|
46
|
+
|
|
47
|
+
<%= partial "/shared/matcher_eq" %>
|
|
48
|
+
|
|
49
|
+
### include
|
|
50
|
+
|
|
51
|
+
<%= partial "/shared/matcher_include" %>
|
|
52
|
+
|
|
53
|
+
### all_have_rule
|
|
54
|
+
|
|
55
|
+
The usage of all_have_rule will return whether or not all selection lines in audit.conf contain a particular rule:
|
|
56
|
+
|
|
57
|
+
describe aide_conf.all_have_rule('sha512') do
|
|
58
|
+
it { should eq true }
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
## Examples
|
|
62
|
+
|
|
63
|
+
The following examples show how to use this InSpec audit resource.
|
|
64
|
+
|
|
65
|
+
### Test if all selection lines contain the xattr rule
|
|
66
|
+
|
|
67
|
+
describe aide_conf.all_have_rule('xattr') do
|
|
68
|
+
it { should eq true }
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
### Test whether selection line for /bin contains a particular rule
|
|
72
|
+
|
|
73
|
+
describe aide_conf.where { selection_line == '/bin' } do
|
|
74
|
+
its('rules.flatten') { should include 'r' }
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
### Test whether selection line for /sbin consists of a particular set of rules
|
|
78
|
+
|
|
79
|
+
describe aide_conf.where { selection_line == '/sbin' } do
|
|
80
|
+
its('rules') { should include ['r', 'sha512'] }
|
|
81
|
+
end
|
|
@@ -6,7 +6,7 @@ title: About the apache_conf Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `apache_conf` InSpec audit resource to test the configuration settings for Apache. This file is typically located under `/etc/apache2` on the Debian and Ubuntu platforms and under `/etc/httpd` on the Fedora, CentOS, RedHat Enterprise Linux, and ArchLinux platforms. The configuration settings may vary significantly from platform to platform.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
An `apache_conf` InSpec audit resource block declares configuration settings that should be tested:
|
|
12
12
|
|
|
@@ -20,7 +20,7 @@ where
|
|
|
20
20
|
* `('path')` is the non-default path to the Apache configuration file
|
|
21
21
|
* `{ should eq 'value' }` is the value that is expected
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Matchers
|
|
24
24
|
|
|
25
25
|
This InSpec audit resource matches any service that is listed in the Apache configuration file:
|
|
26
26
|
|
|
@@ -38,37 +38,37 @@ For example:
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
### be
|
|
42
42
|
|
|
43
43
|
<%= partial "/shared/matcher_be" %>
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
### cmp
|
|
46
46
|
|
|
47
47
|
<%= partial "/shared/matcher_cmp" %>
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
### eq
|
|
50
50
|
|
|
51
51
|
<%= partial "/shared/matcher_eq" %>
|
|
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
|
+
## Examples
|
|
62
62
|
|
|
63
63
|
The following examples show how to use this InSpec audit resource.
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
### Test for blocking .htaccess files on CentOS
|
|
66
66
|
|
|
67
67
|
describe apache_conf do
|
|
68
68
|
its('AllowOverride') { should eq 'None' }
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
### Test ports for SSL
|
|
72
72
|
|
|
73
73
|
describe apache_conf do
|
|
74
74
|
its('Listen') { should eq '443'}
|
data/docs/resources/apt.md.erb
CHANGED
|
@@ -6,7 +6,7 @@ title: About the apt Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `apt` InSpec audit resource to verify Apt repositories on the Debian and Ubuntu platforms, and also PPA repositories on the Ubuntu platform.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
An `apt` resource block tests the contents of Apt and PPA repositories:
|
|
12
12
|
|
|
@@ -22,61 +22,61 @@ where
|
|
|
22
22
|
* `exist` and `be_enabled` are a valid matchers for this resource
|
|
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
|
+
### be_enabled
|
|
34
34
|
|
|
35
35
|
The `be_enabled` matcher tests if a package exists in the repository:
|
|
36
36
|
|
|
37
37
|
it { should be_enabled }
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
### cmp
|
|
40
40
|
|
|
41
41
|
<%= partial "/shared/matcher_cmp" %>
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
### eq
|
|
44
44
|
|
|
45
45
|
<%= partial "/shared/matcher_eq" %>
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
### exist
|
|
48
48
|
|
|
49
49
|
The `exist` matcher tests if a package exists on the system:
|
|
50
50
|
|
|
51
51
|
it { should exist }
|
|
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
|
+
## Examples
|
|
62
62
|
|
|
63
63
|
The following examples show how to use this InSpec audit resource.
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
### Test if apt repository exists and is enabled
|
|
66
66
|
|
|
67
67
|
describe apt('http://ppa.launchpad.net/juju/stable/ubuntu') do
|
|
68
68
|
it { should exist }
|
|
69
69
|
it { should be_enabled }
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
### Verify that a PPA repository exists and is enabled
|
|
73
73
|
|
|
74
74
|
describe apt('ppa:nginx/stable') do
|
|
75
75
|
it { should exist }
|
|
76
76
|
it { should be_enabled }
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
### Verify that a repository is not present
|
|
80
80
|
|
|
81
81
|
describe apt('ubuntu-wine/ppa') do
|
|
82
82
|
it { should_not exist }
|
|
@@ -6,7 +6,7 @@ title: About the audit_policy Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `audit_policy` Inspec audit resource to test auditing policies on the Windows platform. An auditing policy is a category of security-related events to be audited. Auditing is disabled by default and may be enabled for categories like account management, logon events, policy changes, process tracking, privilege use, system events, or object access. For each auditing category property that is enabled, the auditing level may be set to `No Auditing`, `Not Specified`, `Success`, `Success and Failure`, or `Failure`.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
An `audit_policy` resource block declares a parameter that belongs to an audit policy category or subcategory:
|
|
12
12
|
|
|
@@ -20,41 +20,41 @@ where
|
|
|
20
20
|
* `'value'` must be one of `No Auditing`, `Not Specified`, `Success`, `Success and Failure`, or `Failure`
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Matchers
|
|
24
24
|
|
|
25
25
|
This InSpec audit resource has the following matchers:
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
### be
|
|
28
28
|
|
|
29
29
|
<%= partial "/shared/matcher_be" %>
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
### cmp
|
|
32
32
|
|
|
33
33
|
<%= partial "/shared/matcher_cmp" %>
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
### eq
|
|
36
36
|
|
|
37
37
|
<%= partial "/shared/matcher_eq" %>
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
### include
|
|
40
40
|
|
|
41
41
|
<%= partial "/shared/matcher_include" %>
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
### match
|
|
44
44
|
|
|
45
45
|
<%= partial "/shared/matcher_match" %>
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
## Examples
|
|
48
48
|
|
|
49
49
|
The following examples show how to use this InSpec audit resource.
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
### Test that a parameter is not set to "No Auditing"
|
|
52
52
|
|
|
53
53
|
describe audit_policy do
|
|
54
54
|
its('Other Account Logon Events') { should_not eq 'No Auditing' }
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
### Test that a parameter is set to "Success"
|
|
58
58
|
|
|
59
59
|
describe audit_policy do
|
|
60
60
|
its('User Account Management') { should eq 'Success' }
|
|
@@ -6,7 +6,7 @@ title: About the auditd_conf Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `auditd_conf` InSpec audit resource to test the configuration settings for the audit daemon. This file is typically located under `/etc/audit/auditd.conf'` on Unix and Linux platforms.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `auditd_conf` resource block declares configuration settings that should be tested:
|
|
12
12
|
|
|
@@ -21,27 +21,27 @@ where
|
|
|
21
21
|
* `{ should cmp 'value' }` is the value that is expected
|
|
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
|
+
### keyword
|
|
45
45
|
|
|
46
46
|
This matcher will matche any keyword that is listed in the `auditd.conf` configuration file. Option names and values are case-insensitive:
|
|
47
47
|
|
|
@@ -51,15 +51,15 @@ or:
|
|
|
51
51
|
|
|
52
52
|
its('max_log_file') { should cmp 6 }
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
### match
|
|
55
55
|
|
|
56
56
|
<%= partial "/shared/matcher_match" %>
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
## Examples
|
|
59
59
|
|
|
60
60
|
The following examples show how to use this InSpec audit resource.
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
### Test the auditd.conf file
|
|
63
63
|
|
|
64
64
|
describe auditd_conf do
|
|
65
65
|
its('log_file') { should cmp '/full/path/to/file' }
|
|
@@ -7,7 +7,7 @@ title: About the auditd_rules Resource
|
|
|
7
7
|
Use the `auditd_rules` InSpec audit resource to test the rules for logging that exist on the system. The `audit.rules` file is typically located under `/etc/audit/` and contains the list of rules that define what is captured in log files. This resource uses `auditctl` to query the run-time `auditd` rules setup, which may be different from `audit.rules`.
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Syntax
|
|
11
11
|
|
|
12
12
|
An `auditd_rules` resource block declares one (or more) rules to be tested, and then what that rule should do. The syntax depends on the version of `audit`:
|
|
13
13
|
|
|
@@ -62,35 +62,35 @@ or test that individual rules are defined:
|
|
|
62
62
|
where each test must declare one (or more) rules to be tested.
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
## Matchers
|
|
66
66
|
|
|
67
67
|
This InSpec audit resource has the following matchers:
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
### be
|
|
70
70
|
|
|
71
71
|
<%= partial "/shared/matcher_be" %>
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
### cmp
|
|
74
74
|
|
|
75
75
|
<%= partial "/shared/matcher_cmp" %>
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
### eq
|
|
78
78
|
|
|
79
79
|
<%= partial "/shared/matcher_eq" %>
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
### include
|
|
82
82
|
|
|
83
83
|
<%= partial "/shared/matcher_include" %>
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
### match
|
|
86
86
|
|
|
87
87
|
<%= partial "/shared/matcher_match" %>
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
## Examples
|
|
90
90
|
|
|
91
91
|
The following examples show how to use this InSpec audit resource.
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
### Test if a rule contains a matching element that is identified by a regular expression
|
|
94
94
|
|
|
95
95
|
For `audit` >= 2.3:
|
|
96
96
|
|
|
@@ -109,13 +109,13 @@ For `audit` < 2.3:
|
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
### Query the audit daemon status
|
|
113
113
|
|
|
114
114
|
describe auditd_rules.status('backlog') do
|
|
115
115
|
it { should cmp 0 }
|
|
116
116
|
end
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
### Query properties of rules targeting specific syscalls or files
|
|
119
119
|
|
|
120
120
|
describe auditd_rules.syscall('open').action do
|
|
121
121
|
it { should eq(['always']) }
|
data/docs/resources/bash.md.erb
CHANGED
|
@@ -6,7 +6,7 @@ title: About the bash Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `bash` InSpec audit resource to test an arbitrary command that is run on the system using a Bash script.
|
|
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
|
|
|
@@ -30,55 +30,55 @@ For example:
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
## Matchers
|
|
34
34
|
|
|
35
35
|
This InSpec audit resource has the following matchers:
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
### be
|
|
38
38
|
|
|
39
39
|
<%= partial "/shared/matcher_be" %>
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
### cmp
|
|
42
42
|
|
|
43
43
|
<%= partial "/shared/matcher_cmp" %>
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
### eq
|
|
46
46
|
|
|
47
47
|
<%= partial "/shared/matcher_eq" %>
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
### exist
|
|
50
50
|
|
|
51
51
|
The `exist` matcher tests if a command may be run on the system:
|
|
52
52
|
|
|
53
53
|
it { should exist }
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
### exit_status
|
|
56
56
|
|
|
57
57
|
The `exit_status` matcher tests the exit status for the command:
|
|
58
58
|
|
|
59
59
|
its('exit_status') { should eq 0 }
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
### include
|
|
62
62
|
|
|
63
63
|
<%= partial "/shared/matcher_include" %>
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
### match
|
|
66
66
|
|
|
67
67
|
<%= partial "/shared/matcher_match" %>
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
### stderr
|
|
70
70
|
|
|
71
71
|
The `stderr` matcher tests results of the command as returned in standard error (stderr):
|
|
72
72
|
|
|
73
73
|
its('stderr') { should eq '' }
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
### stdout
|
|
76
76
|
|
|
77
77
|
The `stdout` matcher tests results of the command as returned in standard output (stdout).
|
|
78
78
|
|
|
79
79
|
its('stdout') { should match /bin/ }
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
## Examples
|
|
83
83
|
|
|
84
84
|
None.
|
data/docs/resources/bond.md.erb
CHANGED
|
@@ -6,7 +6,7 @@ title: About the bond Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `bond` InSpec audit resource to test a logical, bonded network interface (i.e. "two or more network interfaces aggregated into a single, logical network interface"). On Linux platforms, any value in the `/proc/net/bonding` directory may be tested.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `bond` resource block declares a bonded network interface, and then specifies the properties of that bonded network interface to be tested:
|
|
12
12
|
|
|
@@ -20,72 +20,72 @@ where
|
|
|
20
20
|
* `{ should exist }` is a valid matcher for this resource
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Matchers
|
|
24
24
|
|
|
25
25
|
This InSpec audit resource has the following matchers:
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
### be
|
|
28
28
|
|
|
29
29
|
<%= partial "/shared/matcher_be" %>
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
### cmp
|
|
32
32
|
|
|
33
33
|
<%= partial "/shared/matcher_cmp" %>
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
### content
|
|
36
36
|
|
|
37
37
|
The `content` matcher tests if contents in the file that defines the bonded network interface match the value specified in the test. The values of the `content` matcher are arbitrary:
|
|
38
38
|
|
|
39
39
|
its('content') { should match('value') }
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
### eq
|
|
42
42
|
|
|
43
43
|
<%= partial "/shared/matcher_eq" %>
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
### exist
|
|
46
46
|
|
|
47
47
|
The `exist` matcher tests if the bonded network interface is available:
|
|
48
48
|
|
|
49
49
|
it { should exist }
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
### have_interface
|
|
52
52
|
|
|
53
53
|
The `have_interface` matcher tests if the bonded network interface has one (or more) secondary interfaces:
|
|
54
54
|
|
|
55
55
|
it { should have_interface }
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
### include
|
|
58
58
|
|
|
59
59
|
<%= partial "/shared/matcher_include" %>
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
### interfaces
|
|
62
62
|
|
|
63
63
|
The `interfaces` matcher tests if the named secondary interfaces are available:
|
|
64
64
|
|
|
65
65
|
its('interfaces') { should eq ['eth0', 'eth1', ...] }
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
### match
|
|
68
68
|
|
|
69
69
|
<%= partial "/shared/matcher_match" %>
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
### params
|
|
72
72
|
|
|
73
73
|
The `params` matcher tests arbitrary parameters for the bonded network interface:
|
|
74
74
|
|
|
75
75
|
its('params') { should eq 'value' }
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
## Examples
|
|
78
78
|
|
|
79
79
|
The following examples show how to use this InSpec audit resource.
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
### Test if eth0 is a secondary interface for bond0
|
|
82
82
|
|
|
83
83
|
describe bond('bond0') do
|
|
84
84
|
it { should exist }
|
|
85
85
|
it { should have_interface 'eth0' }
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
### Test parameters for bond0
|
|
89
89
|
|
|
90
90
|
describe bond('bond0') do
|
|
91
91
|
its('Bonding Mode') { should eq 'IEEE 802.3ad Dynamic link aggregation' }
|
|
@@ -9,7 +9,7 @@ Use the `bridge` InSpec audit resource to test basic network bridge properties,
|
|
|
9
9
|
* On Linux platforms, any value in the `/sys/class/net/{interface}/bridge` directory may be tested
|
|
10
10
|
* On the Windows platform, the `Get-NetAdapter` cmdlet is associated with the `Get-NetAdapterBinding` cmdlet and returns the `ComponentID ms_bridge` value as a JSON object
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Syntax
|
|
13
13
|
|
|
14
14
|
A `bridge` resource block declares the bridge to be tested and what interface it should be associated with:
|
|
15
15
|
|
|
@@ -18,39 +18,39 @@ A `bridge` resource block declares the bridge to be tested and what interface it
|
|
|
18
18
|
it { should have_interface 'eth0' }
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## Matchers
|
|
22
22
|
|
|
23
23
|
This InSpec audit resource has the following matchers:
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
### be
|
|
26
26
|
|
|
27
27
|
<%= partial "/shared/matcher_be" %>
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
### cmp
|
|
30
30
|
|
|
31
31
|
<%= partial "/shared/matcher_cmp" %>
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
### eq
|
|
34
34
|
|
|
35
35
|
<%= partial "/shared/matcher_eq" %>
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
### exist
|
|
38
38
|
|
|
39
39
|
The `exist` matcher tests if the network bridge is available:
|
|
40
40
|
|
|
41
41
|
it { should exist }
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
### have_interface
|
|
44
44
|
|
|
45
45
|
The `have_interface` matcher tests if the named interface is defined for the network bridge:
|
|
46
46
|
|
|
47
47
|
it { should have_interface 'eth0' }
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
### include
|
|
50
50
|
|
|
51
51
|
<%= partial "/shared/matcher_include" %>
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
### interfaces
|
|
54
54
|
|
|
55
55
|
The `interfaces` matcher tests if the named interface is present:
|
|
56
56
|
|
|
@@ -58,10 +58,10 @@ The `interfaces` matcher tests if the named interface is present:
|
|
|
58
58
|
its('interfaces') { should eq 'bar' }
|
|
59
59
|
its('interfaces') { should include('foo') }
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
### match
|
|
62
62
|
|
|
63
63
|
<%= partial "/shared/matcher_match" %>
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
## Examples
|
|
66
66
|
|
|
67
67
|
None.
|