inspec-core 2.3.10 → 2.3.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -13
  3. data/etc/plugin_filters.json +25 -0
  4. data/inspec-core.gemspec +1 -1
  5. data/lib/bundles/inspec-compliance/api.rb +3 -0
  6. data/lib/bundles/inspec-compliance/configuration.rb +3 -0
  7. data/lib/bundles/inspec-compliance/http.rb +3 -0
  8. data/lib/bundles/inspec-compliance/support.rb +3 -0
  9. data/lib/bundles/inspec-compliance/target.rb +3 -0
  10. data/lib/inspec/objects/attribute.rb +3 -0
  11. data/lib/inspec/plugin/v2.rb +3 -0
  12. data/lib/inspec/plugin/v2/filter.rb +62 -0
  13. data/lib/inspec/plugin/v2/installer.rb +21 -1
  14. data/lib/inspec/plugin/v2/loader.rb +4 -0
  15. data/lib/inspec/profile.rb +3 -1
  16. data/lib/inspec/version.rb +1 -1
  17. data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +25 -3
  18. data/lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb +65 -11
  19. data/lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb +5 -1
  20. data/lib/resources/package.rb +1 -1
  21. metadata +4 -197
  22. data/docs/.gitignore +0 -2
  23. data/docs/README.md +0 -41
  24. data/docs/dev/control-eval.md +0 -62
  25. data/docs/dev/filtertable-internals.md +0 -353
  26. data/docs/dev/filtertable-usage.md +0 -533
  27. data/docs/dev/integration-testing.md +0 -31
  28. data/docs/dev/plugins.md +0 -323
  29. data/docs/dsl_inspec.md +0 -354
  30. data/docs/dsl_resource.md +0 -100
  31. data/docs/glossary.md +0 -381
  32. data/docs/habitat.md +0 -193
  33. data/docs/inspec_and_friends.md +0 -114
  34. data/docs/matchers.md +0 -161
  35. data/docs/migration.md +0 -293
  36. data/docs/platforms.md +0 -119
  37. data/docs/plugin_kitchen_inspec.md +0 -60
  38. data/docs/plugins.md +0 -57
  39. data/docs/profiles.md +0 -576
  40. data/docs/reporters.md +0 -170
  41. data/docs/resources/aide_conf.md.erb +0 -86
  42. data/docs/resources/apache.md.erb +0 -77
  43. data/docs/resources/apache_conf.md.erb +0 -78
  44. data/docs/resources/apt.md.erb +0 -81
  45. data/docs/resources/audit_policy.md.erb +0 -57
  46. data/docs/resources/auditd.md.erb +0 -89
  47. data/docs/resources/auditd_conf.md.erb +0 -78
  48. data/docs/resources/bash.md.erb +0 -85
  49. data/docs/resources/bond.md.erb +0 -100
  50. data/docs/resources/bridge.md.erb +0 -67
  51. data/docs/resources/bsd_service.md.erb +0 -77
  52. data/docs/resources/chocolatey_package.md.erb +0 -68
  53. data/docs/resources/command.md.erb +0 -176
  54. data/docs/resources/cpan.md.erb +0 -89
  55. data/docs/resources/cran.md.erb +0 -74
  56. data/docs/resources/crontab.md.erb +0 -103
  57. data/docs/resources/csv.md.erb +0 -64
  58. data/docs/resources/dh_params.md.erb +0 -221
  59. data/docs/resources/directory.md.erb +0 -40
  60. data/docs/resources/docker.md.erb +0 -240
  61. data/docs/resources/docker_container.md.erb +0 -113
  62. data/docs/resources/docker_image.md.erb +0 -104
  63. data/docs/resources/docker_plugin.md.erb +0 -80
  64. data/docs/resources/docker_service.md.erb +0 -124
  65. data/docs/resources/elasticsearch.md.erb +0 -252
  66. data/docs/resources/etc_fstab.md.erb +0 -135
  67. data/docs/resources/etc_group.md.erb +0 -85
  68. data/docs/resources/etc_hosts.md.erb +0 -88
  69. data/docs/resources/etc_hosts_allow.md.erb +0 -84
  70. data/docs/resources/etc_hosts_deny.md.erb +0 -84
  71. data/docs/resources/file.md.erb +0 -543
  72. data/docs/resources/filesystem.md.erb +0 -51
  73. data/docs/resources/firewalld.md.erb +0 -117
  74. data/docs/resources/gem.md.erb +0 -108
  75. data/docs/resources/group.md.erb +0 -71
  76. data/docs/resources/grub_conf.md.erb +0 -111
  77. data/docs/resources/host.md.erb +0 -96
  78. data/docs/resources/http.md.erb +0 -207
  79. data/docs/resources/iis_app.md.erb +0 -132
  80. data/docs/resources/iis_site.md.erb +0 -145
  81. data/docs/resources/inetd_conf.md.erb +0 -104
  82. data/docs/resources/ini.md.erb +0 -86
  83. data/docs/resources/interface.md.erb +0 -68
  84. data/docs/resources/iptables.md.erb +0 -74
  85. data/docs/resources/json.md.erb +0 -73
  86. data/docs/resources/kernel_module.md.erb +0 -130
  87. data/docs/resources/kernel_parameter.md.erb +0 -63
  88. data/docs/resources/key_rsa.md.erb +0 -95
  89. data/docs/resources/launchd_service.md.erb +0 -67
  90. data/docs/resources/limits_conf.md.erb +0 -85
  91. data/docs/resources/login_defs.md.erb +0 -81
  92. data/docs/resources/mount.md.erb +0 -79
  93. data/docs/resources/mssql_session.md.erb +0 -78
  94. data/docs/resources/mysql_conf.md.erb +0 -109
  95. data/docs/resources/mysql_session.md.erb +0 -84
  96. data/docs/resources/nginx.md.erb +0 -89
  97. data/docs/resources/nginx_conf.md.erb +0 -148
  98. data/docs/resources/npm.md.erb +0 -78
  99. data/docs/resources/ntp_conf.md.erb +0 -70
  100. data/docs/resources/oneget.md.erb +0 -63
  101. data/docs/resources/oracledb_session.md.erb +0 -103
  102. data/docs/resources/os.md.erb +0 -153
  103. data/docs/resources/os_env.md.erb +0 -101
  104. data/docs/resources/package.md.erb +0 -130
  105. data/docs/resources/packages.md.erb +0 -77
  106. data/docs/resources/parse_config.md.erb +0 -113
  107. data/docs/resources/parse_config_file.md.erb +0 -148
  108. data/docs/resources/passwd.md.erb +0 -151
  109. data/docs/resources/pip.md.erb +0 -77
  110. data/docs/resources/port.md.erb +0 -147
  111. data/docs/resources/postgres_conf.md.erb +0 -89
  112. data/docs/resources/postgres_hba_conf.md.erb +0 -103
  113. data/docs/resources/postgres_ident_conf.md.erb +0 -86
  114. data/docs/resources/postgres_session.md.erb +0 -79
  115. data/docs/resources/powershell.md.erb +0 -112
  116. data/docs/resources/processes.md.erb +0 -119
  117. data/docs/resources/rabbitmq_config.md.erb +0 -51
  118. data/docs/resources/registry_key.md.erb +0 -197
  119. data/docs/resources/runit_service.md.erb +0 -67
  120. data/docs/resources/security_policy.md.erb +0 -57
  121. data/docs/resources/service.md.erb +0 -131
  122. data/docs/resources/shadow.md.erb +0 -267
  123. data/docs/resources/ssh_config.md.erb +0 -83
  124. data/docs/resources/sshd_config.md.erb +0 -93
  125. data/docs/resources/ssl.md.erb +0 -129
  126. data/docs/resources/sys_info.md.erb +0 -52
  127. data/docs/resources/systemd_service.md.erb +0 -67
  128. data/docs/resources/sysv_service.md.erb +0 -67
  129. data/docs/resources/upstart_service.md.erb +0 -67
  130. data/docs/resources/user.md.erb +0 -150
  131. data/docs/resources/users.md.erb +0 -137
  132. data/docs/resources/vbscript.md.erb +0 -65
  133. data/docs/resources/virtualization.md.erb +0 -67
  134. data/docs/resources/windows_feature.md.erb +0 -69
  135. data/docs/resources/windows_hotfix.md.erb +0 -63
  136. data/docs/resources/windows_task.md.erb +0 -95
  137. data/docs/resources/wmi.md.erb +0 -91
  138. data/docs/resources/x509_certificate.md.erb +0 -161
  139. data/docs/resources/xinetd_conf.md.erb +0 -166
  140. data/docs/resources/xml.md.erb +0 -95
  141. data/docs/resources/yaml.md.erb +0 -79
  142. data/docs/resources/yum.md.erb +0 -108
  143. data/docs/resources/zfs_dataset.md.erb +0 -63
  144. data/docs/resources/zfs_pool.md.erb +0 -57
  145. data/docs/shared/matcher_be.md.erb +0 -1
  146. data/docs/shared/matcher_cmp.md.erb +0 -43
  147. data/docs/shared/matcher_eq.md.erb +0 -3
  148. data/docs/shared/matcher_include.md.erb +0 -1
  149. data/docs/shared/matcher_match.md.erb +0 -1
  150. data/docs/shell.md +0 -217
  151. data/docs/style.md +0 -178
  152. data/examples/README.md +0 -8
  153. data/examples/custom-resource/README.md +0 -3
  154. data/examples/custom-resource/controls/example.rb +0 -7
  155. data/examples/custom-resource/inspec.yml +0 -8
  156. data/examples/custom-resource/libraries/batsignal.rb +0 -20
  157. data/examples/custom-resource/libraries/gordon.rb +0 -21
  158. data/examples/inheritance/README.md +0 -65
  159. data/examples/inheritance/controls/example.rb +0 -14
  160. data/examples/inheritance/inspec.yml +0 -16
  161. data/examples/kitchen-ansible/.kitchen.yml +0 -25
  162. data/examples/kitchen-ansible/Gemfile +0 -19
  163. data/examples/kitchen-ansible/README.md +0 -53
  164. data/examples/kitchen-ansible/files/nginx.repo +0 -6
  165. data/examples/kitchen-ansible/tasks/main.yml +0 -16
  166. data/examples/kitchen-ansible/test/integration/default/default.yml +0 -5
  167. data/examples/kitchen-ansible/test/integration/default/web_spec.rb +0 -28
  168. data/examples/kitchen-chef/.kitchen.yml +0 -20
  169. data/examples/kitchen-chef/Berksfile +0 -3
  170. data/examples/kitchen-chef/Gemfile +0 -19
  171. data/examples/kitchen-chef/README.md +0 -27
  172. data/examples/kitchen-chef/metadata.rb +0 -7
  173. data/examples/kitchen-chef/recipes/default.rb +0 -6
  174. data/examples/kitchen-chef/recipes/nginx.rb +0 -30
  175. data/examples/kitchen-chef/test/integration/default/web_spec.rb +0 -28
  176. data/examples/kitchen-puppet/.kitchen.yml +0 -23
  177. data/examples/kitchen-puppet/Gemfile +0 -20
  178. data/examples/kitchen-puppet/Puppetfile +0 -25
  179. data/examples/kitchen-puppet/README.md +0 -53
  180. data/examples/kitchen-puppet/manifests/site.pp +0 -33
  181. data/examples/kitchen-puppet/metadata.json +0 -11
  182. data/examples/kitchen-puppet/modules/.gitkeep +0 -0
  183. data/examples/kitchen-puppet/test/integration/default/web_spec.rb +0 -28
  184. data/examples/meta-profile/README.md +0 -37
  185. data/examples/meta-profile/controls/example.rb +0 -13
  186. data/examples/meta-profile/inspec.yml +0 -13
  187. data/examples/plugins/inspec-resource-lister/Gemfile +0 -12
  188. data/examples/plugins/inspec-resource-lister/LICENSE +0 -13
  189. data/examples/plugins/inspec-resource-lister/README.md +0 -62
  190. data/examples/plugins/inspec-resource-lister/Rakefile +0 -40
  191. data/examples/plugins/inspec-resource-lister/inspec-resource-lister.gemspec +0 -45
  192. data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister.rb +0 -16
  193. data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/cli_command.rb +0 -70
  194. data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/plugin.rb +0 -55
  195. data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/version.rb +0 -10
  196. data/examples/plugins/inspec-resource-lister/test/fixtures/README.md +0 -24
  197. data/examples/plugins/inspec-resource-lister/test/functional/README.md +0 -18
  198. data/examples/plugins/inspec-resource-lister/test/functional/inspec_resource_lister_test.rb +0 -110
  199. data/examples/plugins/inspec-resource-lister/test/helper.rb +0 -26
  200. data/examples/plugins/inspec-resource-lister/test/unit/README.md +0 -17
  201. data/examples/plugins/inspec-resource-lister/test/unit/cli_args_test.rb +0 -64
  202. data/examples/plugins/inspec-resource-lister/test/unit/plugin_def_test.rb +0 -51
  203. data/examples/profile-attribute.yml +0 -2
  204. data/examples/profile-attribute/README.md +0 -14
  205. data/examples/profile-attribute/controls/example.rb +0 -11
  206. data/examples/profile-attribute/inspec.yml +0 -8
  207. data/examples/profile-sensitive/README.md +0 -29
  208. data/examples/profile-sensitive/controls/sensitive-failures.rb +0 -9
  209. data/examples/profile-sensitive/controls/sensitive.rb +0 -9
  210. data/examples/profile-sensitive/inspec.yml +0 -8
  211. data/examples/profile/README.md +0 -48
  212. data/examples/profile/controls/example.rb +0 -24
  213. data/examples/profile/controls/gordon.rb +0 -36
  214. data/examples/profile/controls/meta.rb +0 -36
  215. data/examples/profile/inspec.yml +0 -11
  216. data/examples/profile/libraries/gordon_config.rb +0 -59
@@ -1,113 +0,0 @@
1
- ---
2
- title: About the docker_container Resource
3
- platform: linux
4
- ---
5
-
6
- # docker_container
7
-
8
- Use the `docker_container` InSpec audit resource to test a Docker container.
9
-
10
- <br>
11
-
12
- ## Availability
13
-
14
- ### Installation
15
-
16
- This resource is distributed along with InSpec itself. You can use it automatically.
17
-
18
- ### Version
19
-
20
- This resource first became available in v1.21.0 of InSpec.
21
-
22
- ## Syntax
23
-
24
- A `docker_container` resource block declares the configuration data to be tested:
25
-
26
- describe docker_container('container') do
27
- it { should exist }
28
- it { should be_running }
29
- its('id') { should_not eq '' }
30
- its('image') { should eq 'busybox:latest' }
31
- its('repo') { should eq 'busybox' }
32
- its('tag') { should eq 'latest' }
33
- its('ports') { should eq [] }
34
- its('command') { should eq 'nc -ll -p 1234 -e /bin/cat' }
35
- end
36
-
37
- <br>
38
-
39
- ## Resource Parameter Examples
40
-
41
- ### name
42
-
43
- The container name can also be passed with the `name` resource parameter:
44
-
45
- describe docker_container(name: 'an-echo-server') do
46
- it { should exist }
47
- it { should be_running }
48
- end
49
-
50
- ### id
51
-
52
- Alternatively, you can pass in the container id:
53
-
54
- describe docker_container(id: '71b5df59442b') do
55
- it { should exist }
56
- it { should be_running }
57
- end
58
-
59
- <br>
60
-
61
- ## Property Examples
62
-
63
- The following examples show how to use this InSpec resource.
64
-
65
- ### id
66
-
67
- The `id` property tests the container id:
68
-
69
- its('id') { should eq 'sha:71b5df59...442b' }
70
-
71
- ### repo
72
-
73
- The `repo` property tests the value of the image repository:
74
-
75
- its('repo') { should eq 'busybox' }
76
-
77
- ### tag
78
-
79
- The `tag` property tests the value of the image tag:
80
-
81
- its('tag') { should eq 'latest' }
82
-
83
- ### ports
84
-
85
- The `ports` property tests the value the Docker ports:
86
-
87
- its('ports') { should eq '0.0.0.0:1234->1234/tcp' }
88
-
89
- ### command
90
-
91
- The `command` property tests the value of the container run command:
92
-
93
- its('command') { should eq 'nc -ll -p 1234 -e /bin/cat' }
94
-
95
-
96
- ### Verify a running container:
97
-
98
- describe docker_container('an-echo-server') do
99
- it { should exist }
100
- it { should be_running }
101
- its('id') { should_not eq '' }
102
- its('image') { should eq 'busybox:latest' }
103
- its('repo') { should eq 'busybox' }
104
- its('tag') { should eq 'latest' }
105
- its('ports') { should eq [] }
106
- its('command') { should eq 'nc -ll -p 1234 -e /bin/cat' }
107
- end
108
-
109
- <br>
110
-
111
- ## Matchers
112
-
113
- For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
@@ -1,104 +0,0 @@
1
- ---
2
- title: About the docker_image Resource
3
- platform: linux
4
- ---
5
-
6
- # docker_image
7
-
8
- Use the `docker_image` InSpec audit resource to verify a Docker image.
9
-
10
- <br>
11
-
12
- ## Availability
13
-
14
- ### Installation
15
-
16
- This resource is distributed along with InSpec itself. You can use it automatically.
17
-
18
- ### Version
19
-
20
- This resource first became available in v1.21.0 of InSpec.
21
-
22
- ## Syntax
23
-
24
- A `docker_image` resource block declares the image:
25
-
26
- describe docker_image('alpine:latest') do
27
- it { should exist }
28
- its('id') { should eq 'sha256:4a415e...a526' }
29
- its('repo') { should eq 'alpine' }
30
- its('tag') { should eq 'latest' }
31
- end
32
-
33
- <br>
34
-
35
- ## Resource Parameter Examples
36
-
37
- The resource allows you to pass in an image id:
38
-
39
- describe docker_image(id: alpine_id) do
40
- ...
41
- end
42
-
43
- If the tag is missing for an image, `latest` is assumed as default:
44
-
45
- describe docker_image('alpine') do
46
- ...
47
- end
48
-
49
- You can also pass in repository and tag as separate values
50
-
51
- describe docker_image(repo: 'alpine', tag: 'latest') do
52
- ...
53
- end
54
-
55
- <br>
56
-
57
- ## Property Examples
58
-
59
- ### id
60
-
61
- The `id` property returns the full image id:
62
-
63
- its('id') { should eq 'sha256:4a415e3663882fbc554ee830889c68a33b3585503892cc718a4698e91ef2a526' }
64
-
65
- ### image
66
-
67
- The `image` property tests the value of the image. It is a combination of `repository/tag`:
68
-
69
- its('image') { should eq 'alpine:latest' }
70
-
71
- ### repo
72
-
73
- The `repo` property tests the value of the repository name:
74
-
75
- its('repo') { should eq 'alpine' }
76
-
77
- ### tag
78
-
79
- The `tag` property tests the value of image tag:
80
-
81
- its('tag') { should eq 'latest' }
82
-
83
- ### Test a Docker image
84
-
85
- describe docker_image('alpine:latest') do
86
- it { should exist }
87
- its('id') { should eq 'sha256:4a415e...a526' }
88
- its('image') { should eq 'alpine:latest' }
89
- its('repo') { should eq 'alpine' }
90
- its('tag') { should eq 'latest' }
91
- end
92
-
93
- <br>
94
-
95
- ## Matchers
96
-
97
- For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
98
-
99
- ### exist
100
-
101
- The `exist` matcher tests if the image is available on the node:
102
-
103
- it { should exist }
104
-
@@ -1,80 +0,0 @@
1
- ---
2
- title: About the docker_plugin Resource
3
- platform: linux
4
- ---
5
-
6
- # docker_plugin
7
-
8
- Use the `docker_plugin` InSpec audit resource to verify a Docker plugin.
9
-
10
- <br>
11
-
12
- ## Syntax
13
-
14
- A `docker_plugin` resource block declares the plugin:
15
-
16
- describe docker_plugin('rexray/ebs') do
17
- it { should exist }
18
- its('id') { should_not eq '0ac30b93ad40' }
19
- its('version') { should eq '0.11.1' }
20
- it { should be_enabled }
21
- end
22
-
23
- <br>
24
-
25
- ## Resource Parameter Examples
26
-
27
- The resource allows you to pass in an plugin id:
28
-
29
- describe docker_plugin(id: plugin_id) do
30
- it { should be_enabled }
31
- end
32
-
33
- <br>
34
-
35
- ## Properties
36
-
37
- ### id
38
-
39
- The `id` property returns the full plugin id:
40
-
41
- describe docker_plugin('cloudstor/aws') do
42
- its('id') { should eq '0ac30b93ad40' }
43
- end
44
-
45
- ### version
46
-
47
- The `version` property tests the value of plugin version:
48
-
49
- describe docker_plugin('cloudstor/aws') do
50
- its('version') { should eq '0.11.0' }
51
- end
52
-
53
- ## Examples
54
-
55
- ### Test a Docker plugin
56
-
57
- describe docker_plugin('rexray/ebs') do
58
- it { should exist }
59
- its('id') { should_not eq '0ac30b93ad40' }
60
- its('version') { should eq '0.11.1' }
61
- it { should be_enabled }
62
- end
63
-
64
- <br>
65
-
66
- ## Matchers
67
-
68
- For a full list of available matchers, please visit our [Universal Matchers](https://www.inspec.io/docs/reference/matchers/).
69
-
70
- ### exist
71
-
72
- The `exist` matcher tests if the plugin is available on the node:
73
-
74
- describe docker_plugin('rexray/ebs') do
75
- it { should exist }
76
- end
77
-
78
- ### enabled
79
-
80
- The `be_enabled` matches tests if the plugin is enabled
@@ -1,124 +0,0 @@
1
- ---
2
- title: About the docker_service Resource
3
- platform: linux
4
- ---
5
-
6
- # docker_service
7
-
8
- Use the `docker_service` InSpec audit resource to verify a docker swarm service.
9
-
10
- <br>
11
-
12
- ## Availability
13
-
14
- ### Installation
15
-
16
- This resource is distributed along with InSpec itself. You can use it automatically.
17
-
18
- ### Version
19
-
20
- This resource first became available in v1.51.0 of InSpec.
21
-
22
- ## Syntax
23
-
24
- A `docker_service` resource block declares the service by name:
25
-
26
- describe docker_service('foo') do
27
- it { should exist }
28
- its('id') { should eq '2ghswegspre1' }
29
- its('repo') { should eq 'alpine' }
30
- its('tag') { should eq 'latest' }
31
- end
32
-
33
- <br>
34
-
35
- ## Resource Parameter Examples
36
-
37
- The resource allows you to pass in a service id:
38
-
39
- describe docker_service(id: '2ghswegspre1') do
40
- ...
41
- end
42
-
43
- You can also pass in the fully-qualified image:
44
-
45
- describe docker_service(image: 'localhost:5000/alpine:latest') do
46
- ...
47
- end
48
-
49
- <br>
50
-
51
- ## Property Examples
52
-
53
- The following examples show how to use InSpec `docker_service` resource.
54
-
55
- ### id
56
-
57
- The `id` property returns the service id:
58
-
59
- its('id') { should eq '2ghswegspre1' }
60
-
61
- ### image
62
-
63
- The `image` property is a combination of `repository:tag` it tests the value of the image:
64
-
65
- its('image') { should eq 'alpine:latest' }
66
-
67
- ### mode
68
-
69
- The `mode` property tests the value of the service mode:
70
-
71
- its('mode') { should eq 'replicated' }
72
-
73
- ### name
74
-
75
- The `name` property tests the value of the service name:
76
-
77
- its('name') { should eq 'foo' }
78
-
79
- ### ports
80
-
81
- The `ports` property tests the value of the service's published ports:
82
-
83
- its('ports') { should include '*:8000->8000/tcp' }
84
-
85
- ### repo
86
-
87
- The `repo` property tests the value of the repository name:
88
-
89
- its('repo') { should eq 'alpine' }
90
-
91
- ### replicas
92
-
93
- The `replicas` property tests the value of the service's replica count:
94
-
95
- its('replicas') { should eq '3/3' }
96
-
97
- ### tag
98
-
99
- The `tag` property tests the value of image tag:
100
-
101
- its('tag') { should eq 'latest' }
102
-
103
- ### Test a docker service
104
-
105
- describe docker_service('foo') do
106
- it { should exist }
107
- its('id') { should eq '2ghswegspre1' }
108
- its('repo') { should eq 'alpine' }
109
- its('tag') { should eq 'latest' }
110
- end
111
-
112
- <br>
113
-
114
- ## Matchers
115
-
116
- For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
117
-
118
- ### exist
119
-
120
- The `exist` matcher tests if the image is available on the node:
121
-
122
- it { should exist }
123
-
124
-
@@ -1,252 +0,0 @@
1
- ---
2
- title: About the Elasticsearch Resource
3
- platform: linux
4
- ---
5
-
6
- # elasticsearch
7
-
8
- Use the `elasticsearch` resource to test the status of a node against a running
9
- Elasticsearch cluster. InSpec retrieves the node list from the cluster node URL
10
- provided (defaults to `http://localhost:9200`) and provides the ability to query
11
- a variety of settings and statuses.
12
-
13
- <br>
14
-
15
- ## Availability
16
-
17
- ### Installation
18
-
19
- This resource is distributed along with InSpec itself. You can use it automatically.
20
-
21
- ### Version
22
-
23
- This resource first became available in v1.43.5 of InSpec.
24
-
25
- ## Syntax
26
-
27
- describe elasticsearch do
28
- its('property') { should cmp 'value' }
29
- end
30
-
31
- <br>
32
-
33
- ## Supported Resource parameters
34
-
35
- The `elasticsearch` resource accepts a number of optional resource parameters:
36
-
37
- * `url`: the top-level URL of an Elasticsearch node in the cluster. If your Elasticsearch installation is not served out of the top-level directory at the host, be sure to specific the full URL; for example: `http://my-load-balancer/elasticsearch`. Default: `http://localhost:9200`
38
- * `username`: a username to use to log in with HTTP-Basic authentication. If `username` is provided, a `password` must also be provided.
39
- * `password`: a password to use to log in with HTTP-Basic authentication. If `password` is provided, a `username` must also be provided.
40
- * `ssl_verify`: if `false`, SSL certificate validation will be disabled. Default: `true`
41
-
42
- In addition, the `elasticsearch` resource allows for filtering the nodes returned by property before executing the tests:
43
-
44
- describe elasticsearch.where { node_name == 'one-off-node' } do
45
- its('version') { should eq '1.2.3' }
46
- end
47
-
48
- describe elasticsearch.where { process.mlockall == false } do
49
- its('count') { should cmp 0 }
50
- end
51
-
52
- To simply check if nodes exist that match the criteria, use the `exist` matcher:
53
-
54
- describe elasticsearch.where { cluster_name == 'my_cluster' } do
55
- it { should exist }
56
- end
57
-
58
- <br>
59
-
60
- ## Properties
61
-
62
- The following properties are provided:
63
-
64
- * build\_hash cluster\_name, host, http, ingest, ip, jvm, module\_list, modules, node\_name, node\_id, os, plugin\_list, plugins, process, roles, settings, total\_indexing\_buffer, transport, transport\_address, version
65
-
66
- Since the `elasticsearch` resource is meant for use on a cluster, each property will return an array of the values for each node that matches any provided search criteria. Using InSpec's `cmp` matcher helps avoid issues when comparing values when there is only a single match (i.e. when the cluster only contains a single node, or the `where` filter criteria provided only returns a single node).
67
-
68
- <br>
69
-
70
- ## Property Examples
71
-
72
- ### build_hash
73
-
74
- Returns the build hash for each of the nodes.
75
-
76
- describe elasticsearch do
77
- its('build_hash') { should cmp 'b2f0c09' }
78
- end
79
-
80
- ### cluster_name
81
-
82
- Returns the cluster names of each of the nodes.
83
-
84
- describe elasticsearch do
85
- its('cluster_name') { should cmp 'my_cluster' }
86
- end
87
-
88
- ### host
89
-
90
- Returns the hostname of each of the nodes. This may return an IP address, if the node is improperly performing DNS resolution or has no hostname set.
91
-
92
- describe elasticsearch do
93
- its('host') { should cmp 'my.hostname.mycompany.biz' }
94
- end
95
-
96
- ### http
97
-
98
- Returns a hash of HTTP-related settings for each of the nodes. In this example, the `first` method is used to grab only the first node's HTTP-related info and is a way of removing the item from the Array if only one node is being queried.
99
-
100
- describe elasticsearch do
101
- its('http.first.max_content_length_in_bytes') { should cmp 123456 }
102
- end
103
-
104
- ### ingest
105
-
106
- Returns ingest-related settings and capabilities, such as available processors.
107
-
108
- describe elasticsearch do
109
- its('ingest.first.processors.count') { should be >= 1 }
110
- end
111
-
112
- ### ip
113
-
114
- Returns the IP address of each of the nodes.
115
-
116
- describe elasticsearch do
117
- its('ip') { should cmp '192.168.1.100' }
118
- end
119
-
120
- ### jvm
121
-
122
- Returns Java Virtual Machine related parameters for each of the nodes.
123
-
124
- describe elasticsearch do
125
- its('jvm.first.version') { should cmp '1.8.0_141' }
126
- end
127
-
128
- ### module_list
129
-
130
- Returns a list of enabled modules for each node in the cluster. For more additional information about each module, use the `modules` property.
131
-
132
- describe elasticsearch do
133
- its('module_list.first') { should include 'my_module' }
134
- end
135
-
136
- ### modules
137
-
138
- Returns detailed information about each enabled module for each node in the cluster. For a succinct list of the names of each of the modules enabled, use the `module_list` property. This example uses additional Ruby to find a specific module and assert a value.
139
-
140
- modules = elasticsearch.modules.first
141
- lang_groovy_module = modules.find { |mod| mod.name == 'lang-groovy' }
142
-
143
- describe 'lang-groovy module version' do
144
- subject { lang_groovy_module }
145
- its('version') { should cmp '5.5.2' }
146
- end
147
-
148
- ### node_name
149
-
150
- Returns the node name for each node in the cluster.
151
-
152
- describe elasticsearch do
153
- its('node_name') { should cmp 'node1' }
154
- end
155
-
156
- ### node_id
157
-
158
- Returns the node IDs of each of the nodes in the cluster.
159
-
160
- describe elasticsearch do
161
- its('node_id') { should include 'my_node_id' }
162
- end
163
-
164
- ### os
165
-
166
- Returns OS-related information about each node in the cluster.
167
-
168
- describe elasticsearch do
169
- its('os.first.arch') { should cmp 'amd64' }
170
- end
171
-
172
- ### plugin_list
173
-
174
- Returns a list of enabled plugins for each node in the cluster. For more additional information about each plugin, use the `plugins` property.
175
-
176
- describe elasticsearch do
177
- its('plugin_list.first') { should include 'my_plugin' }
178
- end
179
-
180
- ### plugins
181
-
182
- Returns detailed information about each enabled plugin for each node in the cluster. For a succinct list of the names of each of the plugins enabled, use the `plugin_list` property. This example uses additional Ruby to find a specific plugin and assert a value.
183
-
184
- plugins = elasticsearch.plugins.first
185
- my_plugin = plugins.find { |plugin| plugin.name == 'my_plugin' }
186
-
187
- describe 'my_plugin plugin version' do
188
- subject { my_plugin }
189
- its('version') { should cmp '1.2.3' }
190
- end
191
-
192
- ### process
193
-
194
- Returns process information for each node in the cluster, such as the process ID.
195
-
196
- describe elasticsearch do
197
- its('process.first.mlockall') { should cmp true }
198
- end
199
-
200
- ### roles
201
-
202
- Returns the role for each of the nodes in the cluster.
203
-
204
- describe elasticsearch.where { node_name == 'my_master_node' } do
205
- it { should include 'master' }
206
- end
207
-
208
- ### settings
209
-
210
- Returns all the configuration settings for each node in the cluster. These settings usually include those set in the elasticsearch.yml as well as those set via `-Des.` or `-E` flags at startup. Use the `inspec shell` to explore the various setting keys that are available.
211
-
212
- describe elasticsearch do
213
- its('settings.first.path.home') { should cmp '/usr/share/elasticsearch' }
214
- end
215
-
216
- ### total_indexing_buffer
217
-
218
- Returns the total indexing buffer for each node in the cluster.
219
-
220
- describe elasticsearch do
221
- its('total_indexing_buffer') { should cmp 123456 }
222
- end
223
-
224
- ### transport
225
-
226
- Returns transport-related settings for each node in the cluster, such as the bound and published addresses.
227
-
228
- describe elasticsearch do
229
- its('transport.first.bound_address') { should cmp '1.2.3.4:9200' }
230
- end
231
-
232
- ### transport_address
233
-
234
- Returns the bound transport address for each node in the cluster.
235
-
236
- describe elasticsearch do
237
- its('transport_address') { should cmp '1.2.3.4:9200' }
238
- end
239
-
240
- ### version
241
-
242
- Returns the version of Elasticsearch running on each node of the cluster.
243
-
244
- describe elasticsearch do
245
- its('version') { should cmp '5.5.2' }
246
- end
247
-
248
- <br>
249
-
250
- ## Matchers
251
-
252
- For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).