inspec 2.2.35 → 2.2.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -10
- data/README.md +7 -5
- data/bin/inspec +0 -0
- data/docs/dsl_inspec.md +35 -39
- data/docs/glossary.md +15 -15
- data/docs/habitat.md +10 -9
- data/docs/inspec_and_friends.md +4 -4
- data/docs/matchers.md +1 -9
- data/docs/plugin_kitchen_inspec.md +34 -24
- data/docs/profiles.md +217 -156
- data/docs/reporters.md +13 -4
- data/docs/resources/command.md.erb +28 -0
- data/docs/resources/registry_key.md.erb +5 -2
- data/docs/resources/xinetd_conf.md.erb +1 -1
- data/docs/ruby_usage.md +4 -3
- data/lib/bundles/inspec-init.rb +4 -0
- data/lib/bundles/inspec-init/cli.rb +9 -72
- data/lib/bundles/inspec-init/renderer.rb +79 -0
- data/lib/inspec/base_cli.rb +25 -12
- data/lib/inspec/objects/describe.rb +8 -1
- data/lib/inspec/plugins/resource.rb +2 -2
- data/lib/inspec/version.rb +1 -1
- data/lib/resources/command.rb +17 -2
- data/lib/resources/package.rb +26 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d55e24934410cb4a4eca689c5125ba03a5dbe18711856fdeb8e6aaafbcaf7b3
|
4
|
+
data.tar.gz: 6571c1a3d486c2b20e6a1ba706ccca8f143872ba504e408e3c311cc4a36f3fcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 540657cfc1af9cbcf611b5c7346a2b14a138b033bb94ba7272042f772cc4fa7ec6691b91d14b2f50b1618488699f2658d72198bfe5a187adef68622977dc8515
|
7
|
+
data.tar.gz: 33faa8dd7576c7914e4419956440e7e74faa4bb476d5a3607952767244a1d73ca27ba1d7e655065f6438f51075ccdc9776c5edc67c8e3dda3110aa83ed0b4240
|
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,32 @@
|
|
1
1
|
# Change Log
|
2
2
|
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
|
3
|
-
<!-- latest_release
|
4
|
-
## [v2.2.35](https://github.com/inspec/inspec/tree/v2.2.35) (2018-07-09)
|
5
|
-
|
6
|
-
#### New Features
|
7
|
-
- A number of bug fixes and new features for oracledb_session resource [#3170](https://github.com/inspec/inspec/pull/3170) ([voroniys](https://github.com/voroniys))
|
3
|
+
<!-- latest_release -->
|
8
4
|
<!-- latest_release -->
|
9
5
|
|
10
|
-
<!-- release_rollup
|
11
|
-
|
6
|
+
<!-- release_rollup -->
|
7
|
+
<!-- release_rollup -->
|
8
|
+
|
9
|
+
<!-- latest_stable_release -->
|
10
|
+
## [v2.2.41](https://github.com/inspec/inspec/tree/v2.2.41) (2018-07-20)
|
12
11
|
|
13
12
|
#### New Features
|
14
|
-
-
|
15
|
-
|
13
|
+
- command resource: Allow redacting `#to_s` [#3207](https://github.com/inspec/inspec/pull/3207) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
|
14
|
+
- Add Alpine package provider [#3215](https://github.com/inspec/inspec/pull/3215) ([damacus](https://github.com/damacus))
|
16
15
|
|
16
|
+
#### Enhancements
|
17
|
+
- Refactor 'inspec init profile' into a reusable component. [#3214](https://github.com/inspec/inspec/pull/3214) ([clintoncwolfe](https://github.com/clintoncwolfe))
|
18
|
+
- Ensure resources fail that target something that isn't supported [#3231](https://github.com/inspec/inspec/pull/3231) ([miah](https://github.com/miah))
|
19
|
+
|
20
|
+
#### Merged Pull Requests
|
21
|
+
- docs: Fix formatting/style on InSpec DSL page [#3201](https://github.com/inspec/inspec/pull/3201) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
|
22
|
+
- Update hab package to use psql client [#3234](https://github.com/inspec/inspec/pull/3234) ([jquick](https://github.com/jquick))
|
17
23
|
<!-- latest_stable_release -->
|
24
|
+
|
25
|
+
## [v2.2.35](https://github.com/inspec/inspec/tree/v2.2.35) (2018-07-12)
|
26
|
+
|
27
|
+
#### New Features
|
28
|
+
- A number of bug fixes and new features for oracledb_session resource [#3170](https://github.com/inspec/inspec/pull/3170) ([voroniys](https://github.com/voroniys))
|
29
|
+
|
18
30
|
## [v2.2.34](https://github.com/inspec/inspec/tree/v2.2.34) (2018-07-05)
|
19
31
|
|
20
32
|
#### New Features
|
@@ -31,7 +43,6 @@
|
|
31
43
|
#### Merged Pull Requests
|
32
44
|
- Fix vendor functional test to not validate a repo hash that can change. [#3198](https://github.com/inspec/inspec/pull/3198) ([miah](https://github.com/miah))
|
33
45
|
- Prevent Slashes in profile names [#3175](https://github.com/inspec/inspec/pull/3175) ([miah](https://github.com/miah))
|
34
|
-
<!-- latest_stable_release -->
|
35
46
|
|
36
47
|
## [v2.2.27](https://github.com/inspec/inspec/tree/v2.2.27) (2018-06-29)
|
37
48
|
|
data/README.md
CHANGED
@@ -90,7 +90,7 @@ For Linux:
|
|
90
90
|
|
91
91
|
```
|
92
92
|
docker pull chef/inspec
|
93
|
-
function inspec { docker run -it --rm -v $(pwd):/share chef/inspec
|
93
|
+
function inspec { docker run -it --rm -v $(pwd):/share chef/inspec "$@"; }
|
94
94
|
```
|
95
95
|
|
96
96
|
For Windows (PowerShell):
|
@@ -352,11 +352,13 @@ The AWS resources were inspired by [inspec-aws](https://github.com/arothian/insp
|
|
352
352
|
1. Push to the branch (git push origin my-new-feature)
|
353
353
|
1. Create new Pull Request
|
354
354
|
|
355
|
-
|
356
355
|
The InSpec community and maintainers are very active and helpful. This project benefits greatly from this activity.
|
357
356
|
|
358
|
-
[
|
357
|
+
If you'd like to chat with the community and maintainers directly join us in the `#inspec` channel on the [Chef Community Slack](http://community-slack.chef.io/).
|
358
|
+
|
359
|
+
As a reminder, all participants are expected to follow the [Code of Conduct](https://github.com/inspec/inspec/blob/master/CODE_OF_CONDUCT.md).
|
359
360
|
|
361
|
+
[![Slack](https://community-slack.chef.io/badge.svg)](https://community-slack.chef.io/)
|
360
362
|
|
361
363
|
## Testing InSpec
|
362
364
|
|
@@ -450,5 +452,5 @@ Unless required by applicable law or agreed to in writing, software
|
|
450
452
|
distributed under the License is distributed on an "AS IS" BASIS,
|
451
453
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
452
454
|
See the License for the specific language governing permissions and
|
453
|
-
limitations under the License.
|
454
|
-
|
455
|
+
limitations under the License.
|
456
|
+
|
data/bin/inspec
CHANGED
File without changes
|
data/docs/dsl_inspec.md
CHANGED
@@ -16,7 +16,7 @@ The following resource tests |ssh| server configuration. For example, a simple c
|
|
16
16
|
|
17
17
|
```ruby
|
18
18
|
describe sshd_config do
|
19
|
-
its('Port') { should
|
19
|
+
its('Port') { should cmp 22 }
|
20
20
|
end
|
21
21
|
```
|
22
22
|
|
@@ -27,15 +27,15 @@ control 'sshd-8' do
|
|
27
27
|
impact 0.6
|
28
28
|
title 'Server: Configure the service port'
|
29
29
|
desc '
|
30
|
-
|
31
|
-
|
30
|
+
Always specify which port the SSH server should listen to.
|
31
|
+
Prevent unexpected settings.
|
32
32
|
'
|
33
33
|
tag 'ssh','sshd','openssh-server'
|
34
34
|
tag cce: 'CCE-27072-8'
|
35
35
|
ref 'NSA-RH6-STIG - Section 3.5.2.1', url: 'https://www.nsa.gov/ia/_files/os/redhat/rhel5-guide-i731.pdf'
|
36
36
|
|
37
37
|
describe sshd_config do
|
38
|
-
|
38
|
+
its('Port') { should cmp 22 }
|
39
39
|
end
|
40
40
|
end
|
41
41
|
```
|
@@ -45,15 +45,14 @@ where
|
|
45
45
|
* `'sshd-8'` is the name of the control
|
46
46
|
* `impact`, `title`, and `desc` define metadata that fully describes the importance of the control, its purpose, with a succinct and complete description
|
47
47
|
* `impact` is an float that measures the importance of the compliance results and must be a value between `0.0` and `1.0`. The value ranges are:
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
* `0.0 to <0.4` these are controls with minor criticality
|
49
|
+
* `0.4 to <0.7` these are controls with major criticality
|
50
|
+
* `0.7 to 1.0` these are critical controls
|
51
51
|
* `tag` is optional meta-information with with key or key-value pairs
|
52
52
|
* `ref` is a reference to an external document
|
53
53
|
* `describe` is a block that contains at least one test. A `control` block must contain at least one `describe` block, but may contain as many as required
|
54
54
|
* `sshd_config` is an InSpec resource. For the full list of InSpec resources, see InSpec resource documentation
|
55
|
-
* `its('Port')` is the matcher; `{ should eq
|
56
|
-
|
55
|
+
* `its('Port')` is the matcher; `{ should eq '22' }` is the test. A `describe` block must contain at least one matcher, but may contain as many as required
|
57
56
|
|
58
57
|
## Advanced concepts
|
59
58
|
|
@@ -62,22 +61,22 @@ With InSpec it is possible to check if at least one of a collection of checks is
|
|
62
61
|
```ruby
|
63
62
|
describe.one do
|
64
63
|
describe ConfigurationA do
|
65
|
-
|
64
|
+
its('setting_1') { should eq true }
|
66
65
|
end
|
67
66
|
|
68
67
|
describe ConfigurationB do
|
69
|
-
|
68
|
+
its('setting_2') { should eq true }
|
70
69
|
end
|
71
70
|
end
|
72
71
|
```
|
73
72
|
|
74
|
-
|
73
|
+
### Sensitive resources
|
75
74
|
|
76
75
|
In some scenarios, you may be writing checks involving resources with sensitive content (e.g. a file resource). In the case of failures, it may be desired to suppress output. This can be done by adding the `:sensitive` flag to the resource definition
|
77
76
|
|
78
77
|
```ruby
|
79
78
|
describe file('/tmp/mysecretfile'), :sensitive do
|
80
|
-
its('content') { should
|
79
|
+
its('content') { should match /secret_info/ }
|
81
80
|
end
|
82
81
|
```
|
83
82
|
|
@@ -95,12 +94,12 @@ control 'windows-account-102' do
|
|
95
94
|
title 'Windows Password Complexity is Enabled'
|
96
95
|
desc 'Password must meet complexity requirement'
|
97
96
|
describe security_policy do
|
98
|
-
its('PasswordComplexity') { should
|
97
|
+
its('PasswordComplexity') { should cmp 1 }
|
99
98
|
end
|
100
99
|
end
|
101
100
|
```
|
102
101
|
|
103
|
-
##
|
102
|
+
## Test if PostgreSQL passwords are empty
|
104
103
|
|
105
104
|
The following test shows how to audit machines running PostgreSQL to ensure that passwords are not empty.
|
106
105
|
|
@@ -109,12 +108,12 @@ control 'postgres-7' do
|
|
109
108
|
impact 1.0
|
110
109
|
title "Don't allow empty passwords"
|
111
110
|
describe postgres_session('user', 'pass').query("SELECT * FROM pg_shadow WHERE passwd IS NULL;") do
|
112
|
-
|
111
|
+
its('output') { should cmp '' }
|
113
112
|
end
|
114
113
|
end
|
115
114
|
```
|
116
115
|
|
117
|
-
##
|
116
|
+
## Test if MySQL passwords are in ENV
|
118
117
|
|
119
118
|
The following test shows how to audit machines running MySQL to ensure that passwords are not stored in `ENV`:
|
120
119
|
|
@@ -123,16 +122,16 @@ control 'mysql-3' do
|
|
123
122
|
impact 1.0
|
124
123
|
title 'Do not store your MySQL password in your ENV'
|
125
124
|
desc '
|
126
|
-
|
127
|
-
|
125
|
+
Storing credentials in your ENV may easily expose
|
126
|
+
them to an attacker. Prevent this at all costs.
|
128
127
|
'
|
129
128
|
describe command('env') do
|
130
|
-
|
129
|
+
its('stdout') { should_not match /^MYSQL_PWD=/ }
|
131
130
|
end
|
132
131
|
end
|
133
132
|
```
|
134
133
|
|
135
|
-
##
|
134
|
+
## Test if `/etc/ssh` is a Directory
|
136
135
|
|
137
136
|
The following test shows how to audit machines to ensure that `/etc/ssh` is a directory:
|
138
137
|
|
@@ -141,16 +140,16 @@ control 'basic-1' do
|
|
141
140
|
impact 1.0
|
142
141
|
title '/etc/ssh should be a directory'
|
143
142
|
desc '
|
144
|
-
|
145
|
-
|
143
|
+
In order for OpenSSH to function correctly, its
|
144
|
+
configuration path must be a folder.
|
146
145
|
'
|
147
146
|
describe file('/etc/ssh') do
|
148
|
-
|
147
|
+
it { should be_directory }
|
149
148
|
end
|
150
149
|
end
|
151
150
|
```
|
152
151
|
|
153
|
-
##
|
152
|
+
## Test if Apache running
|
154
153
|
|
155
154
|
The following test shows how to audit machines to ensure that Apache is enabled and running:
|
156
155
|
|
@@ -159,13 +158,13 @@ control 'apache-1' do
|
|
159
158
|
impact 0.3
|
160
159
|
title 'Apache2 should be configured and running'
|
161
160
|
describe service(apache.service) do
|
162
|
-
|
163
|
-
|
161
|
+
it { should be_enabled }
|
162
|
+
it { should be_running }
|
164
163
|
end
|
165
164
|
end
|
166
165
|
```
|
167
166
|
|
168
|
-
##
|
167
|
+
## Test if insecure packages are installed
|
169
168
|
|
170
169
|
The following test shows how to audit machines for insecure packages:
|
171
170
|
|
@@ -173,11 +172,9 @@ The following test shows how to audit machines for insecure packages:
|
|
173
172
|
control 'cis-os-services-5.1.3' do
|
174
173
|
impact 0.7
|
175
174
|
title '5.1.3 Ensure rsh client is not installed'
|
176
|
-
|
177
175
|
describe package('rsh') do
|
178
176
|
it { should_not be_installed }
|
179
177
|
end
|
180
|
-
|
181
178
|
describe package('rsh-redone-client') do
|
182
179
|
it { should_not be_installed }
|
183
180
|
end
|
@@ -213,12 +210,10 @@ control 'nutcracker-connect-redis-001' do
|
|
213
210
|
title 'Check if nutcracker can pass commands to redis'
|
214
211
|
desc 'execute redis-cli set key command, to check connectivity of the service'
|
215
212
|
|
216
|
-
only_if
|
217
|
-
command('redis-cli').exist?
|
218
|
-
end
|
213
|
+
only_if { command('redis-cli').exist? }
|
219
214
|
|
220
215
|
describe command('redis-cli SET test_inspec "HELLO"') do
|
221
|
-
its(
|
216
|
+
its('stdout') { should match /OK/ }
|
222
217
|
end
|
223
218
|
end
|
224
219
|
```
|
@@ -227,7 +222,6 @@ Mixing this with other conditionals (like checking existence of the files etc.)
|
|
227
222
|
|
228
223
|
## Additional metadata for controls
|
229
224
|
|
230
|
-
|
231
225
|
The following example illustrates various ways to add tags and references to `control`
|
232
226
|
|
233
227
|
```ruby
|
@@ -235,9 +229,11 @@ control 'ssh-1' do
|
|
235
229
|
impact 1.0
|
236
230
|
|
237
231
|
title 'Allow only SSH Protocol 2'
|
238
|
-
desc '
|
239
|
-
|
240
|
-
|
232
|
+
desc '
|
233
|
+
Only SSH protocol version 2 connections should be permitted.
|
234
|
+
The default setting in /etc/ssh/sshd_config is correct, and can be
|
235
|
+
verified by ensuring that the following line appears: Protocol 2
|
236
|
+
'
|
241
237
|
|
242
238
|
tag 'production','development'
|
243
239
|
tag 'ssh','sshd','openssh-server'
|
@@ -252,7 +248,7 @@ control 'ssh-1' do
|
|
252
248
|
ref 'http://people.redhat.com/swells/scap-security-guide/RHEL/6/output/ssg-centos6-guide-C2S.html'
|
253
249
|
|
254
250
|
describe ssh_config do
|
255
|
-
its
|
251
|
+
its('Protocol') { should cmp 2 }
|
256
252
|
end
|
257
253
|
end
|
258
254
|
```
|
data/docs/glossary.md
CHANGED
@@ -11,7 +11,7 @@ There are two ways to use it:
|
|
11
11
|
|
12
12
|
### Motivating Example
|
13
13
|
|
14
|
-
Suppose we are interested in auditing cars. Let's suppose we have two InSpec resources for auditing: `cars`, which
|
14
|
+
Suppose we are interested in auditing cars. Let's suppose we have two InSpec resources for auditing: `cars`, which searches for and filters groups of cars, and `car`, which performs detailed auditing of a single car.
|
15
15
|
|
16
16
|
### Basic Syntax
|
17
17
|
|
@@ -134,7 +134,7 @@ A [resource](#resource) that is _not_ included with InSpec. It may be a resource
|
|
134
134
|
|
135
135
|
The _`describe`_ keyword is used with a _`describe block`_ to refer to an InSpec resource. You use the `describe` keyword along with the name of a [resource](#resource) to enclose related [tests](#test) that apply to the resource. Multiple describe blocks are usually grouped together in a [control](#control), but you can also use them outside of a control.
|
136
136
|
|
137
|
-
```
|
137
|
+
```Ruby
|
138
138
|
control 'Rule 1.1 - Color restrictions' do
|
139
139
|
# Count only blue cars
|
140
140
|
describe cars.where(color: 'blue') do
|
@@ -155,7 +155,7 @@ When using a [matcher](#matcher), the _`expected result`_ is the value the match
|
|
155
155
|
|
156
156
|
In this example, the [`cmp`](https://www.inspec.io/docs/reference/matchers/#cmp) matcher is being used to compare the `color` property to the expected result 'black'.
|
157
157
|
|
158
|
-
```
|
158
|
+
```Ruby
|
159
159
|
describe car(owner: 'Bruce Wayne') do
|
160
160
|
its('color') { should cmp 'black' }
|
161
161
|
end
|
@@ -169,7 +169,7 @@ A filter statement may use method call syntax (which allows basic criteria opera
|
|
169
169
|
|
170
170
|
In this example, `where(...)` is the filter statement.
|
171
171
|
|
172
|
-
```
|
172
|
+
```Ruby
|
173
173
|
# Count only blue cars
|
174
174
|
describe cars.where(color: 'blue') do
|
175
175
|
its('count') { should eq 20 }
|
@@ -186,7 +186,7 @@ When method-call syntax is used with the filter statement, you provide filter cr
|
|
186
186
|
|
187
187
|
Here, `(color: blue)` is a single filter criterion being used with a filter statement in method-call syntax.
|
188
188
|
|
189
|
-
```
|
189
|
+
```Ruby
|
190
190
|
# Count only blue cars
|
191
191
|
describe cars.where(color: 'blue') do
|
192
192
|
its('count') { should eq 20 }
|
@@ -197,7 +197,7 @@ When block-method syntax is used with the filter statement, you provide a block.
|
|
197
197
|
|
198
198
|
Here, `{ engine_cylinders >= 6 }` is a block-syntax filter statement referring to one filter criterion.
|
199
199
|
|
200
|
-
```
|
200
|
+
```Ruby
|
201
201
|
# Vroom!
|
202
202
|
describe cars.where { engine_cylinders >= 6 } do
|
203
203
|
its('city_mpg_ratings') { should_not include '4-star' }
|
@@ -212,7 +212,7 @@ Within a [describe block](#describe), _`it`_ declares an individual [test](#test
|
|
212
212
|
|
213
213
|
Here, `it { should ... }` declares a test, calling the `classy?` matcher on Tony Clifton's car.
|
214
214
|
|
215
|
-
```
|
215
|
+
```Ruby
|
216
216
|
describe car(owner: 'Tony Clifton') do
|
217
217
|
it { should be_classy }
|
218
218
|
end
|
@@ -228,7 +228,7 @@ The property to access is passed as a single string argument to `its`. As an adv
|
|
228
228
|
|
229
229
|
Here, `its('fuzzy_dice') { should ... }` declares a test, testing against the `fuzzy_dice` property of Tony Clifton's car. Let's assume - Tony being Tony - that `fuzzy_dice` will return an Array.
|
230
230
|
|
231
|
-
```
|
231
|
+
```Ruby
|
232
232
|
describe car(owner: 'Tony Clifton') do
|
233
233
|
its('fuzzy_dice') { should_not be_empty }
|
234
234
|
its('fuzzy_dice.count') { should be >= 2 }
|
@@ -249,7 +249,7 @@ For information on how RSpec matchers are related o InSpec matchers, see [InSpec
|
|
249
249
|
|
250
250
|
Here, `be_classy` is a resource-specific matcher operating directly on the `car`, while `cmp` is a universal matcher operating on the `manufacturer` property.
|
251
251
|
|
252
|
-
```
|
252
|
+
```Ruby
|
253
253
|
describe car(owner: 'Tony Clifton') do
|
254
254
|
it { should be_classy }
|
255
255
|
its('manufacturer') { should cmp 'Cadillac' }
|
@@ -266,7 +266,7 @@ Plural resources support [filter statements](#filter_statement). See the [resour
|
|
266
266
|
|
267
267
|
Here, `cars` is a plural resource.
|
268
268
|
|
269
|
-
```
|
269
|
+
```Ruby
|
270
270
|
describe cars.where(color: 'blue') do
|
271
271
|
its('count') { should eq 20 }
|
272
272
|
its('license_plates') { should include 'AUTOAZUL' }
|
@@ -296,7 +296,7 @@ Each resource has different properties. See the [resource documentation](https:/
|
|
296
296
|
|
297
297
|
Here, `manufacturer` is a property of the `car` resource.
|
298
298
|
|
299
|
-
```
|
299
|
+
```Ruby
|
300
300
|
describe car(owner: 'Tony Clifton') do
|
301
301
|
its('manufacturer') { should cmp 'Cadillac' }
|
302
302
|
end
|
@@ -316,7 +316,7 @@ Resources are used within a [describe block](#describe_block) to perform [tests]
|
|
316
316
|
|
317
317
|
Here, `car` is a resource.
|
318
318
|
|
319
|
-
```
|
319
|
+
```Ruby
|
320
320
|
describe car(owner: 'Tony Clifton') do
|
321
321
|
it { should be_classy }
|
322
322
|
end
|
@@ -334,7 +334,7 @@ Resource parameters vary from resource to resource; refer to the [resource docum
|
|
334
334
|
|
335
335
|
Here, `owner: 'Tony Clifton'` is a resource parameter.
|
336
336
|
|
337
|
-
```
|
337
|
+
```Ruby
|
338
338
|
describe car(owner: 'Tony Clifton') do
|
339
339
|
it { should be_classy }
|
340
340
|
end
|
@@ -348,7 +348,7 @@ Resource-specific matchers often provide highly customized behavior. Check the [
|
|
348
348
|
|
349
349
|
For example, the hypothetical `car` resource defines a `classy?` method, which is exposed as the `be_classy` matcher in InSpec tests.
|
350
350
|
|
351
|
-
```
|
351
|
+
```Ruby
|
352
352
|
describe car(owner: 'Tony Clifton') do
|
353
353
|
it { should be_classy }
|
354
354
|
end
|
@@ -374,7 +374,7 @@ Universal matchers are documented on the [Universal Matchers](https://www.inspec
|
|
374
374
|
|
375
375
|
Here, we access the 'color' property, then use the `cmp` universal matcher to compare the property to the 'black' [expected result](#expected_result).
|
376
376
|
|
377
|
-
```
|
377
|
+
```Ruby
|
378
378
|
describe car(owner: 'Bruce Wayne') do
|
379
379
|
its('color') { should cmp 'black' }
|
380
380
|
end
|
data/docs/habitat.md
CHANGED
@@ -6,7 +6,7 @@ title: InSpec Integration with Habitat
|
|
6
6
|
|
7
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
8
|
|
9
|
-
## What is Habitat
|
9
|
+
## What is Habitat
|
10
10
|
|
11
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
12
|
|
@@ -28,7 +28,7 @@ HAB_INSPEC_PROFILE_FRONTEND1="sleep_time = 60" hab start adamleff/inspec-profile
|
|
28
28
|
|
29
29
|
The Habitat Supervisor will display output like this:
|
30
30
|
|
31
|
-
```
|
31
|
+
```text
|
32
32
|
hab start adamleff/inspec-profile-frontend1
|
33
33
|
∵ Missing package for core/hab-sup/0.17.0
|
34
34
|
» Installing core/hab-sup/0.17.0
|
@@ -62,7 +62,7 @@ The above sample output shows the supervisor starting, downloading the necessary
|
|
62
62
|
|
63
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
64
|
|
65
|
-
```
|
65
|
+
```text
|
66
66
|
/hab/svc/inspec-profile-frontend1/var/inspec_results/inspec-profile-frontend1.json
|
67
67
|
```
|
68
68
|
|
@@ -74,13 +74,13 @@ Create a Habitat package for an InSpec profile. InSpec will validate the profile
|
|
74
74
|
|
75
75
|
The package file will be named:
|
76
76
|
|
77
|
-
```
|
77
|
+
```text
|
78
78
|
HABITAT_ORIGIN-inspec-profile-PROFILE_NAME-PROFILE_VERSION-BUILD_ID-x86_64-linux.hart
|
79
79
|
```
|
80
80
|
|
81
81
|
For example:
|
82
82
|
|
83
|
-
```
|
83
|
+
```text
|
84
84
|
adamleff-inspec-profile-frontend1-0.1.0-20170328173005-x86_64-linux.hart
|
85
85
|
```
|
86
86
|
|
@@ -104,13 +104,13 @@ The package can then be manually uploaded to a Habitat Depot or manually distrib
|
|
104
104
|
|
105
105
|
The package file will be named:
|
106
106
|
|
107
|
-
```
|
107
|
+
```text
|
108
108
|
HABITAT_ORIGIN-inspec-profile-PROFILE_NAME-PROFILE_VERSION-BUILD_ID-x86_64-linux.hart
|
109
109
|
```
|
110
110
|
|
111
111
|
For example:
|
112
112
|
|
113
|
-
```
|
113
|
+
```text
|
114
114
|
adamleff-inspec-profile-frontend1-0.1.0-20170328173005-x86_64-linux.hart
|
115
115
|
```
|
116
116
|
|
@@ -128,7 +128,7 @@ inspec habitat profile create ~/profiles/frontend1
|
|
128
128
|
|
129
129
|
#### Example Output
|
130
130
|
|
131
|
-
```
|
131
|
+
```text
|
132
132
|
$ habitat profile create ~/profiles/frontend1
|
133
133
|
[2017-03-28T13:29:32-04:00] INFO: Creating a Habitat artifact for profile: /Users/aleff/profiles/frontend1
|
134
134
|
[2017-03-28T13:29:32-04:00] INFO: Checking to see if Habitat is installed...
|
@@ -168,7 +168,8 @@ inspec habitat profile upload ~/profiles/frontend1
|
|
168
168
|
```
|
169
169
|
|
170
170
|
#### Example Output
|
171
|
-
|
171
|
+
|
172
|
+
```text
|
172
173
|
[2017-03-28T13:29:32-04:00] INFO: Creating a Habitat artifact for profile: /Users/aleff/profiles/frontend1
|
173
174
|
[2017-03-28T13:29:32-04:00] INFO: Checking to see if Habitat is installed...
|
174
175
|
[2017-03-28T13:29:32-04:00] INFO: Copying profile contents to the work directory...
|