inspec 0.12.0 → 0.14.0
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/CHANGELOG.md +39 -2
- data/bin/inspec +11 -9
- data/docs/matchers.rst +129 -0
- data/docs/resources.rst +64 -37
- data/inspec.gemspec +1 -1
- data/lib/bundles/inspec-compliance/cli.rb +1 -1
- data/lib/bundles/inspec-compliance/configuration.rb +1 -0
- data/lib/bundles/inspec-compliance/target.rb +16 -32
- data/lib/bundles/inspec-init/cli.rb +2 -0
- data/lib/bundles/inspec-supermarket.rb +13 -0
- data/lib/bundles/inspec-supermarket/api.rb +2 -0
- data/lib/bundles/inspec-supermarket/cli.rb +2 -2
- data/lib/bundles/inspec-supermarket/target.rb +11 -15
- data/lib/fetchers/local.rb +31 -0
- data/lib/fetchers/tar.rb +48 -0
- data/lib/fetchers/url.rb +100 -0
- data/lib/fetchers/zip.rb +47 -0
- data/lib/inspec.rb +2 -3
- data/lib/inspec/fetcher.rb +22 -0
- data/lib/inspec/metadata.rb +4 -2
- data/lib/inspec/plugins.rb +2 -0
- data/lib/inspec/plugins/fetcher.rb +97 -0
- data/lib/inspec/plugins/source_reader.rb +36 -0
- data/lib/inspec/profile.rb +92 -81
- data/lib/inspec/resource.rb +1 -0
- data/lib/inspec/runner.rb +15 -35
- data/lib/inspec/source_reader.rb +32 -0
- data/lib/inspec/version.rb +1 -1
- data/lib/matchers/matchers.rb +5 -6
- data/lib/resources/file.rb +8 -2
- data/lib/resources/passwd.rb +71 -45
- data/lib/resources/service.rb +13 -9
- data/lib/resources/shadow.rb +135 -0
- data/lib/source_readers/flat.rb +38 -0
- data/lib/source_readers/inspec.rb +78 -0
- data/lib/utils/base_cli.rb +2 -2
- data/lib/utils/parser.rb +1 -1
- data/lib/utils/plugin_registry.rb +93 -0
- data/test/docker_test.rb +1 -1
- data/test/helper.rb +62 -2
- data/test/integration/cookbooks/os_prepare/recipes/service.rb +4 -2
- data/test/integration/test/integration/default/compare_matcher_spec.rb +11 -0
- data/test/integration/test/integration/default/service_spec.rb +16 -1
- data/test/unit/fetchers.rb +61 -0
- data/test/unit/fetchers/local_test.rb +67 -0
- data/test/unit/fetchers/tar_test.rb +36 -0
- data/test/unit/fetchers/url_test.rb +152 -0
- data/test/unit/fetchers/zip_test.rb +36 -0
- data/test/unit/mock/files/passwd +1 -1
- data/test/unit/mock/files/shadow +2 -0
- data/test/unit/mock/profiles/complete-profile/libraries/testlib.rb +1 -0
- data/test/unit/plugin_test.rb +0 -1
- data/test/unit/profile_test.rb +32 -53
- data/test/unit/resources/passwd_test.rb +69 -14
- data/test/unit/resources/shadow_test.rb +67 -0
- data/test/unit/source_reader_test.rb +17 -0
- data/test/unit/source_readers/flat_test.rb +61 -0
- data/test/unit/source_readers/inspec_test.rb +38 -0
- data/test/unit/utils/passwd_parser_test.rb +1 -1
- metadata +40 -21
- data/lib/inspec/targets.rb +0 -10
- data/lib/inspec/targets/archive.rb +0 -33
- data/lib/inspec/targets/core.rb +0 -56
- data/lib/inspec/targets/dir.rb +0 -144
- data/lib/inspec/targets/file.rb +0 -33
- data/lib/inspec/targets/folder.rb +0 -38
- data/lib/inspec/targets/tar.rb +0 -61
- data/lib/inspec/targets/url.rb +0 -78
- data/lib/inspec/targets/zip.rb +0 -55
- data/test/unit/targets.rb +0 -132
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e8809fbed2418c889f95bdd22b409fe730ccb92
|
4
|
+
data.tar.gz: a21f007a1136db0e5869d8789152a59ef648f462
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a28f59896f7ae9ce9668ec6c6ba03ff78b1437e1d1a10def6bdb9967fc1257f4b8f22395e5174ca4b2271dcf7f27165f302d0dd4f535c04f7351faa7919139a
|
7
|
+
data.tar.gz: c4e01382ab5344ce014379172526f770341cb3fab75cb8da24be156f13efba8316fc2a0b055d96e6148e1a1b700e10a04386e387c9da98c726f7ab5e3e234c31
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,43 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [0.
|
4
|
-
[Full Changelog](https://github.com/chef/inspec/compare/v0.
|
3
|
+
## [0.14.0](https://github.com/chef/inspec/tree/0.14.0) (2016-02-22)
|
4
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v0.13.0...0.14.0)
|
5
|
+
|
6
|
+
**Fixed bugs:**
|
7
|
+
|
8
|
+
- force encoding to utf-8 [\#476](https://github.com/chef/inspec/pull/476) ([arlimus](https://github.com/arlimus))
|
9
|
+
- bugfix: make sure version is always a string [\#475](https://github.com/chef/inspec/pull/475) ([arlimus](https://github.com/arlimus))
|
10
|
+
- bugfix: handle edge-cases in upstart service [\#474](https://github.com/chef/inspec/pull/474) ([arlimus](https://github.com/arlimus))
|
11
|
+
- replace targets with fetcher+reader system [\#473](https://github.com/chef/inspec/pull/473) ([arlimus](https://github.com/arlimus))
|
12
|
+
|
13
|
+
## [v0.13.0](https://github.com/chef/inspec/tree/v0.13.0) (2016-02-19)
|
14
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v0.12.0...v0.13.0)
|
15
|
+
|
16
|
+
**Implemented enhancements:**
|
17
|
+
|
18
|
+
- add shadow resource for /etc/shadow [\#471](https://github.com/chef/inspec/pull/471) ([arlimus](https://github.com/arlimus))
|
19
|
+
- improve url handling [\#470](https://github.com/chef/inspec/pull/470) ([chris-rock](https://github.com/chris-rock))
|
20
|
+
- add filters to passwd resource + deprecate old accessors [\#467](https://github.com/chef/inspec/pull/467) ([arlimus](https://github.com/arlimus))
|
21
|
+
- cmp for single-entry arrays; add cmp docs [\#466](https://github.com/chef/inspec/pull/466) ([arlimus](https://github.com/arlimus))
|
22
|
+
|
23
|
+
**Fixed bugs:**
|
24
|
+
|
25
|
+
- Windows 2008 Still not detected correctly [\#453](https://github.com/chef/inspec/issues/453)
|
26
|
+
- Service-related docs, bugs, integration tests [\#463](https://github.com/chef/inspec/pull/463) ([srenatus](https://github.com/srenatus))
|
27
|
+
- fix url target resolution with zip and tar [\#462](https://github.com/chef/inspec/pull/462) ([arlimus](https://github.com/arlimus))
|
28
|
+
- ensure permissions of inspec-compliance config.json on store [\#461](https://github.com/chef/inspec/pull/461) ([srenatus](https://github.com/srenatus))
|
29
|
+
|
30
|
+
**Closed issues:**
|
31
|
+
|
32
|
+
- No way to reload the add resources from test code [\#459](https://github.com/chef/inspec/issues/459)
|
33
|
+
- add documentation for new server runlevel support [\#456](https://github.com/chef/inspec/issues/456)
|
34
|
+
|
35
|
+
**Merged pull requests:**
|
36
|
+
|
37
|
+
- 0.13.0 [\#472](https://github.com/chef/inspec/pull/472) ([chris-rock](https://github.com/chris-rock))
|
38
|
+
|
39
|
+
## [v0.12.0](https://github.com/chef/inspec/tree/v0.12.0) (2016-02-15)
|
40
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v0.11.0...v0.12.0)
|
5
41
|
|
6
42
|
**Implemented enhancements:**
|
7
43
|
|
@@ -17,6 +53,7 @@
|
|
17
53
|
|
18
54
|
**Merged pull requests:**
|
19
55
|
|
56
|
+
- 0.12.0 [\#457](https://github.com/chef/inspec/pull/457) ([arlimus](https://github.com/arlimus))
|
20
57
|
- rework target to resolver connection [\#447](https://github.com/chef/inspec/pull/447) ([arlimus](https://github.com/arlimus))
|
21
58
|
- separate directory resolver from target resolver [\#446](https://github.com/chef/inspec/pull/446) ([arlimus](https://github.com/arlimus))
|
22
59
|
|
data/bin/inspec
CHANGED
@@ -20,12 +20,12 @@ class Inspec::InspecCLI < Inspec::BaseCLI # rubocop:disable Metrics/ClassLength
|
|
20
20
|
desc: 'Attach a profile ID to all test results'
|
21
21
|
option :output, aliases: :o, type: :string,
|
22
22
|
desc: 'Save the created profile to a path'
|
23
|
-
def json(
|
23
|
+
def json(target)
|
24
24
|
diagnose
|
25
25
|
o = opts.dup
|
26
26
|
o[:ignore_supports] = true
|
27
27
|
|
28
|
-
profile = Inspec::Profile.
|
28
|
+
profile = Inspec::Profile.for_target(target, o)
|
29
29
|
dst = o[:output].to_s
|
30
30
|
if dst.empty?
|
31
31
|
puts JSON.pretty_generate(profile.info)
|
@@ -49,7 +49,7 @@ class Inspec::InspecCLI < Inspec::BaseCLI # rubocop:disable Metrics/ClassLength
|
|
49
49
|
o[:ignore_supports] = true # we check for integrity only
|
50
50
|
|
51
51
|
# run check
|
52
|
-
profile = Inspec::Profile.
|
52
|
+
profile = Inspec::Profile.for_target(path, o)
|
53
53
|
result = profile.check
|
54
54
|
|
55
55
|
if opts['format'] == 'json'
|
@@ -88,7 +88,7 @@ class Inspec::InspecCLI < Inspec::BaseCLI # rubocop:disable Metrics/ClassLength
|
|
88
88
|
o[:logger] = Logger.new(STDOUT)
|
89
89
|
o[:logger].level = get_log_level(o.log_level)
|
90
90
|
|
91
|
-
profile = Inspec::Profile.
|
91
|
+
profile = Inspec::Profile.for_target(path, o)
|
92
92
|
result = profile.check
|
93
93
|
|
94
94
|
if result && !opts[:ignore_errors] == false
|
@@ -105,9 +105,9 @@ class Inspec::InspecCLI < Inspec::BaseCLI # rubocop:disable Metrics/ClassLength
|
|
105
105
|
desc: 'Attach a profile ID to all test results'
|
106
106
|
target_options
|
107
107
|
option :format, type: :string
|
108
|
-
def exec(*
|
108
|
+
def exec(*targets)
|
109
109
|
diagnose
|
110
|
-
run_tests(
|
110
|
+
run_tests(targets, opts)
|
111
111
|
end
|
112
112
|
|
113
113
|
desc 'detect', 'detect the target OS'
|
@@ -115,11 +115,13 @@ class Inspec::InspecCLI < Inspec::BaseCLI # rubocop:disable Metrics/ClassLength
|
|
115
115
|
def detect
|
116
116
|
diagnose
|
117
117
|
|
118
|
-
runner = Inspec::Runner.new(opts)
|
119
118
|
rel = File.join(File.dirname(__FILE__), *%w{.. lib utils detect.rb})
|
120
119
|
detect_util = File.expand_path(rel)
|
121
|
-
|
122
|
-
runner.
|
120
|
+
# exits on execution:
|
121
|
+
runner = Inspec::Runner.new(opts)
|
122
|
+
profile = Inspec::Profile.for_target(detect_util, opts)
|
123
|
+
runner.add_profile(profile)
|
124
|
+
exit runner.run
|
123
125
|
rescue RuntimeError => e
|
124
126
|
puts e.message
|
125
127
|
end
|
data/docs/matchers.rst
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
=====================================================
|
2
|
+
InSpec Matchers Reference
|
3
|
+
=====================================================
|
4
|
+
|
5
|
+
|
6
|
+
Inspec uses matchers to help compare resource values to expectations. The following matchers are available:
|
7
|
+
|
8
|
+
* `be`
|
9
|
+
* `cmp`
|
10
|
+
* `eq`
|
11
|
+
* `include`
|
12
|
+
* `match`
|
13
|
+
|
14
|
+
|
15
|
+
be
|
16
|
+
=====================================================
|
17
|
+
|
18
|
+
This matcher can be followed by many different comparison operators. Always make sure to use numbers, not strings, for these comparisons.
|
19
|
+
|
20
|
+
.. code-block:: ruby
|
21
|
+
|
22
|
+
describe file('/proc/cpuinfo') do
|
23
|
+
its('size') { should be >= 10 }
|
24
|
+
its('size') { should be < 1000 }
|
25
|
+
end
|
26
|
+
|
27
|
+
cmp
|
28
|
+
=====================================================
|
29
|
+
|
30
|
+
Unlike ``eq``, cmp is a matcher for less-restrictive comparisons. It will try to fit the actual value to the type you are comparing it to. This is meant to relieve the user from having to write type-casts and resolutions.
|
31
|
+
|
32
|
+
.. code-block:: ruby
|
33
|
+
|
34
|
+
describe sshd_config do
|
35
|
+
its('Protocol') { should cmp 2 }
|
36
|
+
end
|
37
|
+
|
38
|
+
describe passwd.uid(0) do
|
39
|
+
its('users') { should cmp 'root' }
|
40
|
+
end
|
41
|
+
|
42
|
+
``cmp`` behaves in the following way:
|
43
|
+
|
44
|
+
* Compare strings to numbers
|
45
|
+
|
46
|
+
.. code-block:: ruby
|
47
|
+
|
48
|
+
describe sshd_config do
|
49
|
+
its('Protocol') { should eq '2' }
|
50
|
+
|
51
|
+
its('Protocol') { should cmp '2' }
|
52
|
+
its('Protocol') { should cmp 2 }
|
53
|
+
end
|
54
|
+
|
55
|
+
* String comparisons are not case-sensitive
|
56
|
+
|
57
|
+
.. code-block:: ruby
|
58
|
+
|
59
|
+
describe auditd_conf do
|
60
|
+
its('log_format') { should cmp 'raw' }
|
61
|
+
its('log_format') { should cmp 'RAW' }
|
62
|
+
end
|
63
|
+
|
64
|
+
* Compare arrays with only one entry to a value
|
65
|
+
|
66
|
+
.. code-block:: ruby
|
67
|
+
|
68
|
+
describe passwd.uids(0) do
|
69
|
+
its('users') { should cmp 'root' }
|
70
|
+
its('users') { should cmp ['root'] }
|
71
|
+
end
|
72
|
+
|
73
|
+
* Improved printing of octal comparisons
|
74
|
+
|
75
|
+
.. code-block:: ruby
|
76
|
+
|
77
|
+
describe file('/proc/cpuinfo') do
|
78
|
+
its('mode') { should cmp '0345' }
|
79
|
+
end
|
80
|
+
|
81
|
+
expected: 0345
|
82
|
+
got: 0444
|
83
|
+
|
84
|
+
eq
|
85
|
+
=====================================================
|
86
|
+
|
87
|
+
Test for exact equality of two values.
|
88
|
+
|
89
|
+
.. code-block:: ruby
|
90
|
+
|
91
|
+
describe sshd_config do
|
92
|
+
its('RSAAuthentication') { should_not eq 'no' }
|
93
|
+
its('Protocol') { should eq '2' }
|
94
|
+
end
|
95
|
+
|
96
|
+
It fails if types don't match. Please keep this in mind, when comparing configuration
|
97
|
+
entries that are numbers:
|
98
|
+
|
99
|
+
.. code-block:: ruby
|
100
|
+
|
101
|
+
its('Port') { should eq '22' } # ok
|
102
|
+
|
103
|
+
its('Port') { should eq 22 }
|
104
|
+
# fails: '2' != 2 (string vs int)
|
105
|
+
|
106
|
+
For less restrictive comparisons, please use ``cmp``.
|
107
|
+
|
108
|
+
include
|
109
|
+
=====================================================
|
110
|
+
|
111
|
+
Verifies if a value is included in a list.
|
112
|
+
|
113
|
+
.. code-block:: ruby
|
114
|
+
|
115
|
+
describe passwd do
|
116
|
+
its('users') { should include 'my_user' }
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
match
|
121
|
+
=====================================================
|
122
|
+
|
123
|
+
Check if a string matches a regular expression.
|
124
|
+
|
125
|
+
.. code-block:: ruby
|
126
|
+
|
127
|
+
describe sshd_config do
|
128
|
+
its('Ciphers') { should_not match /cbc/ }
|
129
|
+
end
|
data/docs/resources.rst
CHANGED
@@ -3102,19 +3102,22 @@ A ``passwd`` |inspec resource| block declares one (or more) users and associated
|
|
3102
3102
|
.. code-block:: ruby
|
3103
3103
|
|
3104
3104
|
describe passwd do
|
3105
|
-
its(
|
3105
|
+
its(:users) { should_not include 'forbidden_user' }
|
3106
3106
|
end
|
3107
3107
|
|
3108
|
-
describe passwd.uid(
|
3109
|
-
its(:
|
3108
|
+
describe passwd.uid(0) do
|
3109
|
+
its(:users) { should cmp 'root' }
|
3110
3110
|
its(:count) { should eq 1 }
|
3111
3111
|
end
|
3112
3112
|
|
3113
3113
|
where
|
3114
3114
|
|
3115
|
-
* ``gids``, ``passwords``, ``
|
3116
|
-
*
|
3117
|
-
*
|
3115
|
+
* ``users``, ``uids``, ``gids``, ``passwords``, ``homes``, and ``shells`` are valid accessors for ``passwd``
|
3116
|
+
* All of these matchers can be given an argument to filter by, for example: ``passwd.users(/name/)``
|
3117
|
+
* There is an explicit method to filter by (``filter``) which can take multiple arguments at once
|
3118
|
+
* ``count`` retrieves the number of entries
|
3119
|
+
* ``lines`` provides raw passwd lines
|
3120
|
+
* ``params`` returns an array of maps for all entries
|
3118
3121
|
|
3119
3122
|
|
3120
3123
|
Matchers for ``passwd``
|
@@ -3127,7 +3130,8 @@ The ``gids`` matcher tests if the group indentifiers in the test match group ide
|
|
3127
3130
|
|
3128
3131
|
.. code-block:: ruby
|
3129
3132
|
|
3130
|
-
its('gids') { should
|
3133
|
+
its('gids') { should include 1234 }
|
3134
|
+
its('gids') { should cmp 0 }
|
3131
3135
|
|
3132
3136
|
passwords
|
3133
3137
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++
|
@@ -3141,7 +3145,8 @@ For example:
|
|
3141
3145
|
|
3142
3146
|
.. code-block:: ruby
|
3143
3147
|
|
3144
|
-
its('passwords') { should eq 'x' }
|
3148
|
+
its('passwords') { should eq ['x'] }
|
3149
|
+
its('passwords') { should cmp '*' }
|
3145
3150
|
|
3146
3151
|
uids
|
3147
3152
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++
|
@@ -3151,42 +3156,25 @@ The ``uids`` matcher tests if the user indentifiers in the test match user ident
|
|
3151
3156
|
|
3152
3157
|
its('uids') { should eq ['1234', '1235'] }
|
3153
3158
|
|
3154
|
-
|
3159
|
+
users
|
3155
3160
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++
|
3156
|
-
The ``
|
3161
|
+
The ``users`` matcher tests if the usernames in the test match usernames in ``/etc/passwd``:
|
3157
3162
|
|
3158
3163
|
.. code-block:: ruby
|
3159
3164
|
|
3160
|
-
its('
|
3161
|
-
|
3165
|
+
its('users') { should_not include 'www-data' }
|
3162
3166
|
|
3163
|
-
Matchers for ``passwd.uid(userid)``
|
3164
|
-
-----------------------------------------------------
|
3165
|
-
This InSpec audit resource has the following matchers.
|
3166
3167
|
|
3167
3168
|
count
|
3168
3169
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++
|
3169
|
-
The ``count`` matcher tests the number of
|
3170
|
-
|
3171
|
-
.. code-block:: ruby
|
3172
|
-
|
3173
|
-
its('count') { should eq 1 }
|
3174
|
-
|
3175
|
-
uid
|
3176
|
-
+++++++++++++++++++++++++++++++++++++++++++++++++++++
|
3177
|
-
The ``uid`` matcher tests if the user identifier in the test matches a user identifier in ``/etc/passwd``:
|
3170
|
+
The ``count`` matcher tests the number of entries in ``/etc/passwd``. It becomes especially useful in conjunction combination with filters:
|
3178
3171
|
|
3179
3172
|
.. code-block:: ruby
|
3180
3173
|
|
3181
|
-
|
3182
|
-
|
3183
|
-
|
3184
|
-
+++++++++++++++++++++++++++++++++++++++++++++++++++++
|
3185
|
-
The ``username`` matcher tests if the user name in the test matches a user name in ``/etc/passwd``:
|
3186
|
-
|
3187
|
-
.. code-block:: ruby
|
3174
|
+
describe passwd.users('highlander') do
|
3175
|
+
its('count') { should eq 1 }
|
3176
|
+
end
|
3188
3177
|
|
3189
|
-
its('username') { should eq 'root' }
|
3190
3178
|
|
3191
3179
|
Examples
|
3192
3180
|
-----------------------------------------------------
|
@@ -3197,7 +3185,7 @@ The following examples show how to use this InSpec audit resource.
|
|
3197
3185
|
.. code-block:: ruby
|
3198
3186
|
|
3199
3187
|
describe passwd do
|
3200
|
-
its('
|
3188
|
+
its('users') { should eq ['root', 'www-data'] }
|
3201
3189
|
its('uids') { should eq [0, 33] }
|
3202
3190
|
end
|
3203
3191
|
|
@@ -3205,13 +3193,13 @@ The following examples show how to use this InSpec audit resource.
|
|
3205
3193
|
|
3206
3194
|
.. code-block:: ruby
|
3207
3195
|
|
3208
|
-
describe passwd.
|
3209
|
-
its('
|
3196
|
+
describe passwd.uids(0) do
|
3197
|
+
its('users') { should cmp 'root' }
|
3210
3198
|
its('count') { should eq 1 }
|
3211
3199
|
end
|
3212
3200
|
|
3213
|
-
describe passwd.
|
3214
|
-
its('
|
3201
|
+
describe passwd.filter(user: 'www-data') do
|
3202
|
+
its('uids') { should cmp 33 }
|
3215
3203
|
its('count') { should eq 1 }
|
3216
3204
|
end
|
3217
3205
|
|
@@ -3875,6 +3863,45 @@ The following examples show how to use this InSpec audit resource.
|
|
3875
3863
|
end
|
3876
3864
|
|
3877
3865
|
|
3866
|
+
**Test the runlevels for Sys-V services**
|
3867
|
+
|
3868
|
+
On targets using Sys-V services, the existing runlevels can also be checked:
|
3869
|
+
|
3870
|
+
.. code-block:: ruby
|
3871
|
+
|
3872
|
+
describe service('sshd').runlevels do
|
3873
|
+
its('keys') { should include(2) }
|
3874
|
+
end
|
3875
|
+
|
3876
|
+
describe service('sshd').runlevels(2,4) do
|
3877
|
+
it { should be_enabled }
|
3878
|
+
end
|
3879
|
+
|
3880
|
+
**Override the service manager**
|
3881
|
+
|
3882
|
+
Under some circumstances, it may be required to override the logic in place to select the right service manager. For example, if you want to check a service managed by Upstart, you can explicitly do so:
|
3883
|
+
|
3884
|
+
.. code-block:: ruby
|
3885
|
+
|
3886
|
+
describe upstart_service('service') do
|
3887
|
+
it { should_not be_enabled }
|
3888
|
+
it { should be_installed }
|
3889
|
+
it { should be_running }
|
3890
|
+
end
|
3891
|
+
|
3892
|
+
This is also possible with `systemd_service`, `runit_service`, `sysv_service`, `bsd_service`, and `launchd_service`.
|
3893
|
+
You can also provide the control command, for when it is not to be found at the default location.
|
3894
|
+
For example, if your `sv` command for services managed by Runit is not in PATH:
|
3895
|
+
|
3896
|
+
.. code-block:: ruby
|
3897
|
+
|
3898
|
+
describe runit_service('service', '/opt/chef/embedded/sbin/sv') do
|
3899
|
+
it { should be_enabled }
|
3900
|
+
it { should be_installed }
|
3901
|
+
it { should be_running }
|
3902
|
+
end
|
3903
|
+
|
3904
|
+
|
3878
3905
|
ssh_config
|
3879
3906
|
=====================================================
|
3880
3907
|
Use the ``ssh_config`` |inspec resource| to test |openssh| |ssh| client configuration data located at ``/etc/ssh/ssh_config`` on |linux| and |unix| platforms.
|
data/inspec.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
25
|
spec.require_paths = ['lib']
|
26
26
|
|
27
|
-
spec.add_dependency 'r-train', '~> 0.
|
27
|
+
spec.add_dependency 'r-train', '~> 0.10'
|
28
28
|
spec.add_dependency 'thor', '~> 0.19'
|
29
29
|
spec.add_dependency 'json', '~> 1.8'
|
30
30
|
spec.add_dependency 'rainbow', '~> 2'
|