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
data/docs/habitat.md DELETED
@@ -1,193 +0,0 @@
1
- ---
2
- title: InSpec Integration with Habitat
3
- ---
4
-
5
- # Habitat Integration
6
-
7
- InSpec provides an easy method to create an executable Habitat package for an InSpec profile. When run via the Habitat Supervisor, the package will run InSpec with your profile and write out its findings to a JSON file. This provides the ability to ship your compliance controls alongside your Habitat-packaged application and continuously run InSpec, providing you *Continuous Compliance.*
8
-
9
- ## What is Habitat
10
-
11
- Habitat by Chef is our new Application Automation tool that aims to make it easy, safe, and fast to build, deploy, and manage applications. From build dependencies, runtime dependencies, dynamic configuration, and service discovery (just to name a few), Habitat packages the automation with the application instead of relying on an underlying platform.
12
-
13
- To learn more about Habitat and try our demos and tutorials, visit [https://www.habitat.sh](https://www.habitat.sh).
14
-
15
- ## Using the Habitat Integration
16
-
17
- After creating a Habitat package for an InSpec profile (see CLI commands below) and uploading the package to a Habitat Depot or manually distributing to a host, start the Habitat Supervisor with your package:
18
-
19
- ```bash
20
- hab start adamleff/inspec-profile-frontend1
21
- ```
22
-
23
- The Habitat Supervisor will install InSpec and execute your profile in a loop. By default, the loop runs every 300 seconds but can be changed via the `sleep_time` configuration value:
24
-
25
- ```bash
26
- HAB_INSPEC_PROFILE_FRONTEND1="sleep_time = 60" hab start adamleff/inspec-profile-frontend1
27
- ```
28
-
29
- The Habitat Supervisor will display output like this:
30
-
31
- ```text
32
- hab start adamleff/inspec-profile-frontend1
33
- ∵ Missing package for core/hab-sup/0.17.0
34
- » Installing core/hab-sup/0.17.0
35
- ↓ Downloading core/hab-sup/0.17.0/20170214235450
36
- 1.68 MB / 1.68 MB - [=========================================================================] 100.00 % 7.43 MB/s
37
-
38
- ... more Habitat output here ...
39
-
40
- hab-sup(MN): Starting adamleff/inspec-profile-frontend1/0.1.0/20170328173005
41
- hab-sup(CS): adamleff/inspec-profile-frontend1/0.1.0/20170328173005 is not installed
42
- ↓ Downloading adamleff-20160617201047 public origin key
43
- 79 B / 79 B | [===============================================================================] 100.00 % 2.64 MB/s
44
- ☑ Cached adamleff-20160617201047 public origin key
45
- ↓ Downloading chef/inspec/1.17.0/20170321214949
46
- 16.93 MB / 16.93 MB / [======================================================================] 100.00 % 10.49 MB/s
47
-
48
- ... more Habitat output here ...
49
-
50
- ★ Install of adamleff/inspec-profile-frontend1/0.1.0/20170328173005 complete with 9 new packages installed.
51
- hab-sup(MR): Butterfly Member ID d9bd761e18c144469d755b1b97406eb2
52
- hab-sup(MR): Starting butterfly on 0.0.0.0:9638
53
- hab-sup(MR): Starting http-gateway on 0.0.0.0:9631
54
- inspec-profile-frontend1.default(SR): Initializing
55
- inspec-profile-frontend1.default(SV): Starting process as user=hab, group=hab
56
- inspec-profile-frontend1.default(O): Executing InSpec for adamleff/inspec-profile-frontend1
57
- inspec-profile-frontend1.default(O): InSpec run completed successfully.
58
- inspec-profile-frontend1.default(O): sleeping for 300 seconds
59
- ```
60
-
61
- The above sample output shows the supervisor starting, downloading the necessary dependencies for the supervisor and the InSpec profile, and then shows the supervisor running InSpec successfully.
62
-
63
- InSpec will write a JSON file in the `${svc_var_path}/inspec_results` directory containing the results of the last InSpec run. For example, for the `adamleff/inspec-profile-frontend1` package, the InSpec results will be at:
64
-
65
- ```text
66
- /hab/svc/inspec-profile-frontend1/var/inspec_results/inspec-profile-frontend1.json
67
- ```
68
-
69
- ## InSpec Habitat CLI Commands
70
-
71
- ### inspec habitat profile create
72
-
73
- Create a Habitat package for an InSpec profile. InSpec will validate the profile, fetch and vendor any dependencies (if necessary), and build the Habitat package with a dependency on the latest InSpec. The resulting package will be saved to the current working directory.
74
-
75
- The package file will be named:
76
-
77
- ```text
78
- HABITAT_ORIGIN-inspec-profile-PROFILE_NAME-PROFILE_VERSION-BUILD_ID-x86_64-linux.hart
79
- ```
80
-
81
- For example:
82
-
83
- ```text
84
- adamleff-inspec-profile-frontend1-0.1.0-20170328173005-x86_64-linux.hart
85
- ```
86
-
87
- #### Syntax
88
-
89
- ```bash
90
- inspec habitat profile create PROFILE_DIRECTORY
91
- ```
92
-
93
- Example:
94
-
95
- ```bash
96
- inspec habitat profile create ~/profiles/frontend1
97
- ```
98
-
99
- ### inspec habitat profile create
100
-
101
- Create a Habitat package for an InSpec profile. InSpec will validate the profile, fetch and vendor any dependencies (if necessary), and build the Habitat package with a dependency on the latest InSpec. The resulting package will be saved to the current working directory.
102
-
103
- The package can then be manually uploaded to a Habitat Depot or manually distributed to a host and installed via `hab pkg install`.
104
-
105
- The package file will be named:
106
-
107
- ```text
108
- HABITAT_ORIGIN-inspec-profile-PROFILE_NAME-PROFILE_VERSION-BUILD_ID-x86_64-linux.hart
109
- ```
110
-
111
- For example:
112
-
113
- ```text
114
- adamleff-inspec-profile-frontend1-0.1.0-20170328173005-x86_64-linux.hart
115
- ```
116
-
117
- #### Syntax
118
-
119
- ```bash
120
- inspec habitat profile create PROFILE_DIRECTORY
121
- ```
122
-
123
- #### Example
124
-
125
- ```bash
126
- inspec habitat profile create ~/profiles/frontend1
127
- ```
128
-
129
- #### Example Output
130
-
131
- ```text
132
- $ habitat profile create ~/profiles/frontend1
133
- [2017-03-28T13:29:32-04:00] INFO: Creating a Habitat artifact for profile: /Users/aleff/profiles/frontend1
134
- [2017-03-28T13:29:32-04:00] INFO: Checking to see if Habitat is installed...
135
- [2017-03-28T13:29:32-04:00] INFO: Copying profile contents to the work directory...
136
- [2017-03-28T13:29:32-04:00] INFO: Generating Habitat plan at /var/folders/v5/z54gb76j2rs3wrn65hmtyf1r0000gp/T/inspec-habitat-exporter20170328-4932-kg2ltd/habitat/plan.sh...
137
- [2017-03-28T13:29:32-04:00] INFO: Generating a Habitat run hook at /var/folders/v5/z54gb76j2rs3wrn65hmtyf1r0000gp/T/inspec-habitat-exporter20170328-4932-kg2ltd/habitat/hooks/run...
138
- [2017-03-28T13:29:32-04:00] INFO: Generating Habitat's default.toml configuration...
139
- [2017-03-28T13:29:32-04:00] INFO: Building our Habitat artifact...
140
- hab-studio: Destroying Studio at /hab/studios/src (default)
141
- hab-studio: Creating Studio at /hab/studios/src (default)
142
- hab-studio: Importing adamleff secret origin key
143
- » Importing origin key from standard input
144
- ★ Imported secret origin key adamleff-20160617201047.
145
- » Installing core/hab-backline
146
- ↓ Downloading core/hab-backline/0.19.0/20170311034116
147
- 2.17 KB / 2.17 KB / [=========================================================================] 100.00 % 4.33 MB/s
148
-
149
- ... more Habitat output here...
150
-
151
- [2017-03-28T13:30:18-04:00] INFO: Copying artifact to /Users/aleff...
152
- ```
153
-
154
- ### inspec habitat profile upload
155
-
156
- Create and then upload a Habitat package for an InSpec profile. Like the `inspec habitat profile create` command, InSpec will validate the profile, fetch and vendor any dependencies (if necessary), and build the Habitat package with a dependency on the latest InSpec. However, instead of saving the package locally to the workstation, InSpec will upload it to the depot defined in the `HAB_DEPOT` environment variable. If `HAB_DEPOT` is not defined, the package will be uploaded to the public Habitat depot at [https://app.habitat.sh](https://app.habitat.sh).
157
-
158
- #### Syntax
159
-
160
- ```bash
161
- inspec habitat profile upload PROFILE_DIRECTORY
162
- ```
163
-
164
- #### Example
165
-
166
- ```bash
167
- inspec habitat profile upload ~/profiles/frontend1
168
- ```
169
-
170
- #### Example Output
171
-
172
- ```text
173
- [2017-03-28T13:29:32-04:00] INFO: Creating a Habitat artifact for profile: /Users/aleff/profiles/frontend1
174
- [2017-03-28T13:29:32-04:00] INFO: Checking to see if Habitat is installed...
175
- [2017-03-28T13:29:32-04:00] INFO: Copying profile contents to the work directory...
176
- [2017-03-28T13:29:32-04:00] INFO: Generating Habitat plan at /var/folders/v5/z54gb76j2rs3wrn65hmtyf1r0000gp/T/inspec-habitat-exporter20170328-4932-kg2ltd/habitat/plan.sh...
177
- [2017-03-28T13:29:32-04:00] INFO: Generating a Habitat run hook at /var/folders/v5/z54gb76j2rs3wrn65hmtyf1r0000gp/T/inspec-habitat-exporter20170328-4932-kg2ltd/habitat/hooks/run...
178
- [2017-03-28T13:29:32-04:00] INFO: Generating Habitat's default.toml configuration...
179
- [2017-03-28T13:29:32-04:00] INFO: Building our Habitat artifact...
180
- hab-studio: Destroying Studio at /hab/studios/src (default)
181
- hab-studio: Creating Studio at /hab/studios/src (default)
182
- hab-studio: Importing adamleff secret origin key
183
- » Importing origin key from standard input
184
- ★ Imported secret origin key adamleff-20160617201047.
185
- » Installing core/hab-backline
186
- ↓ Downloading core/hab-backline/0.19.0/20170311034116
187
- 2.17 KB / 2.17 KB / [=========================================================================] 100.00 % 4.33 MB/s
188
-
189
- ... more Habitat output here...
190
-
191
- [2017-03-28T13:30:18-04:00] INFO: Uploading the Habitat artifact to our Depot...
192
- [2017-03-28T13:30:23-04:00] INFO: Upload complete!
193
- ```
@@ -1,114 +0,0 @@
1
- ---
2
- title: InSpec and friends
3
- ---
4
-
5
- # InSpec and friends
6
-
7
- This page looks at projects that are similar to InSpec to explain how they
8
- relate to each other.
9
-
10
- ## RSpec
11
-
12
- RSpec is an awesome framework that is widely used by software engineers to test
13
- Ruby code. It enables test-driven development (TDD) and helps developers to write
14
- better code every day.
15
-
16
- InSpec is built on top of RSpec and uses it as the underlying foundation
17
- to execute tests. It uses the key strengths of RSpec, easily execute
18
- tests and a DSL to write tests, but extends the functionality for use as
19
- compliance audits. InSpec ships with custom audit resources that make it
20
- easy to write audit checks and with the ability to run those checks on
21
- remote servers. These audit resources provided know the differences
22
- between operating systems and help you abstract from the local operating
23
- system, similar to other resources you might use in your Chef recipes.
24
-
25
- A complete InSpec rule looks like:
26
-
27
- ```ruby
28
- control "sshd-11" do
29
- impact 1.0
30
- title "Server: Set protocol version to SSHv2"
31
- desc "Set the SSH protocol version to 2. Don't use legacy
32
- insecure SSHv1 connections anymore."
33
- tag security: "level-1"
34
- tag "openssh-server"
35
- ref "Server Security Guide v.1.0", url: "http://..."
36
-
37
- describe sshd_config do
38
- its('Protocol') { should eq('2') }
39
- end
40
- end
41
- ```
42
-
43
- That said, InSpec is not RSpec. Some key differences:
44
-
45
- * In InSpec, `describe` blocks should not be nested; instead use `control` blocks to describe a higher-level grouping of tests.
46
- * The RSpec `shared_example` construct is not supported. Instead, create a simple custom resource that executes repetitious tasks.
47
- * InSpec is aimed at compliance practitioners and infrastructure testers, so our focus is providing a few, well-supported, easy-to-use [universal matchers](https://www.inspec.io/docs/reference/matchers/), such as `cmp`. In contrast, RSpec is a tool designed for software engineers. It thus supports a very large range of matchers, to enable testing of software engineering constructs such as exceptions, Object Oriented Programming relationships, and so on.
48
- * While InSpec uses parts of the RSpec project and codebase, it is a separate project from InSpec. Rspec's release schedule and feature set are beyond the control of the InSpec team. While it is possible to use many of the RSpec core features within InSpec profiles, InSpec can only guarantee that the features described at [docs.inspec.io](https://docs.inspec.io) will function correctly. Some RSpec core functionality may be removed in future versions of InSpec as needed to ensure stability in the InSpec project.
49
-
50
- ## Serverspec
51
-
52
- Serverspec is the first extension of RSpec that enabled
53
- users to run RSpec tests on servers to verify deployed artifacts. It was
54
- created in March 2013 by Gosuke Miyashita and has been widely adopted.
55
- It is also one of the core test frameworks within test-kitchen and has
56
- been widely used within the Chef ecosystem. InSpec takes lessons learned
57
- implementing and using Serverspec and builds on them to make auditing
58
- and compliance easier.
59
-
60
- Lessons learned from Serverspec include:
61
-
62
- * IT, compliance, and security professional require metadata beyond what Serverspec offers, such as criticality, to fully describe controls.
63
- * Setting up and running the same tests across multiple machines must be easy.
64
- * It must be easy to locate, debug, and extend operating system-dependent code.
65
- * It must be easy to extend the language and create custom resources.
66
- * It must run multiple tests simultaneously.
67
- * Support for Windows is a first-class requirement.
68
- * A command line interface (CLI) is required for faster iteration of test code.
69
-
70
- You can also watch this [podcast](http://foodfightshow.org/2016/02/inspec.html) to find out more on the relationship of InSpec and Serverspec.
71
-
72
- ### How is InSpec different from Serverspec
73
-
74
- One of the key differences is that InSpec targets more user groups. It
75
- is optimized for DevOps, Security, and Compliance professionals.
76
- Additional metadata, such as impact, title, and description, make it
77
- easier to fully describe the controls which makes it easier to share the
78
- controls with other departments. This enables Security departments to
79
- prioritize rules. DevOps teams use this information to focus on the most
80
- critical issues to remediate.
81
-
82
- ```ruby
83
- control "sshd-11" do
84
- impact 1.0
85
- title "Server: Set protocol version to SSHv2"
86
- desc "Set the SSH protocol version to 2. Don't use legacy
87
- insecure SSHv1 connections anymore."
88
- tag security: "level-1"
89
- tag "openssh-server"
90
- ref "Server Security Guide v.1.0" url: "http://..."
91
-
92
- describe sshd_config do
93
- its('Protocol') { should cmp 2 }
94
- end
95
- end
96
- ```
97
-
98
- **Why not fork Serverspec?**
99
-
100
- InSpec started as an extension of Serverspec. As the extension grew, it
101
- became clear that a new library was required. Creating and maintaining a
102
- fork was not practical so a new project was born.
103
-
104
- **Will InSpec only work on machines managed by Chef?**
105
-
106
- No, InSpec can be used on any machine. It doesn’t matter if that machine
107
- was configured by Chef or configured lovingly by the hands of your local
108
- System Administrator.
109
-
110
- **Is InSpec a replacement of Serverspec?**
111
-
112
- InSpec is intended to be a drop-in replacement of Serverspec. Popular
113
- Serverspec resources have been ported to InSpec. It changed some
114
- behaviour as documented in our migration guide.
data/docs/matchers.md DELETED
@@ -1,161 +0,0 @@
1
- ---
2
- title: InSpec Universal Matchers Reference
3
- ---
4
-
5
- # InSpec Universal Matchers Reference
6
-
7
- InSpec uses matchers to help compare resource values to expectations.
8
- The following matchers are available:
9
-
10
- You may also use any matcher provided by [RSpec::Expectations](https://relishapp.com/rspec/rspec-expectations/docs), but those matchers are outside of InSpec's [scope of support](https://www.inspec.io/docs/reference/inspec_and_friends/#rspec).
11
-
12
- The following InSpec-supported universal matchers are available:
13
-
14
- * [`be`](#be) - make numeric comparisons
15
- * [`be_in`](#be_in) - look for the property value in a list
16
- * [`cmp`](#cmp) - general-use equality (try this first)
17
- * [`eq`](#eq) - type-specific equality
18
- * [`include`](#include) - look for an expected value in a list-valued property
19
- * [`match`](#match) - look for patterns in text using regular expressions
20
-
21
- See [Explore InSpec resources](https://learn.chef.io/modules/explore-inspec-resources#/) on Learn Chef Rally to learn more about InSpec's built-in matchers.
22
-
23
- ## be
24
-
25
- This matcher can be followed by many different comparison operators.
26
- Always make sure to use numbers, not strings, for these comparisons.
27
-
28
- ```ruby
29
- describe file('/proc/cpuinfo') do
30
- its('size') { should be >= 10 }
31
- its('size') { should be < 1000 }
32
- end
33
- ```
34
-
35
- ## cmp
36
-
37
- Unlike `eq`, `cmp` is a matcher for less-restrictive comparisons. It will
38
- try to fit the actual value to the type you are comparing it to. This is
39
- meant to relieve the user from having to write type-casts and
40
- resolutions.
41
-
42
- ```ruby
43
- describe sshd_config do
44
- its('Protocol') { should cmp 2 }
45
- end
46
-
47
- describe passwd.uid(0) do
48
- its('users') { should cmp 'root' }
49
- end
50
- ```
51
-
52
- `cmp` behaves in the following way:
53
-
54
- * Compare strings to numbers
55
-
56
- ```ruby
57
- describe sshd_config do
58
- its('Protocol') { should eq '2' }
59
-
60
- its('Protocol') { should cmp '2' }
61
- its('Protocol') { should cmp 2 }
62
- end
63
- ```
64
-
65
- * String comparisons are not case-sensitive
66
-
67
- ```ruby
68
- describe auditd_conf do
69
- its('log_format') { should cmp 'raw' }
70
- its('log_format') { should cmp 'RAW' }
71
- end
72
- ```
73
-
74
- * Recognize versions embedded in strings
75
-
76
- ```ruby
77
- describe package(curl) do
78
- its('version') { should cmp > '7.35.0-1ubuntu2.10' }
79
- end
80
- ```
81
-
82
- * Compare arrays with only one entry to a value
83
-
84
- ```ruby
85
- describe passwd.uids(0) do
86
- its('users') { should cmp 'root' }
87
- its('users') { should cmp ['root'] }
88
- end
89
- ```
90
-
91
- * Single-value arrays of strings may also be compared to a regex
92
-
93
- ```ruby
94
- describe auditd_conf do
95
- its('log_format') { should cmp /raw/i }
96
- end
97
- ```
98
-
99
- * Improved printing of octal comparisons
100
-
101
- ```ruby
102
- describe file('/proc/cpuinfo') do
103
- its('mode') { should cmp '0345' }
104
- end
105
-
106
- expected: 0345
107
- got: 0444
108
- ```
109
-
110
- ## eq
111
-
112
- Test for exact equality of two values.
113
-
114
- ```ruby
115
- describe sshd_config do
116
- its('RSAAuthentication') { should_not eq 'no' }
117
- its('Protocol') { should eq '2' }
118
- end
119
- ```
120
-
121
- `eq` fails if types don't match. Please keep this in mind, when comparing
122
- configuration entries that are numbers:
123
-
124
- ```ruby
125
- its('Port') { should eq '22' } # ok
126
-
127
- its('Port') { should eq 22 }
128
- # fails: '2' != 2 (string vs int)
129
- ```
130
-
131
- For less restrictive comparisons, please use `cmp`.
132
-
133
- ## include
134
-
135
- Verifies if a value is included in a list.
136
-
137
- ```ruby
138
- describe passwd do
139
- its('users') { should include 'my_user' }
140
- end
141
- ```
142
-
143
- ## be_in
144
-
145
- Verifies that an item is included in a list.
146
-
147
- ```ruby
148
- describe resource do
149
- its('item') { should be_in LIST }
150
- end
151
- ```
152
-
153
- ## match
154
-
155
- Check if a string matches a regular expression.
156
-
157
- ```ruby
158
- describe sshd_config do
159
- its('Ciphers') { should_not match /cbc/ }
160
- end
161
- ```