inspec 0.10.1 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (346) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -2
  3. data/Gemfile +6 -0
  4. data/bin/inspec +5 -1
  5. data/docs/dsl_inspec.rst +1 -1
  6. data/docs/resources.rst +39 -2
  7. data/examples/resource/controls/tiny.rb +3 -0
  8. data/examples/resource/inspec.yml +10 -0
  9. data/examples/resource/libraries/tiny.rb +3 -0
  10. data/lib/bundles/inspec-compliance/cli.rb +1 -1
  11. data/lib/bundles/inspec-supermarket/README.md +0 -19
  12. data/lib/bundles/inspec-supermarket/api.rb +46 -22
  13. data/lib/bundles/inspec-supermarket/cli.rb +13 -18
  14. data/lib/bundles/inspec-supermarket/target.rb +6 -23
  15. data/lib/inspec/plugins.rb +4 -4
  16. data/lib/inspec/plugins/cli.rb +4 -4
  17. data/lib/inspec/version.rb +1 -1
  18. data/lib/resources/apache_conf.rb +8 -0
  19. data/lib/resources/auditd_rules.rb +163 -14
  20. data/lib/resources/registry_key.rb +5 -5
  21. data/lib/resources/script.rb +7 -9
  22. data/lib/utils/filter_array.rb +28 -0
  23. data/test/helper.rb +5 -2
  24. data/test/integration/cookbooks/os_prepare/metadata.rb +2 -0
  25. data/test/integration/cookbooks/os_prepare/recipes/auditctl.rb +8 -0
  26. data/test/integration/cookbooks/os_prepare/recipes/default.rb +13 -3
  27. data/test/integration/test/integration/default/apache_conf_spec.rb +15 -0
  28. data/test/integration/test/integration/default/auditd_rules_spec.rb +32 -0
  29. data/test/unit/mock/cmd/auditctl +3 -7
  30. data/test/unit/mock/cmd/auditctl-legacy +7 -0
  31. data/test/unit/mock/cmd/auditctl-s +8 -0
  32. data/test/unit/mock/profiles/resource-tiny/inspec.yml +10 -0
  33. data/test/unit/mock/profiles/resource-tiny/libraries/resource.rb +3 -0
  34. data/test/unit/plugin_test.rb +5 -6
  35. data/test/unit/resources/auditd_rules_test.rb +80 -10
  36. data/test/unit/resources/script_test.rb +5 -1
  37. data/test/unit/utils/filter_array_test.rb +59 -0
  38. data/test/unit/{simpleconfig_test.rb → utils/simpleconfig_test.rb} +0 -0
  39. metadata +25 -542
  40. data/bin/os +0 -23
  41. data/examples/kitchen-ansible/.kitchen/default-ubuntu-1404.yml +0 -6
  42. data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  43. data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  44. data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
  45. data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  46. data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
  47. data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  48. data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/Vagrantfile +0 -9
  49. data/examples/kitchen-ansible/.kitchen/logs/default-centos-71.log +0 -0
  50. data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1204.log +0 -0
  51. data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1404.log +0 -395
  52. data/examples/kitchen-ansible/.kitchen/logs/kitchen.log +0 -3
  53. data/examples/kitchen-ansible/Gemfile.lock +0 -158
  54. data/examples/kitchen-ansible/test/.DS_Store +0 -0
  55. data/examples/kitchen-ansible/test/integration/.DS_Store +0 -0
  56. data/examples/kitchen-azure/.kitchen.yml +0 -30
  57. data/examples/kitchen-azure/.kitchen/default-debian-80-20151022-x86-64.yml +0 -1
  58. data/examples/kitchen-azure/.kitchen/default-ubuntu-1204.yml +0 -9
  59. data/examples/kitchen-azure/.kitchen/logs/default-debian-80-20151022-x86-64.log +0 -59
  60. data/examples/kitchen-azure/.kitchen/logs/default-ubuntu-1204.log +0 -27
  61. data/examples/kitchen-azure/.kitchen/logs/default-windows2012-r2.log +0 -0
  62. data/examples/kitchen-azure/.kitchen/logs/kitchen.log +0 -29
  63. data/examples/kitchen-azure/Berksfile +0 -3
  64. data/examples/kitchen-azure/Gemfile +0 -20
  65. data/examples/kitchen-azure/Gemfile.lock +0 -273
  66. data/examples/kitchen-azure/README.md +0 -14
  67. data/examples/kitchen-azure/credentials.sh +0 -0
  68. data/examples/kitchen-azure/metadata.rb +0 -7
  69. data/examples/kitchen-azure/recipes/default.rb +0 -6
  70. data/examples/kitchen-azure/recipes/nginx.rb +0 -30
  71. data/examples/kitchen-azure/test/integration/default/web_spec.rb +0 -28
  72. data/examples/kitchen-chef/.kitchen/default-ubuntu-1404.yml +0 -6
  73. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  74. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  75. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
  76. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  77. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
  78. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  79. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/Vagrantfile +0 -9
  80. data/examples/kitchen-chef/.kitchen/logs/default-centos-71.log +0 -0
  81. data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1204.log +0 -0
  82. data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1404.log +0 -3
  83. data/examples/kitchen-chef/.kitchen/logs/kitchen.log +0 -3
  84. data/examples/kitchen-chef/Berksfile.lock +0 -11
  85. data/examples/kitchen-chef/Gemfile.lock +0 -226
  86. data/examples/kitchen-chef/test/integration/.DS_Store +0 -0
  87. data/examples/kitchen-puppet/.bundle/config +0 -2
  88. data/examples/kitchen-puppet/.kitchen/default-ubuntu-1404.yml +0 -6
  89. data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  90. data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  91. data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
  92. data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  93. data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
  94. data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  95. data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/Vagrantfile +0 -9
  96. data/examples/kitchen-puppet/.kitchen/logs/default-centos-71.log +0 -0
  97. data/examples/kitchen-puppet/.kitchen/logs/default-ubuntu-1204.log +0 -0
  98. data/examples/kitchen-puppet/.kitchen/logs/default-ubuntu-1404.log +0 -305
  99. data/examples/kitchen-puppet/.kitchen/logs/kitchen.log +0 -6
  100. data/examples/kitchen-puppet/.librarian/puppet/config +0 -2
  101. data/examples/kitchen-puppet/Gemfile.lock +0 -175
  102. data/examples/kitchen-puppet/Puppetfile.lock +0 -2
  103. data/examples/kitchen-puppet/test/integration/.DS_Store +0 -0
  104. data/examples/kitchen-puppet/test/integration/default/.DS_Store +0 -0
  105. data/examples/profile/libraries/.DS_Store +0 -0
  106. data/examples/test-kitchen/.kitchen/logs/default-centos-71.log +0 -5
  107. data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1204.log +0 -5
  108. data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1404.log +0 -5
  109. data/examples/test-kitchen/.kitchen/logs/kitchen.log +0 -5
  110. data/examples/test-kitchen/Berksfile.lock +0 -11
  111. data/examples/test-kitchen/Gemfile.lock +0 -233
  112. data/lib/.DS_Store +0 -0
  113. data/lib/bundles/inspec-compliance/TODO.md +0 -4
  114. data/lib/bundles/inspec-supermarket.rb +0 -14
  115. data/lib/bundles/inspec-supermarket/TODO.md +0 -5
  116. data/lib/bundles/inspec-supermarket/cache.rb +0 -30
  117. data/test/chefdk/.gitignore +0 -16
  118. data/test/chefdk/.kitchen.yml +0 -27
  119. data/test/chefdk/Policyfile.rb +0 -16
  120. data/test/chefdk/README.md +0 -4
  121. data/test/chefdk/chefignore +0 -100
  122. data/test/chefdk/metadata.rb +0 -7
  123. data/test/chefdk/recipes/default.rb +0 -5
  124. data/test/chefdk/spec/spec_helper.rb +0 -2
  125. data/test/chefdk/spec/unit/recipes/default_spec.rb +0 -20
  126. data/test/chefdk/test/integration/default/serverspec/default_spec.rb +0 -9
  127. data/test/chefdk/test/integration/helpers/serverspec/spec_helper.rb +0 -8
  128. data/test/integration/.kitchen.chef.yml +0 -29
  129. data/test/integration/.kitchen.shell.yml +0 -19
  130. data/test/integration/.kitchen/default-aws-linux.yml +0 -4
  131. data/test/integration/.kitchen/default-centos-7.yml +0 -4
  132. data/test/integration/.kitchen/default-chef-solaris-1011.yml +0 -6
  133. data/test/integration/.kitchen/default-chef-solaris-113.yml +0 -6
  134. data/test/integration/.kitchen/default-chef-windows-server-2008r2-standard.yml +0 -7
  135. data/test/integration/.kitchen/default-chris-rock-omnios-r151014.yml +0 -6
  136. data/test/integration/.kitchen/default-debian-8.yml +0 -4
  137. data/test/integration/.kitchen/default-debian-81.yml +0 -6
  138. data/test/integration/.kitchen/default-fedora-22.yml +0 -4
  139. data/test/integration/.kitchen/default-omniti-omnios-r151014.yml +0 -1
  140. data/test/integration/.kitchen/default-redhat-65.yml +0 -4
  141. data/test/integration/.kitchen/default-redhat-71.yml +0 -4
  142. data/test/integration/.kitchen/default-suse-11sp3.yml +0 -4
  143. data/test/integration/.kitchen/default-suse-12.yml +0 -4
  144. data/test/integration/.kitchen/default-suse-hi11sp3.yml +0 -4
  145. data/test/integration/.kitchen/default-ubuntu-1204.yml +0 -4
  146. data/test/integration/.kitchen/default-ubuntu-1404.yml +0 -4
  147. data/test/integration/.kitchen/default-ubuntu-1510.yml +0 -4
  148. data/test/integration/.kitchen/default-windows-2008.yml +0 -5
  149. data/test/integration/.kitchen/default-windows-2012.yml +0 -1
  150. data/test/integration/.kitchen/default-windows-2012r2.yml +0 -6
  151. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67-i386/Vagrantfile +0 -9
  152. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  153. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  154. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/.vagrant/machines/default/virtualbox/id +0 -1
  155. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  156. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/.vagrant/machines/default/virtualbox/private_key +0 -27
  157. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  158. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/Vagrantfile +0 -8
  159. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  160. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  161. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/.vagrant/machines/default/virtualbox/id +0 -1
  162. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  163. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/.vagrant/machines/default/virtualbox/private_key +0 -27
  164. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  165. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/Vagrantfile +0 -8
  166. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-windows-server-2008r2-standard/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  167. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-windows-server-2008r2-standard/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  168. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-windows-server-2008r2-standard/.vagrant/machines/default/virtualbox/id +0 -1
  169. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-windows-server-2008r2-standard/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  170. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-windows-server-2008r2-standard/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  171. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-windows-server-2008r2-standard/Vagrantfile +0 -7
  172. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  173. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  174. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/.vagrant/machines/default/virtualbox/id +0 -1
  175. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  176. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/.vagrant/machines/default/virtualbox/private_key +0 -27
  177. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  178. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/Vagrantfile +0 -8
  179. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  180. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  181. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/id +0 -1
  182. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  183. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/private_key +0 -27
  184. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  185. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/Vagrantfile +0 -9
  186. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  187. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  188. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/.vagrant/machines/default/virtualbox/id +0 -1
  189. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  190. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/Vagrantfile +0 -8
  191. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-omniti-omnios-r151014/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  192. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-omniti-omnios-r151014/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  193. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-omniti-omnios-r151014/.vagrant/machines/default/virtualbox/id +0 -1
  194. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-omniti-omnios-r151014/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  195. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-omniti-omnios-r151014/.vagrant/machines/default/virtualbox/private_key +0 -27
  196. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-omniti-omnios-r151014/Vagrantfile +0 -8
  197. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  198. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  199. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +0 -1
  200. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  201. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +0 -27
  202. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  203. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/Vagrantfile +0 -9
  204. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  205. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  206. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
  207. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  208. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
  209. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  210. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/Vagrantfile +0 -9
  211. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  212. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  213. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/.vagrant/machines/default/virtualbox/id +0 -1
  214. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  215. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/Vagrantfile +0 -8
  216. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-new-ubuntu-1404/Vagrantfile +0 -9
  217. data/test/integration/.kitchen/logs/default-aws-linux.log +0 -0
  218. data/test/integration/.kitchen/logs/default-centos-511-i386.log +0 -0
  219. data/test/integration/.kitchen/logs/default-centos-511.log +0 -0
  220. data/test/integration/.kitchen/logs/default-centos-67-i386.log +0 -0
  221. data/test/integration/.kitchen/logs/default-centos-67.log +0 -0
  222. data/test/integration/.kitchen/logs/default-centos-7.log +0 -0
  223. data/test/integration/.kitchen/logs/default-centos-71.log +0 -0
  224. data/test/integration/.kitchen/logs/default-chef-solaris-1011.log +0 -0
  225. data/test/integration/.kitchen/logs/default-chef-solaris-113.log +0 -0
  226. data/test/integration/.kitchen/logs/default-chef-windows-server-2008r2-standard.log +0 -43
  227. data/test/integration/.kitchen/logs/default-chef-windows-server-2012r2-standard.log +0 -0
  228. data/test/integration/.kitchen/logs/default-chris-rock-omnios-r151014.log +0 -41
  229. data/test/integration/.kitchen/logs/default-debian-6010-i386.log +0 -0
  230. data/test/integration/.kitchen/logs/default-debian-6010.log +0 -0
  231. data/test/integration/.kitchen/logs/default-debian-78-i386.log +0 -0
  232. data/test/integration/.kitchen/logs/default-debian-78.log +0 -0
  233. data/test/integration/.kitchen/logs/default-debian-8.log +0 -0
  234. data/test/integration/.kitchen/logs/default-debian-81-i386.log +0 -0
  235. data/test/integration/.kitchen/logs/default-debian-81.log +0 -240
  236. data/test/integration/.kitchen/logs/default-dusank-oi-server.log +0 -0
  237. data/test/integration/.kitchen/logs/default-fedora-21-i386.log +0 -0
  238. data/test/integration/.kitchen/logs/default-fedora-21.log +0 -0
  239. data/test/integration/.kitchen/logs/default-fedora-22.log +0 -0
  240. data/test/integration/.kitchen/logs/default-freebsd-102.log +0 -0
  241. data/test/integration/.kitchen/logs/default-freebsd-93.log +0 -0
  242. data/test/integration/.kitchen/logs/default-livinginthepast-smartos-base64.log +0 -0
  243. data/test/integration/.kitchen/logs/default-mint-172-cinnamon.log +0 -0
  244. data/test/integration/.kitchen/logs/default-modernIE-w10-edge.log +0 -2
  245. data/test/integration/.kitchen/logs/default-modernIE-w7-ie11.log +0 -2
  246. data/test/integration/.kitchen/logs/default-modernIE-w81-ie11.log +0 -2
  247. data/test/integration/.kitchen/logs/default-omniti-omnios-r151014.log +0 -0
  248. data/test/integration/.kitchen/logs/default-opensuse-132-i386.log +0 -0
  249. data/test/integration/.kitchen/logs/default-opensuse-132-x86-64.log +0 -0
  250. data/test/integration/.kitchen/logs/default-opentable-win-2008r2-standard-amd64-nocm.log +0 -0
  251. data/test/integration/.kitchen/logs/default-opentable-win-2012r2-standard-amd64-nocm.log +0 -0
  252. data/test/integration/.kitchen/logs/default-redhat-65.log +0 -0
  253. data/test/integration/.kitchen/logs/default-redhat-71.log +0 -0
  254. data/test/integration/.kitchen/logs/default-suse-11sp3.log +0 -0
  255. data/test/integration/.kitchen/logs/default-suse-12.log +0 -0
  256. data/test/integration/.kitchen/logs/default-suse-hi11sp3.log +0 -37
  257. data/test/integration/.kitchen/logs/default-ubuntu-1004-i386.log +0 -0
  258. data/test/integration/.kitchen/logs/default-ubuntu-1004.log +0 -0
  259. data/test/integration/.kitchen/logs/default-ubuntu-1204-i386.log +0 -0
  260. data/test/integration/.kitchen/logs/default-ubuntu-1204.log +0 -23
  261. data/test/integration/.kitchen/logs/default-ubuntu-1404-i386.log +0 -0
  262. data/test/integration/.kitchen/logs/default-ubuntu-1404.log +0 -0
  263. data/test/integration/.kitchen/logs/default-ubuntu-1510.log +0 -0
  264. data/test/integration/.kitchen/logs/default-windows-2008-opentable.log +0 -2
  265. data/test/integration/.kitchen/logs/default-windows-2008.log +0 -0
  266. data/test/integration/.kitchen/logs/default-windows-2012.log +0 -0
  267. data/test/integration/.kitchen/logs/default-windows-2012R2-matt.log +0 -2
  268. data/test/integration/.kitchen/logs/default-windows-2012r2-opentable.log +0 -2
  269. data/test/integration/.kitchen/logs/default-windows-2012r2.log +0 -0
  270. data/test/integration/.kitchen/logs/default-winrm.log +0 -0
  271. data/test/integration/.kitchen/logs/kitchen.log +0 -3
  272. data/test/integration/.kitchen/logs/new-centos-511-i386.log +0 -0
  273. data/test/integration/.kitchen/logs/new-centos-511.log +0 -0
  274. data/test/integration/.kitchen/logs/new-centos-67-i386.log +0 -0
  275. data/test/integration/.kitchen/logs/new-centos-67.log +0 -0
  276. data/test/integration/.kitchen/logs/new-centos-71.log +0 -0
  277. data/test/integration/.kitchen/logs/new-debian-6010-i386.log +0 -0
  278. data/test/integration/.kitchen/logs/new-debian-6010.log +0 -0
  279. data/test/integration/.kitchen/logs/new-debian-78-i386.log +0 -0
  280. data/test/integration/.kitchen/logs/new-debian-78.log +0 -0
  281. data/test/integration/.kitchen/logs/new-debian-81-i386.log +0 -0
  282. data/test/integration/.kitchen/logs/new-debian-81.log +0 -0
  283. data/test/integration/.kitchen/logs/new-fedora-21-i386.log +0 -0
  284. data/test/integration/.kitchen/logs/new-fedora-21.log +0 -0
  285. data/test/integration/.kitchen/logs/new-fedora-22.log +0 -0
  286. data/test/integration/.kitchen/logs/new-freebsd-102.log +0 -0
  287. data/test/integration/.kitchen/logs/new-freebsd-93.log +0 -0
  288. data/test/integration/.kitchen/logs/new-opensuse-132-i386.log +0 -0
  289. data/test/integration/.kitchen/logs/new-opensuse-132-x86-64.log +0 -0
  290. data/test/integration/.kitchen/logs/new-ubuntu-1004-i386.log +0 -0
  291. data/test/integration/.kitchen/logs/new-ubuntu-1004.log +0 -0
  292. data/test/integration/.kitchen/logs/new-ubuntu-1204-i386.log +0 -0
  293. data/test/integration/.kitchen/logs/new-ubuntu-1204.log +0 -0
  294. data/test/integration/.kitchen/logs/new-ubuntu-1404-i386.log +0 -0
  295. data/test/integration/.kitchen/logs/new-ubuntu-1404.log +0 -3
  296. data/test/integration/.kitchen/logs/test-centos-511-i386.log +0 -0
  297. data/test/integration/.kitchen/logs/test-centos-511.log +0 -0
  298. data/test/integration/.kitchen/logs/test-centos-67-i386.log +0 -0
  299. data/test/integration/.kitchen/logs/test-centos-67.log +0 -0
  300. data/test/integration/.kitchen/logs/test-centos-71.log +0 -0
  301. data/test/integration/.kitchen/logs/test-debian-6010-i386.log +0 -0
  302. data/test/integration/.kitchen/logs/test-debian-6010.log +0 -0
  303. data/test/integration/.kitchen/logs/test-debian-78-i386.log +0 -0
  304. data/test/integration/.kitchen/logs/test-debian-78.log +0 -0
  305. data/test/integration/.kitchen/logs/test-debian-81-i386.log +0 -0
  306. data/test/integration/.kitchen/logs/test-debian-81.log +0 -0
  307. data/test/integration/.kitchen/logs/test-fedora-21-i386.log +0 -0
  308. data/test/integration/.kitchen/logs/test-fedora-21.log +0 -0
  309. data/test/integration/.kitchen/logs/test-fedora-22.log +0 -0
  310. data/test/integration/.kitchen/logs/test-freebsd-102.log +0 -0
  311. data/test/integration/.kitchen/logs/test-freebsd-93.log +0 -0
  312. data/test/integration/.kitchen/logs/test-opensuse-132-i386.log +0 -0
  313. data/test/integration/.kitchen/logs/test-opensuse-132-x86-64.log +0 -0
  314. data/test/integration/.kitchen/logs/test-ubuntu-1004-i386.log +0 -0
  315. data/test/integration/.kitchen/logs/test-ubuntu-1004.log +0 -0
  316. data/test/integration/.kitchen/logs/test-ubuntu-1204-i386.log +0 -0
  317. data/test/integration/.kitchen/logs/test-ubuntu-1204.log +0 -0
  318. data/test/integration/.kitchen/logs/test-ubuntu-1404-i386.log +0 -0
  319. data/test/integration/.kitchen/logs/test-ubuntu-1404.log +0 -0
  320. data/test/integration/.kitchen/new-ubuntu-1404.yml +0 -1
  321. data/test/integration/Berksfile.lock +0 -27
  322. data/test/integration/TODO.md +0 -15
  323. data/test/integration/bootstrap.sh +0 -3
  324. data/test/integration/test/.DS_Store +0 -0
  325. data/test/integration/test/integration/.DS_Store +0 -0
  326. data/test/integration/test/integration/default/.DS_Store +0 -0
  327. data/test/integration/test/integration/default/certificate_spec.rb +0 -7
  328. data/test/mac/service_spec.rb +0 -5
  329. data/test/serverspec/.kitchen.yml +0 -18
  330. data/test/serverspec/.kitchen/default-ubuntu-1404.yml +0 -6
  331. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  332. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  333. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
  334. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  335. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
  336. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  337. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/Vagrantfile +0 -9
  338. data/test/serverspec/.kitchen/logs/default-ubuntu-1404.log +0 -2
  339. data/test/serverspec/.kitchen/logs/kitchen.log +0 -3
  340. data/test/serverspec/Berksfile +0 -3
  341. data/test/serverspec/Berksfile.lock +0 -5
  342. data/test/serverspec/TODO.md +0 -2
  343. data/test/serverspec/test/integration/default/serverspec/os_spec.rb +0 -25
  344. data/test/serverspec/test/integration/default/serverspec/spec_helper.rb +0 -48
  345. data/test/serverspec/test/integration/default/serverspec/sysctl_spec.rb +0 -37
  346. data/test/solaris_test.rb +0 -70
@@ -3,5 +3,5 @@
3
3
  # author: Christoph Hartmann
4
4
 
5
5
  module Inspec
6
- VERSION = '0.10.1'.freeze
6
+ VERSION = '0.11.0'.freeze
7
7
  end
@@ -40,6 +40,14 @@ class ApacheConf < Inspec.resource(1)
40
40
  res
41
41
  end
42
42
 
43
+ def method_missing(name)
44
+ # ensure params are loaded
45
+ @params || read_content
46
+
47
+ # extract values
48
+ @params[name.to_s] unless @params.nil?
49
+ end
50
+
43
51
  def filter_comments(data)
44
52
  content = ''
45
53
  data.each_line do |line|
@@ -4,21 +4,12 @@
4
4
  # author: Dominik Richter
5
5
  # license: All rights reserved
6
6
 
7
- class AuditDaemonRules < Inspec.resource(1)
8
- name 'auditd_rules'
9
- desc 'Use the auditd_rules InSpec audit resource to test the rules for logging that exist on the system. The audit.rules file is typically located under /etc/audit/ and contains the list of rules that define what is captured in log files.'
10
- example "
11
- describe auditd_rules do
12
- its('LIST_RULES') {should contain_match(/^exit,always arch=.* key=time-change syscall=adjtimex,settimeofday/) }
13
- its('LIST_RULES') {should contain_match(/^exit,always arch=.* key=time-change syscall=stime,settimeofday,adjtimex/) }
14
- its('LIST_RULES') {should contain_match(/^exit,always arch=.* key=time-change syscall=clock_settime/)}
15
- its('LIST_RULES') {should contain_match(/^exit,always watch=\/etc\/localtime perm=wa key=time-change/)}
16
- end
17
- "
18
-
19
- def initialize
20
- @content = inspec.command('/sbin/auditctl -l').stdout.chomp
7
+ require 'forwardable'
8
+ require 'utils/filter_array'
21
9
 
10
+ class AuditdRulesLegacy
11
+ def initialize(content)
12
+ @content = content
22
13
  @opts = {
23
14
  assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
24
15
  multiple_values: true,
@@ -48,7 +39,165 @@ class AuditDaemonRules < Inspec.resource(1)
48
39
  items[name]
49
40
  end
50
41
 
42
+ def to_s
43
+ 'Audit Daemon Rules (for auditd version < 2.3)'
44
+ end
45
+ end
46
+
47
+ # rubocop:disable Metrics/ClassLength
48
+ class AuditDaemonRules < Inspec.resource(1)
49
+ extend Forwardable
50
+ attr_accessor :rules, :lines
51
+
52
+ name 'auditd_rules'
53
+ desc 'Use the auditd_rules InSpec audit resource to test the rules for logging that exist on the system. The audit.rules file is typically located under /etc/audit/ and contains the list of rules that define what is captured in log files.'
54
+ example "
55
+ # syntax for auditd < 2.3
56
+ describe auditd_rules do
57
+ its('LIST_RULES') {should contain_match(/^exit,always arch=.* key=time-change syscall=adjtimex,settimeofday/) }
58
+ its('LIST_RULES') {should contain_match(/^exit,always arch=.* key=time-change syscall=stime,settimeofday,adjtimex/) }
59
+ its('LIST_RULES') {should contain_match(/^exit,always arch=.* key=time-change syscall=clock_settime/)}
60
+ its('LIST_RULES') {should contain_match(/^exit,always watch=\/etc\/localtime perm=wa key=time-change/)}
61
+ end
62
+
63
+ # syntax for auditd >= 2.3
64
+ describe auditd_rules.syscall('open').action do
65
+ it { should eq(['always']) }
66
+ end
67
+
68
+ describe auditd_rules.key('sshd_config') do
69
+ its(:permissions) { should contain_match(/x/) }
70
+ end
71
+
72
+ describe auditd_rules do
73
+ its(:lines) { should contain_match(%r{-w /etc/ssh/sshd_config/}) }
74
+ end
75
+ "
76
+
77
+ def initialize
78
+ @content = inspec.command('/sbin/auditctl -l').stdout.chomp
79
+
80
+ if @content =~ /^LIST_RULES:/
81
+ # do not warn on centos 5
82
+ unless inspec.os[:family] == 'centos' && inspec.os[:release].to_i == 5
83
+ warn '[WARN] this version of auditd is outdated. Updating it allows for using more precise matchers.'
84
+ end
85
+ @legacy = AuditdRulesLegacy.new(@content)
86
+ else
87
+ parse_content
88
+ end
89
+ end
90
+
91
+ # non-legacy instances are not asked for `its('LIST_RULES')`
92
+ # rubocop:disable Style/MethodName
93
+ def LIST_RULES
94
+ return @legacy.LIST_RULES if @legacy
95
+ fail 'Using legacy auditd_rules LIST_RULES interface with non-legacy audit package. Please use the new syntax.'
96
+ end
97
+
98
+ def status(name = nil)
99
+ return @legacy.status(name) if @legacy
100
+
101
+ @status_content ||= inspec.command('/sbin/auditctl -s').stdout.chomp
102
+ @status_params ||= Hash[@status_content.scan(/^([^ ]+) (.*)$/)]
103
+
104
+ return @status_params[name] if name
105
+ @status_params
106
+ end
107
+
108
+ def parse_content
109
+ @rules = {
110
+ syscalls: [],
111
+ files: [],
112
+ }
113
+ @lines = @content.lines.map(&:chomp)
114
+
115
+ lines.each do |line|
116
+ if is_syscall?(line)
117
+ syscalls = get_syscalls line
118
+ action, list = get_action_list line
119
+ fields, opts = get_fields line
120
+
121
+ # create a 'flatter' structure because sanity
122
+ syscalls.each do |s|
123
+ @rules[:syscalls] << { syscall: s, list: list, action: action, fields: fields }.merge(opts)
124
+ end
125
+ elsif is_file?(line)
126
+ file = get_file line
127
+ perms = get_permissions line
128
+ key = get_key line
129
+
130
+ @rules[:files] << { file: file, key: key, permissions: perms }
131
+ end
132
+ end
133
+ end
134
+
135
+ def syscall(name)
136
+ select_name(:syscall, name)
137
+ end
138
+
139
+ def file(name)
140
+ select_name(:file, name)
141
+ end
142
+
143
+ # both files and syscalls have `key` identifiers
144
+ def key(name)
145
+ res = rules.values.flatten.find_all { |rule| rule[:key] == name }
146
+ FilterArray.new(res)
147
+ end
148
+
51
149
  def to_s
52
150
  'Audit Daemon Rules'
53
151
  end
152
+
153
+ private
154
+
155
+ def select_name(key, name)
156
+ plural = "#{key}s".to_sym
157
+ res = rules[plural].find_all { |rule| rule[key] == name }
158
+ FilterArray.new(res)
159
+ end
160
+
161
+ def is_syscall?(line)
162
+ line.match(/\ -S /)
163
+ end
164
+
165
+ def is_file?(line)
166
+ line.match(/-w /)
167
+ end
168
+
169
+ def get_syscalls(line)
170
+ line.scan(/-S ([^ ]+) /).flatten.first.split(',')
171
+ end
172
+
173
+ def get_action_list(line)
174
+ line.scan(/-a ([^,]+),([^ ]+)/).flatten
175
+ end
176
+
177
+ # NB only in file lines
178
+ def get_key(line)
179
+ line.match(/-k ([^ ]+)/)[1]
180
+ end
181
+
182
+ # NOTE there are NO precautions wrt. filenames containing spaces in auditctl
183
+ # `auditctl -w /foo\ bar` gives the following line: `-w /foo bar -p rwxa`
184
+ def get_file(line)
185
+ line.match(/-w (.+) -p/)[1]
186
+ end
187
+
188
+ def get_permissions(line)
189
+ line.match(/-p ([^ ]+)/)[1]
190
+ end
191
+
192
+ def get_fields(line)
193
+ fields = line.gsub(/-[aS] [^ ]+ /, '').split('-F ').map { |l| l.split(' ') }.flatten
194
+
195
+ opts = {}
196
+ fields.find_all { |x| x.match(/[a-z]+=.*/) }.each do |kv|
197
+ k, v = kv.split('=')
198
+ opts[k.to_sym] = v
199
+ end
200
+
201
+ [fields, opts]
202
+ end
54
203
  end
@@ -92,7 +92,7 @@ class RegistryKey < Inspec.resource(1)
92
92
  end
93
93
 
94
94
  def registry_key(path)
95
- return @registy_cache if defined?(@registy_cache)
95
+ return @registry_cache if defined?(@registry_cache)
96
96
 
97
97
  # load registry key and all properties
98
98
  script = <<-EOH
@@ -115,16 +115,16 @@ class RegistryKey < Inspec.resource(1)
115
115
  # cannot rely on exit code for now, successful command returns exit code 1
116
116
  # return nil if cmd.exit_status != 0, try to parse json
117
117
  begin
118
- @registy_cache = JSON.parse(cmd.stdout)
118
+ @registry_cache = JSON.parse(cmd.stdout)
119
119
  # convert keys to lower case
120
- @registy_cache = Hash[@registy_cache.map do |key, value|
120
+ @registry_cache = Hash[@registry_cache.map do |key, value|
121
121
  [key.downcase, value]
122
122
  end]
123
123
  rescue JSON::ParserError => _e
124
- @registy_cache = nil
124
+ @registry_cache = nil
125
125
  end
126
126
 
127
- @registy_cache
127
+ @registry_cache
128
128
  end
129
129
 
130
130
  # Registry key value types
@@ -18,17 +18,15 @@ class Script < Cmd
18
18
  "
19
19
 
20
20
  def initialize(script)
21
- case inspec.os[:family]
22
- when 'windows'
23
- # encodes a script as base64 to run as powershell encodedCommand
24
- # this comes with performance issues: @see https://gist.github.com/fnichol/7b20596b950e65fb96f9
25
- require 'winrm'
26
- script = WinRM::PowershellScript.new(script)
27
- cmd = "powershell -encodedCommand #{script.encoded}"
28
- else
29
- cmd = ''
21
+ unless inspec.os.windows?
30
22
  return skip_resource 'The `script` resource is not supported on your OS yet.'
31
23
  end
24
+
25
+ # encodes a script as base64 to run as powershell encodedCommand
26
+ # this comes with performance issues: @see https://gist.github.com/fnichol/7b20596b950e65fb96f9
27
+ require 'winrm'
28
+ script = WinRM::PowershellScript.new(script)
29
+ cmd = "powershell -encodedCommand #{script.encoded}"
32
30
  super(cmd)
33
31
  end
34
32
 
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+ # copyright: 2015, Chef Software, Inc.
3
+ # license: All rights reserved
4
+ # author: Stephan Renatus
5
+
6
+ class FilterArray
7
+ attr_accessor :rules
8
+ alias content rules
9
+
10
+ def initialize(rules)
11
+ @rules = rules
12
+ end
13
+
14
+ # allows for chaining
15
+ # .field('arch', 'b32').field('key', 'access').rules
16
+ def field(key, value = nil)
17
+ if value
18
+ res = rules.find_all { |r| r[key.to_sym] == value }
19
+ FilterArray.new(res)
20
+ else
21
+ rules.map { |h| h[key.to_sym] }.uniq
22
+ end
23
+ end
24
+
25
+ def method_missing(meth, *args)
26
+ field(meth, args[0])
27
+ end
28
+ end
@@ -121,10 +121,12 @@ class MockLoader
121
121
  'Remove-Item win_secpol.cfg' => cmd.call('success'),
122
122
  'env' => cmd.call('env'),
123
123
  '$Env:PATH' => cmd.call('$env-PATH'),
124
- # registry key test
124
+ # registry key test (winrm 1.6.0, 1.6.1)
125
125
  '2790db1e88204a073ed7fd3493f5445e5ce531afd0d2724a0e36c17110c535e6' => cmd.call('reg_schedule'),
126
+ 'b00eb49a98c96a808c469e4894b5123a913e354c9ffea5b785898fe30d288ee0' => cmd.call('reg_schedule'),
126
127
  'Auditpol /get /subcategory:\'User Account Management\' /r' => cmd.call('auditpol'),
127
128
  '/sbin/auditctl -l' => cmd.call('auditctl'),
129
+ '/sbin/auditctl -s' => cmd.call('auditctl-s'),
128
130
  'yum -v repolist all' => cmd.call('yum-repolist-all'),
129
131
  'dpkg -s curl' => cmd.call('dpkg-s-curl'),
130
132
  'rpm -qia curl' => cmd.call('rpm-qia-curl'),
@@ -179,8 +181,9 @@ class MockLoader
179
181
  'dscl -q . -read /Users/chartmann NFSHomeDirectory PrimaryGroupID RecordName UniqueID UserShell' => cmd.call('dscl'),
180
182
  # user info for freebsd
181
183
  'pw usershow root -7' => cmd.call('pw-usershow-root-7'),
182
- # user info for windows
184
+ # user info for windows (winrm 1.6.0, 1.6.1)
183
185
  '650b6b72a66316418b25421a54afe21a230704558082914c54711904bb10e370' => cmd.call('GetUserAccount'),
186
+ '272e1d767fe6e28c86cfba1a75c3d458acade1f4a36cfd5e711b97884879de24' => cmd.call('GetUserAccount'),
184
187
  # group info for windows
185
188
  'Get-WmiObject Win32_Group | Select-Object -Property Caption, Domain, Name, SID, LocalAccount | ConvertTo-Json' => cmd.call('GetWin32Group'),
186
189
  # network interface
@@ -4,7 +4,9 @@ maintainer 'Chef Software, Inc.'
4
4
  maintainer_email 'support@chef.io'
5
5
  description 'This cookbook prepares the test operating systems'
6
6
  version '1.0.0'
7
+
7
8
  depends 'apt'
8
9
  depends 'yum'
9
10
  depends 'runit'
10
11
  depends 'postgresql'
12
+ depends 'httpd', '~> 0.2'
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+ # author: Stephan Renatus
3
+
4
+ case node['platform']
5
+ when 'centos'
6
+ execute 'auditctl -a always,exit -F arch=b32 -S open -S openat -F exit=-EACCES -k access'
7
+ execute 'auditctl -w /etc/ssh/sshd_config -p rwxa -k sshd_config'
8
+ end
@@ -4,11 +4,21 @@
4
4
  #
5
5
  # prepare all operating systems with the required configuration
6
6
 
7
- include_recipe('os_prepare::apt')
7
+
8
+ # basic tests
8
9
  include_recipe('os_prepare::file')
9
10
  include_recipe('os_prepare::mount')
10
- include_recipe('os_prepare::json_yaml_csv_ini')
11
+ include_recipe('os_prepare::service')
11
12
  include_recipe('os_prepare::package')
12
13
  include_recipe('os_prepare::registry_key')
13
- include_recipe('os_prepare::service')
14
+
15
+ # configure repos, eg. nginx
16
+ include_recipe('os_prepare::apt')
17
+
18
+ # application configuration
14
19
  include_recipe('os_prepare::postgres')
20
+ include_recipe('os_prepare::auditctl')
21
+ include_recipe('os_prepare::apache')
22
+
23
+ # config file parsing
24
+ include_recipe('os_prepare::json_yaml_csv_ini')
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ if os.linux?
4
+
5
+ # direct access to params of apache conf
6
+ describe apache_conf do
7
+ its('LogLevel') { should eq 'warn' }
8
+ its('MaxKeepAliveRequests') { should eq '100' }
9
+ end
10
+
11
+ # only read one param
12
+ describe apache_conf.params('LogLevel') do
13
+ it { should include 'warn' }
14
+ end
15
+ end
@@ -0,0 +1,32 @@
1
+ # encoding: utf-8
2
+
3
+ # based on operating system we select the available service
4
+ return unless os[:family] == 'centos'
5
+
6
+ describe auditd_rules.syscall('open') do
7
+ its(:action) { should eq(['always']) }
8
+ end
9
+
10
+ describe auditd_rules.syscall('open').action do
11
+ it { should eq(['always']) }
12
+ end
13
+
14
+ describe auditd_rules.key('sshd_config') do
15
+ its(:permissions) { should contain_match(/x/) }
16
+ end
17
+
18
+ describe auditd_rules.file('/etc/ssh/sshd_config').permissions do
19
+ it { should eq(['rwxa']) }
20
+ end
21
+
22
+ describe auditd_rules do
23
+ its(:lines) { should contain_match(%r{-w /etc/ssh/sshd_config/}) }
24
+ end
25
+
26
+ describe auditd_rules.syscall('open').action('always').list do
27
+ it { should eq(['exit']) }
28
+ end
29
+
30
+ describe auditd_rules.status('backlog') do
31
+ it { should cmp 0 }
32
+ end
@@ -1,7 +1,3 @@
1
- LIST_RULES: exit,always syscall=rmdir,unlink
2
- LIST_RULES: exit,always auid=1001 (0x3e9) syscall=open
3
- LIST_RULES: exit,always watch=/etc/group perm=wa
4
- LIST_RULES: exit,always watch=/etc/passwd perm=wa
5
- LIST_RULES: exit,always watch=/etc/shadow perm=wa
6
- LIST_RULES: exit,always watch=/etc/sudoers perm=wa
7
- LIST_RULES: exit,always watch=/etc/secret_directory perm=r
1
+ -a always,exit -F arch=b64 -S open,openat -F exit=-EACCES -F key=access
2
+ -a always,exit -F arch=b32 -S chmod,fchmod,fchmodat -F auid>=500 f24!=0 -F key=perm_mod
3
+ -w /etc/ssh/sshd_config -p rwxa -k CFG_sshd_config
@@ -0,0 +1,7 @@
1
+ LIST_RULES: exit,always syscall=rmdir,unlink
2
+ LIST_RULES: exit,always auid=1001 (0x3e9) syscall=open
3
+ LIST_RULES: exit,always watch=/etc/group perm=wa
4
+ LIST_RULES: exit,always watch=/etc/passwd perm=wa
5
+ LIST_RULES: exit,always watch=/etc/shadow perm=wa
6
+ LIST_RULES: exit,always watch=/etc/sudoers perm=wa
7
+ LIST_RULES: exit,always watch=/etc/secret_directory perm=r
@@ -0,0 +1,8 @@
1
+ enabled 1
2
+ flag 2
3
+ pid 547
4
+ rate_limit 0
5
+ backlog_limit 8192
6
+ lost 0
7
+ backlog 0
8
+ loginuid_immutable 0 unlocked