inspec 2.0.17 → 2.0.32

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,21 +25,9 @@ A `dh_params` resource block declares a parameter file to be tested.
25
25
 
26
26
  <br>
27
27
 
28
- ## Resource Parameter Examples
29
-
30
- ### dh_params?
31
-
32
- Verify whether file contains DH parameters:
33
-
34
- describe dh_params('/path/to/file.dh_pem') do
35
- it { should be_dh_params }
36
- end
37
-
38
- <br>
39
-
40
28
  ## Properties
41
29
 
42
- generator, modulus, prime_length, pem, text
30
+ * `generator`, `modulus`, `prime_length`, `pem`, `text`
43
31
 
44
32
  <br>
45
33
 
@@ -5,7 +5,7 @@ platform: linux
5
5
 
6
6
  # docker
7
7
 
8
- Use the `docker` InSpec audit resource to test configuration data for docker daemon. It is a very comprehensive resource. Please have a look at [docker_container](docker_container) and [docker_image](docker_image), too.
8
+ Use the `docker` InSpec audit resource to test configuration data for the Docker daemon. It is a very comprehensive resource. See also: [docker_container](docker_container) and [docker_image](docker_image), too.
9
9
 
10
10
  <br>
11
11
 
@@ -25,8 +25,8 @@ or:
25
25
 
26
26
  where
27
27
 
28
- * `.where()` may specify a specific item and value, to which the matchers are compared
29
- * `commands`, `ids`, `images`, `labels`, `local_volumes`, `mounts`, `names`, `networks`, `ports`, `sizes` and `'status'` are valid matchers for `containers`
28
+ * `.where()` may specify a specific item and value, to which the resource parameters are compared
29
+ * `commands`, `ids`, `images`, `labels`, `local_volumes`, `mounts`, `names`, `networks`, `ports`, `sizes` and `status` are valid parameters for `containers`
30
30
 
31
31
  The `docker` resource block also declares allows you to write test for many images:
32
32
 
@@ -42,8 +42,7 @@ or if you want to query specific images:
42
42
 
43
43
  where
44
44
 
45
- * `.where()` may specify a specific item and value, to which the matchers are compared
46
- * `commands`, `ids`, `images`, `labels`, `local_volumes`, `mounts`, `names`, `networks`, `ports`, `sizes` and `'status'` are valid matchers for `containers`
45
+ * `.where()` may specify a specific filter and expected value, against which parameters are compared
47
46
 
48
47
  <br>
49
48
 
@@ -69,7 +68,7 @@ The following examples show how to use this InSpec audit resource.
69
68
  ### Iterate over all containers to verify host coniguration
70
69
 
71
70
  docker.containers.ids.each do |id|
72
- # call docker inspect for a specific container id
71
+ # call Docker inspect for a specific container id
73
72
  describe docker.object(id) do
74
73
  its(%w(HostConfig Privileged)) { should cmp false }
75
74
  its(%w(HostConfig Privileged)) { should_not cmp true }
@@ -90,7 +89,9 @@ The following examples show how to use this InSpec audit resource.
90
89
  its(%w(Config Healthcheck)) { should_not eq nil }
91
90
  end
92
91
 
93
- ### Run the DevSec docker baseline profile
92
+ <br>
93
+
94
+ ## How to run the DevSec Docker baseline profile
94
95
 
95
96
  There are two ways to run the `docker-baseline` profile to test Docker via the `docker` resource.
96
97
 
@@ -108,13 +109,17 @@ Or execute the profile directly via URL:
108
109
 
109
110
  <br>
110
111
 
111
- ## Matchers
112
+ ## Resource Parameters
112
113
 
113
- For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
114
+ * `commands`, `ids`, `images`, `labels`, `local_volumes`, `mounts`, `names`, `networks`, `ports`, `sizes` and `status` are valid parameters for `containers`
115
+
116
+ <br>
117
+
118
+ ## Resource Parameter Examples
114
119
 
115
120
  ### containers
116
121
 
117
- `containers` returns information about containers as returned by [docker ps -a](https://docs.docker.com/engine/reference/commandline/ps/). You can determine specific information about
122
+ `containers` returns information about containers as returned by [docker ps -a](https://docs.docker.com/engine/reference/commandline/ps/).
118
123
 
119
124
  describe docker.containers do
120
125
  its('ids') { should include 'sha:71b5df59...442b' }
@@ -124,10 +129,17 @@ For a full list of available matchers, please visit our [matchers page](https://
124
129
  its('labels') { should include 'License=GPLv2,Vendor=CentOS' }
125
130
  end
126
131
 
132
+ ### object('id')
133
+
134
+ `object` returns low-level information about Docker objects. It is calling [docker inspect](https://docs.docker.com/engine/reference/commandline/info/) under the hood.
135
+
136
+ describe docker.object(id) do
137
+ its('Configuration.Path') { should eq 'value' }
138
+ end
127
139
 
128
140
  ### images
129
141
 
130
- `images` returns information about docker image as returned by [docker images](https://docs.docker.com/engine/reference/commandline/images/). You can determine specific information about
142
+ `images` returns information about Docker image as returned by [docker images](https://docs.docker.com/engine/reference/commandline/images/).
131
143
 
132
144
  describe docker.images do
133
145
  its('ids') { should include 'sha:12b5df59...442b' }
@@ -136,6 +148,14 @@ For a full list of available matchers, please visit our [matchers page](https://
136
148
  its('sizes') { should_not include "1.41 GB" }
137
149
  end
138
150
 
151
+ ### info
152
+
153
+ `info` returns the parsed result of [docker info](https://docs.docker.com/engine/reference/commandline/info/)
154
+
155
+ describe docker.info do
156
+ its('Configuration.Path') { should eq 'value' }
157
+ end
158
+
139
159
  ### version
140
160
 
141
161
  `info` returns the parsed result of [docker version](https://docs.docker.com/engine/reference/commandline/version/)
@@ -145,20 +165,55 @@ For a full list of available matchers, please visit our [matchers page](https://
145
165
  its('Client.Version') { should cmp >= '1.12'}
146
166
  end
147
167
 
168
+ <br>
148
169
 
149
- ### info
170
+ ## Properties
150
171
 
151
- `info` returns the parsed result of [docker info](https://docs.docker.com/engine/reference/commandline/info/)
172
+ * `id`, `image`, `repo`, `tag`, `ports`, `command`
152
173
 
153
- describe docker.info do
154
- its('Configuration.Path') { should eq 'value' }
174
+ <br>
175
+
176
+ ## Property Examples
177
+
178
+ ### id
179
+
180
+ describe docker_container(name: 'an-echo-server') do
181
+ its('id') { should_not eq '' }
155
182
  end
156
183
 
184
+ ### image
157
185
 
158
- ### object('id')
186
+ describe docker_container(name: 'an-echo-server') do
187
+ its('image') { should eq 'busybox:latest' }
188
+ end
159
189
 
160
- `object` returns low-level information about docker objects. It is calling [docker inspect](https://docs.docker.com/engine/reference/commandline/info/) under the hood.
190
+ ### repo
161
191
 
162
- describe docker.object(id) do
163
- its('Configuration.Path') { should eq 'value' }
192
+ describe docker_container(name: 'an-echo-server') do
193
+ its('repo') { should eq 'busybox' }
194
+ end
195
+
196
+ ### tag
197
+
198
+ describe docker_container(name: 'an-echo-server') do
199
+ its('tag') { should eq 'latest' }
200
+ end
201
+
202
+ ### ports
203
+
204
+ describe docker_container(name: 'an-echo-server') do
205
+ its('ports') { should eq "0.0.0.0:1234->1234/tcp" }
206
+ end
207
+
208
+ ### command
209
+
210
+ describe docker_container(name: 'an-echo-server') do
211
+ its('command') { should eq 'nc -ll -p 1234 -e /bin/cat' }
164
212
  end
213
+
214
+ <br>
215
+
216
+ ## Matchers
217
+
218
+ For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
219
+
@@ -28,10 +28,24 @@ where
28
28
 
29
29
  <br>
30
30
 
31
- ## Examples
31
+ ## Resource Properties
32
+
33
+ * `connection`, `ipaddress`, `protocol`, `socket`
34
+
35
+ <br>
36
+
37
+ ## Resource Examples
32
38
 
33
39
  The following examples show how to use this InSpec audit resource.
34
40
 
41
+ ### ipaddress
42
+
43
+ The `ipaddress` matcher tests if a host name is resolvable to a specific IP address:
44
+
45
+ describe host('example.com') do
46
+ its('ipaddress') { should include '93.184.216.34' }
47
+ end
48
+
35
49
  ### Verify host name is reachable over a specific protocol and port number
36
50
 
37
51
  describe host('example.com', port: 80, protocol: 'tcp') do
@@ -42,7 +56,7 @@ The following examples show how to use this InSpec audit resource.
42
56
 
43
57
  describe host('example.com') do
44
58
  it { should be_resolvable }
45
- its('ipaddress') { should include '192.168.1.1' }
59
+ its('ipaddress') { should include '93.184.216.34' }
46
60
  end
47
61
 
48
62
  ### Review the connection setup and socket contents when checking reachability
@@ -57,7 +71,7 @@ The following examples show how to use this InSpec audit resource.
57
71
 
58
72
  ## Matchers
59
73
 
60
- For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
74
+ This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
61
75
 
62
76
  ### be_reachable
63
77
 
@@ -70,9 +84,3 @@ The `be_reachable` matcher tests if the host name is available:
70
84
  The `be_resolvable` matcher tests for host name resolution, i.e. "resolvable to an IP address":
71
85
 
72
86
  it { should be_resolvable }
73
-
74
- ### ipaddress
75
-
76
- The `ipaddress` matcher tests if a host name is resolvable to a specific IP address:
77
-
78
- its('ipaddress') { should include '93.184.216.34' }
@@ -33,6 +33,33 @@ where
33
33
 
34
34
  <br>
35
35
 
36
+ ## Example
37
+
38
+ The following examples show how to use this InSpec audit resource. An `http` resource block declares the configuration settings to be tested:
39
+
40
+ ### Simple http test
41
+
42
+ For example, a service is listening on default http port can be tested like this:
43
+
44
+ describe http('http://localhost') do
45
+ its('status') { should cmp 200 }
46
+ end
47
+
48
+ ### Complex http test
49
+
50
+ describe http('http://localhost:8080/ping',
51
+ auth: {user: 'user', pass: 'test'},
52
+ params: {format: 'html'},
53
+ method: 'POST',
54
+ headers: {'Content-Type' => 'application/json'},
55
+ data: '{"data":{"a":"1","b":"five"}}') do
56
+ its('status') { should cmp 200 }
57
+ its('body') { should cmp 'pong' }
58
+ its('headers.Content-Type') { should cmp 'text/html' }
59
+ end
60
+
61
+ <br>
62
+
36
63
  ## Local vs. Remote
37
64
 
38
65
  Beginning with InSpec 1.41, you can enable the ability to have the HTTP test execute on the remote target:
@@ -45,39 +72,102 @@ In InSpec 2.0, the HTTP test will automatically execute remotely whenever InSpec
45
72
 
46
73
  <br>
47
74
 
48
- ## Properties
75
+ ## Parameters
49
76
 
50
- body, headers, http_method, status,
77
+ * `url`, `auth`, `params`, `method`, `headers`, `data`, `open_timeout`, `read_timeout`, `ssl_verify`
51
78
 
52
- <br>
79
+ ## Parameter Examples
53
80
 
54
- ## Property Examples
81
+ ### url
55
82
 
56
- The following examples show how to use this InSpec audit resource.
83
+ `('url')` is the url to test.
57
84
 
58
- ### Simple http test
85
+ describe http('http://localhost:8080/ping') do
86
+ ...
87
+ end
59
88
 
60
- For example, a service is listening on default http port can be tested like this:
89
+ ### auth
61
90
 
62
- describe http('http://localhost') do
63
- its('status') { should cmp 200 }
91
+ `auth: { user: 'user', pass: 'test' }` may be specified for basic auth request.
92
+
93
+ describe http('http://localhost:8080/ping',
94
+ auth: {user: 'user', pass: 'test'}) do
95
+ ...
64
96
  end
65
97
 
66
- ### Complex http test
98
+ ### params
99
+
100
+ `{params}` may be specified for http request parameters.
67
101
 
68
102
  describe http('http://localhost:8080/ping',
69
- auth: {user: 'user', pass: 'test'},
70
- params: {format: 'html'},
71
- method: 'POST',
72
- headers: {'Content-Type' => 'application/json'},
103
+ params: {format: 'html'}) do
104
+ ...
105
+ end
106
+
107
+ ### method
108
+
109
+ `'method'` may be specified for http request method (default to 'GET').
110
+
111
+ describe http('http://localhost:8080/ping',
112
+ method: 'POST') do
113
+ ...
114
+ end
115
+
116
+ ### headers
117
+
118
+ `{headers}` may be specified for http request headers.
119
+
120
+ describe http('http://localhost:8080/ping',
121
+ headers: {'Content-Type' => 'application/json'}) do
122
+ ...
123
+ end
124
+
125
+ ### data
126
+
127
+ `data` may be specified for http request body.
128
+
129
+ describe http('http://localhost:8080/ping',
73
130
  data: '{"data":{"a":"1","b":"five"}}') do
74
- its('status') { should cmp 200 }
75
- its('body') { should cmp 'pong' }
76
- its('headers.Content-Type') { should cmp 'text/html' }
131
+ ...
132
+ end
133
+
134
+ ### open_timeout
135
+
136
+ `open_timeout` may be specified for a timeout for opening connections (default to 60).
137
+
138
+ describe('http://localhost:8080/ping',
139
+ open_timeout: '90') do
140
+ ...
141
+ end
142
+
143
+ ### read_timeout
144
+
145
+ `read_timeout` may be specified for a timeout for reading connections (default to 60).
146
+
147
+ describe('http://localhost:8080/ping',
148
+ read_timeout: '90') do
149
+ ...
77
150
  end
78
151
 
152
+ ### ssl_verify
153
+
154
+ `ssl_verify` may be specified to enable or disable verification of SSL certificates (default to `true`).
155
+
156
+ describe('http://localhost:8080/ping',
157
+ ssl_verify: 'true') do
158
+ ...
159
+ end
160
+
161
+ <br>
162
+
163
+ ## Properties
164
+
165
+ * `body`, `headers`, `http_method`, `status`,
166
+
79
167
  <br>
80
168
 
169
+ ## Property Examples
170
+
81
171
  ### body
82
172
 
83
173
  The `body` matcher tests body content of http response:
@@ -99,3 +189,9 @@ Individual headers can be tested via:
99
189
  The `status` matcher tests status of the http response:
100
190
 
101
191
  its('status') { should eq 200 }
192
+
193
+ <br>
194
+
195
+ ## Matchers
196
+
197
+ For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
@@ -43,6 +43,12 @@ where
43
43
 
44
44
  The following examples show how to use this InSpec audit resource.
45
45
 
46
+ ### name
47
+
48
+ The `name` matcher tests the value of the filename as read from a JSON file versus the value declared in the test:
49
+
50
+ its('name') { should eq '/tmp/example.json' }
51
+
46
52
  ### Test a cookbook version in a policyfile.lock.json file
47
53
 
48
54
  describe json('policyfile.lock.json') do
@@ -55,8 +61,3 @@ The following examples show how to use this InSpec audit resource.
55
61
 
56
62
  For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
57
63
 
58
- ### name
59
-
60
- The `name` matcher tests the value of `name` as read from a JSON file versus the value declared in the test:
61
-
62
- its('name') { should eq 'foo' }
@@ -18,7 +18,7 @@ method.
18
18
  ## Syntax
19
19
 
20
20
  A `kernel_module` resource block declares a module name, and then tests if that
21
- module is a loadable kernel module, if it is enabled, disabled or if it is
21
+ module is a loaded kernel module, if it is enabled, disabled or if it is
22
22
  blacklisted:
23
23
 
24
24
  describe kernel_module('module_name') do
@@ -30,7 +30,7 @@ blacklisted:
30
30
  where
31
31
 
32
32
  * `'module_name'` must specify a kernel module, such as `'bridge'`
33
- * `{ should be_loaded }` tests if the module is a loadable kernel module
33
+ * `{ should be_loaded }` tests if the module is a loaded kernel module
34
34
  * `{ should be_blacklisted }` tests if the module is blacklisted or if the module is disabled via a fake install using /bin/false or /bin/true
35
35
  * `{ should be_disabled }` tests if the module is disabled via a fake install using /bin/false or /bin/true
36
36
 
@@ -40,14 +40,20 @@ where
40
40
 
41
41
  The following examples show how to use this InSpec audit resource.
42
42
 
43
- ### Test a modules 'version'
43
+ ### version
44
+
45
+ The `version` property tests if the kernel module on the system has the correct version:
46
+
47
+ its('version') { should eq '3.2.2' }
48
+
49
+ ### Test a kernel module's 'version'
44
50
 
45
51
  describe kernel_module('bridge') do
46
52
  it { should be_loaded }
47
- its(:version) { should cmp >= '2.2.2' }
53
+ its('version') { should cmp >= '2.2.2' }
48
54
  end
49
55
 
50
- ### Test if a module is loaded, not disabled and not blacklisted
56
+ ### Test if a kernel module is loaded, not disabled, and not blacklisted
51
57
 
52
58
  describe kernel_module('video') do
53
59
  it { should be_loaded }
@@ -55,34 +61,34 @@ The following examples show how to use this InSpec audit resource.
55
61
  it { should_not be_blacklisted }
56
62
  end
57
63
 
58
- ### Check if a module is blacklisted
64
+ ### Check if a kernel module is blacklisted
59
65
 
60
66
  describe kernel_module('floppy') do
61
67
  it { should be_blacklisted }
62
68
  end
63
69
 
64
- ### Ensure a module is *not* blacklisted and it is loaded
70
+ ### Check if a kernel module is *not* blacklisted and is loaded
65
71
 
66
72
  describe kernel_module('video') do
67
73
  it { should_not be_blacklisted }
68
74
  it { should be_loaded }
69
75
  end
70
76
 
71
- ### Ensure a module is disabled via 'bin_false'
77
+ ### Check if a kernel module is disabled via 'bin_false'
72
78
 
73
79
  describe kernel_module('sstfb') do
74
80
  it { should_not be_loaded }
75
81
  it { should be_disabled }
76
82
  end
77
83
 
78
- ### Ensure a module is 'blacklisted'/'disabled' via 'bin_true'
84
+ ### Check if a kernel module is 'blacklisted'/'disabled' via 'bin_true'
79
85
 
80
86
  describe kernel_module('nvidiafb') do
81
87
  it { should_not be_loaded }
82
88
  it { should be_blacklisted }
83
89
  end
84
90
 
85
- ### Ensure a module is not loaded
91
+ ### Check if a kernel module is not loaded
86
92
 
87
93
  describe kernel_module('dhcp') do
88
94
  it { should_not be_loaded }
@@ -94,14 +100,21 @@ The following examples show how to use this InSpec audit resource.
94
100
 
95
101
  For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
96
102
 
97
- ### be_loaded
98
103
 
99
- The `be_loaded` matcher tests if the module is a loadable kernel module:
104
+ ### be_blacklisted
100
105
 
101
- it { should be_loaded }
106
+ The `be_blacklisted` matcher tests if the kernel module is a blacklisted module:
102
107
 
103
- ### version
108
+ it { should be_blacklisted }
104
109
 
105
- The `version` matcher tests if the named module version is on the system:
110
+ ### be_disabled
106
111
 
107
- its(:version) { should eq '3.2.2' }
112
+ The `be_disabled` matcher tests if the kernel module is disabled:
113
+
114
+ it { should be_disabled }
115
+
116
+ ### be_loaded
117
+
118
+ The `be_loaded` matcher tests if the kernel module is loaded:
119
+
120
+ it { should be_loaded }
data/docs/shell.md CHANGED
@@ -26,7 +26,7 @@ $ inspec help shell # This will describe inspec shell usage
26
26
 
27
27
  If you wish to connect to a remote machine (called a target within
28
28
  InSpec), you can use the `-t` flag. We support connecting using ssh,
29
- WinRm and docker. If no target is provided, we implicitly support the
29
+ WinRm and Docker. If no target is provided, we implicitly support the
30
30
  "local" target - i.e. tests running on the current machine running
31
31
  InSpec. For an ssh connection, use `-i` for specifying ssh key files,
32
32
  and the `--sudo*` commands for requesting a privilege escalation after
@@ -37,20 +37,17 @@ path, `--ssl` to use SSL for transport layer encryption.
37
37
  $ inspec shell -t ssh://root@192.168.64.2:11022 # Login to remote machine using ssh as root.
38
38
  $ inspec shell -t ssh://user@hostname:1234 -i /path/to/user_key # Login to hostname on port 1234 as user using given ssh key.
39
39
  $ inspec shell -t winrm://UserName:Password@windowsmachine:1234 # Login to windowsmachine over WinRM as UserName.
40
- $ inspec shell -t docker://container_id # Login to a docker container.
40
+ $ inspec shell -t docker://container_id # Login to a Docker container.
41
41
  ```
42
42
 
43
- ## Resource packs
43
+ ## Resource Packs
44
44
 
45
- The InSpec shell may use additional keywords provided in resource packs.
46
- A resource pack is a profile that defines new language terms that can
47
- be used in InSpec. For example, the profile in `examples/profile` in
48
- the InSpec git repo defines a `gordon_config` resource. To use these
49
- resources with the InSpec shell, you will need to download and specify
50
- them as a dependency.
45
+ Use resource packs to share custom resources with other InSpec users.
46
+ A resource pack is an InSpec profile that contains only custom resources and no other controls or tests.
51
47
 
52
- To use the `gordon_config` resource that is provided in the `examples/profile`
53
- in the InSpec repo you can run the following:
48
+ For example, the profile in [`examples/profile`](https://github.com/chef/inspec/tree/master/examples/profile)in the InSpec git repo defines a [`gordon_config` resource](https://github.com/chef/inspec/blob/master/examples/profile/controls/gordon.rb). To use these resources within the InSpec shell, you will need to download and specify them as a dependency.
49
+
50
+ Once you have local access to the profile, you can use the `gordon_config` custom resource provided in the `examples/profile` GitHub repo in your local environment :
54
51
 
55
52
  ```bash
56
53
  inspec shell --depends examples/profile
@@ -97,12 +94,12 @@ $ inspec shell
97
94
  Welcome to the interactive InSpec Shell
98
95
  To find out how to use it, type: help
99
96
 
100
- inspec> file('/Users/ksubramanian').directory?
97
+ inspec> file('/Users/myuser').directory?
101
98
  => true
102
99
  inspec> os_env('HOME')
103
100
  => Environment variable HOME
104
101
  inspec> os_env('HOME').content
105
- => /Users/ksubramanian
102
+ => /Users/myuser
106
103
  inspec> exit
107
104
  ```
108
105
 
@@ -126,10 +123,10 @@ replaced with the redefinition and the control is re-run.
126
123
  ```bash
127
124
  inspec> control 'my_control' do
128
125
  inspec> describe os_env('HOME') do
129
- inspec> its('content') { should eq '/Users/ksubramanian' }
126
+ inspec> its('content') { should eq '/Users/myuser' }
130
127
  inspec> end
131
128
  inspec> end
132
- ✔ my_control: Environment variable HOME content should eq "/Users/ksubramanian"
129
+ ✔ my_control: Environment variable HOME content should eq "/Users/myuser"
133
130
 
134
131
  Summary: 1 successful, 0 failures, 0 skipped
135
132
  ```
@@ -158,15 +155,61 @@ If you wish to run a single InSpec command and fetch its results, you
158
155
  may use the `-c` flag. This is similar to using `bash -c`.
159
156
 
160
157
  ```bash
161
- $ inspec shell -c 'describe file("/Users/ksubramanian") do it { should exist } end'}
158
+ $ inspec shell -c 'describe file("/Users/myuser") do it { should exist } end'
162
159
  Target: local://
163
160
 
164
- ✔ File /Users/ksubramanian should exist
161
+ ✔ File /Users/myuser should exist
165
162
 
166
163
  Summary: 1 successful, 0 failures, 0 skipped
167
164
  ```
168
165
 
169
166
  ```bash
170
- $ inspec shell --format json -c 'describe file("/Users/ksubramanian") do it { should exist } end'
171
- {"version":"0.30.0","profiles":{"":{"supports":[],"controls":{"(generated from in_memory.rb:1 5aab65c33fb1f133d9244017958eef64)":{"title":null,"desc":null,"impact":0.5,"refs":[],"tags":{},"code":" rule = rule_class.new(id, profile_id, {}) do\n res = describe(*args, &block)\n end\n","source_location":{"ref":"/Users/ksubramanian/repo/chef/inspec/lib/inspec/profile_context.rb","line":184},"results":[{"status":"passed","code_desc":"File /Users/ksubramanian should exist","run_time":0.000747,"start_time":"2016-08-16 11:41:40 -0400"}]}},"groups":{"in_memory.rb":{"title":null,"controls":["(generated from in_memory.rb:1 5aab65c33fb1f133d9244017958eef64)"]}},"attributes":[]}},"other_checks":[],"summary":{"duration":0.001078,"example_count":1,"failure_count":0,"skip_count":0}}}
167
+ $ inspec shell --format json -c 'describe file("/Users/test") do it { should exist } end'
168
+ {
169
+ "version": "1.49.2",
170
+ "controls": [{
171
+ "status": "passed",
172
+ "code_desc": "File /Users/test should exist",
173
+ "run_time": 0.002374,
174
+ "start_time": "2018-01-06 18:32:38 -0500"
175
+ }],
176
+ "other_checks": [],
177
+ "profiles": [{
178
+ "name": "inspec-shell",
179
+ "supports": [],
180
+ "controls": [{
181
+ "title": null,
182
+ "desc": null,
183
+ "impact": 0.5,
184
+ "refs": [],
185
+ "tags": {},
186
+ "code": "",
187
+ "source_location": {
188
+ "ref": "/usr/local/lib/ruby/gems/2.4.0/gems/inspec-1.49.2/lib/inspec/control_eval_context.rb",
189
+ "line": 89
190
+ },
191
+ "id": "(generated from (eval):1 7b6f82c2cc5e4205b3e2c97c8e855f2d)",
192
+ "results": [{
193
+ "status": "passed",
194
+ "code_desc": "File /Users/test should exist",
195
+ "run_time": 0.002374,
196
+ "start_time": "2018-01-06 18:32:38 -0500"
197
+ }]
198
+ }],
199
+ "groups": [{
200
+ "title": null,
201
+ "controls": ["(generated from (eval):1 7b6f82c2cc5e4205b3e2c97c8e855f2d)"],
202
+ "id": "unknown"
203
+ }],
204
+ "attributes": [],
205
+ "sha256": "29c070a90b7e3521babf618215573284a790d92907783d5b2c138f411bfd2e74"
206
+ }],
207
+ "platform": {
208
+ "name": "mac_os_x",
209
+ "release": "17.3.0"
210
+ },
211
+ "statistics": {
212
+ "duration": 0.003171
213
+ }
214
+ }
172
215
  ```