inspec 1.11.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22bd19e0cf0854eb85632b57eee930bb8de88a7b
4
- data.tar.gz: 34154c0b82954d31f5d59dd877b3390e716d7fd3
3
+ metadata.gz: 716b0f2740402869ee9542519dff597bef2c6239
4
+ data.tar.gz: 304547b882202c6a9748148987a8a859efe14752
5
5
  SHA512:
6
- metadata.gz: 81cd38965333e8d651d54a1ce8499279eec91a19abe8e2cbf8ecf6f58ca384fc4abfd580434d4554a864c0bfeace71b02bafdb9f110f26988b2aa2b793868c7e
7
- data.tar.gz: 8ffbd0fb553fd662fb369383b7cbbb04c6c1f338ccbe0abe5d8a417263ab8446d5b74feb7c3cc082a8a7fe8d6efa520f48de660a2a07bef72834687b7fed10ff
6
+ metadata.gz: 2796299fda33d2ad2251e0627c7ecc7ee8e54d2c91e79dc9e03a6c8a1a924fa5105ef77d045a48cbfcc84f0c830187c69f7da6586cf83abce74319eef21a4c5d
7
+ data.tar.gz: 26174779c09a85bcb8dfbb2d3026113b80e27158ae8d7ad021a7e9b8155b845ab47389c8813808d7ee5bab02c5ad35ae27a41f2c933833f34ad6204c5a5fe508
@@ -1,7 +1,20 @@
1
1
  # Change Log
2
2
 
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)
3
+ ## [1.12.0](https://github.com/chef/inspec/tree/1.12.0) (2017-02-03)
4
+ [Full Changelog](https://github.com/chef/inspec/compare/v1.11.0...1.12.0)
5
+
6
+ **Closed issues:**
7
+
8
+ - `skip` parameter ignored inside `describe` block [\#1450](https://github.com/chef/inspec/issues/1450)
9
+
10
+ **Merged pull requests:**
11
+
12
+ - Allow setting of the tests array [\#1455](https://github.com/chef/inspec/pull/1455) ([alexpop](https://github.com/alexpop))
13
+ - switch to faraday as http backend [\#1452](https://github.com/chef/inspec/pull/1452) ([chris-rock](https://github.com/chris-rock))
14
+ - Add FilterTable support to processes resource [\#1451](https://github.com/chef/inspec/pull/1451) ([alexpop](https://github.com/alexpop))
15
+
16
+ ## [v1.11.0](https://github.com/chef/inspec/tree/v1.11.0) (2017-02-01)
17
+ [Full Changelog](https://github.com/chef/inspec/compare/v1.10.0...v1.11.0)
5
18
 
6
19
  **Implemented enhancements:**
7
20
 
@@ -2039,19 +2052,10 @@
2039
2052
 
2040
2053
  **Implemented enhancements:**
2041
2054
 
2042
- - pretty-print resources [\#78](https://github.com/chef/inspec/issues/78)
2043
- - Add networking resources [\#68](https://github.com/chef/inspec/issues/68)
2044
2055
  - Add WinRM transport layer [\#64](https://github.com/chef/inspec/issues/64)
2045
2056
 
2046
- **Fixed bugs:**
2047
-
2048
- - expose all necessary methods in OS resource [\#79](https://github.com/chef/inspec/issues/79)
2049
-
2050
2057
  **Closed issues:**
2051
2058
 
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)
2055
2059
  - ensure all resources have a proper to\_s method [\#98](https://github.com/chef/inspec/issues/98)
2056
2060
  - Escape commands before we execute them [\#70](https://github.com/chef/inspec/issues/70)
2057
2061
 
@@ -2078,90 +2082,6 @@
2078
2082
  - Improve unit tests [\#106](https://github.com/chef/inspec/pull/106) ([chris-rock](https://github.com/chris-rock))
2079
2083
  - add to\_s methods to resources, fixes \#98 [\#105](https://github.com/chef/inspec/pull/105) ([chris-rock](https://github.com/chris-rock))
2080
2084
  - 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))
2165
2085
 
2166
2086
 
2167
2087
 
@@ -0,0 +1,11 @@
1
+ ---
2
+ lockfile_version: 1
3
+ depends:
4
+ - name: profile
5
+ resolved_source:
6
+ path: "/pub/git/inspec/examples/profile"
7
+ version_constraints: ">= 0"
8
+ - name: profile-attribute
9
+ resolved_source:
10
+ path: "/pub/git/inspec/examples/profile-attribute"
11
+ version_constraints: ">= 0"
@@ -0,0 +1,3 @@
1
+ ---
2
+ lockfile_version: 1
3
+ depends: []
@@ -38,5 +38,5 @@ Gem::Specification.new do |spec|
38
38
  spec.add_dependency 'sslshake', '~> 1'
39
39
  spec.add_dependency 'parallel', '~> 1.9'
40
40
  spec.add_dependency 'rspec_junit_formatter', '~> 0.2.3'
41
- spec.add_dependency 'http', '~> 2.1.0'
41
+ spec.add_dependency 'faraday', '>=0.9.0'
42
42
  end
@@ -2,7 +2,8 @@
2
2
 
3
3
  module Inspec
4
4
  class EachLoop < List
5
- attr_reader :tests, :variables
5
+ attr_reader :variables
6
+ attr_accessor :tests
6
7
  def initialize
7
8
  super
8
9
  @tests = []
@@ -4,5 +4,5 @@
4
4
  # author: Christoph Hartmann
5
5
 
6
6
  module Inspec
7
- VERSION = '1.11.0'.freeze
7
+ VERSION = '1.12.0'.freeze
8
8
  end
@@ -1,9 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # copyright: 2017, Criteo
3
- # author: Guilhem Lettron
3
+ # copyright: 2017, Chef Software Inc
4
+ # author: Guilhem Lettron, Christoph Hartmann
4
5
  # license: Apache v2
5
6
 
6
- require 'http'
7
+ require 'faraday'
7
8
  require 'hashie'
8
9
 
9
10
  module Inspec::Resources
@@ -38,7 +39,7 @@ module Inspec::Resources
38
39
  end
39
40
 
40
41
  def body
41
- response.to_s
42
+ response.body
42
43
  end
43
44
 
44
45
  def headers
@@ -52,9 +53,18 @@ module Inspec::Resources
52
53
  private
53
54
 
54
55
  def response
55
- http = HTTP.headers(@headers)
56
- http = http.basic_auth(@auth) unless @auth.empty?
57
- @response ||= http.request(@method, @url, { body: @data, params: @params })
56
+ conn = Faraday.new url: @url, headers: @headers, params: @params
57
+
58
+ # set basic authentication
59
+ conn.basic_auth @auth[:user], @auth[:pass] unless @auth.empty?
60
+
61
+ # set default timeout
62
+ conn.options.timeout = 5 # open/read timeout in seconds
63
+ conn.options.open_timeout = 3 # connection open timeout in seconds
64
+
65
+ @response = conn.send(@method.downcase) do |req|
66
+ req.body = @data
67
+ end
58
68
  end
59
69
  end
60
70
  end
@@ -4,22 +4,23 @@
4
4
  # author: Christoph Hartmann
5
5
  # license: All rights reserved
6
6
 
7
+ require 'utils/filter'
8
+
7
9
  module Inspec::Resources
8
10
  class Processes < Inspec.resource(1)
9
11
  name 'processes'
10
12
  desc 'Use the processes InSpec audit resource to test properties for programs that are running on the system.'
11
13
  example "
12
14
  describe processes('mysqld') do
13
- its('list.length') { should eq 1 }
15
+ its('entries.length') { should eq 1 }
14
16
  its('users') { should eq ['mysql'] }
15
17
  its('states') { should include 'S' }
16
18
  end
19
+ describe processes(/.+/).where { label != 'unconfined' && pid < 1000 } do
20
+ its('users') { should cmp [] }
21
+ end
17
22
  "
18
23
 
19
- attr_reader :list,
20
- :users,
21
- :states
22
-
23
24
  def initialize(grep)
24
25
  @grep = grep
25
26
  # turn into a regexp if it isn't one yet
@@ -31,19 +32,40 @@ module Inspec::Resources
31
32
  @list = all_cmds.find_all do |hm|
32
33
  hm[:command] =~ grep
33
34
  end
34
-
35
- { users: :user,
36
- states: :stat }.each do |var, key|
37
- instance_variable_set("@#{var}", @list.map { |l| l[key] }.uniq)
38
- end
39
35
  end
40
36
 
41
37
  def to_s
42
38
  "Processes #{@grep.class == String ? @grep : @grep.inspect}"
43
39
  end
44
40
 
41
+ def list
42
+ warn '[DEPRECATION] `processes.list` is deprecated. Please use `processes.entries` instead. It will be removed in version 2.0.0.'
43
+ @list
44
+ end
45
+
46
+ filter = FilterTable.create
47
+ filter.add_accessor(:where)
48
+ .add_accessor(:entries)
49
+ .add(:labels, field: 'label')
50
+ .add(:pids, field: 'pid')
51
+ .add(:cpus, field: 'cpu')
52
+ .add(:mem, field: 'mem')
53
+ .add(:vsz, field: 'vsz')
54
+ .add(:rss, field: 'rss')
55
+ .add(:tty, field: 'tty')
56
+ .add(:states, field: 'stat')
57
+ .add(:start, field: 'start')
58
+ .add(:time, field: 'time')
59
+ .add(:users, field: 'user')
60
+ .add(:commands, field: 'command')
61
+ .connect(self, :filtered_processes)
62
+
45
63
  private
46
64
 
65
+ def filtered_processes
66
+ @list
67
+ end
68
+
47
69
  def ps_axo
48
70
  os = inspec.os
49
71
 
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.11.0
4
+ version: 1.12.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-02-01 00:00:00.000000000 Z
11
+ date: 2017-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: train
@@ -219,19 +219,19 @@ dependencies:
219
219
  - !ruby/object:Gem::Version
220
220
  version: 0.2.3
221
221
  - !ruby/object:Gem::Dependency
222
- name: http
222
+ name: faraday
223
223
  requirement: !ruby/object:Gem::Requirement
224
224
  requirements:
225
- - - "~>"
225
+ - - ">="
226
226
  - !ruby/object:Gem::Version
227
- version: 2.1.0
227
+ version: 0.9.0
228
228
  type: :runtime
229
229
  prerelease: false
230
230
  version_requirements: !ruby/object:Gem::Requirement
231
231
  requirements:
232
- - - "~>"
232
+ - - ">="
233
233
  - !ruby/object:Gem::Version
234
- version: 2.1.0
234
+ version: 0.9.0
235
235
  description: InSpec provides a framework for creating end-to-end infrastructure tests.
236
236
  You can use it for integration or even compliance testing. Create fully portable
237
237
  test profiles and use them in your workflow to ensure stability and security. Integrate
@@ -341,6 +341,7 @@ files:
341
341
  - examples/README.md
342
342
  - examples/inheritance/README.md
343
343
  - examples/inheritance/controls/example.rb
344
+ - examples/inheritance/inspec.lock
344
345
  - examples/inheritance/inspec.yml
345
346
  - examples/kitchen-ansible/.kitchen.yml
346
347
  - examples/kitchen-ansible/Gemfile
@@ -375,6 +376,7 @@ files:
375
376
  - examples/profile/controls/example.rb
376
377
  - examples/profile/controls/gordon.rb
377
378
  - examples/profile/controls/meta.rb
379
+ - examples/profile/inspec.lock
378
380
  - examples/profile/inspec.yml
379
381
  - examples/profile/libraries/gordon_config.rb
380
382
  - inspec.gemspec