inspec 3.7.1 → 3.7.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -2
  3. data/lib/inspec/config.rb +12 -0
  4. data/lib/inspec/shell.rb +2 -15
  5. data/lib/inspec/version.rb +1 -1
  6. data/lib/plugins/inspec-habitat/Berksfile +5 -0
  7. data/lib/plugins/inspec-habitat/README.md +150 -0
  8. data/lib/plugins/inspec-habitat/kitchen.yml +28 -0
  9. data/lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb +9 -9
  10. data/lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb +164 -280
  11. data/lib/plugins/inspec-habitat/templates/habitat/config/inspec_exec_config.json.erb +25 -0
  12. data/lib/plugins/inspec-habitat/templates/habitat/default.toml.erb +9 -0
  13. data/lib/plugins/inspec-habitat/templates/habitat/hooks/run.erb +32 -0
  14. data/lib/plugins/inspec-habitat/templates/habitat/plan.sh.erb +85 -0
  15. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/Berksfile +2 -0
  16. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/README.md +3 -0
  17. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/files/hab_setup.exp +28 -0
  18. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/metadata.rb +9 -0
  19. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/recipes/default.rb +61 -0
  20. data/lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb +38 -0
  21. data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/README.md +3 -0
  22. data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb +40 -0
  23. data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/inspec.yml +10 -0
  24. data/lib/plugins/inspec-habitat/test/support/example_profile/README.md +3 -0
  25. data/lib/plugins/inspec-habitat/test/support/example_profile/controls/example.rb +7 -0
  26. data/lib/plugins/inspec-habitat/test/support/example_profile/inspec.yml +10 -0
  27. data/lib/plugins/inspec-habitat/test/unit/profile_test.rb +188 -132
  28. data/lib/plugins/inspec-init/templates/profiles/azure/README.md +56 -0
  29. data/lib/plugins/inspec-init/templates/profiles/azure/controls/example.rb +15 -0
  30. data/lib/plugins/inspec-init/templates/profiles/azure/inspec.yml +14 -0
  31. data/lib/plugins/inspec-init/templates/profiles/azure/libraries/.gitkeep +0 -0
  32. data/lib/plugins/inspec-init/test/functional/inspec_init_profile_test.rb +12 -0
  33. data/lib/resources/aide_conf.rb +2 -2
  34. data/lib/resources/apache.rb +2 -2
  35. data/lib/resources/apache_conf.rb +2 -2
  36. data/lib/resources/apt.rb +2 -2
  37. data/lib/resources/audit_policy.rb +2 -2
  38. data/lib/resources/auditd.rb +2 -2
  39. data/lib/resources/auditd_conf.rb +2 -2
  40. data/lib/resources/aws/aws_billing_report.rb +3 -2
  41. data/lib/resources/aws/aws_billing_reports.rb +11 -10
  42. data/lib/resources/aws/aws_cloudtrail_trail.rb +2 -2
  43. data/lib/resources/aws/aws_cloudtrail_trails.rb +2 -2
  44. data/lib/resources/aws/aws_cloudwatch_alarm.rb +9 -9
  45. data/lib/resources/aws/aws_cloudwatch_log_metric_filter.rb +18 -18
  46. data/lib/resources/aws/aws_config_delivery_channel.rb +2 -2
  47. data/lib/resources/aws/aws_config_recorder.rb +2 -2
  48. data/lib/resources/aws/aws_ebs_volume.rb +2 -2
  49. data/lib/resources/aws/aws_ebs_volumes.rb +2 -2
  50. data/lib/resources/aws/aws_ec2_instance.rb +2 -2
  51. data/lib/resources/aws/aws_ec2_instances.rb +2 -2
  52. data/lib/resources/aws/aws_ecs_cluster.rb +2 -2
  53. data/lib/resources/aws/aws_eks_cluster.rb +2 -2
  54. data/lib/resources/aws/aws_elb.rb +2 -2
  55. data/lib/resources/aws/aws_elbs.rb +2 -2
  56. data/lib/resources/aws/aws_flow_log.rb +2 -2
  57. data/lib/resources/aws/aws_iam_access_key.rb +2 -2
  58. data/lib/resources/aws/aws_iam_access_keys.rb +2 -2
  59. data/lib/resources/aws/aws_iam_group.rb +2 -2
  60. data/lib/resources/aws/aws_iam_groups.rb +2 -2
  61. data/lib/resources/aws/aws_iam_password_policy.rb +2 -2
  62. data/lib/resources/aws/aws_iam_policies.rb +2 -2
  63. data/lib/resources/aws/aws_iam_policy.rb +2 -2
  64. data/lib/resources/aws/aws_iam_role.rb +2 -2
  65. data/lib/resources/aws/aws_iam_root_user.rb +2 -2
  66. data/lib/resources/aws/aws_iam_user.rb +2 -2
  67. data/lib/resources/aws/aws_iam_users.rb +2 -2
  68. data/lib/resources/aws/aws_kms_key.rb +2 -2
  69. data/lib/resources/aws/aws_kms_keys.rb +2 -2
  70. data/lib/resources/aws/aws_rds_instance.rb +2 -2
  71. data/lib/resources/aws/aws_route_table.rb +2 -2
  72. data/lib/resources/aws/aws_route_tables.rb +2 -2
  73. data/lib/resources/aws/aws_s3_bucket.rb +2 -2
  74. data/lib/resources/aws/aws_s3_bucket_object.rb +2 -2
  75. data/lib/resources/aws/aws_s3_buckets.rb +2 -2
  76. data/lib/resources/aws/aws_security_group.rb +5 -5
  77. data/lib/resources/aws/aws_security_groups.rb +2 -2
  78. data/lib/resources/aws/aws_sns_subscription.rb +2 -2
  79. data/lib/resources/aws/aws_sns_topic.rb +2 -2
  80. data/lib/resources/aws/aws_sns_topics.rb +2 -2
  81. data/lib/resources/aws/aws_sqs_queue.rb +2 -2
  82. data/lib/resources/aws/aws_subnet.rb +2 -2
  83. data/lib/resources/aws/aws_subnets.rb +2 -2
  84. data/lib/resources/aws/aws_vpc.rb +2 -2
  85. data/lib/resources/aws/aws_vpcs.rb +2 -2
  86. data/lib/resources/bash.rb +2 -2
  87. data/lib/resources/bond.rb +2 -2
  88. data/lib/resources/bridge.rb +2 -2
  89. data/lib/resources/chocolatey_package.rb +2 -2
  90. data/lib/resources/command.rb +2 -2
  91. data/lib/resources/cpan.rb +2 -2
  92. data/lib/resources/cran.rb +2 -2
  93. data/lib/resources/crontab.rb +2 -2
  94. data/lib/resources/csv.rb +2 -2
  95. data/lib/resources/dh_params.rb +2 -2
  96. data/lib/resources/directory.rb +2 -2
  97. data/lib/resources/docker.rb +2 -2
  98. data/lib/resources/docker_container.rb +2 -2
  99. data/lib/resources/docker_image.rb +2 -2
  100. data/lib/resources/docker_plugin.rb +2 -2
  101. data/lib/resources/docker_service.rb +2 -2
  102. data/lib/resources/elasticsearch.rb +2 -2
  103. data/lib/resources/etc_fstab.rb +2 -2
  104. data/lib/resources/etc_group.rb +2 -2
  105. data/lib/resources/etc_hosts.rb +2 -2
  106. data/lib/resources/etc_hosts_allow_deny.rb +4 -4
  107. data/lib/resources/file.rb +2 -2
  108. data/lib/resources/filesystem.rb +2 -2
  109. data/lib/resources/firewalld.rb +2 -2
  110. data/lib/resources/gem.rb +2 -2
  111. data/lib/resources/groups.rb +4 -4
  112. data/lib/resources/grub_conf.rb +2 -2
  113. data/lib/resources/host.rb +2 -2
  114. data/lib/resources/http.rb +25 -5
  115. data/lib/resources/iis_app.rb +2 -2
  116. data/lib/resources/iis_app_pool.rb +6 -3
  117. data/lib/resources/iis_site.rb +4 -4
  118. data/lib/resources/inetd_conf.rb +2 -2
  119. data/lib/resources/ini.rb +2 -2
  120. data/lib/resources/interface.rb +2 -2
  121. data/lib/resources/iptables.rb +2 -2
  122. data/lib/resources/json.rb +2 -3
  123. data/lib/resources/kernel_module.rb +17 -18
  124. data/lib/resources/kernel_parameter.rb +2 -2
  125. data/lib/resources/key_rsa.rb +2 -2
  126. data/lib/resources/ksh.rb +2 -2
  127. data/lib/resources/limits_conf.rb +2 -2
  128. data/lib/resources/login_def.rb +2 -2
  129. data/lib/resources/mount.rb +2 -2
  130. data/lib/resources/mssql_session.rb +2 -2
  131. data/lib/resources/mysql_conf.rb +2 -2
  132. data/lib/resources/mysql_session.rb +2 -2
  133. data/lib/resources/nginx.rb +2 -2
  134. data/lib/resources/nginx_conf.rb +2 -2
  135. data/lib/resources/npm.rb +2 -2
  136. data/lib/resources/ntp_conf.rb +2 -2
  137. data/lib/resources/oneget.rb +2 -2
  138. data/lib/resources/oracledb_session.rb +2 -2
  139. data/lib/resources/os.rb +2 -2
  140. data/lib/resources/os_env.rb +2 -2
  141. data/lib/resources/package.rb +2 -2
  142. data/lib/resources/packages.rb +2 -2
  143. data/lib/resources/parse_config.rb +4 -4
  144. data/lib/resources/passwd.rb +2 -2
  145. data/lib/resources/pip.rb +2 -2
  146. data/lib/resources/platform.rb +2 -2
  147. data/lib/resources/port.rb +2 -2
  148. data/lib/resources/postgres_conf.rb +2 -2
  149. data/lib/resources/postgres_hba_conf.rb +2 -2
  150. data/lib/resources/postgres_ident_conf.rb +2 -2
  151. data/lib/resources/postgres_session.rb +2 -2
  152. data/lib/resources/powershell.rb +2 -2
  153. data/lib/resources/processes.rb +2 -2
  154. data/lib/resources/rabbitmq_conf.rb +2 -2
  155. data/lib/resources/registry_key.rb +2 -2
  156. data/lib/resources/security_identifier.rb +2 -2
  157. data/lib/resources/security_policy.rb +2 -2
  158. data/lib/resources/service.rb +14 -14
  159. data/lib/resources/shadow.rb +2 -2
  160. data/lib/resources/ssh_conf.rb +4 -4
  161. data/lib/resources/ssl.rb +2 -2
  162. data/lib/resources/sys_info.rb +2 -2
  163. data/lib/resources/toml.rb +2 -2
  164. data/lib/resources/users.rb +4 -4
  165. data/lib/resources/vbscript.rb +2 -2
  166. data/lib/resources/virtualization.rb +2 -2
  167. data/lib/resources/windows_feature.rb +2 -2
  168. data/lib/resources/windows_hotfix.rb +2 -2
  169. data/lib/resources/windows_task.rb +2 -2
  170. data/lib/resources/wmi.rb +2 -2
  171. data/lib/resources/x509_certificate.rb +2 -2
  172. data/lib/resources/xinetd.rb +2 -2
  173. data/lib/resources/xml.rb +2 -2
  174. data/lib/resources/yaml.rb +2 -2
  175. data/lib/resources/yum.rb +2 -2
  176. data/lib/resources/zfs_dataset.rb +2 -2
  177. data/lib/resources/zfs_pool.rb +2 -2
  178. metadata +26 -4
@@ -22,7 +22,7 @@ module Inspec::Resources
22
22
  supports platform: 'unix'
23
23
  supports platform: 'windows'
24
24
  desc 'Use the file InSpec audit resource to test all system file types, including files, directories, symbolic links, named pipes, sockets, character devices, block devices, and doors.'
25
- example "
25
+ example <<~EXAMPLE
26
26
  describe file('path') do
27
27
  it { should exist }
28
28
  it { should be_file }
@@ -32,7 +32,7 @@ module Inspec::Resources
32
32
  it { should be_owned_by 'root' }
33
33
  its('mode') { should cmp '0644' }
34
34
  end
35
- "
35
+ EXAMPLE
36
36
 
37
37
  attr_reader :file, :mount_options
38
38
  def initialize(path)
@@ -4,7 +4,7 @@ module Inspec::Resources
4
4
  supports platform: 'linux'
5
5
  supports platform: 'windows'
6
6
  desc 'Use the filesystem InSpec resource to test file system'
7
- example "
7
+ example <<~EXAMPLE
8
8
  describe filesystem('/') do
9
9
  its('size_kb') { should be >= 32000 }
10
10
  its('free_kb') { should be >= 3200 }
@@ -17,7 +17,7 @@ module Inspec::Resources
17
17
  its('type') { should cmp 'NTFS' }
18
18
  its('percent_free') { should be >= 20 }
19
19
  end
20
- "
20
+ EXAMPLE
21
21
  attr_reader :partition
22
22
 
23
23
  def initialize(partition)
@@ -10,7 +10,7 @@ module Inspec::Resources
10
10
  name 'firewalld'
11
11
  supports platform: 'linux'
12
12
  desc 'Use the firewalld resource to check and see if firewalld is configured to grand or deny access to specific hosts or services'
13
- example "
13
+ example <<~EXAMPLE
14
14
  describe firewalld do
15
15
  it { should be_running }
16
16
  its('default_zone') { should eq 'public' }
@@ -23,7 +23,7 @@ module Inspec::Resources
23
23
  its('sources') { should cmp ['ssh', 'icmp'] }
24
24
  its('services') { should cmp ['192.168.1.0/24', '192.168.1.2'] }
25
25
  end
26
- "
26
+ EXAMPLE
27
27
 
28
28
  attr_reader :params
29
29
 
@@ -6,12 +6,12 @@ module Inspec::Resources
6
6
  supports platform: 'unix'
7
7
  supports platform: 'windows'
8
8
  desc 'Use the gem InSpec audit resource to test if a global gem package is installed.'
9
- example "
9
+ example <<~EXAMPLE
10
10
  describe gem('rubocop') do
11
11
  it { should be_installed }
12
12
  its('version') { should eq '0.33.0' }
13
13
  end
14
- "
14
+ EXAMPLE
15
15
 
16
16
  attr_reader :gem_binary
17
17
 
@@ -28,7 +28,7 @@ module Inspec::Resources
28
28
  supports platform: 'unix'
29
29
  supports platform: 'windows'
30
30
  desc 'Use the group InSpec audit resource to test groups on the system. Groups can be filtered.'
31
- example "
31
+ example <<~EXAMPLE
32
32
  describe groups.where { name == 'root'} do
33
33
  its('names') { should eq ['root'] }
34
34
  its('gids') { should eq [0] }
@@ -38,7 +38,7 @@ module Inspec::Resources
38
38
  its('names') { should eq ['Administrators'] }
39
39
  its('gids') { should eq ['S-1-5-32-544'] }
40
40
  end
41
- "
41
+ EXAMPLE
42
42
 
43
43
  def initialize
44
44
  # select group manager
@@ -80,7 +80,7 @@ module Inspec::Resources
80
80
  supports platform: 'unix'
81
81
  supports platform: 'windows'
82
82
  desc 'Use the group InSpec audit resource to test groups on the system.'
83
- example "
83
+ example <<~EXAMPLE
84
84
  describe group('root') do
85
85
  it { should exist }
86
86
  its('gid') { should eq 0 }
@@ -89,7 +89,7 @@ module Inspec::Resources
89
89
  describe group('Administrators') do
90
90
  its('members') { should include 'Administrator' }
91
91
  end
92
- "
92
+ EXAMPLE
93
93
 
94
94
  def initialize(groupname)
95
95
  @group = groupname
@@ -7,7 +7,7 @@ class GrubConfig < Inspec.resource(1)
7
7
  name 'grub_conf'
8
8
  supports platform: 'unix'
9
9
  desc 'Use the grub_conf InSpec audit resource to test the boot config of Linux systems that use Grub.'
10
- example "
10
+ example <<~EXAMPLE
11
11
  describe grub_conf('/etc/grub.conf', 'default') do
12
12
  its('kernel') { should include '/vmlinuz-2.6.32-573.7.1.el6.x86_64' }
13
13
  its('initrd') { should include '/initramfs-2.6.32-573.el6.x86_64.img=1' }
@@ -19,7 +19,7 @@ class GrubConfig < Inspec.resource(1)
19
19
  describe grub_conf('/etc/grub.conf', 'CentOS (2.6.32-573.12.1.el6.x86_64)') do
20
20
  its('kernel') { should include 'audit=1' }
21
21
  end
22
- "
22
+ EXAMPLE
23
23
 
24
24
  include FileReader
25
25
 
@@ -30,7 +30,7 @@ module Inspec::Resources
30
30
  supports platform: 'unix'
31
31
  supports platform: 'windows'
32
32
  desc 'Use the host InSpec audit resource to test the name used to refer to a specific host and its availability, including the Internet protocols and ports over which that host name should be available.'
33
- example "
33
+ example <<~EXAMPLE
34
34
  describe host('example.com') do
35
35
  it { should be_reachable }
36
36
  it { should be_resolvable }
@@ -40,7 +40,7 @@ module Inspec::Resources
40
40
  describe host('example.com', port: '80', protocol: 'tcp') do
41
41
  it { should be_reachable }
42
42
  end
43
- "
43
+ EXAMPLE
44
44
 
45
45
  attr_reader :hostname, :port, :protocol
46
46
 
@@ -4,6 +4,7 @@
4
4
  # license: Apache v2
5
5
 
6
6
  require 'faraday'
7
+ require 'faraday_middleware'
7
8
  require 'hashie'
8
9
 
9
10
  module Inspec::Resources
@@ -11,7 +12,7 @@ module Inspec::Resources
11
12
  name 'http'
12
13
  supports platform: 'unix'
13
14
  desc 'Use the http InSpec audit resource to test http call.'
14
- example "
15
+ example <<~EXAMPLE
15
16
  describe http('http://localhost:8080/ping', auth: {user: 'user', pass: 'test'}, params: {format: 'html'}) do
16
17
  its('status') { should cmp 200 }
17
18
  its('body') { should cmp 'pong' }
@@ -22,7 +23,7 @@ module Inspec::Resources
22
23
  its('Content-Length') { should cmp 258 }
23
24
  its('Content-Type') { should cmp 'text/html; charset=UTF-8' }
24
25
  end
25
- "
26
+ EXAMPLE
26
27
 
27
28
  def initialize(url, opts = {})
28
29
  @url = url
@@ -63,7 +64,11 @@ module Inspec::Resources
63
64
  end
64
65
 
65
66
  def to_s
66
- "http #{http_method} on #{@url}"
67
+ if @opts and @url
68
+ "HTTP #{http_method} on #{@url}"
69
+ else
70
+ 'HTTP Resource'
71
+ end
67
72
  end
68
73
 
69
74
  class Worker
@@ -110,6 +115,10 @@ module Inspec::Resources
110
115
  def ssl_verify?
111
116
  opts.fetch(:ssl_verify, true)
112
117
  end
118
+
119
+ def max_redirects
120
+ opts.fetch(:max_redirects, 0)
121
+ end
113
122
  end
114
123
 
115
124
  class Local < Base
@@ -129,7 +138,11 @@ module Inspec::Resources
129
138
 
130
139
  def response
131
140
  return @response if @response
132
- conn = Faraday.new url: url, headers: request_headers, params: params, ssl: { verify: ssl_verify? }
141
+ conn = Faraday.new(url: url, headers: request_headers, params: params, ssl: { verify: ssl_verify? }) do |builder|
142
+ builder.request :url_encoded
143
+ builder.use FaradayMiddleware::FollowRedirects, limit: max_redirects if max_redirects > 0
144
+ builder.adapter Faraday.default_adapter
145
+ end
133
146
 
134
147
  # set basic authentication
135
148
  conn.basic_auth username, password unless username.nil? || password.nil?
@@ -187,7 +200,12 @@ module Inspec::Resources
187
200
  response.delete!("\r")
188
201
 
189
202
  # split the prelude (status line and headers) and the body
190
- prelude, @body = response.split("\n\n", 2)
203
+ prelude, remainder = response.split("\n\n", 2)
204
+ loop do
205
+ break unless remainder =~ %r{^HTTP/}
206
+ prelude, remainder = remainder.split("\n\n", 2)
207
+ end
208
+ @body = remainder
191
209
  prelude = prelude.lines
192
210
 
193
211
  # grab the status off of the first line of the prelude
@@ -220,6 +238,8 @@ module Inspec::Resources
220
238
  cmd << "--user \'#{username}:#{password}\'" unless username.nil? || password.nil?
221
239
  cmd << '--insecure' unless ssl_verify?
222
240
  cmd << "--data #{Shellwords.shellescape(request_body)}" unless request_body.nil?
241
+ cmd << '--location' if max_redirects > 0
242
+ cmd << "--max-redirs #{max_redirects}" if max_redirects > 0
223
243
 
224
244
  request_headers.each do |k, v|
225
245
  cmd << "-H '#{k}: #{v}'"
@@ -7,7 +7,7 @@ module Inspec::Resources
7
7
  name 'iis_app'
8
8
  supports platform: 'windows'
9
9
  desc 'Tests IIS application configuration on windows. Supported in server 2012+ only'
10
- example "
10
+ example <<~EXAMPLE
11
11
  describe iis_app('/myapp', 'Default Web Site') do
12
12
  it { should exist }
13
13
  it { should have_application_pool('MyAppPool') }
@@ -16,7 +16,7 @@ module Inspec::Resources
16
16
  it { should have_physical_path('C:\\inetpub\\wwwroot\\myapp') }
17
17
  it { should have_path('\\My Application') }
18
18
  end
19
- "
19
+ EXAMPLE
20
20
 
21
21
  def initialize(path, site_name)
22
22
  @path = path
@@ -7,14 +7,14 @@ class IisAppPool < Inspec.resource(1)
7
7
  name 'iis_app_pool'
8
8
  desc 'Tests IIS application pool configuration on windows.'
9
9
  supports platform: 'windows'
10
- example <<~EOH
10
+ example <<~EXAMPLE
11
11
  describe iis_app_pool('DefaultAppPool') do
12
12
  it { should exist }
13
13
  its('enable32bit') { should cmp 'True' }
14
14
  its('runtime_version') { should eq 'v4.0' }
15
15
  its('pipeline_mode') { should eq 'Integrated' }
16
16
  end
17
- EOH
17
+ EXAMPLE
18
18
 
19
19
  def initialize(pool_name)
20
20
  @pool_name = pool_name
@@ -86,10 +86,13 @@ class IisAppPool < Inspec.resource(1)
86
86
  def iis_app_pool
87
87
  return @cache unless @cache.nil?
88
88
 
89
+ # We use `-Compress` here to avoid a bug in PowerShell
90
+ # It does not affect validity of the output, only the representation
91
+ # See: https://github.com/inspec/inspec/pull/3842
89
92
  script = <<~EOH
90
93
  Import-Module WebAdministration
91
94
  If (Test-Path '#{@pool_path}') {
92
- Get-Item '#{@pool_path}' | Select-Object * | ConvertTo-Json
95
+ Get-Item '#{@pool_path}' | Select-Object * | ConvertTo-Json -Compress
93
96
  } Else {
94
97
  Write-Host '{}'
95
98
  }
@@ -18,7 +18,7 @@ module Inspec::Resources
18
18
  name 'iis_site'
19
19
  supports platform: 'windows'
20
20
  desc 'Tests IIS site configuration on windows. Supported in server 2012+ only'
21
- example "
21
+ example <<~EXAMPLE
22
22
  describe iis_site('Default Web Site') do
23
23
  it { should exist }
24
24
  it { should be_running }
@@ -27,7 +27,7 @@ module Inspec::Resources
27
27
  it { should have_binding('net.pipe *') }
28
28
  it { should have_path('C:\\inetpub\\wwwroot') }
29
29
  end
30
- "
30
+ EXAMPLE
31
31
 
32
32
  def initialize(site_name)
33
33
  @site_name = site_name
@@ -125,13 +125,13 @@ module Inspec::Resources
125
125
  class IisSiteServerSpec < IisSite
126
126
  name 'iis_website'
127
127
  desc 'Tests IIS site configuration on windows. Deprecated, use `iis_site` instead.'
128
- example "
128
+ example <<~EXAMPLE
129
129
  describe iis_website('Default Website') do
130
130
  it{ should exist }
131
131
  it{ should be_running }
132
132
  it{ should be_in_app_pool('Default App Pool') }
133
133
  end
134
- "
134
+ EXAMPLE
135
135
 
136
136
  def initialize(site_name)
137
137
  super(site_name)
@@ -9,13 +9,13 @@ module Inspec::Resources
9
9
  name 'inetd_conf'
10
10
  supports platform: 'unix'
11
11
  desc 'Use the inetd_conf InSpec audit resource to test if a service is enabled in the inetd.conf file on Linux and UNIX platforms. inetd---the Internet service daemon---listens on dedicated ports, and then loads the appropriate program based on a request. The inetd.conf file is typically located at /etc/inetd.conf and contains a list of Internet services associated to the ports on which that service will listen. Only enabled services may handle a request; only services that are required by the system should be enabled.'
12
- example "
12
+ example <<~EXAMPLE
13
13
  describe inetd_conf do
14
14
  its('shell') { should eq nil }
15
15
  its('login') { should eq nil }
16
16
  its('exec') { should eq nil }
17
17
  end
18
- "
18
+ EXAMPLE
19
19
 
20
20
  include FileReader
21
21
 
@@ -8,11 +8,11 @@ module Inspec::Resources
8
8
  supports platform: 'unix'
9
9
  supports platform: 'windows'
10
10
  desc 'Use the ini InSpec audit resource to test data in a INI file.'
11
- example "
11
+ example <<~EXAMPLE
12
12
  descibe ini do
13
13
  its('auth_protocol') { should eq 'https' }
14
14
  end
15
- "
15
+ EXAMPLE
16
16
  # override file load and parse hash with simple config
17
17
  def parse(content)
18
18
  SimpleConfig.new(content).params
@@ -8,13 +8,13 @@ module Inspec::Resources
8
8
  supports platform: 'unix'
9
9
  supports platform: 'windows'
10
10
  desc 'Use the interface InSpec audit resource to test basic network adapter properties, such as name, status, and link speed (in MB/sec).'
11
- example "
11
+ example <<~EXAMPLE
12
12
  describe interface('eth0') do
13
13
  it { should exist }
14
14
  it { should be_up }
15
15
  its('speed') { should eq 1000 }
16
16
  end
17
- "
17
+ EXAMPLE
18
18
  def initialize(iface)
19
19
  @iface = iface
20
20
 
@@ -24,11 +24,11 @@ module Inspec::Resources
24
24
  name 'iptables'
25
25
  supports platform: 'linux'
26
26
  desc 'Use the iptables InSpec audit resource to test rules that are defined in iptables, which maintains tables of IP packet filtering rules. There may be more than one table. Each table contains one (or more) chains (both built-in and custom). A chain is a list of rules that match packets. When the rule matches, the rule defines what target to assign to the packet.'
27
- example "
27
+ example <<~EXAMPLE
28
28
  describe iptables do
29
29
  it { should have_rule('-P INPUT ACCEPT') }
30
30
  end
31
- "
31
+ EXAMPLE
32
32
 
33
33
  def initialize(params = {})
34
34
  @table = params[:table]
@@ -8,7 +8,7 @@ module Inspec::Resources
8
8
  class JsonConfig < Inspec.resource(1)
9
9
  name 'json'
10
10
  desc 'Use the json InSpec audit resource to test data in a JSON file.'
11
- example "
11
+ example <<~EXAMPLE
12
12
  describe json('policyfile.lock.json') do
13
13
  its(['cookbook_locks','omnibus','version']) { should eq('2.2.0') }
14
14
  end
@@ -20,8 +20,7 @@ module Inspec::Resources
20
20
  describe json({ content: '{\"item1\": { \"status\": \"available\" } }' }) do
21
21
  its(['item1', 'status']) { should cmp 'available' }
22
22
  end
23
-
24
- "
23
+ EXAMPLE
25
24
 
26
25
  include ObjectTraverser
27
26
  include FileReader
@@ -12,27 +12,26 @@ module Inspec::Resources
12
12
  or if a module is disabled via a fake install using the `bin_true` or `bin_false`
13
13
  method.'
14
14
 
15
- example "
16
-
17
- describe kernel_module('video') do
18
- it { should be_loaded }
19
- it { should_not be_disabled }
20
- it { should_not be_blacklisted }
21
- end
15
+ example <<~EXAMPLE
16
+ describe kernel_module('video') do
17
+ it { should be_loaded }
18
+ it { should_not be_disabled }
19
+ it { should_not be_blacklisted }
20
+ end
22
21
 
23
- describe kernel_module('sstfb') do
24
- it { should_not be_loaded }
25
- it { should be_disabled }
26
- end
22
+ describe kernel_module('sstfb') do
23
+ it { should_not be_loaded }
24
+ it { should be_disabled }
25
+ end
27
26
 
28
- describe kernel_module('floppy') do
29
- it { should be_blacklisted }
30
- end
27
+ describe kernel_module('floppy') do
28
+ it { should be_blacklisted }
29
+ end
31
30
 
32
- describe kernel_module('dhcp') do
33
- it { should_not be_loaded }
34
- end
35
- "
31
+ describe kernel_module('dhcp') do
32
+ it { should_not be_loaded }
33
+ end
34
+ EXAMPLE
36
35
 
37
36
  def initialize(modulename = nil)
38
37
  @module = modulename
@@ -5,11 +5,11 @@ module Inspec::Resources
5
5
  name 'kernel_parameter'
6
6
  supports platform: 'unix'
7
7
  desc 'Use the kernel_parameter InSpec audit resource to test kernel parameters on Linux platforms.'
8
- example "
8
+ example <<~EXAMPLE
9
9
  describe kernel_parameter('net.ipv4.conf.all.forwarding') do
10
10
  its('value') { should eq 0 }
11
11
  end
12
- "
12
+ EXAMPLE
13
13
 
14
14
  def initialize(parameter = nil)
15
15
  @parameter = parameter