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 iptables Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `iptables` InSpec audit resource to test rules that are defined in `iptables`, which maintains tables of IP packet filtering rules. There may be more than one table. Each table contains one (or more) chains (both built-in and custom). A chain is a list of rules that match packets. When the rule matches, the rule defines what target to assign to the packet.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `iptables` resource block declares tests for rules in IP tables:
|
|
12
12
|
|
|
@@ -20,51 +20,58 @@ where
|
|
|
20
20
|
* `rule:'name'` is the name of a rule that matches a set of packets
|
|
21
21
|
* `table:'name'` is the packet matching table against which the test is run
|
|
22
22
|
* `chain: 'name'` is the name of a user-defined chain or one of `ACCEPT`, `DROP`, `QUEUE`, or `RETURN`
|
|
23
|
-
* `have_rule('RULE')` tests that rule in the iptables
|
|
23
|
+
* `have_rule('RULE')` tests that rule in the iptables list. This must match the entire line taken from `iptables -S CHAIN`.
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
# Matchers
|
|
25
|
+
## Matchers
|
|
27
26
|
|
|
28
27
|
This InSpec audit resource has the following matchers:
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
### be
|
|
31
30
|
|
|
32
31
|
<%= partial "/shared/matcher_be" %>
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
### cmp
|
|
35
34
|
|
|
36
35
|
<%= partial "/shared/matcher_cmp" %>
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
### eq
|
|
39
38
|
|
|
40
39
|
<%= partial "/shared/matcher_eq" %>
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
### have_rule
|
|
43
42
|
|
|
44
43
|
The `have_rule` matcher tests the named rule against the information in the `iptables` file:
|
|
45
44
|
|
|
46
45
|
it { should have_rule('RULE') }
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
### include
|
|
49
48
|
|
|
50
49
|
<%= partial "/shared/matcher_include" %>
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
### match
|
|
53
52
|
|
|
54
53
|
<%= partial "/shared/matcher_match" %>
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
## Examples
|
|
57
56
|
|
|
58
57
|
The following examples show how to use this InSpec audit resource.
|
|
59
58
|
|
|
60
|
-
|
|
59
|
+
### Test if the INPUT chain is in default ACCEPT mode
|
|
61
60
|
|
|
62
61
|
describe iptables do
|
|
63
62
|
it { should have_rule('-P INPUT ACCEPT') }
|
|
64
63
|
end
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
### Test if the INPUT chain from the mangle table is in ACCEPT mode
|
|
67
66
|
|
|
68
|
-
describe iptables(table:'mangle', chain: '
|
|
67
|
+
describe iptables(table:'mangle', chain: 'INPUT') do
|
|
69
68
|
it { should have_rule('-P INPUT ACCEPT') }
|
|
70
69
|
end
|
|
70
|
+
|
|
71
|
+
### Test if there is a rule allowing Postgres (5432/TCP) traffic
|
|
72
|
+
|
|
73
|
+
describe iptables do
|
|
74
|
+
it { should have_rule('-A INPUT -p tcp -m tcp -m multiport --dports 5432 -m comment --comment "postgres" -j ACCEPT') }
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
Note that the rule specification must exactly match what's in the output of `iptables -S INPUT`, which will depend on how you've built your rules.
|
data/docs/resources/json.md.erb
CHANGED
|
@@ -6,7 +6,7 @@ title: About the json Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `json` InSpec audit resource to test data in a JSON file.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `json` resource block declares the data to be tested. Assume the following JSON file:
|
|
12
12
|
|
|
@@ -23,7 +23,7 @@ A `json` resource block declares the data to be tested. Assume the following JSO
|
|
|
23
23
|
|
|
24
24
|
This file can be queried using:
|
|
25
25
|
|
|
26
|
-
describe json('/
|
|
26
|
+
describe json('/path/to/name.json') do
|
|
27
27
|
its('name') { should eq 'hello' }
|
|
28
28
|
its(['meta','creator']) { should eq 'John Doe' }
|
|
29
29
|
its(['array', 1]) { should eq 'one' }
|
|
@@ -35,41 +35,41 @@ where
|
|
|
35
35
|
* `should eq 'foo'` tests a value of `name` as read from a JSON file versus the value declared in the test
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
## Matchers
|
|
39
39
|
|
|
40
40
|
This InSpec audit resource has the following matchers:
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
### be
|
|
43
43
|
|
|
44
44
|
<%= partial "/shared/matcher_be" %>
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
### cmp
|
|
47
47
|
|
|
48
48
|
<%= partial "/shared/matcher_cmp" %>
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
### eq
|
|
51
51
|
|
|
52
52
|
<%= partial "/shared/matcher_eq" %>
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
### include
|
|
55
55
|
|
|
56
56
|
<%= partial "/shared/matcher_include" %>
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
### match
|
|
59
59
|
|
|
60
60
|
<%= partial "/shared/matcher_match" %>
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
### name
|
|
63
63
|
|
|
64
64
|
The `name` matcher tests the value of `name` as read from a JSON file versus the value declared in the test:
|
|
65
65
|
|
|
66
66
|
its('name') { should eq 'foo' }
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
## Examples
|
|
69
69
|
|
|
70
70
|
The following examples show how to use this InSpec audit resource.
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
### Test a cookbook version in a policyfile.lock.json file
|
|
73
73
|
|
|
74
74
|
describe json('policyfile.lock.json') do
|
|
75
75
|
its(['cookbook_locks', 'omnibus', 'version']) { should eq('2.2.0') }
|
|
@@ -4,57 +4,118 @@ title: About the kernel_module Resource
|
|
|
4
4
|
|
|
5
5
|
# kernel_module
|
|
6
6
|
|
|
7
|
-
Use the `kernel_module` InSpec audit resource to test kernel modules on Linux
|
|
7
|
+
Use the `kernel_module` InSpec audit resource to test kernel modules on Linux
|
|
8
|
+
platforms. These parameters are located under `/lib/modules`. Any submodule may
|
|
9
|
+
be tested using this resource.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
The `kernel_module` resource can also verify if a kernel module is `blacklisted`
|
|
12
|
+
or if a module is disabled via a fake install using the `bin_true` or `bin_false`
|
|
13
|
+
method.
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
## Syntax
|
|
16
|
+
|
|
17
|
+
A `kernel_module` resource block declares a module name, and then tests if that
|
|
18
|
+
module is a loadable kernel module, if it is enabled, disabled or if it is
|
|
19
|
+
blacklisted:
|
|
12
20
|
|
|
13
21
|
describe kernel_module('module_name') do
|
|
14
22
|
it { should be_loaded }
|
|
23
|
+
it { should_not be_disabled }
|
|
24
|
+
it { should_not be_blacklisted }
|
|
25
|
+
end
|
|
15
26
|
end
|
|
16
27
|
|
|
17
28
|
where
|
|
18
29
|
|
|
19
30
|
* `'module_name'` must specify a kernel module, such as `'bridge'`
|
|
20
31
|
* `{ should be_loaded }` tests if the module is a loadable kernel module
|
|
32
|
+
* `{ should be_blacklisted }` tests if the module is blacklisted or if the module is disabled via a fake install using /bin/false or /bin/true
|
|
33
|
+
* `{ should be_disabled }` tests if the module is disabled via a fake install using /bin/false or /bin/true
|
|
21
34
|
|
|
22
|
-
|
|
35
|
+
## Matchers
|
|
23
36
|
|
|
24
37
|
This InSpec audit resource has the following matchers:
|
|
25
38
|
|
|
26
|
-
|
|
39
|
+
### be
|
|
27
40
|
|
|
28
41
|
<%= partial "/shared/matcher_be" %>
|
|
29
42
|
|
|
30
|
-
|
|
43
|
+
### be_loaded
|
|
31
44
|
|
|
32
45
|
The `be_loaded` matcher tests if the module is a loadable kernel module:
|
|
33
46
|
|
|
34
47
|
it { should be_loaded }
|
|
35
48
|
|
|
36
|
-
|
|
49
|
+
### cmp
|
|
37
50
|
|
|
38
51
|
<%= partial "/shared/matcher_cmp" %>
|
|
39
52
|
|
|
40
|
-
|
|
53
|
+
### eq
|
|
41
54
|
|
|
42
55
|
<%= partial "/shared/matcher_eq" %>
|
|
43
56
|
|
|
44
|
-
|
|
57
|
+
### include
|
|
45
58
|
|
|
46
59
|
<%= partial "/shared/matcher_include" %>
|
|
47
60
|
|
|
48
|
-
|
|
61
|
+
### match
|
|
49
62
|
|
|
50
63
|
<%= partial "/shared/matcher_match" %>
|
|
51
64
|
|
|
52
|
-
|
|
65
|
+
### version
|
|
66
|
+
|
|
67
|
+
The `version` matcher tests if the named module version is on the system:
|
|
68
|
+
|
|
69
|
+
its(:version) { should eq '3.2.2' }
|
|
70
|
+
|
|
71
|
+
## Examples
|
|
53
72
|
|
|
54
73
|
The following examples show how to use this InSpec audit resource.
|
|
55
74
|
|
|
56
|
-
|
|
75
|
+
### Test a modules 'version'
|
|
57
76
|
|
|
58
77
|
describe kernel_module('bridge') do
|
|
59
78
|
it { should be_loaded }
|
|
79
|
+
its(:version) { should cmp >= '2.2.2' }
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
### Test if a module is loaded, not disabled and not blacklisted
|
|
83
|
+
|
|
84
|
+
describe kernel_module('video') do
|
|
85
|
+
it { should be_loaded }
|
|
86
|
+
it { should_not be_disabled }
|
|
87
|
+
it { should_not be_blacklisted }
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
### Check if a module is blacklisted
|
|
91
|
+
|
|
92
|
+
describe kernel_module('floppy') do
|
|
93
|
+
it { should be_blacklisted }
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
### Ensure a module is *not* blacklisted and it is loaded
|
|
97
|
+
|
|
98
|
+
describe kernel_module('video') do
|
|
99
|
+
it { should_not be_blacklisted }
|
|
100
|
+
it { should be_loaded }
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
### Ensure a module is disabled via 'bin_false'
|
|
104
|
+
|
|
105
|
+
describe kernel_module('sstfb') do
|
|
106
|
+
it { should_not be_loaded }
|
|
107
|
+
it { should be_disabled }
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
### Ensure a module is 'blacklisted'/'disabled' via 'bin_true'
|
|
111
|
+
|
|
112
|
+
describe kernel_module('nvidiafb') do
|
|
113
|
+
it { should_not be_loaded }
|
|
114
|
+
it { should be_blacklisted }
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
### Ensure a module is not loaded
|
|
118
|
+
|
|
119
|
+
describe kernel_module('dhcp') do
|
|
120
|
+
it { should_not be_loaded }
|
|
60
121
|
end
|
|
@@ -6,7 +6,7 @@ title: About the kernel_parameter Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `kernel_parameter` InSpec audit resource to test kernel parameters on Linux platforms.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `kernel_parameter` resource block declares a parameter and then a value to be tested:
|
|
12
12
|
|
|
@@ -19,53 +19,53 @@ where
|
|
|
19
19
|
* `'kernel.parameter'` must specify a kernel parameter, such as `'net.ipv4.conf.all.forwarding'`
|
|
20
20
|
* `{ should eq 0 }` states the value to be tested
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
## Matchers
|
|
23
23
|
|
|
24
24
|
This InSpec audit resource has the following matchers:
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
### be
|
|
27
27
|
|
|
28
28
|
<%= partial "/shared/matcher_be" %>
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
### cmp
|
|
31
31
|
|
|
32
32
|
<%= partial "/shared/matcher_cmp" %>
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
### eq
|
|
35
35
|
|
|
36
36
|
<%= partial "/shared/matcher_eq" %>
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
### include
|
|
39
39
|
|
|
40
40
|
<%= partial "/shared/matcher_include" %>
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
### match
|
|
43
43
|
|
|
44
44
|
<%= partial "/shared/matcher_match" %>
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
### value
|
|
47
47
|
|
|
48
48
|
The `value` matcher tests the value assigned to the named IP address versus the value declared in the test:
|
|
49
49
|
|
|
50
50
|
its('value') { should eq 0 }
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
## Examples
|
|
53
53
|
|
|
54
54
|
The following examples show how to use this InSpec audit resource.
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
### Test if global forwarding is enabled for an IPv4 address
|
|
57
57
|
|
|
58
58
|
describe kernel_parameter('net.ipv4.conf.all.forwarding') do
|
|
59
59
|
its('value') { should eq 1 }
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
### Test if global forwarding is disabled for an IPv6 address
|
|
63
63
|
|
|
64
64
|
describe kernel_parameter('net.ipv6.conf.all.forwarding') do
|
|
65
65
|
its('value') { should eq 0 }
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
### Test if an IPv6 address accepts redirects
|
|
69
69
|
|
|
70
70
|
describe kernel_parameter('net.ipv6.conf.interface.accept_redirects') do
|
|
71
71
|
its('value') { should eq 'true' }
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The key_rsa Resource
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# key_rsa
|
|
6
|
+
|
|
7
|
+
Use the `key_rsa` InSpec audit resource to test RSA public/private keypairs.
|
|
8
|
+
|
|
9
|
+
This resource is mainly useful when used in conjunction with the x509_certificate resource but it can also be used for checking SSH keys.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Syntax
|
|
13
|
+
|
|
14
|
+
An `key_rsa` resource block declares a `key file` to be tested.
|
|
15
|
+
|
|
16
|
+
describe key_rsa('mycertificate.key') do
|
|
17
|
+
it { should be_private }
|
|
18
|
+
it { should be_public }
|
|
19
|
+
its('public_key') { should match "-----BEGIN PUBLIC KEY-----\n3597459df9f3982" }
|
|
20
|
+
its('key_length') { should eq 2048 }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
You can use an optional passphrase with `key_rsa`
|
|
24
|
+
|
|
25
|
+
describe key_rsa('mycertificate.key', 'passphrase') do
|
|
26
|
+
it { should be_private }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
## Supported Properties
|
|
30
|
+
|
|
31
|
+
### public?
|
|
32
|
+
|
|
33
|
+
To verify if a key is public use the following:
|
|
34
|
+
|
|
35
|
+
describe key_rsa('/etc/pki/www.mywebsite.com.key') do
|
|
36
|
+
it { should be_public }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
### public_key (String)
|
|
40
|
+
|
|
41
|
+
The `public_key` property returns the public part of the RSA key pair
|
|
42
|
+
|
|
43
|
+
describe key_rsa('/etc/pki/www.mywebsite.com.key') do
|
|
44
|
+
its('public_key') { should match "-----BEGIN PUBLIC KEY-----\n3597459df9f3982......" }
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
### private?
|
|
48
|
+
|
|
49
|
+
This property verifies that the key includes a private key:
|
|
50
|
+
|
|
51
|
+
describe key_rsa('/etc/pki/www.mywebsite.com.key') do
|
|
52
|
+
it { should be_private }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### private_key (String)
|
|
57
|
+
|
|
58
|
+
The `private_key` property returns the private key or the RSA key pair.
|
|
59
|
+
|
|
60
|
+
describe key_rsa('/etc/pki/www.mywebsite.com.key') do
|
|
61
|
+
its('private_key') { should match "-----BEGIN RSA PRIVATE KEY-----\nMIIJJwIBAAK......" }
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
### key_length
|
|
65
|
+
|
|
66
|
+
The `key_length` property allows testing the number of bits in the key pair.
|
|
67
|
+
|
|
68
|
+
describe key_rsa('/etc/pki/www.mywebsite.com.key') do
|
|
69
|
+
its('key_length') { should eq 2048 }
|
|
70
|
+
end
|
|
@@ -6,7 +6,7 @@ title: About the launchd_service Resource
|
|
|
6
6
|
|
|
7
7
|
Use the ``launchd_service`` InSpec audit resource to test a service using Launchd.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A ``launchd_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.
|
|
@@ -17,7 +17,7 @@ Entries in the `limits.conf` file are similar to:
|
|
|
17
17
|
^^^^^^^^^ ^^^^ ^^^^^^ ^^^^^
|
|
18
18
|
domain type item value
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
## Syntax
|
|
21
21
|
|
|
22
22
|
A `limits_conf` resource block declares a domain to be tested, along with associated type, item, and value:
|
|
23
23
|
|
|
@@ -34,19 +34,19 @@ where
|
|
|
34
34
|
* `'item'` is the item for which limits are defined, such as `core`, `nofile`, `stack`, `nproc`, `priority`, or `maxlogins`
|
|
35
35
|
* `'value'` is the value associated with the `item`
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
## Matchers
|
|
38
38
|
|
|
39
39
|
This InSpec audit resource has the following matchers:
|
|
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
|
+
### domain
|
|
50
50
|
|
|
51
51
|
The `domain` matcher tests the domain in the `limits.conf` file, along with associated type, item, and value:
|
|
52
52
|
|
|
@@ -56,23 +56,23 @@ For example:
|
|
|
56
56
|
|
|
57
57
|
its('grantmc') { should include ['hard', 'nofile', '63536'] }
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
### eq
|
|
60
60
|
|
|
61
61
|
<%= partial "/shared/matcher_eq" %>
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
### include
|
|
64
64
|
|
|
65
65
|
<%= partial "/shared/matcher_include" %>
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
### match
|
|
68
68
|
|
|
69
69
|
<%= partial "/shared/matcher_match" %>
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
## Examples
|
|
72
72
|
|
|
73
73
|
The following examples show how to use this InSpec audit resource.
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
### Test limits
|
|
76
76
|
|
|
77
77
|
describe limits_conf('path') do
|
|
78
78
|
its('*') { should include ['soft', 'core', '0'], ['hard', 'rss', '10000'] }
|
|
@@ -6,7 +6,7 @@ title: About the login_defs Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `login_defs` InSpec audit resource to test configuration settings in the `/etc/login.defs` file. The `logins.defs` file defines site-specific configuration for the shadow password suite on Linux and Unix platforms, such as password expiration ranges, minimum/maximum values for automatic selection of user and group identifiers, or the method with which passwords are encrypted.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `login_defs` resource block declares the `login.defs` configuration data to be tested:
|
|
12
12
|
|
|
@@ -20,41 +20,41 @@ where
|
|
|
20
20
|
* `{ should include('foo') }` tests the value of `name` as read from `login.defs` versus the value declared in the test
|
|
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
|
+
### name
|
|
48
48
|
|
|
49
49
|
The `name` matcher tests the value of `name` as read from `login.defs` versus the value declared in the test:
|
|
50
50
|
|
|
51
51
|
its('name') { should eq 'foo' }
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
## Examples
|
|
54
54
|
|
|
55
55
|
The following examples show how to use this InSpec audit resource.
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
### Test password expiration settings
|
|
58
58
|
|
|
59
59
|
describe login_defs do
|
|
60
60
|
its('PASS_MAX_DAYS') { should eq '180' }
|
|
@@ -63,13 +63,13 @@ The following examples show how to use this InSpec audit resource.
|
|
|
63
63
|
its('PASS_WARN_AGE') { should eq '30' }
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
### Test the encryption method
|
|
67
67
|
|
|
68
68
|
describe login_defs do
|
|
69
69
|
its('ENCRYPT_METHOD') { should eq 'SHA512' }
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
### Test umask setting
|
|
73
73
|
|
|
74
74
|
describe login_def do
|
|
75
75
|
its('UMASK') { should eq '077' }
|