inspec 1.0.0 → 1.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +933 -101
- data/Gemfile +8 -17
- data/MAINTAINERS.md +2 -1
- data/MAINTAINERS.toml +9 -4
- data/README.md +49 -28
- data/Rakefile +54 -39
- data/bin/inspec +1 -1
- data/docs/dsl_inspec.md +17 -4
- data/docs/dsl_resource.md +1 -1
- data/docs/habitat.md +192 -0
- data/docs/inspec_and_friends.md +4 -2
- data/docs/matchers.md +11 -0
- data/docs/migration.md +293 -0
- data/docs/profiles.md +124 -76
- data/docs/resources/aide_conf.md.erb +81 -0
- data/docs/resources/apache_conf.md.erb +10 -10
- data/docs/resources/apt.md.erb +13 -13
- data/docs/resources/audit_policy.md.erb +10 -10
- data/docs/resources/auditd_conf.md.erb +10 -10
- data/docs/resources/auditd_rules.md.erb +11 -11
- data/docs/resources/bash.md.erb +12 -12
- data/docs/resources/bond.md.erb +15 -15
- data/docs/resources/bridge.md.erb +11 -11
- data/docs/resources/bsd_service.md.erb +11 -11
- data/docs/resources/command.md.erb +23 -23
- data/docs/resources/crontab.md.erb +84 -0
- data/docs/resources/csv.md.erb +10 -10
- data/docs/resources/dh_params.md +191 -0
- data/docs/resources/directory.md.erb +8 -8
- data/docs/resources/docker.md.erb +160 -0
- data/docs/resources/docker_container.md.erb +89 -0
- data/docs/resources/docker_image.md.erb +86 -0
- data/docs/resources/etc_group.md.erb +16 -16
- data/docs/resources/etc_hosts.md.erb +62 -0
- data/docs/resources/file.md.erb +80 -58
- data/docs/resources/gem.md.erb +32 -13
- data/docs/resources/group.md.erb +12 -12
- data/docs/resources/grub_conf.md.erb +11 -11
- data/docs/resources/host.md.erb +27 -18
- data/docs/resources/http.md.erb +104 -0
- data/docs/resources/iis_app.md.erb +126 -0
- data/docs/resources/iis_site.md.erb +17 -17
- data/docs/resources/inetd_conf.md.erb +10 -10
- data/docs/resources/ini.md.erb +9 -9
- data/docs/resources/interface.md.erb +13 -13
- data/docs/resources/iptables.md.erb +21 -14
- data/docs/resources/json.md.erb +11 -11
- data/docs/resources/kernel_module.md.erb +73 -12
- data/docs/resources/kernel_parameter.md.erb +12 -12
- data/docs/resources/key_rsa.md.erb +70 -0
- data/docs/resources/launchd_service.md.erb +11 -11
- data/docs/resources/limits_conf.md.erb +10 -10
- data/docs/resources/login_def.md.erb +12 -12
- data/docs/resources/mount.md.erb +14 -14
- data/docs/resources/mssql_session.md.erb +62 -0
- data/docs/resources/mysql_conf.md.erb +14 -14
- data/docs/resources/mysql_session.md.erb +22 -10
- data/docs/resources/npm.md.erb +13 -13
- data/docs/resources/ntp_conf.md.erb +9 -9
- data/docs/resources/oneget.md.erb +11 -11
- data/docs/resources/oracledb_session.md.erb +53 -0
- data/docs/resources/os.md.erb +17 -17
- data/docs/resources/os_env.md.erb +12 -12
- data/docs/resources/package.md.erb +29 -16
- data/docs/resources/parse_config.md.erb +18 -18
- data/docs/resources/parse_config_file.md.erb +29 -23
- data/docs/resources/{etc_passwd.md.erb → passwd.md.erb} +17 -17
- data/docs/resources/pip.md.erb +15 -15
- data/docs/resources/port.md.erb +23 -23
- data/docs/resources/postgres_conf.md.erb +15 -13
- data/docs/resources/postgres_hba_conf.md.erb +104 -0
- data/docs/resources/postgres_ident_conf.md.erb +87 -0
- data/docs/resources/postgres_session.md.erb +28 -21
- data/docs/resources/powershell.md.erb +14 -14
- data/docs/resources/processes.md.erb +123 -0
- data/docs/resources/rabbitmq_config.md.erb +55 -0
- data/docs/resources/registry_key.md.erb +44 -21
- data/docs/resources/runit_service.md.erb +11 -11
- data/docs/resources/security_policy.md.erb +10 -10
- data/docs/resources/service.md.erb +18 -18
- data/docs/resources/{etc_shadow.md.erb → shadow.md.erb} +19 -19
- data/docs/resources/ssh_config.md.erb +13 -13
- data/docs/resources/sshd_config.md.erb +15 -15
- data/docs/resources/ssl.md.erb +13 -13
- data/docs/resources/sys_info.md.erb +10 -10
- data/docs/resources/systemd_service.md.erb +11 -11
- data/docs/resources/sysv_service.md.erb +11 -11
- data/docs/resources/upstart_service.md.erb +11 -11
- data/docs/resources/user.md.erb +20 -20
- data/docs/resources/users.md.erb +19 -19
- data/docs/resources/vbscript.md.erb +13 -13
- data/docs/resources/virtualization.md.erb +71 -0
- data/docs/resources/windows_feature.md.erb +10 -10
- data/docs/resources/windows_task.md.erb +103 -0
- data/docs/resources/wmi.md.erb +10 -10
- data/docs/resources/x509_certificate.md.erb +146 -0
- data/docs/resources/xinetd_conf.md.erb +17 -17
- data/docs/resources/xml.md.erb +75 -0
- data/docs/resources/yaml.md.erb +25 -11
- data/docs/resources/yum.md.erb +24 -16
- data/docs/resources/zfs_dataset.md.erb +63 -0
- data/docs/resources/zfs_pool.md.erb +57 -0
- data/docs/ruby_usage.md +50 -0
- data/docs/shared/matcher_cmp.md.erb +4 -6
- data/examples/inheritance/README.md +49 -3
- data/examples/inheritance/controls/example.rb +4 -1
- data/examples/inheritance/inspec.yml +3 -1
- data/examples/meta-profile/README.md +29 -3
- data/examples/meta-profile/controls/example.rb +10 -5
- data/examples/meta-profile/inspec.yml +4 -8
- data/examples/profile/README.md +1 -1
- data/examples/profile/controls/example.rb +0 -1
- data/examples/profile/controls/gordon.rb +0 -1
- data/examples/profile/inspec.yml +1 -1
- data/examples/profile-attribute/inspec.yml +1 -1
- data/examples/profile-sensitive/README.md +29 -0
- data/examples/profile-sensitive/controls/sensitive-failures.rb +9 -0
- data/examples/profile-sensitive/controls/sensitive.rb +9 -0
- data/examples/profile-sensitive/inspec.yml +8 -0
- data/inspec.gemspec +10 -2
- data/lib/bundles/inspec-artifact/README.md +1 -0
- data/lib/bundles/inspec-artifact/cli.rb +284 -0
- data/lib/bundles/inspec-artifact.rb +7 -0
- data/lib/bundles/inspec-compliance/README.md +44 -15
- data/lib/bundles/inspec-compliance/api.rb +135 -29
- data/lib/bundles/inspec-compliance/cli.rb +128 -21
- data/lib/bundles/inspec-compliance/configuration.rb +8 -0
- data/lib/bundles/inspec-compliance/http.rb +26 -19
- data/lib/bundles/inspec-compliance/target.rb +50 -25
- data/lib/bundles/inspec-habitat/cli.rb +31 -0
- data/lib/bundles/inspec-habitat/log.rb +10 -0
- data/lib/bundles/inspec-habitat/profile.rb +372 -0
- data/lib/bundles/inspec-habitat.rb +12 -0
- data/lib/bundles/inspec-init/templates/profile/controls/example.rb +0 -1
- data/lib/bundles/inspec-init/templates/profile/inspec.yml +1 -1
- data/lib/bundles/inspec-supermarket/api.rb +7 -5
- data/lib/bundles/inspec-supermarket/cli.rb +2 -2
- data/lib/fetchers/git.rb +4 -2
- data/lib/fetchers/local.rb +4 -1
- data/lib/fetchers/url.rb +64 -10
- data/lib/inspec/archive/tar.rb +1 -1
- data/lib/inspec/backend.rb +26 -3
- data/lib/inspec/base_cli.rb +44 -7
- data/lib/inspec/cached_fetcher.rb +2 -2
- data/lib/inspec/cli.rb +34 -12
- data/lib/inspec/completions/fish.sh.erb +34 -0
- data/lib/inspec/control_eval_context.rb +0 -2
- data/lib/inspec/dependencies/cache.rb +0 -1
- data/lib/inspec/dependencies/dependency_set.rb +2 -2
- data/lib/inspec/dependencies/lockfile.rb +13 -6
- data/lib/inspec/dependencies/requirement.rb +6 -6
- data/lib/inspec/dependencies/resolver.rb +4 -4
- data/lib/inspec/dsl.rb +3 -5
- data/lib/inspec/env_printer.rb +9 -1
- data/lib/inspec/exceptions.rb +8 -0
- data/lib/inspec/fetcher.rb +1 -1
- data/lib/inspec/file_provider.rb +47 -11
- data/lib/inspec/library_eval_context.rb +1 -1
- data/lib/inspec/metadata.rb +62 -18
- data/lib/inspec/method_source.rb +24 -0
- data/lib/inspec/objects/attribute.rb +21 -0
- data/lib/inspec/objects/control.rb +21 -3
- data/lib/inspec/objects/each_loop.rb +2 -1
- data/lib/inspec/objects/list.rb +1 -1
- data/lib/inspec/objects/or_test.rb +17 -2
- data/lib/inspec/objects/tag.rb +27 -0
- data/lib/inspec/objects/test.rb +9 -8
- data/lib/inspec/objects.rb +1 -0
- data/lib/inspec/plugins/fetcher.rb +4 -5
- data/lib/inspec/plugins/resource.rb +1 -2
- data/lib/inspec/plugins/source_reader.rb +3 -3
- data/lib/inspec/plugins.rb +1 -1
- data/lib/inspec/polyfill.rb +0 -1
- data/lib/inspec/profile.rb +92 -23
- data/lib/inspec/profile_context.rb +1 -1
- data/lib/inspec/profile_vendor.rb +66 -0
- data/lib/inspec/resource.rb +29 -3
- data/lib/inspec/rspec_json_formatter.rb +672 -285
- data/lib/inspec/rule.rb +12 -16
- data/lib/inspec/runner.rb +26 -15
- data/lib/inspec/runner_rspec.rb +1 -0
- data/lib/inspec/runtime_profile.rb +26 -0
- data/lib/inspec/schema.rb +185 -0
- data/lib/inspec/secrets/yaml.rb +8 -1
- data/lib/inspec/secrets.rb +1 -1
- data/lib/inspec/shell.rb +92 -22
- data/lib/inspec/source_reader.rb +1 -1
- data/lib/inspec/version.rb +1 -1
- data/lib/inspec.rb +1 -1
- data/lib/matchers/matchers.rb +67 -17
- data/lib/resources/aide_conf.rb +162 -0
- data/lib/resources/apache.rb +0 -1
- data/lib/resources/apache_conf.rb +3 -3
- data/lib/resources/apt.rb +2 -1
- data/lib/resources/audit_policy.rb +0 -1
- data/lib/resources/auditd_conf.rb +1 -2
- data/lib/resources/auditd_rules.rb +5 -5
- data/lib/resources/bond.rb +1 -1
- data/lib/resources/bridge.rb +1 -1
- data/lib/resources/command.rb +5 -3
- data/lib/resources/crontab.rb +102 -0
- data/lib/resources/csv.rb +18 -1
- data/lib/resources/dh_params.rb +84 -0
- data/lib/resources/directory.rb +7 -3
- data/lib/resources/docker.rb +198 -0
- data/lib/resources/docker_container.rb +114 -0
- data/lib/resources/docker_image.rb +96 -0
- data/lib/resources/etc_group.rb +2 -3
- data/lib/resources/etc_hosts.rb +81 -0
- data/lib/resources/file.rb +88 -30
- data/lib/resources/gem.rb +26 -6
- data/lib/resources/groups.rb +4 -5
- data/lib/resources/grub_conf.rb +3 -4
- data/lib/resources/host.rb +175 -35
- data/lib/resources/http.rb +73 -0
- data/lib/resources/iis_app.rb +103 -0
- data/lib/resources/iis_site.rb +23 -0
- data/lib/resources/inetd_conf.rb +9 -4
- data/lib/resources/interface.rb +4 -3
- data/lib/resources/json.rb +37 -14
- data/lib/resources/kernel_module.rb +77 -10
- data/lib/resources/kernel_parameter.rb +0 -1
- data/lib/resources/key_rsa.rb +67 -0
- data/lib/resources/limits_conf.rb +3 -4
- data/lib/resources/login_def.rb +2 -3
- data/lib/resources/mount.rb +34 -4
- data/lib/resources/mssql_session.rb +81 -12
- data/lib/resources/mysql.rb +0 -1
- data/lib/resources/mysql_conf.rb +1 -2
- data/lib/resources/mysql_session.rb +18 -7
- data/lib/resources/nginx_conf.rb +95 -0
- data/lib/resources/ntp_conf.rb +2 -3
- data/lib/resources/oracledb_session.rb +138 -0
- data/lib/resources/os_env.rb +7 -5
- data/lib/resources/package.rb +70 -13
- data/lib/resources/packages.rb +111 -0
- data/lib/resources/parse_config.rb +3 -4
- data/lib/resources/passwd.rb +4 -5
- data/lib/resources/pip.rb +29 -21
- data/lib/resources/port.rb +133 -14
- data/lib/resources/postgres.rb +53 -43
- data/lib/resources/postgres_conf.rb +40 -13
- data/lib/resources/postgres_hba_conf.rb +101 -0
- data/lib/resources/postgres_ident_conf.rb +79 -0
- data/lib/resources/postgres_session.rb +28 -20
- data/lib/resources/powershell.rb +2 -2
- data/lib/resources/processes.rb +61 -26
- data/lib/resources/rabbitmq_conf.rb +53 -0
- data/lib/resources/registry_key.rb +34 -11
- data/lib/resources/security_policy.rb +2 -2
- data/lib/resources/service.rb +17 -7
- data/lib/resources/ssh_conf.rb +17 -6
- data/lib/resources/ssl.rb +3 -4
- data/lib/resources/sys_info.rb +1 -1
- data/lib/resources/toml.rb +26 -0
- data/lib/resources/users.rb +41 -41
- data/lib/resources/virtualization.rb +252 -0
- data/lib/resources/windows_task.rb +106 -0
- data/lib/resources/x509_certificate.rb +143 -0
- data/lib/resources/xinetd.rb +18 -2
- data/lib/resources/xml.rb +27 -0
- data/lib/resources/yaml.rb +10 -2
- data/lib/resources/yum.rb +25 -7
- data/lib/resources/zfs_dataset.rb +60 -0
- data/lib/resources/zfs_pool.rb +49 -0
- data/lib/source_readers/flat.rb +2 -1
- data/lib/source_readers/inspec.rb +30 -11
- data/lib/utils/command_wrapper.rb +3 -3
- data/lib/utils/database_helpers.rb +77 -0
- data/lib/utils/erlang_parser.rb +192 -0
- data/lib/utils/filter.rb +2 -1
- data/lib/utils/filter_array.rb +0 -1
- data/lib/utils/find_files.rb +1 -2
- data/lib/utils/latest_version.rb +21 -0
- data/lib/utils/nginx_parser.rb +76 -0
- data/lib/utils/object_traversal.rb +5 -4
- data/lib/utils/parser.rb +23 -4
- data/lib/utils/plugin_registry.rb +3 -3
- data/lib/utils/simpleconfig.rb +25 -8
- data/lib/utils/spdx.rb +13 -0
- data/lib/utils/spdx.txt +344 -0
- metadata +168 -22
- data/docs/cli.md +0 -342
- data/docs/resources/process.md.erb +0 -73
- /data/docs/{plugin_kitchen_inspec.html.md → plugin_kitchen_inspec.md} +0 -0
data/docs/resources/mount.md.erb
CHANGED
|
@@ -4,9 +4,9 @@ title: About the mount Resource
|
|
|
4
4
|
|
|
5
5
|
# mount
|
|
6
6
|
|
|
7
|
-
Use the `mount` InSpec audit resource to test the mount points on Linux systems.
|
|
7
|
+
Use the `mount` InSpec audit resource to test the mount points on FreeBSD and Linux systems.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
An `mount` resource block declares the synchronization settings that should be tested:
|
|
12
12
|
|
|
@@ -21,59 +21,59 @@ where
|
|
|
21
21
|
* `'value'` is the value to be tested
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
## Matchers
|
|
25
25
|
|
|
26
26
|
This InSpec audit resource has the following matchers:
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
### be
|
|
29
29
|
|
|
30
30
|
<%= partial "/shared/matcher_be" %>
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
### be_mounted
|
|
33
33
|
|
|
34
34
|
The `be_mounted` matcher tests if the file is accessible from the file system:
|
|
35
35
|
|
|
36
36
|
it { should be_mounted }
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
### cmp
|
|
39
39
|
|
|
40
40
|
<%= partial "/shared/matcher_cmp" %>
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
### device
|
|
43
43
|
|
|
44
44
|
The `device` matcher tests the device from the `fstab` table:
|
|
45
45
|
|
|
46
46
|
its('device') { should eq '/dev/mapper/VolGroup-lv_root' }
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
### eq
|
|
49
49
|
|
|
50
50
|
<%= partial "/shared/matcher_eq" %>
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
### include
|
|
53
53
|
|
|
54
54
|
<%= partial "/shared/matcher_include" %>
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
### match
|
|
57
57
|
|
|
58
58
|
<%= partial "/shared/matcher_match" %>
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
### options
|
|
61
61
|
|
|
62
62
|
The `options` matcher tests the mount options for the file system from the `fstab` table:
|
|
63
63
|
|
|
64
64
|
its('options') { should eq ['rw', 'mode=620'] }
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
### type
|
|
67
67
|
|
|
68
68
|
The `type` matcher tests the file system type:
|
|
69
69
|
|
|
70
70
|
its('type') { should eq 'ext4' }
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
## Examples
|
|
73
73
|
|
|
74
74
|
The following examples show how to use this InSpec audit resource.
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
### Test a the mount point on '/'
|
|
77
77
|
|
|
78
78
|
describe mount('/') do
|
|
79
79
|
it { should be_mounted }
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: About the mssql_session Resource
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# mssql_session
|
|
6
|
+
|
|
7
|
+
Use the `mssql_session` InSpec audit resource to test SQL commands run against a Microsoft SQL database.
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
A `mssql_session` resource block declares the username and password to use for the session, and then the command to be run:
|
|
12
|
+
|
|
13
|
+
describe mssql_session(user: 'username', password: 'password').query('QUERY').row(0).column('result') do
|
|
14
|
+
its('value') { should eq('') }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
where
|
|
18
|
+
|
|
19
|
+
* `mssql_session` declares a username and password with permission to run the query. Omitting the username or password parameters results in the use of Windows authentication as the user InSpec is executing as. You may also optionally pass a host and instance name. If omitted, they will default to host: localhost and the default instance.
|
|
20
|
+
* `query('QUERY')` contains the query to be run
|
|
21
|
+
* `its('value') { should eq('') }` compares the results of the query against the expected result in the test
|
|
22
|
+
|
|
23
|
+
## Matchers
|
|
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" %>
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
The following examples show how to use this InSpec audit resource.
|
|
39
|
+
|
|
40
|
+
### Test for matching databases
|
|
41
|
+
|
|
42
|
+
sql = mssql_session(user: 'my_user', password: 'password')
|
|
43
|
+
|
|
44
|
+
describe sql.query("SELECT SERVERPROPERTY('ProductVersion') as result").row(0).column('result') do
|
|
45
|
+
its("value") { should cmp > '12.00.4457' }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
### Test using Windows authentication
|
|
49
|
+
|
|
50
|
+
sql = mssql_session
|
|
51
|
+
|
|
52
|
+
describe sql.query("SELECT SERVERPROPERTY('ProductVersion') as result").row(0).column('result') do
|
|
53
|
+
its("value") { should cmp > '12.00.4457' }
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
### Test a specific host and instance
|
|
57
|
+
|
|
58
|
+
sql = mssql_session(user: 'my_user', password: 'password', host: 'mssqlserver', instance: 'foo')
|
|
59
|
+
|
|
60
|
+
describe sql.query("SELECT SERVERPROPERTY('ProductVersion') as result").row(0).column('result') do
|
|
61
|
+
its("value") { should cmp > '12.00.4457' }
|
|
62
|
+
end
|
|
@@ -6,7 +6,7 @@ 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
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
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:
|
|
12
12
|
|
|
@@ -21,31 +21,31 @@ where
|
|
|
21
21
|
* `should eq 'value'` is the value that is expected
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
## Matchers
|
|
25
25
|
|
|
26
26
|
This InSpec audit resource has the following matchers:
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
### be
|
|
29
29
|
|
|
30
30
|
<%= partial "/shared/matcher_be" %>
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
### cmp
|
|
33
33
|
|
|
34
34
|
<%= partial "/shared/matcher_cmp" %>
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
### eq
|
|
37
37
|
|
|
38
38
|
<%= partial "/shared/matcher_eq" %>
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
### include
|
|
41
41
|
|
|
42
42
|
<%= partial "/shared/matcher_include" %>
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
### match
|
|
45
45
|
|
|
46
46
|
<%= partial "/shared/matcher_match" %>
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
### setting
|
|
49
49
|
|
|
50
50
|
The `setting` matcher tests specific, named settings in the `my.cnf` file:
|
|
51
51
|
|
|
@@ -53,18 +53,18 @@ The `setting` matcher tests specific, named settings in the `my.cnf` file:
|
|
|
53
53
|
|
|
54
54
|
Use a `setting` matcher for each setting to be tested.
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
## Examples
|
|
57
57
|
|
|
58
58
|
The following examples show how to use this InSpec audit resource.
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
### Test the maximum number of allowed connections
|
|
61
61
|
|
|
62
62
|
describe mysql_conf do
|
|
63
63
|
its('max_connections') { should eq '505' }
|
|
64
64
|
its('max_user_connections') { should eq '500' }
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
### Test slow query logging**
|
|
68
68
|
|
|
69
69
|
describe mysql_conf do
|
|
70
70
|
its('slow_query_log_file') { should eq 'hostname_slow.log' }
|
|
@@ -74,14 +74,14 @@ The following examples show how to use this InSpec audit resource.
|
|
|
74
74
|
its('min_examined_row_limit') { should eq '100' }
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
### Test the port and socket on which MySQL listens
|
|
78
78
|
|
|
79
79
|
describe mysql_conf do
|
|
80
80
|
its('port') { should eq '3306' }
|
|
81
81
|
its('socket') { should eq '/var/run/mysqld/mysql.sock' }
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
### Test connection and thread variables
|
|
85
85
|
|
|
86
86
|
describe mysql_conf do
|
|
87
87
|
its('port') { should eq '3306' }
|
|
@@ -95,7 +95,7 @@ The following examples show how to use this InSpec audit resource.
|
|
|
95
95
|
its('thread_cache_size') { should eq '505' }
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
### Test the safe-user-create parameter
|
|
99
99
|
|
|
100
100
|
describe mysql_conf.params('mysqld') do
|
|
101
101
|
its('safe-user-create') { should eq('1') }
|
|
@@ -6,7 +6,7 @@ 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
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `mysql_session` resource block declares the username and password to use for the session, and then the command to be run:
|
|
12
12
|
|
|
@@ -20,44 +20,56 @@ where
|
|
|
20
20
|
* `query('QUERY')` contains the query to be run
|
|
21
21
|
* `its('output') { should eq('') }` compares the results of the query against the expected result in the test
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Matchers
|
|
24
24
|
|
|
25
25
|
This InSpec audit resource has the following matchers:
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
### be
|
|
28
28
|
|
|
29
29
|
<%= partial "/shared/matcher_be" %>
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
### cmp
|
|
32
32
|
|
|
33
33
|
<%= partial "/shared/matcher_cmp" %>
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
### eq
|
|
36
36
|
|
|
37
37
|
<%= partial "/shared/matcher_eq" %>
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
### include
|
|
40
40
|
|
|
41
41
|
<%= partial "/shared/matcher_include" %>
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
### match
|
|
44
44
|
|
|
45
45
|
<%= partial "/shared/matcher_match" %>
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
### output
|
|
48
48
|
|
|
49
49
|
The `output` matcher tests the results of the query:
|
|
50
50
|
|
|
51
51
|
its('output') { should eq(/^0/) }
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
## Examples
|
|
54
54
|
|
|
55
55
|
The following examples show how to use this InSpec audit resource.
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
### Test for matching databases
|
|
58
58
|
|
|
59
59
|
sql = mysql_session('my_user','password')
|
|
60
60
|
|
|
61
61
|
describe sql.query('show databases like \'test\';') do
|
|
62
62
|
its('stdout') { should_not match(/test/) }
|
|
63
63
|
end
|
|
64
|
+
|
|
65
|
+
### Alternate Connection: Different Host
|
|
66
|
+
|
|
67
|
+
sql = mysql_session('my_user','password','db.example.com')
|
|
68
|
+
|
|
69
|
+
### Alternate Connection: Different Port
|
|
70
|
+
|
|
71
|
+
sql = mysql_seesion('my_user','password','localhost',3307)
|
|
72
|
+
|
|
73
|
+
### Alternate Connection: Using a socket
|
|
74
|
+
|
|
75
|
+
sql = mysql_session('my_user','password', nil, nil, '/var/lib/mysql-default/mysqld.sock')
|
data/docs/resources/npm.md.erb
CHANGED
|
@@ -7,11 +7,11 @@ title: About the npm Resource
|
|
|
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
9
|
|
|
10
|
-
|
|
10
|
+
## Syntax
|
|
11
11
|
|
|
12
12
|
A `npm` resource block declares a package and (optionally) a package version:
|
|
13
13
|
|
|
14
|
-
describe
|
|
14
|
+
describe npm('npm_package_name') do
|
|
15
15
|
it { should be_installed }
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -21,54 +21,54 @@ where
|
|
|
21
21
|
* `be_installed` is a valid matcher for this resource
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
## Matchers
|
|
25
25
|
|
|
26
26
|
This InSpec audit resource has the following matchers:
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
### be
|
|
29
29
|
|
|
30
30
|
<%= partial "/shared/matcher_be" %>
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
### be_installed
|
|
33
33
|
|
|
34
34
|
The `be_installed` matcher tests if the named Gem package and package version (if specified) is installed:
|
|
35
35
|
|
|
36
36
|
it { should be_installed }
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
### cmp
|
|
39
39
|
|
|
40
40
|
<%= partial "/shared/matcher_cmp" %>
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
### eq
|
|
43
43
|
|
|
44
44
|
<%= partial "/shared/matcher_eq" %>
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
### include
|
|
47
47
|
|
|
48
48
|
<%= partial "/shared/matcher_include" %>
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
### match
|
|
51
51
|
|
|
52
52
|
<%= partial "/shared/matcher_match" %>
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
### version
|
|
55
55
|
|
|
56
56
|
The `version` matcher tests if the named package version is on the system:
|
|
57
57
|
|
|
58
58
|
its('version') { should eq '1.2.3' }
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
## Examples
|
|
61
61
|
|
|
62
62
|
The following examples show how to use this InSpec audit resource.
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
### Verify that bower is installed, with a specific version
|
|
65
65
|
|
|
66
66
|
describe npm('bower') do
|
|
67
67
|
it { should be_installed }
|
|
68
68
|
its('version') { should eq '1.4.1' }
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
### Verify that statsd is not installed
|
|
72
72
|
|
|
73
73
|
describe npm('statsd') do
|
|
74
74
|
it { should_not be_installed }
|
|
@@ -7,7 +7,7 @@ title: About the ntp_conf Resource
|
|
|
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
9
|
|
|
10
|
-
|
|
10
|
+
## Syntax
|
|
11
11
|
|
|
12
12
|
An `ntp_conf` resource block declares the synchronization settings that should be tested:
|
|
13
13
|
|
|
@@ -22,7 +22,7 @@ where
|
|
|
22
22
|
* `{ should eq 'value' }` is the value that is expected
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
## Matchers
|
|
26
26
|
|
|
27
27
|
This resource matches any service that is listed in the `ntp.conf` file:
|
|
28
28
|
|
|
@@ -40,31 +40,31 @@ For example:
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
### be
|
|
44
44
|
|
|
45
45
|
<%= partial "/shared/matcher_be" %>
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
### cmp
|
|
48
48
|
|
|
49
49
|
<%= partial "/shared/matcher_cmp" %>
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
### eq
|
|
52
52
|
|
|
53
53
|
<%= partial "/shared/matcher_eq" %>
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
### include
|
|
56
56
|
|
|
57
57
|
<%= partial "/shared/matcher_include" %>
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
### match
|
|
60
60
|
|
|
61
61
|
<%= partial "/shared/matcher_match" %>
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
## Examples
|
|
64
64
|
|
|
65
65
|
The following examples show how to use this InSpec audit resource.
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
### Test for clock drift against named servers
|
|
68
68
|
|
|
69
69
|
describe ntp_conf do
|
|
70
70
|
its('driftfile') { should eq '/var/lib/ntp/ntp.drift' }
|
|
@@ -6,7 +6,7 @@ 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
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
A `oneget` resource block declares a package and (optionally) a package version:
|
|
12
12
|
|
|
@@ -20,47 +20,47 @@ where
|
|
|
20
20
|
* `be_installed` is a valid matcher for this resource
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Matchers
|
|
24
24
|
|
|
25
25
|
This InSpec audit resource has the following matchers:
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
### be
|
|
28
28
|
|
|
29
29
|
<%= partial "/shared/matcher_be" %>
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
### be_installed
|
|
32
32
|
|
|
33
33
|
The `be_installed` matcher tests if the named package is installed on the system:
|
|
34
34
|
|
|
35
35
|
it { should be_installed }
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
### cmp
|
|
38
38
|
|
|
39
39
|
<%= partial "/shared/matcher_cmp" %>
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
### eq
|
|
42
42
|
|
|
43
43
|
<%= partial "/shared/matcher_eq" %>
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
### include
|
|
46
46
|
|
|
47
47
|
<%= partial "/shared/matcher_include" %>
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
### match
|
|
50
50
|
|
|
51
51
|
<%= partial "/shared/matcher_match" %>
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
### version
|
|
54
54
|
|
|
55
55
|
The `version` matcher tests if the named package version is on the system:
|
|
56
56
|
|
|
57
57
|
its('version') { should eq '1.2.3' }
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
## Examples
|
|
60
60
|
|
|
61
61
|
The following examples show how to use this InSpec audit resource.
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
### Test if VLC is installed
|
|
64
64
|
|
|
65
65
|
describe oneget('VLC') do
|
|
66
66
|
it { should be_installed }
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: About the oracledb_session Resource
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# oracledb_session
|
|
6
|
+
|
|
7
|
+
Use the `oracledb_session` InSpec audit resource to test SQL commands run against a Oracle database.
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
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:
|
|
12
|
+
|
|
13
|
+
describe oracledb_session(user: 'username', password: 'password', service: 'ORCL.localdomain').query('QUERY').row(0).column('result') do
|
|
14
|
+
its('value') { should eq('') }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
where
|
|
18
|
+
|
|
19
|
+
* `oracledb_session` declares a username and password with permission to run the query (required), and an optional parameters for host (default: `localhost`), SID (default: `nil`, which uses the default SID, and path to the sqlplus binary (default: `sqlplus`).
|
|
20
|
+
* `query('QUERY')` contains the query to be run
|
|
21
|
+
* `its('value') { should eq('') }` compares the results of the query against the expected result in the test
|
|
22
|
+
|
|
23
|
+
## Matchers
|
|
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" %>
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
The following examples show how to use this InSpec audit resource.
|
|
38
|
+
|
|
39
|
+
### Test for matching databases
|
|
40
|
+
|
|
41
|
+
sql = oracledb_session(user: 'my_user', pass: 'password')
|
|
42
|
+
|
|
43
|
+
describe sql.query('SELECT NAME AS VALUE FROM v$database;').row(0).column('value') do
|
|
44
|
+
its('value') { should cmp 'ORCL' }
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
### Test for matching databases with custom host, SID and sqlplus binary location
|
|
48
|
+
|
|
49
|
+
sql = oracledb_session(user: 'my_user', pass: 'password', host: 'oraclehost', sid: 'mysid', sqlplus_bin: '/u01/app/oracle/product/12.1.0/dbhome_1/bin/sqlplus')
|
|
50
|
+
|
|
51
|
+
describe sql.query('SELECT NAME FROM v$database;').row(0).column('name') do
|
|
52
|
+
its('value') { should cmp 'ORCL' }
|
|
53
|
+
end
|
data/docs/resources/os.md.erb
CHANGED
|
@@ -6,7 +6,7 @@ title: About the os Resource
|
|
|
6
6
|
|
|
7
7
|
Use the `os` InSpec audit resource to test the platform on which the system is running.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Syntax
|
|
10
10
|
|
|
11
11
|
An `os` resource block declares the platform to be tested. The platform may specified via matcher or control block name. For example, using a matcher:
|
|
12
12
|
|
|
@@ -22,31 +22,31 @@ or using the block name:
|
|
|
22
22
|
|
|
23
23
|
* `'platform_name'` (a string) or `:family_name` (a symbol) is one of `aix`, `bsd`, `darwin`, `debian`, `hpux`, `linux`, `redhat`, `solaris`, `suse`, `unix`, or `windows`
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
## Matchers
|
|
26
26
|
|
|
27
27
|
This InSpec audit resource has the following matchers:
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
### be
|
|
30
30
|
|
|
31
31
|
<%= partial "/shared/matcher_be" %>
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
### cmp
|
|
34
34
|
|
|
35
35
|
<%= partial "/shared/matcher_cmp" %>
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
### eq
|
|
38
38
|
|
|
39
39
|
<%= partial "/shared/matcher_eq" %>
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
### include
|
|
42
42
|
|
|
43
43
|
<%= partial "/shared/matcher_include" %>
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
### match
|
|
46
46
|
|
|
47
47
|
<%= partial "/shared/matcher_match" %>
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
## os.family? Helpers
|
|
50
50
|
|
|
51
51
|
The `os` audit resource includes a collection of helpers that enable more granular testing of platforms, platform names, architectures, and releases. Use any of the following platform-specific helpers to test for specific platforms:
|
|
52
52
|
|
|
@@ -56,7 +56,7 @@ The `os` audit resource includes a collection of helpers that enable more granul
|
|
|
56
56
|
* `debian?`
|
|
57
57
|
* `hpux?`
|
|
58
58
|
* `linux?` (including Alpine Linux, Amazon Linux, ArchLinux, CoreOS, Exherbo, Fedora, Gentoo, and Slackware)
|
|
59
|
-
* `redhat?`
|
|
59
|
+
* `redhat?` (including CentOS)
|
|
60
60
|
* `solaris?` (including Nexenta Core, OmniOS, Open Indiana, Solaris Open, and SmartOS)
|
|
61
61
|
* `suse?`
|
|
62
62
|
* `unix?`
|
|
@@ -94,7 +94,7 @@ Use the following helpers to test for operating system names, releases, and arch
|
|
|
94
94
|
it { should eq 'foo' }
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
## os[:family] Symbols
|
|
98
98
|
|
|
99
99
|
Use `os[:family]` to enable more granular testing of platforms, platform names, architectures, and releases. Use any of the following platform-specific symbols to test for specific platforms:
|
|
100
100
|
|
|
@@ -103,7 +103,7 @@ Use `os[:family]` to enable more granular testing of platforms, platform names,
|
|
|
103
103
|
* `:debian`
|
|
104
104
|
* `:hpux`
|
|
105
105
|
* `:linux`. For platforms that are part of the Linux family: `:alpine`, `:amazon`, `:arch`, `:coreos`, `:exherbo`, `:fedora`, `:gentoo`, and `:slackware`.
|
|
106
|
-
* `:redhat
|
|
106
|
+
* `:redhat`. For platforms that are part of the Redhat family: `:centos`.
|
|
107
107
|
* `:solaris`. For platforms that are part of the Solaris family: `:nexentacore`, `:omnios`, `:openindiana`, `:opensolaris`, and `:smartos`.
|
|
108
108
|
* `:suse`
|
|
109
109
|
* `:unix`
|
|
@@ -115,7 +115,7 @@ For example, both of the following tests should have the same result:
|
|
|
115
115
|
describe port(69) do
|
|
116
116
|
its('processes') { should include 'in.tftpd' }
|
|
117
117
|
end
|
|
118
|
-
elsif os[:family] == '
|
|
118
|
+
elsif os[:family] == 'redhat'
|
|
119
119
|
describe port(69) do
|
|
120
120
|
its('processes') { should include 'xinetd' }
|
|
121
121
|
end
|
|
@@ -125,29 +125,29 @@ For example, both of the following tests should have the same result:
|
|
|
125
125
|
describe port(69) do
|
|
126
126
|
its('processes') { should include 'in.tftpd' }
|
|
127
127
|
end
|
|
128
|
-
elsif os[:
|
|
128
|
+
elsif os[:redhat]
|
|
129
129
|
describe port(69) do
|
|
130
130
|
its('processes') { should include 'xinetd' }
|
|
131
131
|
end
|
|
132
132
|
end
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
## Examples
|
|
135
135
|
|
|
136
136
|
The following examples show how to use this InSpec audit resource.
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
### Test for RedHat
|
|
139
139
|
|
|
140
140
|
describe os[:family] do
|
|
141
141
|
it { should eq 'redhat' }
|
|
142
142
|
end
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
### Test for Ubuntu
|
|
145
145
|
|
|
146
146
|
describe os[:family] do
|
|
147
147
|
it { should eq 'debian' }
|
|
148
148
|
end
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
### Test for Microsoft Windows
|
|
151
151
|
|
|
152
152
|
describe os[:family] do
|
|
153
153
|
it { should eq 'windows' }
|