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 mysql_conf Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `mysql_conf` InSpec audit resource to test the contents of the configuration file for MySQL, typically located at `/etc/mysql/my.cnf` or `/etc/my.cnf`.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `mysql_conf` resource block declares one (or more) settings in the `my.cnf` file, and then compares the setting in the configuration file to the value stated in the test:
|
|
@@ -14,44 +16,24 @@ A `mysql_conf` resource block declares one (or more) settings in the `my.cnf` fi
|
|
|
14
16
|
its('setting') { should eq 'value' }
|
|
15
17
|
end
|
|
16
18
|
|
|
19
|
+
# Test a parameter set within the [mysqld] section
|
|
20
|
+
describe mysql_conf do
|
|
21
|
+
its('mysqld.port') { should cmp 3306 }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Test a parameter set within the [mariadb] section using array notation
|
|
25
|
+
describe mysql_conf do
|
|
26
|
+
its(['mariadb', 'max-connections']) { should_not be_nil }
|
|
27
|
+
end
|
|
28
|
+
|
|
17
29
|
where
|
|
18
30
|
|
|
19
31
|
* `'setting'` specifies a setting in the `my.cnf` file, such as `max_connections`
|
|
32
|
+
* when checking a setting within sections, such as `[mysqld]`, the section name must be included
|
|
20
33
|
* `('path')` is the non-default path to the `my.cnf` file
|
|
21
34
|
* `should eq 'value'` is the value that is expected
|
|
22
35
|
|
|
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
|
-
### match
|
|
45
|
-
|
|
46
|
-
<%= partial "/shared/matcher_match" %>
|
|
47
|
-
|
|
48
|
-
### setting
|
|
49
|
-
|
|
50
|
-
The `setting` matcher tests specific, named settings in the `my.cnf` file:
|
|
51
|
-
|
|
52
|
-
its('setting') { should eq 'value' }
|
|
53
|
-
|
|
54
|
-
Use a `setting` matcher for each setting to be tested.
|
|
36
|
+
<br>
|
|
55
37
|
|
|
56
38
|
## Examples
|
|
57
39
|
|
|
@@ -100,3 +82,17 @@ The following examples show how to use this InSpec audit resource.
|
|
|
100
82
|
describe mysql_conf.params('mysqld') do
|
|
101
83
|
its('safe-user-create') { should eq('1') }
|
|
102
84
|
end
|
|
85
|
+
|
|
86
|
+
<br>
|
|
87
|
+
|
|
88
|
+
## Matchers
|
|
89
|
+
|
|
90
|
+
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/).
|
|
91
|
+
|
|
92
|
+
### setting
|
|
93
|
+
|
|
94
|
+
The `setting` matcher tests specific, named settings in the `my.cnf` file:
|
|
95
|
+
|
|
96
|
+
its('setting') { should eq 'value' }
|
|
97
|
+
|
|
98
|
+
Use a `setting` matcher for each setting to be tested.
|
|
@@ -6,6 +6,8 @@ title: About the mysql_session Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `mysql_session` InSpec audit resource to test SQL commands run against a MySQL database.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `mysql_session` resource block declares the username and password to use for the session, and then the command to be run:
|
|
@@ -20,35 +22,7 @@ where
|
|
|
20
22
|
* `query('QUERY')` contains the query to be run
|
|
21
23
|
* `its('output') { should eq('') }` compares the results of the query against the expected result in the test
|
|
22
24
|
|
|
23
|
-
|
|
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
|
-
### output
|
|
48
|
-
|
|
49
|
-
The `output` matcher tests the results of the query:
|
|
50
|
-
|
|
51
|
-
its('output') { should eq(/^0/) }
|
|
25
|
+
<br>
|
|
52
26
|
|
|
53
27
|
## Examples
|
|
54
28
|
|
|
@@ -73,3 +47,15 @@ The following examples show how to use this InSpec audit resource.
|
|
|
73
47
|
### Alternate Connection: Using a socket
|
|
74
48
|
|
|
75
49
|
sql = mysql_session('my_user','password', nil, nil, '/var/lib/mysql-default/mysqld.sock')
|
|
50
|
+
|
|
51
|
+
<br>
|
|
52
|
+
|
|
53
|
+
## Matchers
|
|
54
|
+
|
|
55
|
+
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/).
|
|
56
|
+
|
|
57
|
+
### output
|
|
58
|
+
|
|
59
|
+
The `output` matcher tests the results of the query:
|
|
60
|
+
|
|
61
|
+
its('output') { should eq(/^0/) }
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The Nginx Resource
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# nginx
|
|
6
|
+
|
|
7
|
+
Use the `nginx` InSpec audit resource to test the fields and validity of nginx.
|
|
8
|
+
|
|
9
|
+
Nginx resource extracts and exposes data reported by the command 'nginx -V'
|
|
10
|
+
|
|
11
|
+
<br>
|
|
12
|
+
|
|
13
|
+
## Syntax
|
|
14
|
+
|
|
15
|
+
An `nginx` InSpec audit resource block extracts configuration settings that should be tested:
|
|
16
|
+
|
|
17
|
+
describe nginx do
|
|
18
|
+
its('attribute') { should eq 'value' }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe nginx('path to nginx') do
|
|
22
|
+
its('attribute') { should eq 'value' }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
where
|
|
26
|
+
|
|
27
|
+
* `'attribute'` is a configuration parsed from result of the command 'nginx -V'
|
|
28
|
+
* `'value'` is the value that is expected of the attribute
|
|
29
|
+
|
|
30
|
+
<br>
|
|
31
|
+
|
|
32
|
+
## Supported Properties
|
|
33
|
+
|
|
34
|
+
* 'compiler_info', 'error_log_path', 'http_client_body_temp_path', 'http_fastcgi_temp_path', 'http_log_path', 'http_proxy_temp_path', 'http_scgi_temp_path', 'http_uwsgi_temp_path', 'lock_path', 'modules', 'modules_path', 'openssl_version', 'prefix', 'sbin_path', 'service', 'support_info', 'version'
|
|
35
|
+
|
|
36
|
+
<br>
|
|
37
|
+
|
|
38
|
+
## Property Examples and Return Types
|
|
39
|
+
|
|
40
|
+
### version(String)
|
|
41
|
+
|
|
42
|
+
`version` returns a string of the version of the running nginx instance
|
|
43
|
+
|
|
44
|
+
describe nginx do
|
|
45
|
+
its('version') { should eq '1.12.0' }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
### modules(String)
|
|
49
|
+
|
|
50
|
+
`modules` returns a array modules in the running nginx instance
|
|
51
|
+
|
|
52
|
+
describe nginx do
|
|
53
|
+
its('modules') { should include 'my_module' }
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
### openssl_version(Hash)
|
|
57
|
+
|
|
58
|
+
`openssl_version ` returns a hash with 'version' and 'date' as keys
|
|
59
|
+
|
|
60
|
+
describe nginx do
|
|
61
|
+
its('openssl_version.date') { should eq '11 Feb 2013' }
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
### compiler_info(Hash)
|
|
65
|
+
|
|
66
|
+
`compiler_info ` returns a hash with 'compiler' , version' and 'date' as keys
|
|
67
|
+
|
|
68
|
+
describe nginx do
|
|
69
|
+
its('compiler_info.compiler') { should eq 'gcc' }
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
### support_info(String)
|
|
73
|
+
|
|
74
|
+
`support_info ` returns a string containing supported protocols
|
|
75
|
+
|
|
76
|
+
describe nginx do
|
|
77
|
+
its('support_info') { should match /TLS/ }
|
|
78
|
+
end
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: About the nginx_conf Resource
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# nginx_conf
|
|
6
|
+
|
|
7
|
+
Use the `nginx_conf` InSpec resource to test configuration data for the NGINX server located at `/etc/nginx/nginx.conf` on Linux and Unix platforms.
|
|
8
|
+
|
|
9
|
+
**Stability: Experimental**
|
|
10
|
+
|
|
11
|
+
<br>
|
|
12
|
+
|
|
13
|
+
## Syntax
|
|
14
|
+
|
|
15
|
+
An `nginx_conf` resource block declares the client NGINX configuration data to be tested:
|
|
16
|
+
|
|
17
|
+
describe nginx_conf.params['pid'] do
|
|
18
|
+
it { should cmp 'logs/nginx.pid' }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
where
|
|
22
|
+
|
|
23
|
+
* `nginx_conf` is the resource to reference your NGINX configuration
|
|
24
|
+
* `params` accesses all its parameters
|
|
25
|
+
* `params['pid']` selects the `pid` entry from the global NGINX configuration
|
|
26
|
+
* `{ should cmp 'logs/nginx.pid' }` tests if the PID is set to `logs/nginx.pid` (via `cmp` matcher)
|
|
27
|
+
|
|
28
|
+
<br>
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
The following examples show how to use this InSpec audit resource.
|
|
33
|
+
|
|
34
|
+
### Find a specific server
|
|
35
|
+
|
|
36
|
+
servers = nginx_conf.servers
|
|
37
|
+
domain2 = servers.find { |s| s.params['server_name'].flatten.include? 'domain2.com' }
|
|
38
|
+
describe 'No server serves domain2' do
|
|
39
|
+
subject { domain2 }
|
|
40
|
+
it { should be_nil }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
### Test a raw parameter
|
|
44
|
+
|
|
45
|
+
describe nginx_conf.params['worker_processes'].flatten do
|
|
46
|
+
it { should cmp 5 }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
<br>
|
|
50
|
+
|
|
51
|
+
## Matchers
|
|
52
|
+
|
|
53
|
+
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/).
|
|
54
|
+
|
|
55
|
+
### http
|
|
56
|
+
|
|
57
|
+
Retrieves all `http` entries in the configuration file.
|
|
58
|
+
|
|
59
|
+
nginx_conf.http
|
|
60
|
+
=> nginx_conf /etc/nginx/nginx.conf, http entries
|
|
61
|
+
|
|
62
|
+
It provides further access to all individual entries, servers, and locations.
|
|
63
|
+
|
|
64
|
+
nginx_conf.http.entries
|
|
65
|
+
=> [nginx_conf /etc/nginx/nginx.conf, http entry ...]
|
|
66
|
+
|
|
67
|
+
nginx_conf.http.servers
|
|
68
|
+
=> [nginx_conf /etc/nginx/nginx.conf, server entry ...]
|
|
69
|
+
|
|
70
|
+
nginx_conf.http.locations
|
|
71
|
+
=> [nginx_conf /etc/nginx/nginx.conf, location entry ...]
|
|
72
|
+
|
|
73
|
+
You can access each of these from the array and inspect it further (see below).
|
|
74
|
+
|
|
75
|
+
### servers
|
|
76
|
+
|
|
77
|
+
Retrieve all `servers` entries in the configuration:
|
|
78
|
+
|
|
79
|
+
# all servers across all configs aggregated:
|
|
80
|
+
nginx_conf.servers
|
|
81
|
+
=> [nginx_conf /etc/nginx/nginx.conf, server entry ...]
|
|
82
|
+
|
|
83
|
+
# servers that belong to a specific http entry:
|
|
84
|
+
nginx_conf.http.entries[0].servers
|
|
85
|
+
=> [nginx_conf /etc/nginx/nginx.conf, server entry ...]
|
|
86
|
+
|
|
87
|
+
Servers provide access to all their locations, parent http entry, and raw parameters:
|
|
88
|
+
|
|
89
|
+
server = nginx_conf.servers[0]
|
|
90
|
+
|
|
91
|
+
server.locations
|
|
92
|
+
=> [nginx_conf /etc/nginx/nginx.conf, location entry ...]
|
|
93
|
+
|
|
94
|
+
server.parent
|
|
95
|
+
=> nginx_conf /etc/nginx/nginx.conf, http entry
|
|
96
|
+
|
|
97
|
+
server.params
|
|
98
|
+
=> {"listen"=>[["85"]],
|
|
99
|
+
"server_name"=>[["domain1.com", "www.domain1.com"]],
|
|
100
|
+
"root"=>[["html"]],
|
|
101
|
+
"location"=>[{"_"=>["~", "\\.php$"], "fastcgi_pass"=>[["127.0.0.1:1025"]]}]}
|
|
102
|
+
|
|
103
|
+
### locations
|
|
104
|
+
|
|
105
|
+
Retrieve all `location` entries in the configuration:
|
|
106
|
+
|
|
107
|
+
# all locations across all configs aggregated:
|
|
108
|
+
nginx_conf.locations
|
|
109
|
+
=> [nginx_conf /etc/nginx/nginx.conf, location entry ...]
|
|
110
|
+
|
|
111
|
+
# locations of a http entry aggregated:
|
|
112
|
+
nginx_conf.http.entries[0].locations
|
|
113
|
+
=> [nginx_conf /etc/nginx/nginx.conf, location entry ...]
|
|
114
|
+
|
|
115
|
+
# locations of a specific server:
|
|
116
|
+
nginx_conf.servers[0].locations
|
|
117
|
+
=> [nginx_conf /etc/nginx/nginx.conf, location entry ...]
|
|
118
|
+
|
|
119
|
+
Locations provide access to their parent server entry and raw parameters:
|
|
120
|
+
|
|
121
|
+
location = nginx_conf.locations[0]
|
|
122
|
+
|
|
123
|
+
location.parent
|
|
124
|
+
=> nginx_conf /etc/nginx/nginx.conf, server entry
|
|
125
|
+
|
|
126
|
+
location.params
|
|
127
|
+
=> {"_"=>["~", "\\.php$"], "fastcgi_pass"=>[["127.0.0.1:1025"]]}
|
data/docs/resources/npm.md.erb
CHANGED
|
@@ -6,6 +6,7 @@ title: About the npm Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `npm` InSpec audit resource to test if a global NPM package is installed. NPM is the the package manager for Node.js packages (https://docs.npmjs.com), such as Bower and StatsD.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
9
10
|
|
|
10
11
|
## Syntax
|
|
11
12
|
|
|
@@ -20,56 +21,39 @@ where
|
|
|
20
21
|
* `('npm_package_name')` must specify an NPM package, such as `'bower'` or `'statsd'`
|
|
21
22
|
* `be_installed` is a valid matcher for this resource
|
|
22
23
|
|
|
24
|
+
<br>
|
|
23
25
|
|
|
24
|
-
##
|
|
25
|
-
|
|
26
|
-
This InSpec audit resource has the following matchers:
|
|
27
|
-
|
|
28
|
-
### be
|
|
29
|
-
|
|
30
|
-
<%= partial "/shared/matcher_be" %>
|
|
26
|
+
## Examples
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
The following examples show how to use this InSpec audit resource.
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
### Verify that bower is installed, with a specific version
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
describe npm('bower') do
|
|
33
|
+
it { should be_installed }
|
|
34
|
+
its('version') { should eq '1.4.1' }
|
|
35
|
+
end
|
|
37
36
|
|
|
38
|
-
###
|
|
37
|
+
### Verify that statsd is not installed
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
describe npm('statsd') do
|
|
40
|
+
it { should_not be_installed }
|
|
41
|
+
end
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
<br>
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
## Matchers
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
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/).
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
### be_installed
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
The `be_installed` matcher tests if the named Gem package and package version (if specified) is installed:
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
it { should be_installed }
|
|
53
54
|
|
|
54
55
|
### version
|
|
55
56
|
|
|
56
57
|
The `version` matcher tests if the named package version is on the system:
|
|
57
58
|
|
|
58
59
|
its('version') { should eq '1.2.3' }
|
|
59
|
-
|
|
60
|
-
## Examples
|
|
61
|
-
|
|
62
|
-
The following examples show how to use this InSpec audit resource.
|
|
63
|
-
|
|
64
|
-
### Verify that bower is installed, with a specific version
|
|
65
|
-
|
|
66
|
-
describe npm('bower') do
|
|
67
|
-
it { should be_installed }
|
|
68
|
-
its('version') { should eq '1.4.1' }
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
### Verify that statsd is not installed
|
|
72
|
-
|
|
73
|
-
describe npm('statsd') do
|
|
74
|
-
it { should_not be_installed }
|
|
75
|
-
end
|
|
@@ -6,6 +6,7 @@ title: About the ntp_conf Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `ntp_conf` InSpec audit resource to test the synchronization settings defined in the `ntp.conf` file. This file is typically located at `/etc/ntp.conf`.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
9
10
|
|
|
10
11
|
## Syntax
|
|
11
12
|
|
|
@@ -21,56 +22,38 @@ where
|
|
|
21
22
|
* `('path')` is the non-default path to the `ntp.conf` file
|
|
22
23
|
* `{ should eq 'value' }` is the value that is expected
|
|
23
24
|
|
|
25
|
+
<br>
|
|
24
26
|
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
This resource matches any service that is listed in the `ntp.conf` file:
|
|
28
|
-
|
|
29
|
-
its('server') { should_not eq nil }
|
|
30
|
-
|
|
31
|
-
or:
|
|
27
|
+
## Examples
|
|
32
28
|
|
|
33
|
-
|
|
29
|
+
The following examples show how to use this InSpec audit resource.
|
|
34
30
|
|
|
35
|
-
|
|
31
|
+
### Test for clock drift against named servers
|
|
36
32
|
|
|
37
33
|
describe ntp_conf do
|
|
38
|
-
its('
|
|
39
|
-
its('
|
|
34
|
+
its('driftfile') { should eq '/var/lib/ntp/ntp.drift' }
|
|
35
|
+
its('server') { should eq [
|
|
36
|
+
0.ubuntu.pool.ntp.org,
|
|
37
|
+
1.ubuntu.pool.ntp.org,
|
|
38
|
+
2.ubuntu.pool.ntp.org
|
|
39
|
+
] }
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
<br>
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<%= partial "/shared/matcher_be" %>
|
|
46
|
-
|
|
47
|
-
### cmp
|
|
48
|
-
|
|
49
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
50
|
-
|
|
51
|
-
### eq
|
|
52
|
-
|
|
53
|
-
<%= partial "/shared/matcher_eq" %>
|
|
54
|
-
|
|
55
|
-
### include
|
|
56
|
-
|
|
57
|
-
<%= partial "/shared/matcher_include" %>
|
|
44
|
+
## Matchers
|
|
58
45
|
|
|
59
|
-
|
|
46
|
+
This resource matches any service that is listed in the `ntp.conf` file. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
60
47
|
|
|
61
|
-
|
|
48
|
+
its('server') { should_not eq nil }
|
|
62
49
|
|
|
63
|
-
|
|
50
|
+
or:
|
|
64
51
|
|
|
65
|
-
|
|
52
|
+
its('restrict') { should include '-4 default kod notrap nomodify nopeer noquery'}
|
|
66
53
|
|
|
67
|
-
|
|
54
|
+
For example:
|
|
68
55
|
|
|
69
56
|
describe ntp_conf do
|
|
70
|
-
its('
|
|
71
|
-
its('
|
|
72
|
-
0.ubuntu.pool.ntp.org,
|
|
73
|
-
1.ubuntu.pool.ntp.org,
|
|
74
|
-
2.ubuntu.pool.ntp.org
|
|
75
|
-
] }
|
|
57
|
+
its('server') { should_not eq nil }
|
|
58
|
+
its('restrict') { should include '-4 default kod notrap nomodify nopeer noquery'}
|
|
76
59
|
end
|
|
@@ -6,6 +6,8 @@ title: About the oneget Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `oneget` InSpec audit resource to test if the named package and/or package version is installed on the system. This resource uses Oneget, which is `part of the Windows Management Framework 5.0 and Windows 10 <https://github.com/OneGet/oneget>`__. This resource uses the `Get-Package` cmdlet to return all of the package names in the Oneget repository.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `oneget` resource block declares a package and (optionally) a package version:
|
|
@@ -19,49 +21,32 @@ where
|
|
|
19
21
|
* `('name')` must specify the name of a package, such as `'VLC'`
|
|
20
22
|
* `be_installed` is a valid matcher for this resource
|
|
21
23
|
|
|
24
|
+
<br>
|
|
22
25
|
|
|
23
|
-
##
|
|
24
|
-
|
|
25
|
-
This InSpec audit resource has the following matchers:
|
|
26
|
-
|
|
27
|
-
### be
|
|
28
|
-
|
|
29
|
-
<%= partial "/shared/matcher_be" %>
|
|
30
|
-
|
|
31
|
-
### be_installed
|
|
32
|
-
|
|
33
|
-
The `be_installed` matcher tests if the named package is installed on the system:
|
|
26
|
+
## Examples
|
|
34
27
|
|
|
35
|
-
|
|
28
|
+
The following examples show how to use this InSpec audit resource.
|
|
36
29
|
|
|
37
|
-
###
|
|
30
|
+
### Test if VLC is installed
|
|
38
31
|
|
|
39
|
-
|
|
32
|
+
describe oneget('VLC') do
|
|
33
|
+
it { should be_installed }
|
|
34
|
+
end
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
<br>
|
|
42
37
|
|
|
43
|
-
|
|
38
|
+
## Matchers
|
|
44
39
|
|
|
45
|
-
|
|
40
|
+
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/).
|
|
46
41
|
|
|
47
|
-
|
|
42
|
+
### be_installed
|
|
48
43
|
|
|
49
|
-
|
|
44
|
+
The `be_installed` matcher tests if the named package is installed on the system:
|
|
50
45
|
|
|
51
|
-
|
|
46
|
+
it { should be_installed }
|
|
52
47
|
|
|
53
48
|
### version
|
|
54
49
|
|
|
55
50
|
The `version` matcher tests if the named package version is on the system:
|
|
56
51
|
|
|
57
52
|
its('version') { should eq '1.2.3' }
|
|
58
|
-
|
|
59
|
-
## Examples
|
|
60
|
-
|
|
61
|
-
The following examples show how to use this InSpec audit resource.
|
|
62
|
-
|
|
63
|
-
### Test if VLC is installed
|
|
64
|
-
|
|
65
|
-
describe oneget('VLC') do
|
|
66
|
-
it { should be_installed }
|
|
67
|
-
end
|
|
@@ -6,6 +6,8 @@ title: About the oracledb_session Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `oracledb_session` InSpec audit resource to test SQL commands run against a Oracle database.
|
|
8
8
|
|
|
9
|
+
<br>
|
|
10
|
+
|
|
9
11
|
## Syntax
|
|
10
12
|
|
|
11
13
|
A `oracledb_session` resource block declares the username and password to use for the session with an optional service to connect to, and then the command to be run:
|
|
@@ -20,17 +22,7 @@ where
|
|
|
20
22
|
* `query('QUERY')` contains the query to be run
|
|
21
23
|
* `its('value') { should eq('') }` compares the results of the query against the expected result in the test
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
This InSpec audit resource has the following matchers:
|
|
26
|
-
|
|
27
|
-
### cmp
|
|
28
|
-
|
|
29
|
-
<%= partial "/shared/matcher_cmp" %>
|
|
30
|
-
|
|
31
|
-
### eq
|
|
32
|
-
|
|
33
|
-
<%= partial "/shared/matcher_eq" %>
|
|
25
|
+
<br>
|
|
34
26
|
|
|
35
27
|
## Examples
|
|
36
28
|
|
|
@@ -51,3 +43,9 @@ The following examples show how to use this InSpec audit resource.
|
|
|
51
43
|
describe sql.query('SELECT NAME FROM v$database;').row(0).column('name') do
|
|
52
44
|
its('value') { should cmp 'ORCL' }
|
|
53
45
|
end
|
|
46
|
+
|
|
47
|
+
<br>
|
|
48
|
+
|
|
49
|
+
## Matchers
|
|
50
|
+
|
|
51
|
+
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|