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.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/CHANGELOG.md +2599 -1
  4. data/Gemfile +0 -1
  5. data/README.md +24 -34
  6. data/Rakefile +0 -31
  7. data/docs/dsl_inspec.md +10 -0
  8. data/docs/matchers.md +29 -0
  9. data/docs/plugin_kitchen_inspec.md +18 -24
  10. data/docs/profiles.md +101 -81
  11. data/docs/resources/aide_conf.md.erb +71 -0
  12. data/docs/resources/apache_conf.md.erb +19 -33
  13. data/docs/resources/apt.md.erb +22 -36
  14. data/docs/resources/audit_policy.md.erb +9 -24
  15. data/docs/resources/auditd.md.erb +78 -0
  16. data/docs/resources/auditd_conf.md.erb +20 -34
  17. data/docs/resources/auditd_rules.md.erb +8 -24
  18. data/docs/resources/bash.md.erb +4 -26
  19. data/docs/resources/bond.md.erb +25 -40
  20. data/docs/resources/bridge.md.erb +5 -25
  21. data/docs/resources/bsd_service.md.erb +5 -25
  22. data/docs/resources/command.md.erb +35 -50
  23. data/docs/resources/cpan.md.erb +62 -0
  24. data/docs/resources/cran.md.erb +54 -0
  25. data/docs/resources/crontab.md.erb +9 -23
  26. data/docs/resources/csv.md.erb +12 -27
  27. data/docs/resources/dh_params.md +1 -0
  28. data/docs/resources/directory.md.erb +5 -25
  29. data/docs/resources/docker.md.erb +61 -58
  30. data/docs/resources/docker_container.md.erb +23 -19
  31. data/docs/resources/docker_image.md.erb +20 -16
  32. data/docs/resources/elasticsearch.md.erb +245 -0
  33. data/docs/resources/etc_fstab.md.erb +120 -0
  34. data/docs/resources/etc_group.md.erb +29 -45
  35. data/docs/resources/etc_hosts.md.erb +68 -0
  36. data/docs/resources/etc_hosts_allow.md.erb +68 -0
  37. data/docs/resources/etc_hosts_deny.md.erb +68 -0
  38. data/docs/resources/file.md.erb +227 -216
  39. data/docs/resources/firewalld.md.erb +104 -0
  40. data/docs/resources/gem.md.erb +21 -35
  41. data/docs/resources/group.md.erb +16 -30
  42. data/docs/resources/grub_conf.md.erb +9 -24
  43. data/docs/resources/host.md.erb +32 -49
  44. data/docs/resources/http.md.erb +38 -44
  45. data/docs/resources/iis_app.md.erb +25 -35
  46. data/docs/resources/iis_site.md.erb +26 -40
  47. data/docs/resources/inetd_conf.md.erb +27 -42
  48. data/docs/resources/ini.md.erb +9 -23
  49. data/docs/resources/interface.md.erb +5 -25
  50. data/docs/resources/iptables.md.erb +15 -29
  51. data/docs/resources/json.md.erb +12 -27
  52. data/docs/resources/kernel_module.md.erb +47 -61
  53. data/docs/resources/kernel_parameter.md.erb +15 -29
  54. data/docs/resources/key_rsa.md.erb +3 -0
  55. data/docs/resources/launchd_service.md.erb +5 -25
  56. data/docs/resources/limits_conf.md.erb +15 -29
  57. data/docs/resources/login_def.md.erb +15 -30
  58. data/docs/resources/mount.md.erb +18 -33
  59. data/docs/resources/mssql_session.md.erb +9 -12
  60. data/docs/resources/mysql_conf.md.erb +28 -32
  61. data/docs/resources/mysql_session.md.erb +15 -29
  62. data/docs/resources/nginx.md.erb +78 -0
  63. data/docs/resources/nginx_conf.md.erb +127 -0
  64. data/docs/resources/npm.md.erb +19 -35
  65. data/docs/resources/ntp_conf.md.erb +20 -37
  66. data/docs/resources/oneget.md.erb +15 -30
  67. data/docs/resources/oracledb_session.md.erb +9 -11
  68. data/docs/resources/os.md.erb +29 -43
  69. data/docs/resources/os_env.md.erb +23 -44
  70. data/docs/resources/package.md.erb +34 -36
  71. data/docs/resources/parse_config.md.erb +5 -25
  72. data/docs/resources/parse_config_file.md.erb +31 -43
  73. data/docs/resources/{etc_passwd.md.erb → passwd.md.erb} +24 -39
  74. data/docs/resources/pip.md.erb +20 -35
  75. data/docs/resources/port.md.erb +43 -57
  76. data/docs/resources/postgres_conf.md.erb +17 -31
  77. data/docs/resources/postgres_hba_conf.md.erb +26 -38
  78. data/docs/resources/postgres_ident_conf.md.erb +25 -37
  79. data/docs/resources/postgres_session.md.erb +15 -29
  80. data/docs/resources/powershell.md.erb +27 -42
  81. data/docs/resources/processes.md.erb +17 -33
  82. data/docs/resources/rabbitmq_config.md.erb +9 -24
  83. data/docs/resources/registry_key.md.erb +27 -42
  84. data/docs/resources/runit_service.md.erb +5 -25
  85. data/docs/resources/security_policy.md.erb +12 -27
  86. data/docs/resources/service.md.erb +27 -42
  87. data/docs/resources/{etc_shadow.md.erb → shadow.md.erb} +41 -47
  88. data/docs/resources/ssh_config.md.erb +19 -34
  89. data/docs/resources/sshd_config.md.erb +19 -34
  90. data/docs/resources/ssl.md.erb +39 -54
  91. data/docs/resources/sys_info.md.erb +12 -26
  92. data/docs/resources/systemd_service.md.erb +5 -25
  93. data/docs/resources/sysv_service.md.erb +5 -25
  94. data/docs/resources/upstart_service.md.erb +5 -25
  95. data/docs/resources/user.md.erb +29 -44
  96. data/docs/resources/users.md.erb +12 -26
  97. data/docs/resources/vbscript.md.erb +9 -24
  98. data/docs/resources/virtualization.md.erb +8 -23
  99. data/docs/resources/windows_feature.md.erb +15 -30
  100. data/docs/resources/windows_hotfix.md.erb +50 -0
  101. data/docs/resources/windows_task.md.erb +12 -26
  102. data/docs/resources/wmi.md.erb +9 -24
  103. data/docs/resources/x509_certificate.md.erb +4 -0
  104. data/docs/resources/xinetd_conf.md.erb +65 -80
  105. data/docs/resources/xml.md.erb +61 -0
  106. data/docs/resources/yaml.md.erb +12 -27
  107. data/docs/resources/yum.md.erb +37 -51
  108. data/docs/resources/zfs_dataset.md.erb +15 -26
  109. data/docs/resources/zfs_pool.md.erb +9 -20
  110. data/docs/ruby_usage.md +0 -1
  111. data/examples/meta-profile/README.md +1 -1
  112. data/examples/profile-sensitive/README.md +29 -0
  113. data/examples/profile-sensitive/controls/sensitive-failures.rb +9 -0
  114. data/examples/profile-sensitive/controls/sensitive.rb +9 -0
  115. data/examples/profile-sensitive/inspec.yml +8 -0
  116. data/inspec.gemspec +3 -3
  117. data/lib/bundles/inspec-artifact/cli.rb +5 -5
  118. data/lib/bundles/inspec-compliance/README.md +24 -22
  119. data/lib/bundles/inspec-compliance/api/login.rb +152 -0
  120. data/lib/bundles/inspec-compliance/api.rb +46 -16
  121. data/lib/bundles/inspec-compliance/cli.rb +58 -165
  122. data/lib/bundles/inspec-compliance/target.rb +2 -3
  123. data/lib/bundles/inspec-habitat/cli.rb +7 -2
  124. data/lib/bundles/inspec-habitat/profile.rb +44 -20
  125. data/lib/bundles/inspec-init/templates/profile/README.md +1 -1
  126. data/lib/bundles/inspec-init/templates/profile/controls/example.rb +1 -1
  127. data/lib/bundles/inspec-supermarket/api.rb +1 -1
  128. data/lib/inspec/backend.rb +8 -0
  129. data/lib/inspec/cli.rb +1 -1
  130. data/lib/inspec/control_eval_context.rb +16 -6
  131. data/lib/inspec/dependencies/requirement.rb +22 -8
  132. data/lib/inspec/dependencies/resolver.rb +1 -1
  133. data/lib/inspec/exceptions.rb +4 -0
  134. data/lib/inspec/file_provider.rb +38 -9
  135. data/lib/inspec/metadata.rb +17 -3
  136. data/lib/inspec/objects/attribute.rb +16 -7
  137. data/lib/inspec/objects/control.rb +10 -2
  138. data/lib/inspec/plugins/resource.rb +34 -5
  139. data/lib/inspec/profile.rb +10 -1
  140. data/lib/inspec/profile_context.rb +3 -1
  141. data/lib/inspec/resource.rb +17 -5
  142. data/lib/inspec/rspec_json_formatter.rb +48 -14
  143. data/lib/inspec/rule.rb +4 -0
  144. data/lib/inspec/runner.rb +72 -30
  145. data/lib/inspec/shell.rb +24 -19
  146. data/lib/inspec/version.rb +1 -1
  147. data/lib/matchers/matchers.rb +40 -0
  148. data/lib/resources/aide_conf.rb +162 -0
  149. data/lib/resources/auditd.rb +231 -0
  150. data/lib/resources/auditd_rules.rb +3 -1
  151. data/lib/resources/command.rb +1 -1
  152. data/lib/resources/cpan.rb +60 -0
  153. data/lib/resources/cran.rb +66 -0
  154. data/lib/resources/docker.rb +8 -1
  155. data/lib/resources/docker_container.rb +19 -2
  156. data/lib/resources/elasticsearch.rb +172 -0
  157. data/lib/resources/etc_fstab.rb +102 -0
  158. data/lib/resources/etc_group.rb +1 -1
  159. data/lib/resources/etc_hosts.rb +81 -0
  160. data/lib/resources/etc_hosts_allow_deny.rb +122 -0
  161. data/lib/resources/file.rb +87 -10
  162. data/lib/resources/firewalld.rb +144 -0
  163. data/lib/resources/groups.rb +0 -1
  164. data/lib/resources/host.rb +30 -15
  165. data/lib/resources/http.rb +178 -22
  166. data/lib/resources/mssql_session.rb +3 -3
  167. data/lib/resources/mysql_conf.rb +10 -0
  168. data/lib/resources/mysql_session.rb +1 -1
  169. data/lib/resources/nginx.rb +97 -0
  170. data/lib/resources/nginx_conf.rb +134 -1
  171. data/lib/resources/oracledb_session.rb +9 -8
  172. data/lib/resources/os_env.rb +7 -4
  173. data/lib/resources/package.rb +14 -2
  174. data/lib/resources/packages.rb +1 -1
  175. data/lib/resources/pip.rb +28 -20
  176. data/lib/resources/port.rb +251 -3
  177. data/lib/resources/postgres.rb +1 -1
  178. data/lib/resources/postgres_session.rb +1 -1
  179. data/lib/resources/processes.rb +106 -20
  180. data/lib/resources/registry_key.rb +11 -2
  181. data/lib/resources/service.rb +5 -24
  182. data/lib/resources/ssh_conf.rb +1 -1
  183. data/lib/resources/ssl.rb +4 -3
  184. data/lib/resources/toml.rb +2 -2
  185. data/lib/resources/windows_hotfix.rb +35 -0
  186. data/lib/resources/xinetd.rb +4 -6
  187. data/lib/resources/xml.rb +27 -0
  188. data/lib/source_readers/inspec.rb +3 -3
  189. data/lib/utils/find_files.rb +2 -1
  190. data/lib/utils/nginx_parser.rb +10 -1
  191. data/lib/utils/object_traversal.rb +35 -10
  192. data/lib/utils/parser.rb +21 -3
  193. metadata +48 -18
  194. 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
- ## 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
- ### 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"]]}
@@ -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
- ## Matchers
25
-
26
- This InSpec audit resource has the following matchers:
27
-
28
- ### be
29
-
30
- <%= partial "/shared/matcher_be" %>
26
+ ## Examples
31
27
 
32
- ### be_installed
28
+ The following examples show how to use this InSpec audit resource.
33
29
 
34
- The `be_installed` matcher tests if the named Gem package and package version (if specified) is installed:
30
+ ### Verify that bower is installed, with a specific version
35
31
 
36
- it { should be_installed }
32
+ describe npm('bower') do
33
+ it { should be_installed }
34
+ its('version') { should eq '1.4.1' }
35
+ end
37
36
 
38
- ### cmp
37
+ ### Verify that statsd is not installed
39
38
 
40
- <%= partial "/shared/matcher_cmp" %>
39
+ describe npm('statsd') do
40
+ it { should_not be_installed }
41
+ end
41
42
 
42
- ### eq
43
+ <br>
43
44
 
44
- <%= partial "/shared/matcher_eq" %>
45
+ ## Matchers
45
46
 
46
- ### include
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
- <%= partial "/shared/matcher_include" %>
49
+ ### be_installed
49
50
 
50
- ### match
51
+ The `be_installed` matcher tests if the named Gem package and package version (if specified) is installed:
51
52
 
52
- <%= partial "/shared/matcher_match" %>
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
- ## Matchers
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
- its('restrict') { should include '-4 default kod notrap nomodify nopeer noquery'}
29
+ The following examples show how to use this InSpec audit resource.
34
30
 
35
- For example:
31
+ ### Test for clock drift against named servers
36
32
 
37
33
  describe ntp_conf do
38
- its('server') { should_not eq nil }
39
- its('restrict') { should include '-4 default kod notrap nomodify nopeer noquery'}
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
- ### be
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
- ### match
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
- <%= partial "/shared/matcher_match" %>
48
+ its('server') { should_not eq nil }
62
49
 
63
- ## Examples
50
+ or:
64
51
 
65
- The following examples show how to use this InSpec audit resource.
52
+ its('restrict') { should include '-4 default kod notrap nomodify nopeer noquery'}
66
53
 
67
- ### Test for clock drift against named servers
54
+ For example:
68
55
 
69
56
  describe ntp_conf do
70
- its('driftfile') { should eq '/var/lib/ntp/ntp.drift' }
71
- its('server') { should eq [
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
- ## Matchers
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
- it { should be_installed }
28
+ The following examples show how to use this InSpec audit resource.
36
29
 
37
- ### cmp
30
+ ### Test if VLC is installed
38
31
 
39
- <%= partial "/shared/matcher_cmp" %>
32
+ describe oneget('VLC') do
33
+ it { should be_installed }
34
+ end
40
35
 
41
- ### eq
36
+ <br>
42
37
 
43
- <%= partial "/shared/matcher_eq" %>
38
+ ## Matchers
44
39
 
45
- ### include
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
- <%= partial "/shared/matcher_include" %>
42
+ ### be_installed
48
43
 
49
- ### match
44
+ The `be_installed` matcher tests if the named package is installed on the system:
50
45
 
51
- <%= partial "/shared/matcher_match" %>
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
- ## 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" %>
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/).