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
@@ -11,7 +11,7 @@ module Inspec::Resources
11
11
  supports platform: 'unix'
12
12
  supports platform: 'windows'
13
13
  desc 'public/private RSA key pair test'
14
- example "
14
+ example <<~EXAMPLE
15
15
  describe key_rsa('/etc/pki/www.mywebsite.com.key') do
16
16
  its('public_key') { should match /BEGIN RSA PUBLIC KEY/ }
17
17
  end
@@ -20,7 +20,7 @@ module Inspec::Resources
20
20
  it { should be_private }
21
21
  it { should be_public }
22
22
  end
23
- "
23
+ EXAMPLE
24
24
 
25
25
  include FileReader
26
26
  include PkeyReader
@@ -8,7 +8,7 @@ module Inspec::Resources
8
8
  name 'ksh'
9
9
  supports platform: 'unix'
10
10
  desc 'Run a command or script in KornShell.'
11
- example "
11
+ example <<~EXAMPLE
12
12
  describe ksh('ls -al /') do
13
13
  its('stdout') { should match /bin/ }
14
14
  its('stderr') { should eq '' }
@@ -20,7 +20,7 @@ module Inspec::Resources
20
20
 
21
21
  # Specify arguments (defaults to -c)
22
22
  ksh('...', args: '-x -c')
23
- "
23
+ EXAMPLE
24
24
 
25
25
  def initialize(command, options = {})
26
26
  @raw_command = command
@@ -9,11 +9,11 @@ module Inspec::Resources
9
9
  name 'limits_conf'
10
10
  supports platform: 'unix'
11
11
  desc 'Use the limits_conf InSpec audit resource to test configuration settings in the /etc/security/limits.conf file. The limits.conf defines limits for processes (by user and/or group names) and helps ensure that the system on which those processes are running remains stable. Each process may be assigned a hard or soft limit.'
12
- example "
12
+ example <<~EXAMPLE
13
13
  describe limits_conf do
14
14
  its('*') { should include ['hard','core','0'] }
15
15
  end
16
- "
16
+ EXAMPLE
17
17
 
18
18
  include FileReader
19
19
 
@@ -21,11 +21,11 @@ module Inspec::Resources
21
21
  name 'login_defs'
22
22
  supports platform: 'unix'
23
23
  desc 'Use the login_defs InSpec audit resource to test configuration settings in the /etc/login.defs file. The logins.defs file defines site-specific configuration for the shadow password suite on Linux and UNIX platforms, such as password expiration ranges, minimum/maximum values for automatic selection of user and group identifiers, or the method with which passwords are encrypted.'
24
- example "
24
+ example <<~EXAMPLE
25
25
  describe login_defs do
26
26
  its('ENCRYPT_METHOD') { should eq 'SHA512' }
27
27
  end
28
- "
28
+ EXAMPLE
29
29
 
30
30
  include FileReader
31
31
 
@@ -7,7 +7,7 @@ module Inspec::Resources
7
7
  name 'mount'
8
8
  supports platform: 'unix'
9
9
  desc 'Use the mount InSpec audit resource to test if mount points.'
10
- example "
10
+ example <<~EXAMPLE
11
11
  describe mount('/') do
12
12
  it { should be_mounted }
13
13
  its('count') { should eq 1 }
@@ -16,7 +16,7 @@ module Inspec::Resources
16
16
  its('options') { should eq ['rw', 'mode=620'] }
17
17
  its('options') { should include 'nodev' }
18
18
  end
19
- "
19
+ EXAMPLE
20
20
  attr_reader :file
21
21
 
22
22
  def initialize(path)
@@ -14,7 +14,7 @@ module Inspec::Resources
14
14
  name 'mssql_session'
15
15
  supports platform: 'windows'
16
16
  desc 'Use the mssql_session InSpec audit resource to test SQL commands run against a MS Sql Server database.'
17
- example "
17
+ example <<~EXAMPLE
18
18
  # Using SQL authentication
19
19
  sql = mssql_session(user: 'myuser', pass: 'mypassword')
20
20
  describe sql.query('SELECT * FROM table').row(0).column('columnname') do
@@ -27,7 +27,7 @@ module Inspec::Resources
27
27
  its('value') { should_not be_empty }
28
28
  its('value') { should cmp == 1 }
29
29
  end
30
- "
30
+ EXAMPLE
31
31
 
32
32
  attr_reader :user, :password, :host, :port, :instance, :local_mode, :db_name
33
33
  def initialize(opts = {})
@@ -31,7 +31,7 @@ module Inspec::Resources
31
31
  supports platform: 'unix'
32
32
  supports platform: 'windows'
33
33
  desc 'Use the mysql_conf InSpec audit resource to test the contents of the configuration file for MySQL, typically located at /etc/mysql/my.cnf or /etc/my.cnf.'
34
- example "
34
+ example <<~EXAMPLE
35
35
  describe mysql_conf('path') do
36
36
  its('setting') { should eq 'value' }
37
37
  end
@@ -45,7 +45,7 @@ module Inspec::Resources
45
45
  describe mysql_conf do
46
46
  its(['mariadb', 'max-connections']) { should_not be_nil }
47
47
  end
48
- "
48
+ EXAMPLE
49
49
 
50
50
  include FindFiles
51
51
  include FileReader
@@ -9,12 +9,12 @@ module Inspec::Resources
9
9
  supports platform: 'unix'
10
10
  supports platform: 'windows'
11
11
  desc 'Use the mysql_session InSpec audit resource to test SQL commands run against a MySQL database.'
12
- example "
12
+ example <<~EXAMPLE
13
13
  sql = mysql_session('my_user','password','host')
14
14
  describe sql.query('show databases like \'test\';') do
15
15
  its('stdout') { should_not match(/test/) }
16
16
  end
17
- "
17
+ EXAMPLE
18
18
 
19
19
  def initialize(user = nil, pass = nil, host = 'localhost', port = nil, socket = nil)
20
20
  @user = user
@@ -8,7 +8,7 @@ module Inspec::Resources
8
8
  name 'nginx'
9
9
  supports platform: 'unix'
10
10
  desc 'Use the nginx InSpec audit resource to test information about your NGINX instance.'
11
- example "
11
+ example <<~EXAMPLE
12
12
  describe nginx do
13
13
  its('conf_path') { should cmp '/etc/nginx/nginx.conf' }
14
14
  end
@@ -18,7 +18,7 @@ module Inspec::Resources
18
18
  describe nginx do
19
19
  its('modules') { should include 'my_module' }
20
20
  end
21
- "
21
+ EXAMPLE
22
22
  attr_reader :params, :bin_dir
23
23
 
24
24
  def initialize(nginx_path = '/usr/sbin/nginx')
@@ -19,10 +19,10 @@ module Inspec::Resources
19
19
  desc 'Use the nginx_conf InSpec resource to test configuration data '\
20
20
  'for the NginX web server located in /etc/nginx/nginx.conf on '\
21
21
  'Linux and UNIX platforms.'
22
- example "
22
+ example <<~EXAMPLE
23
23
  describe nginx_conf.params ...
24
24
  describe nginx_conf('/path/to/my/nginx.conf').params ...
25
- "
25
+ EXAMPLE
26
26
 
27
27
  extend Forwardable
28
28
 
@@ -8,7 +8,7 @@ module Inspec::Resources
8
8
  supports platform: 'unix'
9
9
  supports platform: 'windows'
10
10
  desc 'Use the npm InSpec audit resource to test if a global npm package is installed. npm is the the package manager for Nodejs packages, such as bower and StatsD.'
11
- example "
11
+ example <<~EXAMPLE
12
12
  describe npm('bower') do
13
13
  it { should be_installed }
14
14
  end
@@ -16,7 +16,7 @@ module Inspec::Resources
16
16
  describe npm('tar', path: '/path/to/project') do
17
17
  it { should be_installed }
18
18
  end
19
- "
19
+ EXAMPLE
20
20
 
21
21
  def initialize(package_name, opts = {})
22
22
  @package_name = package_name
@@ -9,12 +9,12 @@ module Inspec::Resources
9
9
  name 'ntp_conf'
10
10
  supports platform: 'unix'
11
11
  desc 'Use the ntp_conf InSpec audit resource to test the synchronization settings defined in the ntp.conf file. This file is typically located at /etc/ntp.conf.'
12
- example "
12
+ example <<~EXAMPLE
13
13
  describe ntp_conf do
14
14
  its('server') { should_not eq nil }
15
15
  its('restrict') { should include '-4 default kod notrap nomodify nopeer noquery'}
16
16
  end
17
- "
17
+ EXAMPLE
18
18
 
19
19
  include FileReader
20
20
 
@@ -12,12 +12,12 @@ module Inspec::Resources
12
12
  name 'oneget'
13
13
  supports platform: 'windows'
14
14
  desc 'Use the oneget InSpec audit resource to test if the named package and/or package version is installed on the system. This resource uses OneGet, which is part of the Windows Management Framework 5.0 and Windows 10. This resource uses the Get-Package cmdlet to return all of the package names in the OneGet repository.'
15
- example "
15
+ example <<~EXAMPLE
16
16
  describe oneget('zoomit') do
17
17
  it { should be_installed }
18
18
  its('version') { should eq '1.2.3' }
19
19
  end
20
- "
20
+ EXAMPLE
21
21
 
22
22
  def initialize(package_name)
23
23
  @package_name = package_name
@@ -15,12 +15,12 @@ module Inspec::Resources
15
15
  supports platform: 'unix'
16
16
  supports platform: 'windows'
17
17
  desc 'Use the oracledb_session InSpec resource to test commands against an Oracle database'
18
- example "
18
+ example <<~EXAMPLE
19
19
  sql = oracledb_session(user: 'my_user', pass: 'password')
20
20
  describe sql.query(\"SELECT UPPER(VALUE) AS VALUE FROM V$PARAMETER WHERE UPPER(NAME)='AUDIT_SYS_OPERATIONS'\").row(0).column('value') do
21
21
  its('value') { should eq 'TRUE' }
22
22
  end
23
- "
23
+ EXAMPLE
24
24
 
25
25
  attr_reader :user, :password, :host, :service, :as_os_user, :as_db_role
26
26
  # rubocop:disable Metrics/PerceivedComplexity,Metrics/CyclomaticComplexity
@@ -8,7 +8,7 @@ module Inspec::Resources
8
8
  supports platform: 'unix'
9
9
  supports platform: 'windows'
10
10
  desc 'Use the os InSpec audit resource to test the platform on which the system is running.'
11
- example "
11
+ example <<~EXAMPLE
12
12
  describe os[:family] do
13
13
  it { should eq 'redhat' }
14
14
  end
@@ -20,7 +20,7 @@ module Inspec::Resources
20
20
  describe os.linux? do
21
21
  it { should eq true }
22
22
  end
23
- "
23
+ EXAMPLE
24
24
 
25
25
  # reuse helper methods from backend
26
26
  %w{aix? redhat? debian? suse? bsd? solaris? linux? unix? windows? hpux? darwin?}.each do |os_family|
@@ -16,11 +16,11 @@ module Inspec::Resources
16
16
  supports platform: 'unix'
17
17
  supports platform: 'windows'
18
18
  desc 'Use the os_env InSpec audit resource to test the environment variables for the platform on which the system is running.'
19
- example "
19
+ example <<~EXAMPLE
20
20
  describe os_env('VARIABLE') do
21
21
  its('matcher') { should eq 1 }
22
22
  end
23
- "
23
+ EXAMPLE
24
24
 
25
25
  def initialize(env = nil, target = nil)
26
26
  @osenv = env
@@ -12,13 +12,13 @@ module Inspec::Resources
12
12
  supports platform: 'unix'
13
13
  supports platform: 'windows'
14
14
  desc 'Use the package InSpec audit resource to test if the named package and/or package version is installed on the system.'
15
- example "
15
+ example <<~EXAMPLE
16
16
  describe package('nginx') do
17
17
  it { should be_installed }
18
18
  it { should_not be_held } # for dpkg platforms that support holding a version from being upgraded
19
19
  its('version') { should eq 1.9.5 }
20
20
  end
21
- "
21
+ EXAMPLE
22
22
  def initialize(package_name, opts = {}) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
23
23
  @package_name = package_name
24
24
  @name = @package_name
@@ -8,7 +8,7 @@ module Inspec::Resources
8
8
  name 'packages'
9
9
  supports platform: 'unix'
10
10
  desc 'Use the packages InSpec audit resource to test properties for multiple packages installed on the system'
11
- example "
11
+ example <<~EXAMPLE
12
12
  describe packages(/xserver-xorg.*/) do
13
13
  its('entries') { should be_empty }
14
14
  end
@@ -18,7 +18,7 @@ module Inspec::Resources
18
18
  describe packages(/vi.+/).where { status != 'installed' } do
19
19
  its('statuses') { should be_empty }
20
20
  end
21
- "
21
+ EXAMPLE
22
22
 
23
23
  def initialize(pattern)
24
24
  os = inspec.os
@@ -18,7 +18,7 @@ module Inspec::Resources
18
18
  supports platform: 'unix'
19
19
  supports platform: 'windows'
20
20
  desc 'Use the parse_config InSpec audit resource to test arbitrary configuration files.'
21
- example "
21
+ example <<~EXAMPLE
22
22
  output = command('some-command').stdout
23
23
  describe parse_config(output, { data_config_option: value } ) do
24
24
  its('setting') { should eq 1 }
@@ -41,7 +41,7 @@ module Inspec::Resources
41
41
  describe parse_config(output2, options2 ).params['listen queue'].to_i do
42
42
  it { should be < 100 }
43
43
  end
44
- "
44
+ EXAMPLE
45
45
 
46
46
  include FileReader
47
47
 
@@ -94,11 +94,11 @@ module Inspec::Resources
94
94
  class PConfigFile < PConfig
95
95
  name 'parse_config_file'
96
96
  desc 'Use the parse_config_file InSpec resource to test arbitrary configuration files. It works identically to parse_config. Instead of using a command output, this resource works with files.'
97
- example "
97
+ example <<~EXAMPLE
98
98
  describe parse_config_file('/path/to/file') do
99
99
  its('setting') { should eq 1 }
100
100
  end
101
- "
101
+ EXAMPLE
102
102
 
103
103
  def initialize(path, opts = nil)
104
104
  super(nil, opts)
@@ -19,7 +19,7 @@ module Inspec::Resources
19
19
  name 'passwd'
20
20
  supports platform: 'unix'
21
21
  desc 'Use the passwd InSpec audit resource to test the contents of /etc/passwd, which contains the following information for users that may log into the system and/or as users that own running processes.'
22
- example "
22
+ example <<~EXAMPLE
23
23
  describe passwd do
24
24
  its('users') { should_not include 'forbidden_user' }
25
25
  end
@@ -32,7 +32,7 @@ module Inspec::Resources
32
32
  # find all users with a nologin shell
33
33
  its('users') { should_not include 'my_login_user' }
34
34
  end
35
- "
35
+ EXAMPLE
36
36
 
37
37
  include PasswdParser
38
38
  include FileReader
@@ -12,7 +12,7 @@ module Inspec::Resources
12
12
  supports platform: 'unix'
13
13
  supports platform: 'windows'
14
14
  desc 'Use the pip InSpec audit resource to test packages that are installed using the pip installer.'
15
- example "
15
+ example <<~EXAMPLE
16
16
  describe pip('Jinja2') do
17
17
  it { should be_installed }
18
18
  end
@@ -21,7 +21,7 @@ module Inspec::Resources
21
21
  it { should be_installed }
22
22
  its('version') { should eq('1.11.4')}
23
23
  end
24
- "
24
+ EXAMPLE
25
25
 
26
26
  def initialize(package_name, pip_path = nil)
27
27
  @package_name = package_name
@@ -4,7 +4,7 @@ module Inspec::Resources
4
4
  class PlatformResource < Inspec.resource(1)
5
5
  name 'platform'
6
6
  desc 'Use the platform InSpec resource to test the platform on which the system is running.'
7
- example "
7
+ example <<~EXAMPLE
8
8
  describe platform do
9
9
  its('name') { should eq 'redhat' }
10
10
  end
@@ -12,7 +12,7 @@ module Inspec::Resources
12
12
  describe platform do
13
13
  it { should be_in_family('unix') }
14
14
  end
15
- "
15
+ EXAMPLE
16
16
 
17
17
  def initialize
18
18
  @platform = inspec.backend.platform
@@ -12,7 +12,7 @@ module Inspec::Resources
12
12
  supports platform: 'unix'
13
13
  supports platform: 'windows'
14
14
  desc "Use the port InSpec audit resource to test basic port properties, such as port, process, if it's listening."
15
- example "
15
+ example <<~EXAMPLE
16
16
  describe port(80) do
17
17
  it { should be_listening }
18
18
  its('protocols') {should eq ['tcp']}
@@ -22,7 +22,7 @@ module Inspec::Resources
22
22
  describe port.where { protocol =~ /tcp/ && port > 80 } do
23
23
  it { should_not be_listening }
24
24
  end
25
- "
25
+ EXAMPLE
26
26
 
27
27
  def initialize(*args)
28
28
  args.unshift(nil) if args.length <= 1 # add the ip address to the front
@@ -12,11 +12,11 @@ module Inspec::Resources
12
12
  supports platform: 'unix'
13
13
  supports platform: 'windows'
14
14
  desc 'Use the postgres_conf InSpec audit resource to test the contents of the configuration file for PostgreSQL, typically located at /etc/postgresql/<version>/main/postgresql.conf or /var/lib/postgres/data/postgresql.conf, depending on the platform.'
15
- example "
15
+ example <<~EXAMPLE
16
16
  describe postgres_conf do
17
17
  its('max_connections') { should eq '5' }
18
18
  end
19
- "
19
+ EXAMPLE
20
20
 
21
21
  include FindFiles
22
22
  include FileReader
@@ -9,11 +9,11 @@ module Inspec::Resources
9
9
  supports platform: 'unix'
10
10
  desc 'Use the `postgres_hba_conf` InSpec audit resource to test the client
11
11
  authentication data defined in the pg_hba.conf file.'
12
- example "
12
+ example <<~EXAMPLE
13
13
  describe postgres_hba_conf.where { type == 'local' } do
14
14
  its('auth_method') { should eq ['peer'] }
15
15
  end
16
- "
16
+ EXAMPLE
17
17
 
18
18
  include FileReader
19
19
 
@@ -9,11 +9,11 @@ module Inspec::Resources
9
9
  supports platform: 'unix'
10
10
  desc 'Use the postgres_ident_conf InSpec audit resource to test the client
11
11
  authentication data is controlled by a pg_ident.conf file.'
12
- example "
12
+ example <<~EXAMPLE
13
13
  describe postgres_ident_conf.where { pg_username == 'acme_user' } do
14
14
  its('map_name') { should eq ['ssl-test'] }
15
15
  end
16
- "
16
+ EXAMPLE
17
17
 
18
18
  include FileReader
19
19