inspec 1.10.0 → 1.11.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 +107 -3
- data/docs/resources/kernel_module.md.erb +7 -0
- data/lib/inspec/objects/or_test.rb +17 -2
- data/lib/inspec/objects/test.rb +1 -1
- data/lib/inspec/version.rb +1 -1
- data/lib/resources/kernel_module.rb +11 -0
- data/lib/resources/xinetd.rb +17 -1
- data/lib/utils/parser.rb +7 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 22bd19e0cf0854eb85632b57eee930bb8de88a7b
|
|
4
|
+
data.tar.gz: 34154c0b82954d31f5d59dd877b3390e716d7fd3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81cd38965333e8d651d54a1ce8499279eec91a19abe8e2cbf8ecf6f58ca384fc4abfd580434d4554a864c0bfeace71b02bafdb9f110f26988b2aa2b793868c7e
|
|
7
|
+
data.tar.gz: 8ffbd0fb553fd662fb369383b7cbbb04c6c1f338ccbe0abe5d8a417263ab8446d5b74feb7c3cc082a8a7fe8d6efa520f48de660a2a07bef72834687b7fed10ff
|
data/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## [1.
|
|
4
|
-
[Full Changelog](https://github.com/chef/inspec/compare/v1.
|
|
3
|
+
## [1.11.0](https://github.com/chef/inspec/tree/1.11.0) (2017-02-01)
|
|
4
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v1.10.0...1.11.0)
|
|
5
5
|
|
|
6
6
|
**Implemented enhancements:**
|
|
7
7
|
|
|
8
8
|
- HTTP request resource [\#336](https://github.com/chef/inspec/issues/336)
|
|
9
9
|
|
|
10
|
+
**Merged pull requests:**
|
|
11
|
+
|
|
12
|
+
- derive xinetd protocol from socket\_type when not defined in the config file [\#1448](https://github.com/chef/inspec/pull/1448) ([alexpop](https://github.com/alexpop))
|
|
13
|
+
- Fix xinetd parsing of services from the same file. Expose resource.protocols [\#1444](https://github.com/chef/inspec/pull/1444) ([alexpop](https://github.com/alexpop))
|
|
14
|
+
- Add negate! support for describe.one object [\#1442](https://github.com/chef/inspec/pull/1442) ([alexpop](https://github.com/alexpop))
|
|
15
|
+
- Make minor grammar/style changes to `inspec.io` [\#1441](https://github.com/chef/inspec/pull/1441) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
|
|
16
|
+
- Version method for kernel\_module [\#1435](https://github.com/chef/inspec/pull/1435) ([postgred](https://github.com/postgred))
|
|
17
|
+
|
|
18
|
+
## [v1.10.0](https://github.com/chef/inspec/tree/v1.10.0) (2017-01-26)
|
|
19
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v1.9.0...v1.10.0)
|
|
20
|
+
|
|
10
21
|
**Closed issues:**
|
|
11
22
|
|
|
12
23
|
- fix functional tests [\#1429](https://github.com/chef/inspec/issues/1429)
|
|
13
24
|
|
|
14
25
|
**Merged pull requests:**
|
|
15
26
|
|
|
27
|
+
- 1.10.0 [\#1433](https://github.com/chef/inspec/pull/1433) ([chris-rock](https://github.com/chris-rock))
|
|
16
28
|
- improve http header handling [\#1432](https://github.com/chef/inspec/pull/1432) ([chris-rock](https://github.com/chris-rock))
|
|
17
29
|
- use new devsec baseline [\#1431](https://github.com/chef/inspec/pull/1431) ([chris-rock](https://github.com/chris-rock))
|
|
18
30
|
- 'execution' is spelled correctly [\#1428](https://github.com/chef/inspec/pull/1428) ([nathenharvey](https://github.com/nathenharvey))
|
|
@@ -222,7 +234,6 @@
|
|
|
222
234
|
|
|
223
235
|
- Add file integration tests for docker [\#1277](https://github.com/chef/inspec/issues/1277)
|
|
224
236
|
- Solaris Sudo Not Always In /usr/bin/sudo [\#1265](https://github.com/chef/inspec/issues/1265)
|
|
225
|
-
- Link to robert\_config.rb is broken on inspec.io [\#1226](https://github.com/chef/inspec/issues/1226)
|
|
226
237
|
|
|
227
238
|
**Merged pull requests:**
|
|
228
239
|
|
|
@@ -2028,10 +2039,19 @@
|
|
|
2028
2039
|
|
|
2029
2040
|
**Implemented enhancements:**
|
|
2030
2041
|
|
|
2042
|
+
- pretty-print resources [\#78](https://github.com/chef/inspec/issues/78)
|
|
2043
|
+
- Add networking resources [\#68](https://github.com/chef/inspec/issues/68)
|
|
2031
2044
|
- Add WinRM transport layer [\#64](https://github.com/chef/inspec/issues/64)
|
|
2032
2045
|
|
|
2046
|
+
**Fixed bugs:**
|
|
2047
|
+
|
|
2048
|
+
- expose all necessary methods in OS resource [\#79](https://github.com/chef/inspec/issues/79)
|
|
2049
|
+
|
|
2033
2050
|
**Closed issues:**
|
|
2034
2051
|
|
|
2052
|
+
- script resource [\#74](https://github.com/chef/inspec/issues/74)
|
|
2053
|
+
- add project docs [\#72](https://github.com/chef/inspec/issues/72)
|
|
2054
|
+
- OS detection on debian does not detect versions [\#39](https://github.com/chef/inspec/issues/39)
|
|
2035
2055
|
- ensure all resources have a proper to\_s method [\#98](https://github.com/chef/inspec/issues/98)
|
|
2036
2056
|
- Escape commands before we execute them [\#70](https://github.com/chef/inspec/issues/70)
|
|
2037
2057
|
|
|
@@ -2058,6 +2078,90 @@
|
|
|
2058
2078
|
- Improve unit tests [\#106](https://github.com/chef/inspec/pull/106) ([chris-rock](https://github.com/chris-rock))
|
|
2059
2079
|
- add to\_s methods to resources, fixes \#98 [\#105](https://github.com/chef/inspec/pull/105) ([chris-rock](https://github.com/chris-rock))
|
|
2060
2080
|
- 0.7.0 release [\#104](https://github.com/chef/inspec/pull/104) ([chris-rock](https://github.com/chris-rock))
|
|
2081
|
+
- implement iptables resource [\#103](https://github.com/chef/inspec/pull/103) ([chris-rock](https://github.com/chris-rock))
|
|
2082
|
+
- bugfix: return function if data is already cached [\#102](https://github.com/chef/inspec/pull/102) ([chris-rock](https://github.com/chris-rock))
|
|
2083
|
+
- implement apt resource [\#101](https://github.com/chef/inspec/pull/101) ([chris-rock](https://github.com/chris-rock))
|
|
2084
|
+
- improve shell [\#100](https://github.com/chef/inspec/pull/100) ([chris-rock](https://github.com/chris-rock))
|
|
2085
|
+
- implement host resource [\#99](https://github.com/chef/inspec/pull/99) ([chris-rock](https://github.com/chris-rock))
|
|
2086
|
+
- implement bridge resource [\#97](https://github.com/chef/inspec/pull/97) ([chris-rock](https://github.com/chris-rock))
|
|
2087
|
+
- interactive shell [\#95](https://github.com/chef/inspec/pull/95) ([arlimus](https://github.com/arlimus))
|
|
2088
|
+
- interface resource [\#94](https://github.com/chef/inspec/pull/94) ([chris-rock](https://github.com/chris-rock))
|
|
2089
|
+
- lint: dont use undefined vars [\#93](https://github.com/chef/inspec/pull/93) ([arlimus](https://github.com/arlimus))
|
|
2090
|
+
- fix delivery dependencies [\#92](https://github.com/chef/inspec/pull/92) ([arlimus](https://github.com/arlimus))
|
|
2091
|
+
- improvement: add default print method to resources [\#91](https://github.com/chef/inspec/pull/91) ([arlimus](https://github.com/arlimus))
|
|
2092
|
+
- extend os backend helper [\#90](https://github.com/chef/inspec/pull/90) ([chris-rock](https://github.com/chris-rock))
|
|
2093
|
+
- integrate docs [\#89](https://github.com/chef/inspec/pull/89) ([chris-rock](https://github.com/chris-rock))
|
|
2094
|
+
- integrate docs [\#88](https://github.com/chef/inspec/pull/88) ([chris-rock](https://github.com/chris-rock))
|
|
2095
|
+
- script resource [\#87](https://github.com/chef/inspec/pull/87) ([chris-rock](https://github.com/chris-rock))
|
|
2096
|
+
- implement group resource [\#85](https://github.com/chef/inspec/pull/85) ([chris-rock](https://github.com/chris-rock))
|
|
2097
|
+
- add author header [\#84](https://github.com/chef/inspec/pull/84) ([chris-rock](https://github.com/chris-rock))
|
|
2098
|
+
- Resource bugfix [\#83](https://github.com/chef/inspec/pull/83) ([arlimus](https://github.com/arlimus))
|
|
2099
|
+
- Resource in resource [\#80](https://github.com/chef/inspec/pull/80) ([arlimus](https://github.com/arlimus))
|
|
2100
|
+
- ignore local delivery config [\#77](https://github.com/chef/inspec/pull/77) ([arlimus](https://github.com/arlimus))
|
|
2101
|
+
- bugfix user resource for windows [\#76](https://github.com/chef/inspec/pull/76) ([chris-rock](https://github.com/chris-rock))
|
|
2102
|
+
- activate lint in travis [\#75](https://github.com/chef/inspec/pull/75) ([arlimus](https://github.com/arlimus))
|
|
2103
|
+
- Simplify SSL configuration [\#69](https://github.com/chef/inspec/pull/69) ([arlimus](https://github.com/arlimus))
|
|
2104
|
+
- implement user resource [\#67](https://github.com/chef/inspec/pull/67) ([chris-rock](https://github.com/chris-rock))
|
|
2105
|
+
- switch from open4 -\> mixlib-shellout [\#66](https://github.com/chef/inspec/pull/66) ([arlimus](https://github.com/arlimus))
|
|
2106
|
+
- WinRM path [\#63](https://github.com/chef/inspec/pull/63) ([arlimus](https://github.com/arlimus))
|
|
2107
|
+
- bugfix: catch cases where oneget returns an array [\#62](https://github.com/chef/inspec/pull/62) ([chris-rock](https://github.com/chris-rock))
|
|
2108
|
+
- extend delivery tests to extra docker images [\#61](https://github.com/chef/inspec/pull/61) ([arlimus](https://github.com/arlimus))
|
|
2109
|
+
- rename --key-file to --key on cli [\#60](https://github.com/chef/inspec/pull/60) ([arlimus](https://github.com/arlimus))
|
|
2110
|
+
- Simpleconfig groups [\#57](https://github.com/chef/inspec/pull/57) ([arlimus](https://github.com/arlimus))
|
|
2111
|
+
- OS detection tests [\#56](https://github.com/chef/inspec/pull/56) ([arlimus](https://github.com/arlimus))
|
|
2112
|
+
- Start Linting remaining resources [\#55](https://github.com/chef/inspec/pull/55) ([arlimus](https://github.com/arlimus))
|
|
2113
|
+
- fix various robocop lint issues [\#54](https://github.com/chef/inspec/pull/54) ([chris-rock](https://github.com/chris-rock))
|
|
2114
|
+
- overhaul rule structure [\#53](https://github.com/chef/inspec/pull/53) ([arlimus](https://github.com/arlimus))
|
|
2115
|
+
- Verify ssh transport backend [\#51](https://github.com/chef/inspec/pull/51) ([arlimus](https://github.com/arlimus))
|
|
2116
|
+
- Unit test for service resource [\#50](https://github.com/chef/inspec/pull/50) ([chris-rock](https://github.com/chris-rock))
|
|
2117
|
+
- Ssh backend tests [\#49](https://github.com/chef/inspec/pull/49) ([arlimus](https://github.com/arlimus))
|
|
2118
|
+
- Docker concurrency [\#48](https://github.com/chef/inspec/pull/48) ([arlimus](https://github.com/arlimus))
|
|
2119
|
+
- unit tests for package resource [\#47](https://github.com/chef/inspec/pull/47) ([chris-rock](https://github.com/chris-rock))
|
|
2120
|
+
- Docker runner test [\#46](https://github.com/chef/inspec/pull/46) ([arlimus](https://github.com/arlimus))
|
|
2121
|
+
- add port resource [\#45](https://github.com/chef/inspec/pull/45) ([chris-rock](https://github.com/chris-rock))
|
|
2122
|
+
- bugfix: windows server 2008 detection [\#44](https://github.com/chef/inspec/pull/44) ([arlimus](https://github.com/arlimus))
|
|
2123
|
+
- Add detect command [\#43](https://github.com/chef/inspec/pull/43) ([arlimus](https://github.com/arlimus))
|
|
2124
|
+
- unit test mock os [\#42](https://github.com/chef/inspec/pull/42) ([chris-rock](https://github.com/chris-rock))
|
|
2125
|
+
- let travis do dockerized resource tests [\#41](https://github.com/chef/inspec/pull/41) ([arlimus](https://github.com/arlimus))
|
|
2126
|
+
- docker test run [\#40](https://github.com/chef/inspec/pull/40) ([arlimus](https://github.com/arlimus))
|
|
2127
|
+
- bugfix: detect os via unames [\#38](https://github.com/chef/inspec/pull/38) ([arlimus](https://github.com/arlimus))
|
|
2128
|
+
- run kitchen test instead of converge [\#37](https://github.com/chef/inspec/pull/37) ([arlimus](https://github.com/arlimus))
|
|
2129
|
+
- bugfix: local file owner [\#36](https://github.com/chef/inspec/pull/36) ([arlimus](https://github.com/arlimus))
|
|
2130
|
+
- bugfix: backend description for local + docker [\#35](https://github.com/chef/inspec/pull/35) ([arlimus](https://github.com/arlimus))
|
|
2131
|
+
- implement fake os method for mock backend \(for now\) [\#34](https://github.com/chef/inspec/pull/34) ([chris-rock](https://github.com/chris-rock))
|
|
2132
|
+
- add Windows feature resource [\#33](https://github.com/chef/inspec/pull/33) ([chris-rock](https://github.com/chris-rock))
|
|
2133
|
+
- add linux kernel resources [\#32](https://github.com/chef/inspec/pull/32) ([chris-rock](https://github.com/chris-rock))
|
|
2134
|
+
- Exist vs exists [\#31](https://github.com/chef/inspec/pull/31) ([arlimus](https://github.com/arlimus))
|
|
2135
|
+
- File formats [\#30](https://github.com/chef/inspec/pull/30) ([chris-rock](https://github.com/chris-rock))
|
|
2136
|
+
- OS detection and resource [\#29](https://github.com/chef/inspec/pull/29) ([arlimus](https://github.com/arlimus))
|
|
2137
|
+
- bugfix: fix simplified runner configuration [\#28](https://github.com/chef/inspec/pull/28) ([chris-rock](https://github.com/chris-rock))
|
|
2138
|
+
- improvement: simplify runner configuration [\#27](https://github.com/chef/inspec/pull/27) ([arlimus](https://github.com/arlimus))
|
|
2139
|
+
- bugfix: catch cases, where no service is available [\#26](https://github.com/chef/inspec/pull/26) ([chris-rock](https://github.com/chris-rock))
|
|
2140
|
+
- support package for windows [\#25](https://github.com/chef/inspec/pull/25) ([chris-rock](https://github.com/chris-rock))
|
|
2141
|
+
- implement service for FreeBSD [\#24](https://github.com/chef/inspec/pull/24) ([chris-rock](https://github.com/chris-rock))
|
|
2142
|
+
- move integration dependencies to Gemfile [\#23](https://github.com/chef/inspec/pull/23) ([chris-rock](https://github.com/chris-rock))
|
|
2143
|
+
- add oracle linux docker tests [\#22](https://github.com/chef/inspec/pull/22) ([arlimus](https://github.com/arlimus))
|
|
2144
|
+
- Support FreeBSD [\#21](https://github.com/chef/inspec/pull/21) ([arlimus](https://github.com/arlimus))
|
|
2145
|
+
- Service resource [\#20](https://github.com/chef/inspec/pull/20) ([chris-rock](https://github.com/chris-rock))
|
|
2146
|
+
- Improvements [\#19](https://github.com/chef/inspec/pull/19) ([chris-rock](https://github.com/chris-rock))
|
|
2147
|
+
- bugfix: set host for ssh config in specinfra [\#18](https://github.com/chef/inspec/pull/18) ([chris-rock](https://github.com/chris-rock))
|
|
2148
|
+
- improve readme [\#17](https://github.com/chef/inspec/pull/17) ([chris-rock](https://github.com/chris-rock))
|
|
2149
|
+
- Integration tests for the backend runner [\#16](https://github.com/chef/inspec/pull/16) ([arlimus](https://github.com/arlimus))
|
|
2150
|
+
- Fix specinfra OS detection [\#15](https://github.com/chef/inspec/pull/15) ([arlimus](https://github.com/arlimus))
|
|
2151
|
+
- Os detection [\#14](https://github.com/chef/inspec/pull/14) ([chris-rock](https://github.com/chris-rock))
|
|
2152
|
+
- bugfix: require specinfra backend [\#13](https://github.com/chef/inspec/pull/13) ([chris-rock](https://github.com/chris-rock))
|
|
2153
|
+
- improve docker test runner structure [\#12](https://github.com/chef/inspec/pull/12) ([arlimus](https://github.com/arlimus))
|
|
2154
|
+
- Concurrent integrationtest [\#11](https://github.com/chef/inspec/pull/11) ([arlimus](https://github.com/arlimus))
|
|
2155
|
+
- add oneget resource [\#10](https://github.com/chef/inspec/pull/10) ([chris-rock](https://github.com/chris-rock))
|
|
2156
|
+
- Winrm [\#9](https://github.com/chef/inspec/pull/9) ([chris-rock](https://github.com/chris-rock))
|
|
2157
|
+
- bugfix: linux file stat parameters and mount [\#8](https://github.com/chef/inspec/pull/8) ([arlimus](https://github.com/arlimus))
|
|
2158
|
+
- Mysql conf [\#7](https://github.com/chef/inspec/pull/7) ([arlimus](https://github.com/arlimus))
|
|
2159
|
+
- Lint update [\#6](https://github.com/chef/inspec/pull/6) ([arlimus](https://github.com/arlimus))
|
|
2160
|
+
- SSH PTY [\#5](https://github.com/chef/inspec/pull/5) ([arlimus](https://github.com/arlimus))
|
|
2161
|
+
- Start Docker + SSH backends [\#4](https://github.com/chef/inspec/pull/4) ([arlimus](https://github.com/arlimus))
|
|
2162
|
+
- travis checks [\#3](https://github.com/chef/inspec/pull/3) ([chris-rock](https://github.com/chris-rock))
|
|
2163
|
+
- Package [\#2](https://github.com/chef/inspec/pull/2) ([chris-rock](https://github.com/chris-rock))
|
|
2164
|
+
- shared linux file handling + specinfra config + cleanup [\#1](https://github.com/chef/inspec/pull/1) ([arlimus](https://github.com/arlimus))
|
|
2061
2165
|
|
|
2062
2166
|
|
|
2063
2167
|
|
|
@@ -49,6 +49,12 @@ The `be_loaded` matcher tests if the module is a loadable kernel module:
|
|
|
49
49
|
|
|
50
50
|
<%= partial "/shared/matcher_match" %>
|
|
51
51
|
|
|
52
|
+
### version
|
|
53
|
+
|
|
54
|
+
The `version` matcher tests if the named module version is on the system:
|
|
55
|
+
|
|
56
|
+
its(:version) { should eq '3.2.2' }
|
|
57
|
+
|
|
52
58
|
## Examples
|
|
53
59
|
|
|
54
60
|
The following examples show how to use this InSpec audit resource.
|
|
@@ -57,4 +63,5 @@ The following examples show how to use this InSpec audit resource.
|
|
|
57
63
|
|
|
58
64
|
describe kernel_module('bridge') do
|
|
59
65
|
it { should be_loaded }
|
|
66
|
+
its(:version) { should cmp >= '2.2.2' }
|
|
60
67
|
end
|
|
@@ -5,15 +5,30 @@ module Inspec
|
|
|
5
5
|
attr_reader :tests
|
|
6
6
|
def initialize(tests)
|
|
7
7
|
@tests = tests
|
|
8
|
+
@negated = false
|
|
8
9
|
end
|
|
9
10
|
|
|
10
11
|
def skip
|
|
11
12
|
nil
|
|
12
13
|
end
|
|
13
14
|
|
|
15
|
+
def negate!
|
|
16
|
+
@negated = !@negated
|
|
17
|
+
end
|
|
18
|
+
|
|
14
19
|
def to_ruby
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
if @negated
|
|
21
|
+
# We don't use the describe.one wrapper when negated because:
|
|
22
|
+
# !(test1 || test2) same as (!test1 && !test2) where && is implicit in inspec
|
|
23
|
+
all_tests = @tests.map { |test|
|
|
24
|
+
test.negate!
|
|
25
|
+
test
|
|
26
|
+
}.map(&:to_ruby).join("\n")
|
|
27
|
+
return all_tests
|
|
28
|
+
else
|
|
29
|
+
all_tests = @tests.map(&:to_ruby).join("\n").gsub("\n", "\n ")
|
|
30
|
+
return format("describe.one do\n %s\nend", all_tests)
|
|
31
|
+
end
|
|
17
32
|
end
|
|
18
33
|
|
|
19
34
|
def to_hash
|
data/lib/inspec/objects/test.rb
CHANGED
|
@@ -67,7 +67,7 @@ module Inspec
|
|
|
67
67
|
itsy = xtra.nil? ? 'it' : 'its(' + xtra.to_s.inspect + ')'
|
|
68
68
|
naughty = @negated ? '_not' : ''
|
|
69
69
|
xpect = defined?(@expectation) ? expectation.inspect : ''
|
|
70
|
-
if
|
|
70
|
+
if @expectation.class == Regexp
|
|
71
71
|
# without this, xpect values like / \/zones\// will not be parsed properly
|
|
72
72
|
xpect = "(#{xpect})"
|
|
73
73
|
elsif xpect != ''
|
data/lib/inspec/version.rb
CHANGED
|
@@ -36,6 +36,17 @@ module Inspec::Resources
|
|
|
36
36
|
!found.nil?
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
def version
|
|
40
|
+
if inspec.os[:name] == 'centos' && inspec.os[:release].to_i == 5
|
|
41
|
+
modinfo_cmd = "/sbin/modinfo -F version #{@module}"
|
|
42
|
+
else
|
|
43
|
+
modinfo_cmd = "modinfo -F version #{@module}"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
cmd = inspec.command(modinfo_cmd)
|
|
47
|
+
cmd.exit_status.zero? ? cmd.stdout.delete("\n") : nil
|
|
48
|
+
end
|
|
49
|
+
|
|
39
50
|
def to_s
|
|
40
51
|
"Kernel Module #{@module}"
|
|
41
52
|
end
|
data/lib/resources/xinetd.rb
CHANGED
|
@@ -41,6 +41,7 @@ module Inspec::Resources
|
|
|
41
41
|
.add(:ids, field: 'id')
|
|
42
42
|
.add(:socket_types, field: 'socket_type')
|
|
43
43
|
.add(:types, field: 'type')
|
|
44
|
+
.add(:protocols, field: 'protocol')
|
|
44
45
|
.add(:wait, field: 'wait')
|
|
45
46
|
.add(:disabled?) { |x| x.where('disable' => 'no').services.empty? }
|
|
46
47
|
.add(:enabled?) { |x| x.where('disable' => 'yes').services.empty? }
|
|
@@ -91,8 +92,23 @@ module Inspec::Resources
|
|
|
91
92
|
params
|
|
92
93
|
end
|
|
93
94
|
|
|
95
|
+
# Method used to derive the default protocol used from the socket_type
|
|
96
|
+
def default_protocol(type)
|
|
97
|
+
case type
|
|
98
|
+
when 'stream'
|
|
99
|
+
'tcp'
|
|
100
|
+
when 'dgram'
|
|
101
|
+
'udp'
|
|
102
|
+
else
|
|
103
|
+
'unknown'
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
94
107
|
def service_lines
|
|
95
|
-
@services ||= params['services'].values.flatten.map
|
|
108
|
+
@services ||= params['services'].values.flatten.map { |service|
|
|
109
|
+
service.params['protocol'] ||= default_protocol(service.params['socket_type'])
|
|
110
|
+
service.params
|
|
111
|
+
}
|
|
96
112
|
end
|
|
97
113
|
end
|
|
98
114
|
end
|
data/lib/utils/parser.rb
CHANGED
|
@@ -209,7 +209,12 @@ module XinetdParser
|
|
|
209
209
|
next if inner_line.empty?
|
|
210
210
|
|
|
211
211
|
if inner_line == '}'
|
|
212
|
-
|
|
212
|
+
if cur_group == 'defaults'
|
|
213
|
+
res[cur_group] = SimpleConfig.new(simple_conf.join("\n"))
|
|
214
|
+
else
|
|
215
|
+
res[cur_group] ||= []
|
|
216
|
+
res[cur_group].push(SimpleConfig.new(simple_conf.join("\n")))
|
|
217
|
+
end
|
|
213
218
|
cur_group = nil
|
|
214
219
|
elsif rest.lstrip[0] == '{'
|
|
215
220
|
cur_group = inner_line
|
|
@@ -224,7 +229,7 @@ module XinetdParser
|
|
|
224
229
|
others.each { |ores|
|
|
225
230
|
ores.each { |k, v|
|
|
226
231
|
res[k] ||= []
|
|
227
|
-
res[k].
|
|
232
|
+
res[k].concat(v)
|
|
228
233
|
}
|
|
229
234
|
}
|
|
230
235
|
else
|
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: 1.
|
|
4
|
+
version: 1.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dominik Richter
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-01
|
|
11
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: train
|