inspec 1.31.0 → 1.45.9
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/.rubocop.yml +3 -0
- data/CHANGELOG.md +2599 -1
- data/Gemfile +0 -1
- data/README.md +24 -34
- data/Rakefile +0 -31
- data/docs/dsl_inspec.md +10 -0
- data/docs/matchers.md +29 -0
- data/docs/plugin_kitchen_inspec.md +18 -24
- data/docs/profiles.md +101 -81
- data/docs/resources/aide_conf.md.erb +71 -0
- data/docs/resources/apache_conf.md.erb +19 -33
- data/docs/resources/apt.md.erb +22 -36
- data/docs/resources/audit_policy.md.erb +9 -24
- data/docs/resources/auditd.md.erb +78 -0
- data/docs/resources/auditd_conf.md.erb +20 -34
- data/docs/resources/auditd_rules.md.erb +8 -24
- data/docs/resources/bash.md.erb +4 -26
- data/docs/resources/bond.md.erb +25 -40
- data/docs/resources/bridge.md.erb +5 -25
- data/docs/resources/bsd_service.md.erb +5 -25
- data/docs/resources/command.md.erb +35 -50
- data/docs/resources/cpan.md.erb +62 -0
- data/docs/resources/cran.md.erb +54 -0
- data/docs/resources/crontab.md.erb +9 -23
- data/docs/resources/csv.md.erb +12 -27
- data/docs/resources/dh_params.md +1 -0
- data/docs/resources/directory.md.erb +5 -25
- data/docs/resources/docker.md.erb +61 -58
- data/docs/resources/docker_container.md.erb +23 -19
- data/docs/resources/docker_image.md.erb +20 -16
- data/docs/resources/elasticsearch.md.erb +245 -0
- data/docs/resources/etc_fstab.md.erb +120 -0
- data/docs/resources/etc_group.md.erb +29 -45
- data/docs/resources/etc_hosts.md.erb +68 -0
- data/docs/resources/etc_hosts_allow.md.erb +68 -0
- data/docs/resources/etc_hosts_deny.md.erb +68 -0
- data/docs/resources/file.md.erb +227 -216
- data/docs/resources/firewalld.md.erb +104 -0
- data/docs/resources/gem.md.erb +21 -35
- data/docs/resources/group.md.erb +16 -30
- data/docs/resources/grub_conf.md.erb +9 -24
- data/docs/resources/host.md.erb +32 -49
- data/docs/resources/http.md.erb +38 -44
- data/docs/resources/iis_app.md.erb +25 -35
- data/docs/resources/iis_site.md.erb +26 -40
- data/docs/resources/inetd_conf.md.erb +27 -42
- data/docs/resources/ini.md.erb +9 -23
- data/docs/resources/interface.md.erb +5 -25
- data/docs/resources/iptables.md.erb +15 -29
- data/docs/resources/json.md.erb +12 -27
- data/docs/resources/kernel_module.md.erb +47 -61
- data/docs/resources/kernel_parameter.md.erb +15 -29
- data/docs/resources/key_rsa.md.erb +3 -0
- data/docs/resources/launchd_service.md.erb +5 -25
- data/docs/resources/limits_conf.md.erb +15 -29
- data/docs/resources/login_def.md.erb +15 -30
- data/docs/resources/mount.md.erb +18 -33
- data/docs/resources/mssql_session.md.erb +9 -12
- data/docs/resources/mysql_conf.md.erb +28 -32
- data/docs/resources/mysql_session.md.erb +15 -29
- data/docs/resources/nginx.md.erb +78 -0
- data/docs/resources/nginx_conf.md.erb +127 -0
- data/docs/resources/npm.md.erb +19 -35
- data/docs/resources/ntp_conf.md.erb +20 -37
- data/docs/resources/oneget.md.erb +15 -30
- data/docs/resources/oracledb_session.md.erb +9 -11
- data/docs/resources/os.md.erb +29 -43
- data/docs/resources/os_env.md.erb +23 -44
- data/docs/resources/package.md.erb +34 -36
- data/docs/resources/parse_config.md.erb +5 -25
- data/docs/resources/parse_config_file.md.erb +31 -43
- data/docs/resources/{etc_passwd.md.erb → passwd.md.erb} +24 -39
- data/docs/resources/pip.md.erb +20 -35
- data/docs/resources/port.md.erb +43 -57
- data/docs/resources/postgres_conf.md.erb +17 -31
- data/docs/resources/postgres_hba_conf.md.erb +26 -38
- data/docs/resources/postgres_ident_conf.md.erb +25 -37
- data/docs/resources/postgres_session.md.erb +15 -29
- data/docs/resources/powershell.md.erb +27 -42
- data/docs/resources/processes.md.erb +17 -33
- data/docs/resources/rabbitmq_config.md.erb +9 -24
- data/docs/resources/registry_key.md.erb +27 -42
- data/docs/resources/runit_service.md.erb +5 -25
- data/docs/resources/security_policy.md.erb +12 -27
- data/docs/resources/service.md.erb +27 -42
- data/docs/resources/{etc_shadow.md.erb → shadow.md.erb} +41 -47
- data/docs/resources/ssh_config.md.erb +19 -34
- data/docs/resources/sshd_config.md.erb +19 -34
- data/docs/resources/ssl.md.erb +39 -54
- data/docs/resources/sys_info.md.erb +12 -26
- data/docs/resources/systemd_service.md.erb +5 -25
- data/docs/resources/sysv_service.md.erb +5 -25
- data/docs/resources/upstart_service.md.erb +5 -25
- data/docs/resources/user.md.erb +29 -44
- data/docs/resources/users.md.erb +12 -26
- data/docs/resources/vbscript.md.erb +9 -24
- data/docs/resources/virtualization.md.erb +8 -23
- data/docs/resources/windows_feature.md.erb +15 -30
- data/docs/resources/windows_hotfix.md.erb +50 -0
- data/docs/resources/windows_task.md.erb +12 -26
- data/docs/resources/wmi.md.erb +9 -24
- data/docs/resources/x509_certificate.md.erb +4 -0
- data/docs/resources/xinetd_conf.md.erb +65 -80
- data/docs/resources/xml.md.erb +61 -0
- data/docs/resources/yaml.md.erb +12 -27
- data/docs/resources/yum.md.erb +37 -51
- data/docs/resources/zfs_dataset.md.erb +15 -26
- data/docs/resources/zfs_pool.md.erb +9 -20
- data/docs/ruby_usage.md +0 -1
- data/examples/meta-profile/README.md +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 +3 -3
- data/lib/bundles/inspec-artifact/cli.rb +5 -5
- data/lib/bundles/inspec-compliance/README.md +24 -22
- data/lib/bundles/inspec-compliance/api/login.rb +152 -0
- data/lib/bundles/inspec-compliance/api.rb +46 -16
- data/lib/bundles/inspec-compliance/cli.rb +58 -165
- data/lib/bundles/inspec-compliance/target.rb +2 -3
- data/lib/bundles/inspec-habitat/cli.rb +7 -2
- data/lib/bundles/inspec-habitat/profile.rb +44 -20
- data/lib/bundles/inspec-init/templates/profile/README.md +1 -1
- data/lib/bundles/inspec-init/templates/profile/controls/example.rb +1 -1
- data/lib/bundles/inspec-supermarket/api.rb +1 -1
- data/lib/inspec/backend.rb +8 -0
- data/lib/inspec/cli.rb +1 -1
- data/lib/inspec/control_eval_context.rb +16 -6
- data/lib/inspec/dependencies/requirement.rb +22 -8
- data/lib/inspec/dependencies/resolver.rb +1 -1
- data/lib/inspec/exceptions.rb +4 -0
- data/lib/inspec/file_provider.rb +38 -9
- data/lib/inspec/metadata.rb +17 -3
- data/lib/inspec/objects/attribute.rb +16 -7
- data/lib/inspec/objects/control.rb +10 -2
- data/lib/inspec/plugins/resource.rb +34 -5
- data/lib/inspec/profile.rb +10 -1
- data/lib/inspec/profile_context.rb +3 -1
- data/lib/inspec/resource.rb +17 -5
- data/lib/inspec/rspec_json_formatter.rb +48 -14
- data/lib/inspec/rule.rb +4 -0
- data/lib/inspec/runner.rb +72 -30
- data/lib/inspec/shell.rb +24 -19
- data/lib/inspec/version.rb +1 -1
- data/lib/matchers/matchers.rb +40 -0
- data/lib/resources/aide_conf.rb +162 -0
- data/lib/resources/auditd.rb +231 -0
- data/lib/resources/auditd_rules.rb +3 -1
- data/lib/resources/command.rb +1 -1
- data/lib/resources/cpan.rb +60 -0
- data/lib/resources/cran.rb +66 -0
- data/lib/resources/docker.rb +8 -1
- data/lib/resources/docker_container.rb +19 -2
- data/lib/resources/elasticsearch.rb +172 -0
- data/lib/resources/etc_fstab.rb +102 -0
- data/lib/resources/etc_group.rb +1 -1
- data/lib/resources/etc_hosts.rb +81 -0
- data/lib/resources/etc_hosts_allow_deny.rb +122 -0
- data/lib/resources/file.rb +87 -10
- data/lib/resources/firewalld.rb +144 -0
- data/lib/resources/groups.rb +0 -1
- data/lib/resources/host.rb +30 -15
- data/lib/resources/http.rb +178 -22
- data/lib/resources/mssql_session.rb +3 -3
- data/lib/resources/mysql_conf.rb +10 -0
- data/lib/resources/mysql_session.rb +1 -1
- data/lib/resources/nginx.rb +97 -0
- data/lib/resources/nginx_conf.rb +134 -1
- data/lib/resources/oracledb_session.rb +9 -8
- data/lib/resources/os_env.rb +7 -4
- data/lib/resources/package.rb +14 -2
- data/lib/resources/packages.rb +1 -1
- data/lib/resources/pip.rb +28 -20
- data/lib/resources/port.rb +251 -3
- data/lib/resources/postgres.rb +1 -1
- data/lib/resources/postgres_session.rb +1 -1
- data/lib/resources/processes.rb +106 -20
- data/lib/resources/registry_key.rb +11 -2
- data/lib/resources/service.rb +5 -24
- data/lib/resources/ssh_conf.rb +1 -1
- data/lib/resources/ssl.rb +4 -3
- data/lib/resources/toml.rb +2 -2
- data/lib/resources/windows_hotfix.rb +35 -0
- data/lib/resources/xinetd.rb +4 -6
- data/lib/resources/xml.rb +27 -0
- data/lib/source_readers/inspec.rb +3 -3
- data/lib/utils/find_files.rb +2 -1
- data/lib/utils/nginx_parser.rb +10 -1
- data/lib/utils/object_traversal.rb +35 -10
- data/lib/utils/parser.rb +21 -3
- metadata +48 -18
- data/docs/cli.md +0 -392
|
@@ -6,6 +6,8 @@ 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
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
An `apache_conf` InSpec audit resource block declares configuration settings that should be tested:
|
|
@@ -20,56 +22,40 @@ where
|
|
|
20
22
|
* `('path')` is the non-default path to the Apache configuration file
|
|
21
23
|
* `{ should eq 'value' }` is the value that is expected
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
<br>
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
## Examples
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
The following examples show how to use this InSpec audit resource.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
### Test for blocking .htaccess files on CentOS
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
describe apache_conf do
|
|
34
|
+
its('AllowOverride') { should eq 'None' }
|
|
35
|
+
end
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
### Test ports for SSL
|
|
34
38
|
|
|
35
39
|
describe apache_conf do
|
|
36
|
-
its('MaxClients') { should eq 100 }
|
|
37
40
|
its('Listen') { should eq '443'}
|
|
38
41
|
end
|
|
39
42
|
|
|
43
|
+
<br>
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<%= partial "/shared/matcher_be" %>
|
|
44
|
-
|
|
45
|
-
### cmp
|
|
46
|
-
|
|
47
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
48
|
-
|
|
49
|
-
### eq
|
|
50
|
-
|
|
51
|
-
<%= partial "/shared/matcher_eq" %>
|
|
52
|
-
|
|
53
|
-
### include
|
|
54
|
-
|
|
55
|
-
<%= partial "/shared/matcher_include" %>
|
|
56
|
-
|
|
57
|
-
### match
|
|
58
|
-
|
|
59
|
-
<%= partial "/shared/matcher_match" %>
|
|
45
|
+
## Matchers
|
|
60
46
|
|
|
61
|
-
|
|
47
|
+
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
48
|
+
This InSpec audit resource matches any service that is listed in the Apache configuration file:
|
|
62
49
|
|
|
63
|
-
|
|
50
|
+
its('PidFile') { should_not eq '/var/run/httpd.pid' }
|
|
64
51
|
|
|
65
|
-
|
|
52
|
+
or:
|
|
66
53
|
|
|
67
|
-
|
|
68
|
-
its('AllowOverride') { should eq 'None' }
|
|
69
|
-
end
|
|
54
|
+
its('Timeout') { should eq 300 }
|
|
70
55
|
|
|
71
|
-
|
|
56
|
+
For example:
|
|
72
57
|
|
|
73
58
|
describe apache_conf do
|
|
59
|
+
its('MaxClients') { should eq 100 }
|
|
74
60
|
its('Listen') { should eq '443'}
|
|
75
61
|
end
|
data/docs/resources/apt.md.erb
CHANGED
|
@@ -6,6 +6,8 @@ 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
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
An `apt` resource block tests the contents of Apt and PPA repositories:
|
|
@@ -21,42 +23,7 @@ where
|
|
|
21
23
|
* `('path')` may be an `http://` address, a `ppa:` address, or a short `repo-name/ppa` address
|
|
22
24
|
* `exist` and `be_enabled` are a valid matchers for this resource
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
## Matchers
|
|
26
|
-
|
|
27
|
-
This InSpec audit resource has the following matchers:
|
|
28
|
-
|
|
29
|
-
### be
|
|
30
|
-
|
|
31
|
-
<%= partial "/shared/matcher_be" %>
|
|
32
|
-
|
|
33
|
-
### be_enabled
|
|
34
|
-
|
|
35
|
-
The `be_enabled` matcher tests if a package exists in the repository:
|
|
36
|
-
|
|
37
|
-
it { should be_enabled }
|
|
38
|
-
|
|
39
|
-
### cmp
|
|
40
|
-
|
|
41
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
42
|
-
|
|
43
|
-
### eq
|
|
44
|
-
|
|
45
|
-
<%= partial "/shared/matcher_eq" %>
|
|
46
|
-
|
|
47
|
-
### exist
|
|
48
|
-
|
|
49
|
-
The `exist` matcher tests if a package exists on the system:
|
|
50
|
-
|
|
51
|
-
it { should exist }
|
|
52
|
-
|
|
53
|
-
### include
|
|
54
|
-
|
|
55
|
-
<%= partial "/shared/matcher_include" %>
|
|
56
|
-
|
|
57
|
-
### match
|
|
58
|
-
|
|
59
|
-
<%= partial "/shared/matcher_match" %>
|
|
26
|
+
<br>
|
|
60
27
|
|
|
61
28
|
## Examples
|
|
62
29
|
|
|
@@ -82,3 +49,22 @@ The following examples show how to use this InSpec audit resource.
|
|
|
82
49
|
it { should_not exist }
|
|
83
50
|
it { should_not be_enabled }
|
|
84
51
|
end
|
|
52
|
+
|
|
53
|
+
<br>
|
|
54
|
+
|
|
55
|
+
## Matchers
|
|
56
|
+
|
|
57
|
+
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### be_enabled
|
|
61
|
+
|
|
62
|
+
The `be_enabled` matcher tests if a package exists in the repository:
|
|
63
|
+
|
|
64
|
+
it { should be_enabled }
|
|
65
|
+
|
|
66
|
+
### exist
|
|
67
|
+
|
|
68
|
+
The `exist` matcher tests if a package exists on the system:
|
|
69
|
+
|
|
70
|
+
it { should exist }
|
|
@@ -6,6 +6,8 @@ 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
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
An `audit_policy` resource block declares a parameter that belongs to an audit policy category or subcategory:
|
|
@@ -19,30 +21,7 @@ where
|
|
|
19
21
|
* `'parameter'` must specify a parameter
|
|
20
22
|
* `'value'` must be one of `No Auditing`, `Not Specified`, `Success`, `Success and Failure`, or `Failure`
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
## Matchers
|
|
24
|
-
|
|
25
|
-
This InSpec audit resource has the following matchers:
|
|
26
|
-
|
|
27
|
-
### be
|
|
28
|
-
|
|
29
|
-
<%= partial "/shared/matcher_be" %>
|
|
30
|
-
|
|
31
|
-
### cmp
|
|
32
|
-
|
|
33
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
34
|
-
|
|
35
|
-
### eq
|
|
36
|
-
|
|
37
|
-
<%= partial "/shared/matcher_eq" %>
|
|
38
|
-
|
|
39
|
-
### include
|
|
40
|
-
|
|
41
|
-
<%= partial "/shared/matcher_include" %>
|
|
42
|
-
|
|
43
|
-
### match
|
|
44
|
-
|
|
45
|
-
<%= partial "/shared/matcher_match" %>
|
|
24
|
+
<br>
|
|
46
25
|
|
|
47
26
|
## Examples
|
|
48
27
|
|
|
@@ -59,3 +38,9 @@ The following examples show how to use this InSpec audit resource.
|
|
|
59
38
|
describe audit_policy do
|
|
60
39
|
its('User Account Management') { should eq 'Success' }
|
|
61
40
|
end
|
|
41
|
+
|
|
42
|
+
<br>
|
|
43
|
+
|
|
44
|
+
## Matchers
|
|
45
|
+
|
|
46
|
+
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: About the auditd Resource
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# auditd
|
|
6
|
+
|
|
7
|
+
Use the `auditd` 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. These rules are output using the auditcl -l command. This resource supports versions of `audit` >= 2.3.
|
|
8
|
+
|
|
9
|
+
<br>
|
|
10
|
+
|
|
11
|
+
## Syntax
|
|
12
|
+
|
|
13
|
+
An `auditd` resource block declares one (or more) rules to be tested, and then what that rule should do:
|
|
14
|
+
|
|
15
|
+
describe auditd do
|
|
16
|
+
its('lines') { should include %r(-w /etc/ssh/sshd_config) }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
or test that multiple individual rules are defined:
|
|
20
|
+
|
|
21
|
+
describe auditd do
|
|
22
|
+
its('lines') { should include %r(-a always,exit -F arch=.* -S init_module,delete_module -F key=modules) }
|
|
23
|
+
its('lines') { should include %r(-a always,exit -F arch=.* -S chmod,fchmod,fchmodat -F auid>=1000 -F auid!=-1 -F key=.+) }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
where each test must declare one (or more) rules to be tested.
|
|
27
|
+
|
|
28
|
+
<br>
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
The following examples show how to use this InSpec audit resource.
|
|
33
|
+
|
|
34
|
+
### Test if a rule contains a matching element that is identified by a regular expression
|
|
35
|
+
|
|
36
|
+
For `audit` >= 2.3:
|
|
37
|
+
|
|
38
|
+
describe auditd do
|
|
39
|
+
its('lines') { should include %r(-a always,exit -F arch=.* -S chown.* -F auid>=1000 -F auid!=-1 -F key=perm_mod) }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
### Query the audit daemon status
|
|
43
|
+
|
|
44
|
+
describe auditd.status('backlog') do
|
|
45
|
+
it { should cmp 0 }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
### Query properties of rules targeting specific syscalls or files - uniq is used to handle multiple rules for the same syscall with redundant field values
|
|
49
|
+
|
|
50
|
+
describe auditd.syscall('open') do
|
|
51
|
+
its('action.uniq') { should eq ['always'] }
|
|
52
|
+
its('list.uniq') { should eq ['exit'] }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
describe auditd.file('/etc/sudoers') do
|
|
56
|
+
its('permissions') { should include ['x'] }
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
The where accessor can be used to filter on fields. For example:
|
|
60
|
+
|
|
61
|
+
describe auditd.syscall('chown').where { arch == "b32" } do
|
|
62
|
+
its('action') { should eq ['always'] }
|
|
63
|
+
its('list') { should eq ['exit'] }
|
|
64
|
+
its('exit') { should include ['-EACCES'] }
|
|
65
|
+
its('exit') { should include ['-EPERM'] }
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
The key filter may be useful in evaluating rules with particular key values:
|
|
69
|
+
|
|
70
|
+
describe auditd.where { key == "privileged" } do
|
|
71
|
+
its('permissions') { should include ['x'] }
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
<br>
|
|
75
|
+
|
|
76
|
+
## Matchers
|
|
77
|
+
|
|
78
|
+
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
@@ -6,6 +6,8 @@ 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
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `auditd_conf` resource block declares configuration settings that should be tested:
|
|
@@ -20,40 +22,7 @@ where
|
|
|
20
22
|
* `('path')` is the non-default path to the `auditd.conf` configuration file
|
|
21
23
|
* `{ should cmp 'value' }` is the value that is expected
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
## Matchers
|
|
25
|
-
|
|
26
|
-
This InSpec audit resource has the following matchers:
|
|
27
|
-
|
|
28
|
-
### be
|
|
29
|
-
|
|
30
|
-
<%= partial "/shared/matcher_be" %>
|
|
31
|
-
|
|
32
|
-
### cmp
|
|
33
|
-
|
|
34
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
35
|
-
|
|
36
|
-
### eq
|
|
37
|
-
|
|
38
|
-
<%= partial "/shared/matcher_eq" %>
|
|
39
|
-
|
|
40
|
-
### include
|
|
41
|
-
|
|
42
|
-
<%= partial "/shared/matcher_include" %>
|
|
43
|
-
|
|
44
|
-
### keyword
|
|
45
|
-
|
|
46
|
-
This matcher will matche any keyword that is listed in the `auditd.conf` configuration file. Option names and values are case-insensitive:
|
|
47
|
-
|
|
48
|
-
its('log_format') { should cmp 'raw' }
|
|
49
|
-
|
|
50
|
-
or:
|
|
51
|
-
|
|
52
|
-
its('max_log_file') { should cmp 6 }
|
|
53
|
-
|
|
54
|
-
### match
|
|
55
|
-
|
|
56
|
-
<%= partial "/shared/matcher_match" %>
|
|
25
|
+
<br>
|
|
57
26
|
|
|
58
27
|
## Examples
|
|
59
28
|
|
|
@@ -77,3 +46,20 @@ The following examples show how to use this InSpec audit resource.
|
|
|
77
46
|
its('disk_full_action') { should cmp 'halt' }
|
|
78
47
|
its('disk_error_action') { should cmp 'halt' }
|
|
79
48
|
end
|
|
49
|
+
|
|
50
|
+
<br>
|
|
51
|
+
|
|
52
|
+
## Matchers
|
|
53
|
+
|
|
54
|
+
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### keyword
|
|
58
|
+
|
|
59
|
+
This matcher will matche any keyword that is listed in the `auditd.conf` configuration file. Option names and values are case-insensitive:
|
|
60
|
+
|
|
61
|
+
its('log_format') { should cmp 'raw' }
|
|
62
|
+
|
|
63
|
+
or:
|
|
64
|
+
|
|
65
|
+
its('max_log_file') { should cmp 6 }
|
|
@@ -6,6 +6,7 @@ title: About the auditd_rules Resource
|
|
|
6
6
|
|
|
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
|
+
<br>
|
|
9
10
|
|
|
10
11
|
## Syntax
|
|
11
12
|
|
|
@@ -61,30 +62,7 @@ or test that individual rules are defined:
|
|
|
61
62
|
|
|
62
63
|
where each test must declare one (or more) rules to be tested.
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
## Matchers
|
|
66
|
-
|
|
67
|
-
This InSpec audit resource has the following matchers:
|
|
68
|
-
|
|
69
|
-
### be
|
|
70
|
-
|
|
71
|
-
<%= partial "/shared/matcher_be" %>
|
|
72
|
-
|
|
73
|
-
### cmp
|
|
74
|
-
|
|
75
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
76
|
-
|
|
77
|
-
### eq
|
|
78
|
-
|
|
79
|
-
<%= partial "/shared/matcher_eq" %>
|
|
80
|
-
|
|
81
|
-
### include
|
|
82
|
-
|
|
83
|
-
<%= partial "/shared/matcher_include" %>
|
|
84
|
-
|
|
85
|
-
### match
|
|
86
|
-
|
|
87
|
-
<%= partial "/shared/matcher_match" %>
|
|
65
|
+
<br>
|
|
88
66
|
|
|
89
67
|
## Examples
|
|
90
68
|
|
|
@@ -130,3 +108,9 @@ Filters may be chained. For example:
|
|
|
130
108
|
describe auditd_rules.syscall('open').action('always').list do
|
|
131
109
|
it { should eq(['exit']) }
|
|
132
110
|
end
|
|
111
|
+
|
|
112
|
+
<br>
|
|
113
|
+
|
|
114
|
+
## Matchers
|
|
115
|
+
|
|
116
|
+
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
data/docs/resources/bash.md.erb
CHANGED
|
@@ -6,6 +6,8 @@ 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
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `command` resource block declares a command to be run, one (or more) expected outputs, and the location to which that output is sent:
|
|
@@ -29,22 +31,11 @@ For example:
|
|
|
29
31
|
its('exit_status') { should eq 0 }
|
|
30
32
|
end
|
|
31
33
|
|
|
34
|
+
<br>
|
|
32
35
|
|
|
33
36
|
## Matchers
|
|
34
37
|
|
|
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" %>
|
|
38
|
+
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
48
39
|
|
|
49
40
|
### exist
|
|
50
41
|
|
|
@@ -58,14 +49,6 @@ The `exit_status` matcher tests the exit status for the command:
|
|
|
58
49
|
|
|
59
50
|
its('exit_status') { should eq 0 }
|
|
60
51
|
|
|
61
|
-
### include
|
|
62
|
-
|
|
63
|
-
<%= partial "/shared/matcher_include" %>
|
|
64
|
-
|
|
65
|
-
### match
|
|
66
|
-
|
|
67
|
-
<%= partial "/shared/matcher_match" %>
|
|
68
|
-
|
|
69
52
|
### stderr
|
|
70
53
|
|
|
71
54
|
The `stderr` matcher tests results of the command as returned in standard error (stderr):
|
|
@@ -77,8 +60,3 @@ The `stderr` matcher tests results of the command as returned in standard error
|
|
|
77
60
|
The `stdout` matcher tests results of the command as returned in standard output (stdout).
|
|
78
61
|
|
|
79
62
|
its('stdout') { should match /bin/ }
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
## Examples
|
|
83
|
-
|
|
84
|
-
None.
|
data/docs/resources/bond.md.erb
CHANGED
|
@@ -6,6 +6,8 @@ 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
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `bond` resource block declares a bonded network interface, and then specifies the properties of that bonded network interface to be tested:
|
|
@@ -19,18 +21,35 @@ where
|
|
|
19
21
|
* `'name'` is the name of the bonded network interface
|
|
20
22
|
* `{ should exist }` is a valid matcher for this resource
|
|
21
23
|
|
|
24
|
+
<br>
|
|
22
25
|
|
|
23
|
-
##
|
|
26
|
+
## Examples
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
The following examples show how to use this InSpec audit resource.
|
|
26
29
|
|
|
27
|
-
###
|
|
30
|
+
### Test if eth0 is a secondary interface for bond0
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
describe bond('bond0') do
|
|
33
|
+
it { should exist }
|
|
34
|
+
it { should have_interface 'eth0' }
|
|
35
|
+
end
|
|
30
36
|
|
|
31
|
-
###
|
|
37
|
+
### Test parameters for bond0
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
describe bond('bond0') do
|
|
40
|
+
its('Bonding Mode') { should eq 'IEEE 802.3ad Dynamic link aggregation' }
|
|
41
|
+
its('Transmit Hash Policy') { should eq 'layer3+4 (1)' }
|
|
42
|
+
its('MII Status') { should eq 'up' }
|
|
43
|
+
its('MII Polling Interval (ms)') { should eq '100' }
|
|
44
|
+
its('Up Delay (ms)') { should eq '0' }
|
|
45
|
+
its('Down Delay (ms)') { should eq '0' }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
<br>
|
|
49
|
+
|
|
50
|
+
## Matchers
|
|
51
|
+
|
|
52
|
+
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
34
53
|
|
|
35
54
|
### content
|
|
36
55
|
|
|
@@ -38,10 +57,6 @@ The `content` matcher tests if contents in the file that defines the bonded netw
|
|
|
38
57
|
|
|
39
58
|
its('content') { should match('value') }
|
|
40
59
|
|
|
41
|
-
### eq
|
|
42
|
-
|
|
43
|
-
<%= partial "/shared/matcher_eq" %>
|
|
44
|
-
|
|
45
60
|
### exist
|
|
46
61
|
|
|
47
62
|
The `exist` matcher tests if the bonded network interface is available:
|
|
@@ -54,44 +69,14 @@ The `have_interface` matcher tests if the bonded network interface has one (or m
|
|
|
54
69
|
|
|
55
70
|
it { should have_interface }
|
|
56
71
|
|
|
57
|
-
### include
|
|
58
|
-
|
|
59
|
-
<%= partial "/shared/matcher_include" %>
|
|
60
|
-
|
|
61
72
|
### interfaces
|
|
62
73
|
|
|
63
74
|
The `interfaces` matcher tests if the named secondary interfaces are available:
|
|
64
75
|
|
|
65
76
|
its('interfaces') { should eq ['eth0', 'eth1', ...] }
|
|
66
77
|
|
|
67
|
-
### match
|
|
68
|
-
|
|
69
|
-
<%= partial "/shared/matcher_match" %>
|
|
70
|
-
|
|
71
78
|
### params
|
|
72
79
|
|
|
73
80
|
The `params` matcher tests arbitrary parameters for the bonded network interface:
|
|
74
81
|
|
|
75
82
|
its('params') { should eq 'value' }
|
|
76
|
-
|
|
77
|
-
## Examples
|
|
78
|
-
|
|
79
|
-
The following examples show how to use this InSpec audit resource.
|
|
80
|
-
|
|
81
|
-
### Test if eth0 is a secondary interface for bond0
|
|
82
|
-
|
|
83
|
-
describe bond('bond0') do
|
|
84
|
-
it { should exist }
|
|
85
|
-
it { should have_interface 'eth0' }
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
### Test parameters for bond0
|
|
89
|
-
|
|
90
|
-
describe bond('bond0') do
|
|
91
|
-
its('Bonding Mode') { should eq 'IEEE 802.3ad Dynamic link aggregation' }
|
|
92
|
-
its('Transmit Hash Policy') { should eq 'layer3+4 (1)' }
|
|
93
|
-
its('MII Status') { should eq 'up' }
|
|
94
|
-
its('MII Polling Interval (ms)') { should eq '100' }
|
|
95
|
-
its('Up Delay (ms)') { should eq '0' }
|
|
96
|
-
its('Down Delay (ms)') { should eq '0' }
|
|
97
|
-
end
|
|
@@ -9,6 +9,8 @@ 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
|
+
<br>
|
|
13
|
+
|
|
12
14
|
## Syntax
|
|
13
15
|
|
|
14
16
|
A `bridge` resource block declares the bridge to be tested and what interface it should be associated with:
|
|
@@ -18,21 +20,11 @@ A `bridge` resource block declares the bridge to be tested and what interface it
|
|
|
18
20
|
it { should have_interface 'eth0' }
|
|
19
21
|
end
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
This InSpec audit resource has the following matchers:
|
|
24
|
-
|
|
25
|
-
### be
|
|
26
|
-
|
|
27
|
-
<%= partial "/shared/matcher_be" %>
|
|
28
|
-
|
|
29
|
-
### cmp
|
|
30
|
-
|
|
31
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
23
|
+
<br>
|
|
32
24
|
|
|
33
|
-
|
|
25
|
+
## Matchers
|
|
34
26
|
|
|
35
|
-
|
|
27
|
+
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
36
28
|
|
|
37
29
|
### exist
|
|
38
30
|
|
|
@@ -46,10 +38,6 @@ The `have_interface` matcher tests if the named interface is defined for the net
|
|
|
46
38
|
|
|
47
39
|
it { should have_interface 'eth0' }
|
|
48
40
|
|
|
49
|
-
### include
|
|
50
|
-
|
|
51
|
-
<%= partial "/shared/matcher_include" %>
|
|
52
|
-
|
|
53
41
|
### interfaces
|
|
54
42
|
|
|
55
43
|
The `interfaces` matcher tests if the named interface is present:
|
|
@@ -57,11 +45,3 @@ The `interfaces` matcher tests if the named interface is present:
|
|
|
57
45
|
its('interfaces') { should eq 'foo' }
|
|
58
46
|
its('interfaces') { should eq 'bar' }
|
|
59
47
|
its('interfaces') { should include('foo') }
|
|
60
|
-
|
|
61
|
-
### match
|
|
62
|
-
|
|
63
|
-
<%= partial "/shared/matcher_match" %>
|
|
64
|
-
|
|
65
|
-
## Examples
|
|
66
|
-
|
|
67
|
-
None.
|
|
@@ -6,6 +6,8 @@ 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
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `bsd_service` resource block declares the name of a service and then one (or more) matchers to test the state of the service:
|
|
@@ -29,13 +31,11 @@ The path to the service manager's control may be specified for situations where
|
|
|
29
31
|
it { should be_running }
|
|
30
32
|
end
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
This InSpec audit resource has the following matchers:
|
|
34
|
+
<br>
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
## Matchers
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
39
39
|
|
|
40
40
|
### be_enabled
|
|
41
41
|
|
|
@@ -54,23 +54,3 @@ The `be_installed` matcher tests if the named service is installed:
|
|
|
54
54
|
The `be_running` matcher tests if the named service is running:
|
|
55
55
|
|
|
56
56
|
it { should be_running }
|
|
57
|
-
|
|
58
|
-
### cmp
|
|
59
|
-
|
|
60
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
61
|
-
|
|
62
|
-
### eq
|
|
63
|
-
|
|
64
|
-
<%= partial "/shared/matcher_eq" %>
|
|
65
|
-
|
|
66
|
-
### include
|
|
67
|
-
|
|
68
|
-
<%= partial "/shared/matcher_include" %>
|
|
69
|
-
|
|
70
|
-
### match
|
|
71
|
-
|
|
72
|
-
<%= partial "/shared/matcher_match" %>
|
|
73
|
-
|
|
74
|
-
## Examples
|
|
75
|
-
|
|
76
|
-
None.
|