inspec 2.2.20 → 2.2.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -12
  3. data/docs/resources/file.md.erb +10 -3
  4. data/lib/inspec/base_cli.rb +2 -0
  5. data/lib/inspec/cli.rb +5 -0
  6. data/lib/inspec/dependencies/dependency_set.rb +3 -3
  7. data/lib/inspec/dependencies/requirement.rb +18 -11
  8. data/lib/inspec/profile.rb +9 -1
  9. data/lib/inspec/reporters/json.rb +1 -0
  10. data/lib/inspec/resource.rb +21 -9
  11. data/lib/inspec/runner_rspec.rb +2 -2
  12. data/lib/inspec/version.rb +1 -1
  13. data/lib/resources/aide_conf.rb +3 -5
  14. data/lib/resources/apache_conf.rb +8 -0
  15. data/lib/resources/auditd.rb +13 -15
  16. data/lib/resources/aws/aws_cloudtrail_trails.rb +4 -5
  17. data/lib/resources/aws/aws_ec2_instances.rb +3 -4
  18. data/lib/resources/aws/aws_iam_access_keys.rb +16 -18
  19. data/lib/resources/aws/aws_iam_groups.rb +2 -2
  20. data/lib/resources/aws/aws_iam_policies.rb +4 -5
  21. data/lib/resources/aws/aws_iam_users.rb +17 -22
  22. data/lib/resources/aws/aws_kms_keys.rb +4 -5
  23. data/lib/resources/aws/aws_route_tables.rb +4 -5
  24. data/lib/resources/aws/aws_s3_buckets.rb +3 -5
  25. data/lib/resources/aws/aws_security_groups.rb +3 -5
  26. data/lib/resources/aws/aws_sns_topics.rb +3 -5
  27. data/lib/resources/aws/aws_subnets.rb +6 -8
  28. data/lib/resources/aws/aws_vpcs.rb +6 -8
  29. data/lib/resources/azure/azure_generic_resource.rb +7 -11
  30. data/lib/resources/azure/azure_virtual_machine_data_disk.rb +15 -17
  31. data/lib/resources/crontab.rb +9 -11
  32. data/lib/resources/docker.rb +32 -38
  33. data/lib/resources/elasticsearch.rb +24 -26
  34. data/lib/resources/etc_fstab.rb +8 -10
  35. data/lib/resources/etc_hosts.rb +4 -6
  36. data/lib/resources/etc_hosts_allow_deny.rb +4 -6
  37. data/lib/resources/file.rb +1 -1
  38. data/lib/resources/firewalld.rb +6 -8
  39. data/lib/resources/groups.rb +6 -8
  40. data/lib/resources/nginx_conf.rb +4 -6
  41. data/lib/resources/packages.rb +5 -7
  42. data/lib/resources/passwd.rb +9 -11
  43. data/lib/resources/port.rb +7 -9
  44. data/lib/resources/postgres_hba_conf.rb +7 -9
  45. data/lib/resources/postgres_ident_conf.rb +4 -6
  46. data/lib/resources/processes.rb +13 -15
  47. data/lib/resources/ssl.rb +5 -7
  48. data/lib/resources/users.rb +15 -17
  49. data/lib/resources/xinetd.rb +9 -11
  50. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e42bda28814bf570413a78722e5d9b8533e3e993ba01aacea19822b4bd2a8fb5
4
- data.tar.gz: d4c231e279a19a1875aaa21d1eb82cc507c942f4bd82051146f52b61fd9331ff
3
+ metadata.gz: 8d1fd91c23f600805625f0091a060ed582d7037cf057f5d302f9d8251807ae64
4
+ data.tar.gz: 168ceacd5af2cc37cfd5728c11f22045efe2146ebd4ef7e0838e799b7591ad31
5
5
  SHA512:
6
- metadata.gz: bbe7929ee06d7a836d46e2d661048631b5bb32e2214ce13c67a6a3cfa2efb51db9469e3832d90de76d87193bcf70c29a9379c3ef8a4b95d0c8ad241ef3396e4f
7
- data.tar.gz: 432df70f939256dbd22e5f8e8a8399030650c0bd9ee042eb4d89370ea151e17cafff810b012afba07ddb67b35c7bad4999067a496afcfc944593c1520c0095f5
6
+ metadata.gz: '018755cf06f189d55edf114bcddc147e1ebfb4cf14c46b0363d20408cf90a4e6682df07c706aff1290f6848b50072fd7204ae493463ae97d8f89db84c745c86b'
7
+ data.tar.gz: ff105b814bbeb16760bed805bb6ea6a31af22e686bbc005ba25176e2d953a10052496bd5d0cb174258ec50f02a0b18f62540db6ed344733fde116a96c0690a65
@@ -1,25 +1,43 @@
1
1
  # Change Log
2
2
  <!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
3
- <!-- latest_release 2.2.20 -->
4
- ## [v2.2.20](https://github.com/inspec/inspec/tree/v2.2.20) (2018-06-21)
3
+ <!-- latest_release 2.2.27 -->
4
+ ## [v2.2.27](https://github.com/inspec/inspec/tree/v2.2.27) (2018-06-29)
5
5
 
6
- #### Merged Pull Requests
7
- - Accept symbols and downcased criteria in aws_iam_policy have_statement matcher [#3129](https://github.com/inspec/inspec/pull/3129) ([clintoncwolfe](https://github.com/clintoncwolfe))
6
+ #### New Features
7
+ - Document exit codes for &#39;inspec exec&#39; and add --no-distinct-exit option [#3178](https://github.com/inspec/inspec/pull/3178) ([clintoncwolfe](https://github.com/clintoncwolfe))
8
8
  <!-- latest_release -->
9
9
 
10
- <!-- release_rollup since=2.2.16 -->
11
- ### Changes since 2.2.16 release
10
+ <!-- release_rollup since=2.2.20 -->
11
+ ### Changes since 2.2.20 release
12
12
 
13
- #### Merged Pull Requests
14
- - Accept symbols and downcased criteria in aws_iam_policy have_statement matcher [#3129](https://github.com/inspec/inspec/pull/3129) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 2.2.20 -->
13
+ #### New Features
14
+ - Document exit codes for &#39;inspec exec&#39; and add --no-distinct-exit option [#3178](https://github.com/inspec/inspec/pull/3178) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 2.2.27 -->
15
+ - Set parent_profile field on child profiles (json report) [#3164](https://github.com/inspec/inspec/pull/3164) ([jquick](https://github.com/jquick)) <!-- 2.2.25 -->
15
16
 
16
17
  #### Enhancements
17
- - Fix control merging when overriding child controls [#3155](https://github.com/inspec/inspec/pull/3155) ([jquick](https://github.com/jquick)) <!-- 2.2.19 -->
18
- - auditd resource: Add handling for sudo/no command [#3151](https://github.com/inspec/inspec/pull/3151) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 2.2.18 -->
19
- - updated skip message to reflect accurate version of audit support [#3153](https://github.com/inspec/inspec/pull/3153) ([jeremymv2](https://github.com/jeremymv2)) <!-- 2.2.17 -->
18
+ - Update core resources with filtertable API changes [#3117](https://github.com/inspec/inspec/pull/3117) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 2.2.26 -->
19
+ - apache_conf resource: Strip quotes from values [#3142](https://github.com/inspec/inspec/pull/3142) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 2.2.24 -->
20
+
21
+ #### Merged Pull Requests
22
+ - Add functional tests for nested attributes [#3157](https://github.com/inspec/inspec/pull/3157) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 2.2.23 -->
23
+
24
+ #### Bug Fixes
25
+ - Detect inspec-core mode and do not attempt to load cloud resources [#3163](https://github.com/inspec/inspec/pull/3163) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 2.2.22 -->
26
+ - Add support for shallow link paths [#3168](https://github.com/inspec/inspec/pull/3168) ([ColinHebert](https://github.com/ColinHebert)) <!-- 2.2.21 -->
20
27
  <!-- release_rollup -->
21
28
 
22
29
  <!-- latest_stable_release -->
30
+ ## [v2.2.20](https://github.com/inspec/inspec/tree/v2.2.20) (2018-06-21)
31
+
32
+ #### Enhancements
33
+ - updated skip message to reflect accurate version of audit support [#3153](https://github.com/inspec/inspec/pull/3153) ([jeremymv2](https://github.com/jeremymv2))
34
+ - auditd resource: Add handling for sudo/no command [#3151](https://github.com/inspec/inspec/pull/3151) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
35
+ - Fix control merging when overriding child controls [#3155](https://github.com/inspec/inspec/pull/3155) ([jquick](https://github.com/jquick))
36
+
37
+ #### Merged Pull Requests
38
+ - Accept symbols and downcased criteria in aws_iam_policy have_statement matcher [#3129](https://github.com/inspec/inspec/pull/3129) ([clintoncwolfe](https://github.com/clintoncwolfe))
39
+ <!-- latest_stable_release -->
40
+
23
41
  ## [v2.2.16](https://github.com/inspec/inspec/tree/v2.2.16) (2018-06-15)
24
42
 
25
43
  #### Enhancements
@@ -31,7 +49,6 @@
31
49
  - Add insecure option to the automate report json [#3124](https://github.com/inspec/inspec/pull/3124) ([jquick](https://github.com/jquick))
32
50
  - Bump train version for inspec [#3147](https://github.com/inspec/inspec/pull/3147) ([jquick](https://github.com/jquick))
33
51
  - deprecate azure_generic_resource [#3132](https://github.com/inspec/inspec/pull/3132) ([chris-rock](https://github.com/chris-rock))
34
- <!-- latest_stable_release -->
35
52
 
36
53
  ## [v2.2.10](https://github.com/inspec/inspec/tree/v2.2.10) (2018-06-08)
37
54
 
@@ -33,7 +33,7 @@ content, size, basename, path, owner, group, type
33
33
 
34
34
  ### Unix/Linux Properties
35
35
 
36
- symlink, mode, link_path, mtime, size, selinux\_label, md5sum, sha256sum, path, source, source\_path, uid, gid
36
+ symlink, mode, link_path, shallow_link_path, mtime, size, selinux\_label, md5sum, sha256sum, path, source, source\_path, uid, gid
37
37
 
38
38
  ### Windows Properties
39
39
 
@@ -74,10 +74,17 @@ The following examples show how to use this InSpec audit resource.
74
74
  ### link_path
75
75
 
76
76
  The `link_path` property tests if the file exists at the specified path. If the file is a symlink,
77
- InSpec will resolve the symlink and return the ultimate linked file.
77
+ InSpec will resolve the symlink recursively and return the ultimate linked file.
78
78
 
79
79
  its('link_path') { should eq '/some/path/to/file' }
80
80
 
81
+ ### shallow_link_path
82
+
83
+ The `shallow_link_path`` property returns the path that the file refers to, only resolving
84
+ it once (that is, it performs a readlink operation). If the file is not a symlink, nil is returned.
85
+
86
+ its('shallow_link_path') { should eq '/some/path/to/file' }
87
+
81
88
  ### md5sum
82
89
 
83
90
  The `md5sum` property tests if the MD5 checksum for a file matches the specified value.
@@ -316,7 +323,7 @@ The following example shows how to use the `file` audit resource to verify if th
316
323
 
317
324
  ### Test parameters of symlinked file
318
325
 
319
- If you need to test the parameters of the target file for a symlink, you can use the `link_path` method for the `file` resource.
326
+ If you need to test the parameters of the target file for a symlink, you can use the `link_path` (recursive resolution) or `shallow_link_path` (direct link) method for the `file` resource.
320
327
 
321
328
  For example, for the following symlink:
322
329
 
@@ -83,6 +83,8 @@ module Inspec
83
83
  desc: 'Allow caching for backend command output. (default: true)'
84
84
  option :show_progress, type: :boolean,
85
85
  desc: 'Show progress while executing tests.'
86
+ option :distinct_exit, type: :boolean, default: true,
87
+ desc: 'Exit with code 101 if any tests fail, and 100 if any are skipped (default). If disabled, exit 0 on skips and 1 for failures.'
86
88
  end
87
89
 
88
90
  def self.default_options
@@ -156,6 +156,9 @@ class Inspec::InspecCLI < Inspec::BaseCLI
156
156
  end
157
157
 
158
158
  desc 'exec PATHS', 'run all test files at the specified PATH.'
159
+ long_desc <<~EOT
160
+ Loads the given profile(s) and fetches their dependencies if needed. Then connects to the target and executes any controls contained in the profiles. One or more reporters are used to generate output. If all tests passed (no fails, no skips) exit code 0 is returned. If some tests skipped but none failed, exit code 101 is returned. If at least one test failed, exit code 100 is returned. If inspec failed for any other reason, exit code 1 is returned.
161
+ EOT
159
162
  exec_options
160
163
  def exec(*targets)
161
164
  o = opts(:exec).dup
@@ -204,6 +207,8 @@ class Inspec::InspecCLI < Inspec::BaseCLI
204
207
  desc: 'Enable one or more output reporters: cli, documentation, html, progress, json, json-min, json-rspec, junit'
205
208
  option :depends, type: :array, default: [],
206
209
  desc: 'A space-delimited list of local folders containing profiles whose libraries and resources will be loaded into the new shell'
210
+ option :distinct_exit, type: :boolean, default: true,
211
+ desc: 'Exit with code 101 if any tests fail, and 100 if any are skipped (default). If disabled, exit 0 on skips and 1 for failures.'
207
212
  def shell_func
208
213
  o = opts(:shell).dup
209
214
  diagnose(o)
@@ -14,13 +14,13 @@ module Inspec
14
14
  # @param cwd [String] Current working directory for relative path includes
15
15
  # @param vendor_path [String] Path to the vendor directory
16
16
  #
17
- def self.from_lockfile(lockfile, cwd, cache, backend, opts = {})
17
+ def self.from_lockfile(lockfile, config, opts = {})
18
18
  dep_tree = lockfile.deps.map do |dep|
19
- Inspec::Requirement.from_lock_entry(dep, cwd, cache, backend, opts)
19
+ Inspec::Requirement.from_lock_entry(dep, config, opts)
20
20
  end
21
21
 
22
22
  dep_list = flatten_dep_tree(dep_tree)
23
- new(cwd, cache, dep_list, backend)
23
+ new(config[:cwd], config[:cache], dep_list, config[:backend])
24
24
  end
25
25
 
26
26
  def self.from_array(dependencies, cwd, cache, backend)
@@ -17,37 +17,42 @@ module Inspec
17
17
  if dep[:path]
18
18
  req_path = File.expand_path(dep[:path], req_path)
19
19
  end
20
+ config = {
21
+ cache: cache,
22
+ cwd: req_path,
23
+ }
20
24
 
21
25
  new(dep[:name],
22
26
  dep[:version],
23
- cache,
24
- req_path,
27
+ config,
25
28
  opts.merge(dep))
26
29
  end
27
30
 
28
- def self.from_lock_entry(entry, cwd, cache, backend, opts = {})
31
+ def self.from_lock_entry(entry, config, opts = {})
29
32
  req = new(entry[:name],
30
33
  entry[:version_constraints],
31
- cache,
32
- cwd,
33
- entry[:resolved_source].merge(backend: backend).merge(opts))
34
+ config,
35
+ entry[:resolved_source].merge(backend: config[:backend]).merge(opts))
34
36
 
35
37
  locked_deps = []
36
38
  Array(entry[:dependencies]).each do |dep_entry|
37
- locked_deps << Inspec::Requirement.from_lock_entry(dep_entry, cwd, cache, backend, opts)
39
+ dep_config = config.dup
40
+ dep_config[:parent_profile] = entry[:name]
41
+ locked_deps << Inspec::Requirement.from_lock_entry(dep_entry, dep_config, opts)
38
42
  end
39
43
  req.lock_deps(locked_deps)
40
44
  req
41
45
  end
42
46
 
43
47
  attr_reader :cwd, :opts, :version_constraints
44
- def initialize(name, version_constraints, cache, cwd, opts)
48
+ def initialize(name, version_constraints, config, opts)
45
49
  @name = name
46
50
  @version_constraints = Array(version_constraints)
47
- @cache = cache
51
+ @cache = config[:cache]
48
52
  @backend = opts[:backend]
49
53
  @opts = opts
50
- @cwd = cwd
54
+ @cwd = config[:cwd]
55
+ @parent_profile = config[:parent_profile]
51
56
  end
52
57
 
53
58
  #
@@ -114,10 +119,12 @@ module Inspec
114
119
  return @profile unless @profile.nil?
115
120
  opts = @opts.dup
116
121
  opts[:backend] = @backend
117
- if !@dependencies.nil?
122
+ if !@dependencies.nil? && !@dependencies.empty?
118
123
  opts[:dependencies] = Inspec::DependencySet.from_array(@dependencies, @cwd, @cache, @backend)
119
124
  end
120
125
  @profile = Inspec::Profile.for_fetcher(fetcher, opts)
126
+ @profile.parent_profile = @parent_profile
127
+ @profile
121
128
  end
122
129
  end
123
130
  end
@@ -79,6 +79,7 @@ module Inspec
79
79
  end
80
80
 
81
81
  attr_reader :source_reader, :backend, :runner_context, :check_mode
82
+ attr_accessor :parent_profile
82
83
  def_delegator :@source_reader, :tests
83
84
  def_delegator :@source_reader, :libraries
84
85
  def_delegator :@source_reader, :metadata
@@ -230,6 +231,7 @@ module Inspec
230
231
  # add information about the required attributes
231
232
  res[:attributes] = res[:attributes].map(&:to_hash) unless res[:attributes].nil? || res[:attributes].empty?
232
233
  res[:sha256] = sha256
234
+ res[:parent_profile] = parent_profile unless parent_profile.nil?
233
235
  res
234
236
  end
235
237
 
@@ -414,7 +416,13 @@ module Inspec
414
416
  end
415
417
 
416
418
  def load_dependencies
417
- Inspec::DependencySet.from_lockfile(lockfile, cwd, @cache, @backend, { attributes: @attr_values })
419
+ config = {
420
+ cwd: cwd,
421
+ cache: @cache,
422
+ backend: @backend,
423
+ parent_profile: name,
424
+ }
425
+ Inspec::DependencySet.from_lockfile(lockfile, config, { attributes: @attr_values })
418
426
  end
419
427
 
420
428
  # Calculate this profile's SHA256 checksum. Includes metadata, dependencies,
@@ -105,6 +105,7 @@ module Inspec::Reporters
105
105
  copyright_email: p[:copyright_email],
106
106
  supports: p[:supports],
107
107
  attributes: p[:attributes],
108
+ parent_profile: p[:parent_profile],
108
109
  depends: p[:depends],
109
110
  groups: profile_groups(p),
110
111
  controls: profile_controls(p),
@@ -85,15 +85,27 @@ end
85
85
  # Many resources use FilterTable.
86
86
  require 'utils/filter'
87
87
 
88
- # AWS resources are included via their own file.
89
- require 'resource_support/aws' if Gem.loaded_specs.key?('aws-sdk')
90
-
91
- if Gem.loaded_specs.key?('azure_mgmt_resources')
92
- require 'resources/azure/azure_backend.rb'
93
- require 'resources/azure/azure_generic_resource.rb'
94
- require 'resources/azure/azure_resource_group.rb'
95
- require 'resources/azure/azure_virtual_machine.rb'
96
- require 'resources/azure/azure_virtual_machine_data_disk.rb'
88
+ # Detect if we are running the stripped-down inspec-core
89
+ # This relies on AWS being stripped from the inspec-core gem
90
+ inspec_core_only = !File.exist?(File.join(File.dirname(__FILE__), '..', 'resource_support', 'aws.rb'))
91
+
92
+ # Do not attempt to load cloud resources if we are in inspec-core mode
93
+ unless inspec_core_only
94
+ # AWS resources are included via their own file,
95
+ # but only consider loading them if we have the SDK available, and is v2.
96
+ # https://github.com/inspec/inspec/issues/2571
97
+ if Gem.loaded_specs.key?('aws-sdk') && Gem.loaded_specs['aws-sdk'].version < Gem::Version.new('3.0.0')
98
+ require 'resource_support/aws'
99
+ end
100
+
101
+ # Azure resources
102
+ if Gem.loaded_specs.key?('azure_mgmt_resources')
103
+ require 'resources/azure/azure_backend.rb'
104
+ require 'resources/azure/azure_generic_resource.rb'
105
+ require 'resources/azure/azure_resource_group.rb'
106
+ require 'resources/azure/azure_virtual_machine.rb'
107
+ require 'resources/azure/azure_virtual_machine_data_disk.rb'
108
+ end
97
109
  end
98
110
 
99
111
  require 'resources/aide_conf'
@@ -87,9 +87,9 @@ module Inspec
87
87
  if stats[:failed][:total] == 0 && stats[:skipped][:total] == 0
88
88
  0
89
89
  elsif stats[:failed][:total] > 0
90
- 100
90
+ @conf['distinct_exit'] ? 100 : 1
91
91
  elsif stats[:skipped][:total] > 0
92
- 101
92
+ @conf['distinct_exit'] ? 101 : 0
93
93
  else
94
94
  @rspec_exit_code
95
95
  end
@@ -4,5 +4,5 @@
4
4
  # author: Christoph Hartmann
5
5
 
6
6
  module Inspec
7
- VERSION = '2.2.20'
7
+ VERSION = '2.2.27'
8
8
  end
@@ -44,12 +44,10 @@ module Inspec::Resources
44
44
  end
45
45
 
46
46
  filter = FilterTable.create
47
- filter.add_accessor(:where)
48
- .add_accessor(:entries)
49
- .add(:selection_lines, field: 'selection_line')
50
- .add(:rules, field: 'rules')
47
+ filter.register_column(:selection_lines, field: 'selection_line')
48
+ .register_column(:rules, field: 'rules')
51
49
 
52
- filter.connect(self, :params)
50
+ filter.install_filter_methods_on_resource(self, :params)
53
51
 
54
52
  private
55
53
 
@@ -85,6 +85,14 @@ module Inspec::Resources
85
85
  assignment_regex: /^\s*(\S+)\s+((?=.*\s+$).*?|.*)\s*$/,
86
86
  multiple_values: true,
87
87
  ).params
88
+
89
+ # Capture any characters between quotes that are not escaped in values
90
+ params.values.map! do |value|
91
+ value.map! do |sub_value|
92
+ sub_value[/(?<=["|'])(?:\\.|[^"'\\])*(?=["|'])/] || sub_value
93
+ end
94
+ end
95
+
88
96
  @params.merge!(params)
89
97
 
90
98
  to_read = to_read.drop(1)
@@ -55,21 +55,19 @@ module Inspec::Resources
55
55
  end
56
56
 
57
57
  filter = FilterTable.create
58
- filter.add_accessor(:where)
59
- .add_accessor(:entries)
60
- .add(:file, field: 'file')
61
- .add(:list, field: 'list')
62
- .add(:action, field: 'action')
63
- .add(:fields, field: 'fields')
64
- .add(:fields_nokey, field: 'fields_nokey')
65
- .add(:syscall, field: 'syscall')
66
- .add(:key, field: 'key')
67
- .add(:arch, field: 'arch')
68
- .add(:path, field: 'path')
69
- .add(:permissions, field: 'permissions')
70
- .add(:exit, field: 'exit')
71
-
72
- filter.connect(self, :params)
58
+ filter.register_column(:file, field: 'file')
59
+ .register_column(:list, field: 'list')
60
+ .register_column(:action, field: 'action')
61
+ .register_column(:fields, field: 'fields')
62
+ .register_column(:fields_nokey, field: 'fields_nokey')
63
+ .register_column(:syscall, field: 'syscall')
64
+ .register_column(:key, field: 'key')
65
+ .register_column(:arch, field: 'arch')
66
+ .register_column(:path, field: 'path')
67
+ .register_column(:permissions, field: 'permissions')
68
+ .register_column(:exit, field: 'exit')
69
+
70
+ filter.install_filter_methods_on_resource(self, :params)
73
71
 
74
72
  def status(name = nil)
75
73
  @status_content ||= inspec.command('/sbin/auditctl -s').stdout.chomp
@@ -19,11 +19,10 @@ class AwsCloudTrailTrails < Inspec.resource(1)
19
19
 
20
20
  # Underlying FilterTable implementation.
21
21
  filter = FilterTable.create
22
- filter.add_accessor(:entries)
23
- .add(:exists?) { |x| !x.entries.empty? }
24
- .add(:names, field: :name)
25
- .add(:trail_arns, field: :trail_arn)
26
- filter.connect(self, :table)
22
+ filter.register_custom_matcher(:exists?) { |x| !x.entries.empty? }
23
+ filter.register_column(:trail_arns, field: :trail_arn)
24
+ filter.register_column(:names, field: :name)
25
+ filter.install_filter_methods_on_resource(self, :table)
27
26
 
28
27
  def to_s
29
28
  'CloudTrail Trails'
@@ -18,10 +18,9 @@ class AwsEc2Instances < Inspec.resource(1)
18
18
 
19
19
  # Underlying FilterTable implementation.
20
20
  filter = FilterTable.create
21
- filter.add_accessor(:entries)
22
- .add(:exists?) { |x| !x.entries.empty? }
23
- .add(:instance_ids, field: :instance_id)
24
- filter.connect(self, :table)
21
+ filter.register_custom_matcher(:exists?) { |x| !x.entries.empty? }
22
+ filter.register_column(:instance_ids, field: :instance_id)
23
+ filter.install_filter_methods_on_resource(self, :table)
25
24
 
26
25
  def to_s
27
26
  'EC2 Instances'
@@ -38,24 +38,22 @@ class AwsIamAccessKeys < Inspec.resource(1)
38
38
 
39
39
  # Underlying FilterTable implementation.
40
40
  filter = FilterTable.create
41
- filter.add_accessor(:where)
42
- .add_accessor(:entries)
43
- .add(:exists?) { |x| !x.entries.empty? }
44
- .add(:access_key_ids, field: :access_key_id)
45
- .add(:created_date, field: :create_date)
46
- .add(:created_days_ago, field: :created_days_ago)
47
- .add(:created_with_user, field: :created_with_user)
48
- .add(:created_hours_ago, field: :created_hours_ago)
49
- .add(:usernames, field: :username)
50
- .add(:active, field: :active)
51
- .add(:inactive, field: :inactive)
52
- .add(:last_used_date, field: :last_used_date)
53
- .add(:last_used_hours_ago, field: :last_used_hours_ago)
54
- .add(:last_used_days_ago, field: :last_used_days_ago)
55
- .add(:ever_used, field: :ever_used)
56
- .add(:never_used, field: :never_used)
57
- .add(:user_created_date, field: :user_created_date)
58
- filter.connect(self, :table)
41
+ filter.register_custom_matcher(:exists?) { |x| !x.entries.empty? }
42
+ filter.register_column(:access_key_ids, field: :access_key_id)
43
+ .register_column(:created_date, field: :create_date)
44
+ .register_column(:created_days_ago, field: :created_days_ago)
45
+ .register_column(:created_with_user, field: :created_with_user)
46
+ .register_column(:created_hours_ago, field: :created_hours_ago)
47
+ .register_column(:usernames, field: :username)
48
+ .register_column(:active, field: :active)
49
+ .register_column(:inactive, field: :inactive)
50
+ .register_column(:last_used_date, field: :last_used_date)
51
+ .register_column(:last_used_hours_ago, field: :last_used_hours_ago)
52
+ .register_column(:last_used_days_ago, field: :last_used_days_ago)
53
+ .register_column(:ever_used, field: :ever_used)
54
+ .register_column(:never_used, field: :never_used)
55
+ .register_column(:user_created_date, field: :user_created_date)
56
+ filter.install_filter_methods_on_resource(self, :table)
59
57
 
60
58
  def to_s
61
59
  'IAM Access Keys'