inspec 2.2.112 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -2
- data/CHANGELOG.md +42 -19
- data/README.md +1 -1
- data/Rakefile +16 -3
- data/docs/dev/integration-testing.md +31 -0
- data/docs/dev/plugins.md +4 -2
- data/docs/dsl_inspec.md +104 -4
- data/docs/plugins.md +57 -0
- data/docs/resources/aws_ebs_volume.md.erb +76 -0
- data/docs/resources/aws_ebs_volumes.md.erb +86 -0
- data/docs/style.md +178 -0
- data/examples/plugins/inspec-resource-lister/Gemfile +12 -0
- data/examples/plugins/inspec-resource-lister/LICENSE +13 -0
- data/examples/plugins/inspec-resource-lister/README.md +62 -0
- data/examples/plugins/inspec-resource-lister/Rakefile +40 -0
- data/examples/plugins/inspec-resource-lister/inspec-resource-lister.gemspec +45 -0
- data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister.rb +16 -0
- data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/cli_command.rb +70 -0
- data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/plugin.rb +55 -0
- data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/version.rb +10 -0
- data/examples/plugins/inspec-resource-lister/test/fixtures/README.md +24 -0
- data/examples/plugins/inspec-resource-lister/test/functional/README.md +18 -0
- data/examples/plugins/inspec-resource-lister/test/functional/inspec_resource_lister_test.rb +110 -0
- data/examples/plugins/inspec-resource-lister/test/helper.rb +26 -0
- data/examples/plugins/inspec-resource-lister/test/unit/README.md +17 -0
- data/examples/plugins/inspec-resource-lister/test/unit/cli_args_test.rb +64 -0
- data/examples/plugins/inspec-resource-lister/test/unit/plugin_def_test.rb +51 -0
- data/examples/profile/controls/example.rb +9 -8
- data/inspec.gemspec +2 -1
- data/lib/inspec/attribute_registry.rb +1 -1
- data/lib/inspec/globals.rb +4 -0
- data/lib/inspec/objects/control.rb +18 -3
- data/lib/inspec/plugin/v2.rb +14 -3
- data/lib/inspec/plugin/v2/activator.rb +7 -2
- data/lib/inspec/plugin/v2/installer.rb +426 -0
- data/lib/inspec/plugin/v2/loader.rb +137 -30
- data/lib/inspec/plugin/v2/registry.rb +13 -4
- data/lib/inspec/profile.rb +2 -1
- data/lib/inspec/reporters/json.rb +11 -1
- data/lib/inspec/resource.rb +6 -15
- data/lib/inspec/rule.rb +18 -9
- data/lib/inspec/runner_rspec.rb +1 -1
- data/lib/inspec/schema.rb +1 -0
- data/lib/inspec/version.rb +1 -1
- data/lib/plugins/inspec-plugin-manager-cli/README.md +6 -0
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb +18 -0
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +420 -0
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb +12 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/config_dirs/empty/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette.rb +2 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-wrong-structure/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name.rb +1 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb +651 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb +71 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb +20 -0
- data/lib/plugins/shared/core_plugin_test_helper.rb +101 -2
- data/lib/plugins/things-for-train-integration.rb +14 -0
- data/lib/resource_support/aws.rb +2 -0
- data/lib/resources/aws/aws_ebs_volume.rb +122 -0
- data/lib/resources/aws/aws_ebs_volumes.rb +63 -0
- data/lib/resources/port.rb +10 -6
- metadata +56 -11
- data/docs/ruby_usage.md +0 -204
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Richter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: train
|
@@ -16,20 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 1.4.37
|
19
|
+
version: '1.5'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '1.
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 1.4.37
|
26
|
+
version: '1.5'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: thor
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -308,6 +302,20 @@ dependencies:
|
|
308
302
|
- - ">="
|
309
303
|
- !ruby/object:Gem::Version
|
310
304
|
version: '0'
|
305
|
+
- !ruby/object:Gem::Dependency
|
306
|
+
name: term-ansicolor
|
307
|
+
requirement: !ruby/object:Gem::Requirement
|
308
|
+
requirements:
|
309
|
+
- - ">="
|
310
|
+
- !ruby/object:Gem::Version
|
311
|
+
version: '0'
|
312
|
+
type: :runtime
|
313
|
+
prerelease: false
|
314
|
+
version_requirements: !ruby/object:Gem::Requirement
|
315
|
+
requirements:
|
316
|
+
- - ">="
|
317
|
+
- !ruby/object:Gem::Version
|
318
|
+
version: '0'
|
311
319
|
description: InSpec provides a framework for creating end-to-end infrastructure tests.
|
312
320
|
You can use it for integration or even compliance testing. Create fully portable
|
313
321
|
test profiles and use them in your workflow to ensure stability and security. Integrate
|
@@ -333,6 +341,7 @@ files:
|
|
333
341
|
- docs/dev/control-eval.md
|
334
342
|
- docs/dev/filtertable-internals.md
|
335
343
|
- docs/dev/filtertable-usage.md
|
344
|
+
- docs/dev/integration-testing.md
|
336
345
|
- docs/dev/plugins.md
|
337
346
|
- docs/dsl_inspec.md
|
338
347
|
- docs/dsl_resource.md
|
@@ -343,6 +352,7 @@ files:
|
|
343
352
|
- docs/migration.md
|
344
353
|
- docs/platforms.md
|
345
354
|
- docs/plugin_kitchen_inspec.md
|
355
|
+
- docs/plugins.md
|
346
356
|
- docs/profiles.md
|
347
357
|
- docs/reporters.md
|
348
358
|
- docs/resources/aide_conf.md.erb
|
@@ -358,6 +368,8 @@ files:
|
|
358
368
|
- docs/resources/aws_cloudwatch_log_metric_filter.md.erb
|
359
369
|
- docs/resources/aws_config_delivery_channel.md.erb
|
360
370
|
- docs/resources/aws_config_recorder.md.erb
|
371
|
+
- docs/resources/aws_ebs_volume.md.erb
|
372
|
+
- docs/resources/aws_ebs_volumes.md.erb
|
361
373
|
- docs/resources/aws_ec2_instance.md.erb
|
362
374
|
- docs/resources/aws_ec2_instances.md.erb
|
363
375
|
- docs/resources/aws_elb.md.erb
|
@@ -492,13 +504,13 @@ files:
|
|
492
504
|
- docs/resources/yum.md.erb
|
493
505
|
- docs/resources/zfs_dataset.md.erb
|
494
506
|
- docs/resources/zfs_pool.md.erb
|
495
|
-
- docs/ruby_usage.md
|
496
507
|
- docs/shared/matcher_be.md.erb
|
497
508
|
- docs/shared/matcher_cmp.md.erb
|
498
509
|
- docs/shared/matcher_eq.md.erb
|
499
510
|
- docs/shared/matcher_include.md.erb
|
500
511
|
- docs/shared/matcher_match.md.erb
|
501
512
|
- docs/shell.md
|
513
|
+
- docs/style.md
|
502
514
|
- examples/README.md
|
503
515
|
- examples/custom-resource/README.md
|
504
516
|
- examples/custom-resource/controls/example.rb
|
@@ -534,6 +546,22 @@ files:
|
|
534
546
|
- examples/meta-profile/README.md
|
535
547
|
- examples/meta-profile/controls/example.rb
|
536
548
|
- examples/meta-profile/inspec.yml
|
549
|
+
- examples/plugins/inspec-resource-lister/Gemfile
|
550
|
+
- examples/plugins/inspec-resource-lister/LICENSE
|
551
|
+
- examples/plugins/inspec-resource-lister/README.md
|
552
|
+
- examples/plugins/inspec-resource-lister/Rakefile
|
553
|
+
- examples/plugins/inspec-resource-lister/inspec-resource-lister.gemspec
|
554
|
+
- examples/plugins/inspec-resource-lister/lib/inspec-resource-lister.rb
|
555
|
+
- examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/cli_command.rb
|
556
|
+
- examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/plugin.rb
|
557
|
+
- examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/version.rb
|
558
|
+
- examples/plugins/inspec-resource-lister/test/fixtures/README.md
|
559
|
+
- examples/plugins/inspec-resource-lister/test/functional/README.md
|
560
|
+
- examples/plugins/inspec-resource-lister/test/functional/inspec_resource_lister_test.rb
|
561
|
+
- examples/plugins/inspec-resource-lister/test/helper.rb
|
562
|
+
- examples/plugins/inspec-resource-lister/test/unit/README.md
|
563
|
+
- examples/plugins/inspec-resource-lister/test/unit/cli_args_test.rb
|
564
|
+
- examples/plugins/inspec-resource-lister/test/unit/plugin_def_test.rb
|
537
565
|
- examples/profile-attribute.yml
|
538
566
|
- examples/profile-attribute/README.md
|
539
567
|
- examples/profile-attribute/controls/example.rb
|
@@ -638,6 +666,7 @@ files:
|
|
638
666
|
- lib/inspec/plugin/v1/registry.rb
|
639
667
|
- lib/inspec/plugin/v2.rb
|
640
668
|
- lib/inspec/plugin/v2/activator.rb
|
669
|
+
- lib/inspec/plugin/v2/installer.rb
|
641
670
|
- lib/inspec/plugin/v2/loader.rb
|
642
671
|
- lib/inspec/plugin/v2/plugin_base.rb
|
643
672
|
- lib/inspec/plugin/v2/plugin_types/cli.rb
|
@@ -691,7 +720,21 @@ files:
|
|
691
720
|
- lib/plugins/inspec-init/lib/inspec-init/templates/profile/inspec.yml
|
692
721
|
- lib/plugins/inspec-init/lib/inspec-init/templates/profile/libraries/.gitkeep
|
693
722
|
- lib/plugins/inspec-init/test/functional/inspec_init_test.rb
|
723
|
+
- lib/plugins/inspec-plugin-manager-cli/README.md
|
724
|
+
- lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb
|
725
|
+
- lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb
|
726
|
+
- lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb
|
727
|
+
- lib/plugins/inspec-plugin-manager-cli/test/fixtures/config_dirs/empty/.gitkeep
|
728
|
+
- lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette.rb
|
729
|
+
- lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette/.gitkeep
|
730
|
+
- lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-wrong-structure/.gitkeep
|
731
|
+
- lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name.rb
|
732
|
+
- lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name/.gitkeep
|
733
|
+
- lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb
|
734
|
+
- lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb
|
735
|
+
- lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb
|
694
736
|
- lib/plugins/shared/core_plugin_test_helper.rb
|
737
|
+
- lib/plugins/things-for-train-integration.rb
|
695
738
|
- lib/resource_support/aws.rb
|
696
739
|
- lib/resource_support/aws/aws_backend_base.rb
|
697
740
|
- lib/resource_support/aws/aws_backend_factory_mixin.rb
|
@@ -711,6 +754,8 @@ files:
|
|
711
754
|
- lib/resources/aws/aws_cloudwatch_log_metric_filter.rb
|
712
755
|
- lib/resources/aws/aws_config_delivery_channel.rb
|
713
756
|
- lib/resources/aws/aws_config_recorder.rb
|
757
|
+
- lib/resources/aws/aws_ebs_volume.rb
|
758
|
+
- lib/resources/aws/aws_ebs_volumes.rb
|
714
759
|
- lib/resources/aws/aws_ec2_instance.rb
|
715
760
|
- lib/resources/aws/aws_ec2_instances.rb
|
716
761
|
- lib/resources/aws/aws_ecs_cluster.rb
|
data/docs/ruby_usage.md
DELETED
@@ -1,204 +0,0 @@
|
|
1
|
-
# Using Ruby in InSpec
|
2
|
-
|
3
|
-
The InSpec DSL is a Ruby based DSL for writing audit controls, which
|
4
|
-
includes audit resources that you can invoke. Core and custom resources
|
5
|
-
are written as regular Ruby classes which inherit from
|
6
|
-
`Inspec.resource`.
|
7
|
-
|
8
|
-
Assuming we have a JSON file like this on the node to be tested:
|
9
|
-
|
10
|
-
```json
|
11
|
-
{
|
12
|
-
"keys":[
|
13
|
-
{"username":"john", "key":"/opt/keys/johnd.key"},
|
14
|
-
{"username":"jane", "key":"/opt/keys/janed.key"},
|
15
|
-
{"username":"sunny ", "key":"/opt/keys/sunnym.key"}
|
16
|
-
]
|
17
|
-
}
|
18
|
-
```
|
19
|
-
|
20
|
-
The following example shows how you can use pure Ruby code(variables,
|
21
|
-
loops, conditionals, regular expressions, etc) to run a few tests
|
22
|
-
against the above JSON file:
|
23
|
-
|
24
|
-
```ruby
|
25
|
-
control 'check-interns' do
|
26
|
-
# use the json InSpec resource to get the file
|
27
|
-
json_obj = json('/opt/keys/interns.json')
|
28
|
-
describe json_obj do
|
29
|
-
its('keys') { should_not eq nil }
|
30
|
-
end
|
31
|
-
if json_obj['keys']
|
32
|
-
# loop over the keys array
|
33
|
-
json_obj['keys'].each do |intern|
|
34
|
-
username = intern['username'].strip
|
35
|
-
# check for white spaces chars in usernames
|
36
|
-
describe username do
|
37
|
-
it { should_not match(/\s/) }
|
38
|
-
end
|
39
|
-
# check key file owners and permissions
|
40
|
-
describe file(intern['key']) do
|
41
|
-
it { should be_owned_by username }
|
42
|
-
its('mode') { should cmp '0600' }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
```
|
48
|
-
|
49
|
-
## Execution
|
50
|
-
|
51
|
-
It's important to understand that Ruby code used in custom resources and
|
52
|
-
controls DSL is executed on the system that runs InSpec. This allows
|
53
|
-
InSpec to work without Ruby and rubygems being required on remote
|
54
|
-
targets(servers or containers).
|
55
|
-
|
56
|
-
For example, using `` `ls ``\` or `system('ls')` will result in the `ls`
|
57
|
-
command being run locally and not on the target(remote) system. In order
|
58
|
-
to process the output of `ls` executed on the target system, use
|
59
|
-
`inspec.command('ls')` or `inspec.powershell('ls')`
|
60
|
-
|
61
|
-
Similarly, use `inspec.file(PATH)` to access files or directories from
|
62
|
-
remote systems in your tests or custom resources.
|
63
|
-
|
64
|
-
## Using rubygems
|
65
|
-
|
66
|
-
Ruby gems are self-contained programs and libraries. If you create a custom
|
67
|
-
resource please vendor gems into the library. This ensures that all resources
|
68
|
-
are self-contained and complete and don't need any resolution at runtime. We
|
69
|
-
vendor resources and requirements through dependency resolution, which is
|
70
|
-
independent of programming languages and their resolver mechanisms.
|
71
|
-
|
72
|
-
## Interactive Debugging with Pry
|
73
|
-
|
74
|
-
Here's a sample InSpec control that users Ruby variables to instantiate
|
75
|
-
an InSpec resource once and use the content in multiple tests.
|
76
|
-
|
77
|
-
```ruby
|
78
|
-
control 'check-perl' do
|
79
|
-
impact 0.3
|
80
|
-
title 'Check perl compiled options and permissions'
|
81
|
-
perl_out = command('perl -V')
|
82
|
-
#require 'pry'; binding.pry;
|
83
|
-
describe perl_out do
|
84
|
-
its('exit_status') { should eq 0 }
|
85
|
-
its('stdout') { should match (/USE_64_BIT_ALL/) }
|
86
|
-
its('stdout') { should match (/useposix=true/) }
|
87
|
-
its('stdout') { should match (/-fstack-protector/) }
|
88
|
-
end
|
89
|
-
|
90
|
-
# extract an array of include directories
|
91
|
-
perl_inc = perl_out.stdout.partition('@INC:').last.strip.split("\n")
|
92
|
-
# ensure include directories are only writable by 'owner'
|
93
|
-
perl_inc.each do |path|
|
94
|
-
describe directory(path.strip) do
|
95
|
-
it { should_not be_writable.by('group') }
|
96
|
-
it { should_not be_writable.by('other') }
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
```
|
101
|
-
|
102
|
-
An **advanced** but very useful Ruby tip. In the previous example, I
|
103
|
-
commented out the `require 'pry'; binding.pry;` line. If you remove the
|
104
|
-
`#` prefix and run the control, the execution will stop at that line and
|
105
|
-
give you a `pry` shell. Use that to troubleshoot, print variables, see
|
106
|
-
methods available, etc. For the above example:
|
107
|
-
|
108
|
-
```ruby
|
109
|
-
[1] pry> perl_out.exit_status
|
110
|
-
=> 0
|
111
|
-
[2] pry> perl_out.stderr
|
112
|
-
=> ""
|
113
|
-
[3] pry> ls perl_out
|
114
|
-
Inspec::Plugins::Resource#methods: inspect
|
115
|
-
Inspec::Resources::Cmd#methods: command exist? exit_status result stderr stdout to_s
|
116
|
-
Inspec::Resource::Registry::Command#methods: inspec
|
117
|
-
instance variables: @__backend_runner__ @__resource_name__ @command @result
|
118
|
-
[4] pry> perl_out.stdout.partition('@INC:').last.strip.split("\n")
|
119
|
-
=> ["/Library/Perl/5.18/darwin-thread-multi-2level",
|
120
|
-
" /Library/Perl/5.18",
|
121
|
-
...REDACTED...
|
122
|
-
[5] pry> exit # or abort
|
123
|
-
```
|
124
|
-
|
125
|
-
You can use `pry` inside both the controls DSL and resources. Similarly,
|
126
|
-
for dev and test, you can use `inspec shell` which is based on `pry`,
|
127
|
-
for example:
|
128
|
-
|
129
|
-
```ruby
|
130
|
-
$ inspec shell
|
131
|
-
Welcome to the interactive InSpec Shell
|
132
|
-
To find out how to use it, type: help
|
133
|
-
|
134
|
-
inspec> command('ls /home/gordon/git/inspec/docs').stdout
|
135
|
-
=> "ctl_inspec.rst\ndsl_inspec.rst\ndsl_resource.rst\n"
|
136
|
-
inspec> command('ls').stdout.split("\n")
|
137
|
-
=> ["ctl_inspec.rst", "dsl_inspec.rst", "dsl_resource.rst"]
|
138
|
-
|
139
|
-
inspec> help command
|
140
|
-
Name: command
|
141
|
-
|
142
|
-
Description:
|
143
|
-
Use the command InSpec audit resource to test an arbitrary command that is run on the system.
|
144
|
-
|
145
|
-
Example:
|
146
|
-
describe command('ls -al /') do
|
147
|
-
it { should exist }
|
148
|
-
its('stdout') { should match /bin/ }
|
149
|
-
its('stderr') { should eq '' }
|
150
|
-
its('exit_status') { should eq 0 }
|
151
|
-
end
|
152
|
-
```
|
153
|
-
|
154
|
-
## Shelling out in tests
|
155
|
-
|
156
|
-
When writing tests you can not use standard ruby methods to shellout as it tries to execute those commands locally.
|
157
|
-
However, the `command` resource has a `.stdout` method that will allow you to manipulate the results.
|
158
|
-
Using the above example, you could check the writes on several subdirectories.
|
159
|
-
|
160
|
-
### Example 1
|
161
|
-
|
162
|
-
```ruby
|
163
|
-
$ inspec shell
|
164
|
-
Welcome to the interactive InSpec Shell
|
165
|
-
To find out how to use it, type: help
|
166
|
-
|
167
|
-
inspec> output=command('echo test').stdout
|
168
|
-
=> "test\n"
|
169
|
-
inspec> describe command('echo test') do
|
170
|
-
inspec> its('stdout') { should eq output }
|
171
|
-
inspec> end
|
172
|
-
|
173
|
-
Profile: inspec-shell
|
174
|
-
Version: (not specified)
|
175
|
-
|
176
|
-
Command echo
|
177
|
-
✔ test stdout should eq "test\n"
|
178
|
-
|
179
|
-
Test Summary: 1 successful, 0 failures, 0 skipped
|
180
|
-
```
|
181
|
-
|
182
|
-
### Example 2
|
183
|
-
|
184
|
-
```ruby
|
185
|
-
$ inspec shell
|
186
|
-
Welcome to the interactive InSpec Shell
|
187
|
-
To find out how to use it, type: help
|
188
|
-
|
189
|
-
inspec> dirs = command('ls -d /home/gordon/git/inspec/docs').stdout.split("\n")
|
190
|
-
=> ["/home/gordon/git/inspec/docs"]
|
191
|
-
inspec> dirs.each do |dir|
|
192
|
-
inspec> describe directory(dir) do
|
193
|
-
inspec> its('mode') { should cmp '0775' }
|
194
|
-
inspec> end
|
195
|
-
inspec> end
|
196
|
-
|
197
|
-
Profile: inspec-shell
|
198
|
-
Version: (not specified)
|
199
|
-
|
200
|
-
File /home/gordon/git/inspec/docs/
|
201
|
-
✔ mode should cmp == "0775"
|
202
|
-
|
203
|
-
Test Summary: 1 successful, 0 failures, 0 skipped
|
204
|
-
```
|