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
data/docs/resources/port.md.erb
CHANGED
|
@@ -6,6 +6,8 @@ title: About the port Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `port` InSpec audit resource to test basic port properties, such as port, process, if it's listening.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `port` resource block declares a port, and then depending on what needs to be tested, a process, protocol, process identifier, and its state (is it listening?):
|
|
@@ -35,63 +37,7 @@ For example, to test if the SSH daemon is available on a Linux machine via the d
|
|
|
35
37
|
its('addresses') { should include '0.0.0.0' }
|
|
36
38
|
end
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
This InSpec audit resource has the following matchers:
|
|
41
|
-
|
|
42
|
-
### address
|
|
43
|
-
|
|
44
|
-
The `addresses` matcher tests if the specified address is associated with a port:
|
|
45
|
-
|
|
46
|
-
its('addresses') { should include '0.0.0.0' }
|
|
47
|
-
|
|
48
|
-
### be
|
|
49
|
-
|
|
50
|
-
<%= partial "/shared/matcher_be" %>
|
|
51
|
-
|
|
52
|
-
### be_listening
|
|
53
|
-
|
|
54
|
-
The `be_listening` matcher tests if the port is listening for traffic:
|
|
55
|
-
|
|
56
|
-
it { should be_listening }
|
|
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
|
-
### pids
|
|
75
|
-
|
|
76
|
-
The `pids` matcher tests the process identifiers (PIDs):
|
|
77
|
-
|
|
78
|
-
its('pids') { should cmp 27808 }
|
|
79
|
-
|
|
80
|
-
### processes
|
|
81
|
-
|
|
82
|
-
The `processes` matcher tests if the named process is running on the system:
|
|
83
|
-
|
|
84
|
-
its('processes') { should cmp 'syslog' }
|
|
85
|
-
|
|
86
|
-
### protocols
|
|
87
|
-
|
|
88
|
-
The `protocols` matcher tests the Internet protocol: ICMP (`'icmp'`), TCP (`'tcp'` or `'tcp6'`), or UDP (`'udp'` or `'udp6'`):
|
|
89
|
-
|
|
90
|
-
its('protocols') { should include 'tcp' }
|
|
91
|
-
|
|
92
|
-
or for the IPv6 protocol:
|
|
93
|
-
|
|
94
|
-
its('protocols') { should include 'tcp6' }
|
|
40
|
+
<br>
|
|
95
41
|
|
|
96
42
|
## Examples
|
|
97
43
|
|
|
@@ -148,3 +94,43 @@ or:
|
|
|
148
94
|
describe port(65432) do
|
|
149
95
|
it { should_not be_listening }
|
|
150
96
|
end
|
|
97
|
+
|
|
98
|
+
<br>
|
|
99
|
+
|
|
100
|
+
## Matchers
|
|
101
|
+
|
|
102
|
+
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/).
|
|
103
|
+
|
|
104
|
+
### address
|
|
105
|
+
|
|
106
|
+
The `addresses` matcher tests if the specified address is associated with a port:
|
|
107
|
+
|
|
108
|
+
its('addresses') { should include '0.0.0.0' }
|
|
109
|
+
|
|
110
|
+
### be_listening
|
|
111
|
+
|
|
112
|
+
The `be_listening` matcher tests if the port is listening for traffic:
|
|
113
|
+
|
|
114
|
+
it { should be_listening }
|
|
115
|
+
|
|
116
|
+
### pids
|
|
117
|
+
|
|
118
|
+
The `pids` matcher tests the process identifiers (PIDs):
|
|
119
|
+
|
|
120
|
+
its('pids') { should cmp 27808 }
|
|
121
|
+
|
|
122
|
+
### processes
|
|
123
|
+
|
|
124
|
+
The `processes` matcher tests if the named process is running on the system:
|
|
125
|
+
|
|
126
|
+
its('processes') { should cmp 'syslog' }
|
|
127
|
+
|
|
128
|
+
### protocols
|
|
129
|
+
|
|
130
|
+
The `protocols` matcher tests the Internet protocol: ICMP (`'icmp'`), TCP (`'tcp'` or `'tcp6'`), or UDP (`'udp'` or `'udp6'`):
|
|
131
|
+
|
|
132
|
+
its('protocols') { should include 'tcp' }
|
|
133
|
+
|
|
134
|
+
or for the IPv6 protocol:
|
|
135
|
+
|
|
136
|
+
its('protocols') { should include 'tcp6' }
|
|
@@ -6,6 +6,8 @@ title: About the postgres_conf Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `postgres_conf` InSpec audit resource to test the contents of the configuration file for PostgreSQL, typically located at `/etc/postgresql/<version>/main/postgresql.conf` or `/var/lib/postgres/data/postgresql.conf`, depending on the platform.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `postgres_conf` resource block declares one (or more) settings in the `postgresql.conf` file, and then compares the setting in the configuration file to the value stated in the test:
|
|
@@ -21,37 +23,7 @@ where
|
|
|
21
23
|
* `('path')` is the non-default path to the `postgresql.conf` file (optional)
|
|
22
24
|
* `should eq 'value'` is the value that is expected
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
This InSpec audit resource has the following matchers:
|
|
27
|
-
|
|
28
|
-
### be
|
|
29
|
-
|
|
30
|
-
<%= partial "/shared/matcher_be" %>
|
|
31
|
-
|
|
32
|
-
### cmp
|
|
33
|
-
|
|
34
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
35
|
-
|
|
36
|
-
### eq
|
|
37
|
-
|
|
38
|
-
<%= partial "/shared/matcher_eq" %>
|
|
39
|
-
|
|
40
|
-
### include
|
|
41
|
-
|
|
42
|
-
<%= partial "/shared/matcher_include" %>
|
|
43
|
-
|
|
44
|
-
### match
|
|
45
|
-
|
|
46
|
-
<%= partial "/shared/matcher_match" %>
|
|
47
|
-
|
|
48
|
-
### setting
|
|
49
|
-
|
|
50
|
-
The `setting` matcher tests specific, named settings in the `postgresql.conf` file:
|
|
51
|
-
|
|
52
|
-
its('setting') { should eq 'value' }
|
|
53
|
-
|
|
54
|
-
Use a `setting` matcher for each setting to be tested.
|
|
26
|
+
<br>
|
|
55
27
|
|
|
56
28
|
## Examples
|
|
57
29
|
|
|
@@ -90,3 +62,17 @@ The following examples show how to use this InSpec audit resource.
|
|
|
90
62
|
end
|
|
91
63
|
|
|
92
64
|
where `unix_socket_group` is set to the PostgreSQL default setting (the group to which the server user belongs).
|
|
65
|
+
|
|
66
|
+
<br>
|
|
67
|
+
|
|
68
|
+
## Matchers
|
|
69
|
+
|
|
70
|
+
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/).
|
|
71
|
+
|
|
72
|
+
### setting
|
|
73
|
+
|
|
74
|
+
The `setting` matcher tests specific, named settings in the `postgresql.conf` file:
|
|
75
|
+
|
|
76
|
+
its('setting') { should eq 'value' }
|
|
77
|
+
|
|
78
|
+
Use a `setting` matcher for each setting to be tested.
|
|
@@ -5,6 +5,9 @@ title: About the postgres_hba_conf Resource
|
|
|
5
5
|
# postgres_hba_conf
|
|
6
6
|
|
|
7
7
|
Use the `postgres_hba_conf` InSpec audit resource to test the client authentication data defined in the pg_hba.conf file.
|
|
8
|
+
|
|
9
|
+
<br>
|
|
10
|
+
|
|
8
11
|
## Syntax
|
|
9
12
|
|
|
10
13
|
An `postgres_hba_conf` InSpec audit resource block declares client authentication data that should be tested:
|
|
@@ -19,48 +22,14 @@ where
|
|
|
19
22
|
* `'filter_value'` is the value that is to be filtered for
|
|
20
23
|
* `'value'` is the value that is to be matched expected
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
This InSpec audit resource matches any service that is listed in the HBA configuration file:
|
|
25
|
-
|
|
26
|
-
its('auth_method') { should_not cmp 'peer' }
|
|
27
|
-
|
|
28
|
-
or:
|
|
29
|
-
|
|
30
|
-
its('auth_method') { should cmp 'peer' }
|
|
31
|
-
|
|
32
|
-
For example:
|
|
33
|
-
|
|
34
|
-
describe postgres_hba_conf.where { type == 'type' } do
|
|
35
|
-
its('auth_method') { should cmp 'value' }
|
|
36
|
-
its('user') { should cmp 'value' }
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
### be
|
|
40
|
-
|
|
41
|
-
<%= partial "/shared/matcher_be" %>
|
|
42
|
-
|
|
43
|
-
### cmp
|
|
44
|
-
|
|
45
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
46
|
-
|
|
47
|
-
### eq
|
|
48
|
-
|
|
49
|
-
<%= partial "/shared/matcher_eq" %>
|
|
50
|
-
|
|
51
|
-
### include
|
|
52
|
-
|
|
53
|
-
<%= partial "/shared/matcher_include" %>
|
|
54
|
-
|
|
55
|
-
### match
|
|
56
|
-
|
|
57
|
-
<%= partial "/shared/matcher_match" %>
|
|
58
|
-
|
|
25
|
+
<br>
|
|
59
26
|
|
|
60
27
|
## Supported Properties
|
|
61
28
|
|
|
62
29
|
'address', 'auth_method', 'auth_params', 'conf_dir' , 'conf_file' , 'database', 'params' ,'type', 'user'
|
|
63
30
|
|
|
31
|
+
<br>
|
|
32
|
+
|
|
64
33
|
## Property Examples and Return Types
|
|
65
34
|
|
|
66
35
|
### address([String])
|
|
@@ -70,7 +39,7 @@ For example:
|
|
|
70
39
|
describe postgres_hba_conf.where { type == 'local' } do
|
|
71
40
|
its('address') { should cmp 'value' }
|
|
72
41
|
end
|
|
73
|
-
|
|
42
|
+
|
|
74
43
|
### auth_method([String])
|
|
75
44
|
|
|
76
45
|
`auth_method` returns a an array of strings that matches the where condition of the filter table
|
|
@@ -102,3 +71,22 @@ For example:
|
|
|
102
71
|
describe postgres_hba_conf.where { database == 'acme_test_db' } do
|
|
103
72
|
its('user') { should cmp 'value' }
|
|
104
73
|
end
|
|
74
|
+
|
|
75
|
+
<br>
|
|
76
|
+
|
|
77
|
+
## Matchers
|
|
78
|
+
|
|
79
|
+
This InSpec audit resource matches any service that is listed in the HBA configuration file. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
80
|
+
|
|
81
|
+
its('auth_method') { should_not cmp 'peer' }
|
|
82
|
+
|
|
83
|
+
or:
|
|
84
|
+
|
|
85
|
+
its('auth_method') { should cmp 'peer' }
|
|
86
|
+
|
|
87
|
+
For example:
|
|
88
|
+
|
|
89
|
+
describe postgres_hba_conf.where { type == 'type' } do
|
|
90
|
+
its('auth_method') { should cmp 'value' }
|
|
91
|
+
its('user') { should cmp 'value' }
|
|
92
|
+
end
|
|
@@ -5,6 +5,9 @@ title: About the postgres_ident_conf Resource
|
|
|
5
5
|
# postgres_ident_conf
|
|
6
6
|
|
|
7
7
|
Use the `postgres_ident_conf` InSpec audit resource to test the client authentication data defined in the pg_hba.conf file.
|
|
8
|
+
|
|
9
|
+
<br>
|
|
10
|
+
|
|
8
11
|
## Syntax
|
|
9
12
|
|
|
10
13
|
An `postgres_ident_conf` InSpec audit resource block declares client authentication data that should be tested:
|
|
@@ -19,48 +22,14 @@ where
|
|
|
19
22
|
* `'filter_value'` is the value that is to be filtered for
|
|
20
23
|
* `'value'` is the value that is to be matched expected
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
This InSpec audit resource matches any service that is listed in the pg ident configuration file:
|
|
25
|
-
|
|
26
|
-
its('pg_username') { should_not eq ['peer'] }
|
|
27
|
-
|
|
28
|
-
or:
|
|
29
|
-
|
|
30
|
-
its('map_name') { should eq ['value'] }
|
|
31
|
-
|
|
32
|
-
For example:
|
|
33
|
-
|
|
34
|
-
describe postgres_ident_conf.where { pg_username == 'name' } do
|
|
35
|
-
its('system_username') { should eq ['value'] }
|
|
36
|
-
its('map_name') { should eq ['value'] }
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
### be
|
|
40
|
-
|
|
41
|
-
<%= partial "/shared/matcher_be" %>
|
|
42
|
-
|
|
43
|
-
### cmp
|
|
44
|
-
|
|
45
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
46
|
-
|
|
47
|
-
### eq
|
|
48
|
-
|
|
49
|
-
<%= partial "/shared/matcher_eq" %>
|
|
50
|
-
|
|
51
|
-
### include
|
|
52
|
-
|
|
53
|
-
<%= partial "/shared/matcher_include" %>
|
|
54
|
-
|
|
55
|
-
### match
|
|
56
|
-
|
|
57
|
-
<%= partial "/shared/matcher_match" %>
|
|
58
|
-
|
|
25
|
+
<br>
|
|
59
26
|
|
|
60
27
|
## Supported Properties
|
|
61
28
|
|
|
62
29
|
'conf_file', 'map_name', 'params', 'pg_username', 'system_username'
|
|
63
30
|
|
|
31
|
+
<br>
|
|
32
|
+
|
|
64
33
|
## Property Examples and Return Types
|
|
65
34
|
|
|
66
35
|
### map_name([String])
|
|
@@ -85,3 +54,22 @@ For example:
|
|
|
85
54
|
describe pg_hba_conf.where { pg_username == 'name' } do
|
|
86
55
|
its('system_username') { should eq ['value'] }
|
|
87
56
|
end
|
|
57
|
+
|
|
58
|
+
<br>
|
|
59
|
+
|
|
60
|
+
## Matchers
|
|
61
|
+
|
|
62
|
+
This InSpec audit resource matches any service that is listed in the pg ident configuration file. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
63
|
+
|
|
64
|
+
its('pg_username') { should_not eq ['peer'] }
|
|
65
|
+
|
|
66
|
+
or:
|
|
67
|
+
|
|
68
|
+
its('map_name') { should eq ['value'] }
|
|
69
|
+
|
|
70
|
+
For example:
|
|
71
|
+
|
|
72
|
+
describe postgres_ident_conf.where { pg_username == 'name' } do
|
|
73
|
+
its('system_username') { should eq ['value'] }
|
|
74
|
+
its('map_name') { should eq ['value'] }
|
|
75
|
+
end
|
|
@@ -6,6 +6,8 @@ title: About the postgres_session Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `postgres_session` InSpec audit resource to test SQL commands run against a PostgreSQL database.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `postgres_session` resource block declares the username and password to use for the session, and then the command to be run:
|
|
@@ -29,35 +31,7 @@ A full example is:
|
|
|
29
31
|
|
|
30
32
|
where `its('output') { should eq '' }` compares the results of the query against the expected result in the test
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
This InSpec audit resource has the following matchers:
|
|
35
|
-
|
|
36
|
-
### be
|
|
37
|
-
|
|
38
|
-
<%= partial "/shared/matcher_be" %>
|
|
39
|
-
|
|
40
|
-
### cmp
|
|
41
|
-
|
|
42
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
43
|
-
|
|
44
|
-
### eq
|
|
45
|
-
|
|
46
|
-
<%= partial "/shared/matcher_eq" %>
|
|
47
|
-
|
|
48
|
-
### include
|
|
49
|
-
|
|
50
|
-
<%= partial "/shared/matcher_include" %>
|
|
51
|
-
|
|
52
|
-
### match
|
|
53
|
-
|
|
54
|
-
<%= partial "/shared/matcher_match" %>
|
|
55
|
-
|
|
56
|
-
### output
|
|
57
|
-
|
|
58
|
-
The `output` matcher tests the results of the query:
|
|
59
|
-
|
|
60
|
-
its('output') { should eq(/^0/) }
|
|
34
|
+
<br>
|
|
61
35
|
|
|
62
36
|
## Examples
|
|
63
37
|
|
|
@@ -80,3 +54,15 @@ The following examples show how to use this InSpec audit resource.
|
|
|
80
54
|
AND lanname!=\'c\';', ['postgres']) do
|
|
81
55
|
its('output') { should eq '0' }
|
|
82
56
|
end
|
|
57
|
+
|
|
58
|
+
<br>
|
|
59
|
+
|
|
60
|
+
## Matchers
|
|
61
|
+
|
|
62
|
+
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/).
|
|
63
|
+
|
|
64
|
+
### output
|
|
65
|
+
|
|
66
|
+
The `output` matcher tests the results of the query:
|
|
67
|
+
|
|
68
|
+
its('output') { should eq(/^0/) }
|
|
@@ -6,6 +6,8 @@ title: About the powershell Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `powershell` InSpec audit resource to test a Powershell script on the Windows platform.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `powershell` resource block declares a Powershell script to be tested, and then compares the output of that command to the matcher in the test:
|
|
@@ -24,48 +26,7 @@ where
|
|
|
24
26
|
* `'matcher'` is one of `exit_status`, `stderr`, or `stdout`
|
|
25
27
|
* `'output'` tests the output of the command run on the system versus the output value stated in the test
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
## Matchers
|
|
29
|
-
|
|
30
|
-
This InSpec audit resource has the following matchers:
|
|
31
|
-
|
|
32
|
-
### be
|
|
33
|
-
|
|
34
|
-
<%= partial "/shared/matcher_be" %>
|
|
35
|
-
|
|
36
|
-
### cmp
|
|
37
|
-
|
|
38
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
39
|
-
|
|
40
|
-
### eq
|
|
41
|
-
|
|
42
|
-
<%= partial "/shared/matcher_eq" %>
|
|
43
|
-
|
|
44
|
-
### exit_status
|
|
45
|
-
|
|
46
|
-
The `exit_status` matcher tests the exit status for the command:
|
|
47
|
-
|
|
48
|
-
its('exit_status') { should eq 123 }
|
|
49
|
-
|
|
50
|
-
### include
|
|
51
|
-
|
|
52
|
-
<%= partial "/shared/matcher_include" %>
|
|
53
|
-
|
|
54
|
-
### match
|
|
55
|
-
|
|
56
|
-
<%= partial "/shared/matcher_match" %>
|
|
57
|
-
|
|
58
|
-
### stderr
|
|
59
|
-
|
|
60
|
-
The `stderr` matcher tests results of the command as returned in standard error (stderr):
|
|
61
|
-
|
|
62
|
-
its('stderr') { should eq 'error' }
|
|
63
|
-
|
|
64
|
-
### stdout
|
|
65
|
-
|
|
66
|
-
The `stdout` matcher tests results of the command as returned in standard output (stdout):
|
|
67
|
-
|
|
68
|
-
its('stdout') { should eq '/^1$/' }
|
|
29
|
+
<br>
|
|
69
30
|
|
|
70
31
|
## Examples
|
|
71
32
|
|
|
@@ -114,3 +75,27 @@ No newline:
|
|
|
114
75
|
its('stdout') { should eq 'hello' }
|
|
115
76
|
its('stderr') { should eq '' }
|
|
116
77
|
end
|
|
78
|
+
|
|
79
|
+
<br>
|
|
80
|
+
|
|
81
|
+
## Matchers
|
|
82
|
+
|
|
83
|
+
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/).
|
|
84
|
+
|
|
85
|
+
### exit_status
|
|
86
|
+
|
|
87
|
+
The `exit_status` matcher tests the exit status for the command:
|
|
88
|
+
|
|
89
|
+
its('exit_status') { should eq 123 }
|
|
90
|
+
|
|
91
|
+
### stderr
|
|
92
|
+
|
|
93
|
+
The `stderr` matcher tests results of the command as returned in standard error (stderr):
|
|
94
|
+
|
|
95
|
+
its('stderr') { should eq 'error' }
|
|
96
|
+
|
|
97
|
+
### stdout
|
|
98
|
+
|
|
99
|
+
The `stdout` matcher tests results of the command as returned in standard output (stdout):
|
|
100
|
+
|
|
101
|
+
its('stdout') { should eq '/^1$/' }
|
|
@@ -6,6 +6,8 @@ title: About the processes Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `processes` InSpec audit resource to test properties for programs that are running on the system.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `processes` resource block declares the name of the process to be tested, and then declares one (or more) property/value pairs:
|
|
@@ -16,39 +18,10 @@ A `processes` resource block declares the name of the process to be tested, and
|
|
|
16
18
|
|
|
17
19
|
where
|
|
18
20
|
|
|
19
|
-
* `processes('process_name')` specifies the name of a process to check. If this is a string, it will be converted to a Regexp. For more specificity, pass a Regexp directly.
|
|
21
|
+
* `processes('process_name')` specifies the name of a process to check. If this is a string, it will be converted to a Regexp. For more specificity, pass a Regexp directly. If left blank, all processes will be returned.
|
|
20
22
|
* `property_name` may be used to test user (`its('users')`) and state properties (`its('states')`)
|
|
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" %>
|
|
46
|
-
|
|
47
|
-
### property_name
|
|
48
|
-
|
|
49
|
-
The `property_name` matcher tests the named property for the specified value:
|
|
50
|
-
|
|
51
|
-
its('property_name') { should eq ['property_value'] }
|
|
24
|
+
<br>
|
|
52
25
|
|
|
53
26
|
## Examples
|
|
54
27
|
|
|
@@ -100,9 +73,9 @@ needed.
|
|
|
100
73
|
### Notes for auditing Windows systems
|
|
101
74
|
|
|
102
75
|
Sometimes with system properties there isn't a direct comparison between different operating systems.
|
|
103
|
-
Most of the `property_name`'s do align between the different OS's.
|
|
76
|
+
Most of the `property_name`'s do align between the different OS's.
|
|
104
77
|
|
|
105
|
-
There are however some exception's, for example, within linux `states` offers multiple properties.
|
|
78
|
+
There are however some exception's, for example, within linux `states` offers multiple properties.
|
|
106
79
|
Windows doesn't have direct comparison that is a single property so instead `states` is mapped to the property of `Responding`, This is a boolean true/false flag to help determine if the process is hung.
|
|
107
80
|
|
|
108
81
|
Below is a mapping table to help you understand what property the unix field maps to the windows `Get-Process` Property
|
|
@@ -121,3 +94,14 @@ Below is a mapping table to help you understand what property the unix field map
|
|
|
121
94
|
|time |TotalProcessorTime|
|
|
122
95
|
|users |UserName|
|
|
123
96
|
|commands |Path|
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
## Matchers
|
|
100
|
+
|
|
101
|
+
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/).
|
|
102
|
+
|
|
103
|
+
### property_name
|
|
104
|
+
|
|
105
|
+
The `property_name` matcher tests the named property for the specified value:
|
|
106
|
+
|
|
107
|
+
its('property_name') { should eq ['property_value'] }
|
|
@@ -6,6 +6,8 @@ title: About the rabbitmq_config Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `rabbitmq_config` InSpec audit resource to test configuration data for the RabbitMQ daemon located at `/etc/rabbitmq/rabbitmq.config` on Linux and Unix platforms.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `rabbitmq_config` resource block declares the RabbitMQ configuration data to be tested:
|
|
@@ -19,30 +21,7 @@ where
|
|
|
19
21
|
* `params` is the list of parameters configured in the RabbitMQ config file
|
|
20
22
|
* `{ should cmp 5671 }` tests the value of `rabbit.ssl_listeners` as read from `rabbitmq.config` versus the value declared in the test
|
|
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
|
|
|
@@ -53,3 +32,9 @@ The following examples show how to use this InSpec audit resource.
|
|
|
53
32
|
describe rabbitmq_config.params('rabbit', 'tcp_listeners') do
|
|
54
33
|
it { should eq [5672] }
|
|
55
34
|
end
|
|
35
|
+
|
|
36
|
+
<br>
|
|
37
|
+
|
|
38
|
+
## Matchers
|
|
39
|
+
|
|
40
|
+
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|