inspec 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (365) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +40 -2
  3. data/Gemfile +1 -0
  4. data/README.md +21 -2
  5. data/Rakefile +1 -1
  6. data/bin/inspec +25 -3
  7. data/bin/os +23 -0
  8. data/docs/dsl_resource.rst +90 -0
  9. data/docs/profiles.rst +167 -0
  10. data/docs/resources.rst +79 -0
  11. data/examples/README.md +1 -0
  12. data/examples/kitchen-ansible/.kitchen/logs/default-centos-71.log +0 -0
  13. data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1204.log +0 -0
  14. data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1404.log +432 -0
  15. data/examples/kitchen-ansible/.kitchen/logs/kitchen.log +10 -0
  16. data/examples/kitchen-ansible/Gemfile.lock +154 -0
  17. data/examples/kitchen-chef/.kitchen/default-centos-71.yml +6 -0
  18. data/examples/kitchen-chef/.kitchen/default-ubuntu-1204.yml +6 -0
  19. data/examples/kitchen-chef/.kitchen/default-ubuntu-1404.yml +6 -0
  20. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  21. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  22. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/id +1 -0
  23. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  24. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/private_key +27 -0
  25. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  26. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/Vagrantfile +9 -0
  27. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  28. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  29. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +1 -0
  30. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  31. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +27 -0
  32. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  33. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/Vagrantfile +9 -0
  34. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  35. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  36. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +1 -0
  37. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  38. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +27 -0
  39. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  40. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/Vagrantfile +9 -0
  41. data/examples/kitchen-chef/.kitchen/logs/default-centos-71.log +4 -0
  42. data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1204.log +4 -0
  43. data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1404.log +4 -0
  44. data/examples/kitchen-chef/.kitchen/logs/kitchen.log +8 -0
  45. data/examples/kitchen-chef/Berksfile.lock +11 -0
  46. data/examples/kitchen-chef/Gemfile.lock +223 -0
  47. data/examples/kitchen-puppet/.bundle/config +2 -0
  48. data/examples/kitchen-puppet/.kitchen/logs/default-centos-71.log +0 -0
  49. data/examples/kitchen-puppet/.kitchen/logs/default-ubuntu-1204.log +0 -0
  50. data/examples/kitchen-puppet/.kitchen/logs/default-ubuntu-1404.log +306 -0
  51. data/examples/kitchen-puppet/.kitchen/logs/kitchen.log +10 -0
  52. data/examples/kitchen-puppet/.librarian/puppet/config +2 -0
  53. data/examples/kitchen-puppet/Gemfile.lock +174 -0
  54. data/examples/kitchen-puppet/Puppetfile.lock +2 -0
  55. data/examples/profile/README.md +30 -0
  56. data/examples/profile/controls/example.rb +14 -0
  57. data/examples/profile/controls/gordon.rb +20 -0
  58. data/examples/profile/inspec.yml +10 -0
  59. data/examples/profile/libraries/.DS_Store +0 -0
  60. data/examples/profile/libraries/gordon_config.rb +17 -0
  61. data/examples/test-kitchen/.kitchen/logs/default-centos-71.log +5 -0
  62. data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1204.log +5 -0
  63. data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1404.log +5 -0
  64. data/examples/test-kitchen/.kitchen/logs/kitchen.log +5 -0
  65. data/examples/test-kitchen/Berksfile.lock +11 -0
  66. data/examples/test-kitchen/Gemfile.lock +233 -0
  67. data/inspec.gemspec +1 -1
  68. data/lib/.DS_Store +0 -0
  69. data/lib/inspec/archive/tar.rb +29 -0
  70. data/lib/inspec/archive/zip.rb +19 -0
  71. data/lib/inspec/metadata.rb +110 -15
  72. data/lib/inspec/profile.rb +88 -19
  73. data/lib/inspec/profile_context.rb +10 -4
  74. data/lib/inspec/resource.rb +1 -0
  75. data/lib/inspec/runner.rb +21 -4
  76. data/lib/inspec/targets.rb +2 -1
  77. data/lib/inspec/targets/archive.rb +39 -0
  78. data/lib/inspec/targets/core.rb +2 -2
  79. data/lib/inspec/targets/dir.rb +18 -2
  80. data/lib/inspec/targets/file.rb +4 -0
  81. data/lib/inspec/targets/folder.rb +21 -11
  82. data/lib/inspec/targets/tar.rb +36 -5
  83. data/lib/inspec/targets/url.rb +45 -13
  84. data/lib/inspec/targets/zip.rb +22 -15
  85. data/lib/inspec/version.rb +1 -1
  86. data/lib/matchers/matchers.rb +30 -0
  87. data/lib/resources/certificate.rb +0 -0
  88. data/lib/resources/etc_group.rb +1 -1
  89. data/lib/resources/file.rb +28 -3
  90. data/lib/resources/mount.rb +57 -0
  91. data/lib/resources/passwd.rb +1 -1
  92. data/lib/resources/private_key.rb +0 -0
  93. data/lib/resources/user.rb +3 -2
  94. data/lib/utils/hash.rb +29 -1
  95. data/lib/utils/parser.rb +34 -1
  96. data/lib/utils/simpleconfig.rb +1 -1
  97. data/test/chefdk/.gitignore +16 -0
  98. data/test/chefdk/.kitchen.yml +27 -0
  99. data/test/chefdk/Policyfile.rb +16 -0
  100. data/test/chefdk/README.md +4 -0
  101. data/test/chefdk/chefignore +100 -0
  102. data/test/chefdk/metadata.rb +7 -0
  103. data/test/chefdk/recipes/default.rb +5 -0
  104. data/test/chefdk/spec/spec_helper.rb +2 -0
  105. data/test/chefdk/spec/unit/recipes/default_spec.rb +20 -0
  106. data/test/chefdk/test/integration/default/serverspec/default_spec.rb +9 -0
  107. data/test/chefdk/test/integration/helpers/serverspec/spec_helper.rb +8 -0
  108. data/test/helper.rb +3 -1
  109. data/test/integration/.DS_Store +0 -0
  110. data/test/integration/.kitchen.ec2.yml +67 -0
  111. data/test/integration/.kitchen.local.yml +68 -0
  112. data/test/integration/.kitchen/default-aws-linux.yml +4 -0
  113. data/test/integration/.kitchen/default-centos-511.yml +6 -0
  114. data/test/integration/.kitchen/default-centos-67.yml +6 -0
  115. data/test/integration/.kitchen/default-centos-7.yml +4 -0
  116. data/test/integration/.kitchen/default-centos-71.yml +6 -0
  117. data/test/integration/.kitchen/default-debian-6010.yml +6 -0
  118. data/test/integration/.kitchen/default-debian-78.yml +6 -0
  119. data/test/integration/.kitchen/default-debian-8.yml +4 -0
  120. data/test/integration/.kitchen/default-debian-81.yml +6 -0
  121. data/test/integration/.kitchen/default-fedora-21.yml +6 -0
  122. data/test/integration/.kitchen/default-fedora-22.yml +4 -0
  123. data/test/integration/.kitchen/default-freebsd-102.yml +6 -0
  124. data/test/integration/.kitchen/default-freebsd-93.yml +6 -0
  125. data/test/integration/.kitchen/default-opensuse-132-x86-64.yml +6 -0
  126. data/test/integration/.kitchen/default-redhat-65.yml +4 -0
  127. data/test/integration/.kitchen/default-redhat-71.yml +4 -0
  128. data/test/integration/.kitchen/default-suse-11sp3.yml +4 -0
  129. data/test/integration/.kitchen/default-suse-12.yml +4 -0
  130. data/test/integration/.kitchen/default-ubuntu-1004.yml +6 -0
  131. data/test/integration/.kitchen/default-ubuntu-1204.yml +4 -0
  132. data/test/integration/.kitchen/default-ubuntu-1404.yml +4 -0
  133. data/test/integration/.kitchen/default-ubuntu-1510.yml +4 -0
  134. data/test/integration/.kitchen/default-windows-2012.yml +5 -0
  135. data/test/integration/.kitchen/default-windows-2012r2.yml +6 -0
  136. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  137. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  138. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/id +1 -0
  139. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  140. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/private_key +27 -0
  141. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  142. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/Vagrantfile +9 -0
  143. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67-i386/Vagrantfile +9 -0
  144. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  145. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  146. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/id +1 -0
  147. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  148. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/private_key +27 -0
  149. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  150. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/Vagrantfile +9 -0
  151. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  152. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  153. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/id +1 -0
  154. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  155. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/private_key +27 -0
  156. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  157. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/Vagrantfile +9 -0
  158. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  159. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  160. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/id +1 -0
  161. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  162. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/private_key +27 -0
  163. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  164. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/Vagrantfile +9 -0
  165. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  166. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  167. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/id +1 -0
  168. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  169. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/private_key +27 -0
  170. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  171. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/Vagrantfile +9 -0
  172. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  173. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  174. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/id +1 -0
  175. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  176. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/private_key +27 -0
  177. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  178. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/Vagrantfile +9 -0
  179. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  180. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  181. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/id +1 -0
  182. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  183. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/private_key +27 -0
  184. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  185. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/Vagrantfile +9 -0
  186. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  187. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  188. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/id +1 -0
  189. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  190. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/private_key +27 -0
  191. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  192. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/Vagrantfile +9 -0
  193. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  194. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  195. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/id +1 -0
  196. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  197. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/private_key +27 -0
  198. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  199. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/Vagrantfile +9 -0
  200. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  201. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  202. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/id +1 -0
  203. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  204. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/private_key +27 -0
  205. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  206. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/Vagrantfile +9 -0
  207. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  208. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  209. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/id +1 -0
  210. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  211. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/private_key +27 -0
  212. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  213. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/Vagrantfile +9 -0
  214. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  215. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  216. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/id +1 -0
  217. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  218. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/private_key +27 -0
  219. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  220. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/Vagrantfile +9 -0
  221. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  222. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  223. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +1 -0
  224. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  225. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +27 -0
  226. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  227. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/Vagrantfile +9 -0
  228. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  229. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  230. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +1 -0
  231. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  232. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +27 -0
  233. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  234. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/Vagrantfile +9 -0
  235. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-new-ubuntu-1404/Vagrantfile +9 -0
  236. data/test/integration/.kitchen/logs/default-aws-linux.log +0 -0
  237. data/test/integration/.kitchen/logs/default-centos-511-i386.log +0 -0
  238. data/test/integration/.kitchen/logs/default-centos-511.log +0 -0
  239. data/test/integration/.kitchen/logs/default-centos-67-i386.log +0 -0
  240. data/test/integration/.kitchen/logs/default-centos-67.log +0 -0
  241. data/test/integration/.kitchen/logs/default-centos-7.log +0 -0
  242. data/test/integration/.kitchen/logs/default-centos-71.log +0 -0
  243. data/test/integration/.kitchen/logs/default-debian-6010-i386.log +0 -0
  244. data/test/integration/.kitchen/logs/default-debian-6010.log +0 -0
  245. data/test/integration/.kitchen/logs/default-debian-78-i386.log +0 -0
  246. data/test/integration/.kitchen/logs/default-debian-78.log +0 -0
  247. data/test/integration/.kitchen/logs/default-debian-8.log +0 -0
  248. data/test/integration/.kitchen/logs/default-debian-81-i386.log +0 -0
  249. data/test/integration/.kitchen/logs/default-debian-81.log +0 -0
  250. data/test/integration/.kitchen/logs/default-fedora-21-i386.log +0 -0
  251. data/test/integration/.kitchen/logs/default-fedora-21.log +0 -0
  252. data/test/integration/.kitchen/logs/default-fedora-22.log +0 -0
  253. data/test/integration/.kitchen/logs/default-freebsd-102.log +0 -0
  254. data/test/integration/.kitchen/logs/default-freebsd-93.log +0 -0
  255. data/test/integration/.kitchen/logs/default-mint-172-cinnamon.log +0 -0
  256. data/test/integration/.kitchen/logs/default-opensuse-132-i386.log +0 -0
  257. data/test/integration/.kitchen/logs/default-opensuse-132-x86-64.log +0 -0
  258. data/test/integration/.kitchen/logs/default-redhat-65.log +0 -0
  259. data/test/integration/.kitchen/logs/default-redhat-71.log +0 -0
  260. data/test/integration/.kitchen/logs/default-suse-11sp3.log +0 -0
  261. data/test/integration/.kitchen/logs/default-suse-12.log +0 -0
  262. data/test/integration/.kitchen/logs/default-ubuntu-1004-i386.log +0 -0
  263. data/test/integration/.kitchen/logs/default-ubuntu-1004.log +0 -0
  264. data/test/integration/.kitchen/logs/default-ubuntu-1204-i386.log +0 -0
  265. data/test/integration/.kitchen/logs/default-ubuntu-1204.log +23 -0
  266. data/test/integration/.kitchen/logs/default-ubuntu-1404-i386.log +0 -0
  267. data/test/integration/.kitchen/logs/default-ubuntu-1404.log +0 -0
  268. data/test/integration/.kitchen/logs/default-ubuntu-1510.log +0 -0
  269. data/test/integration/.kitchen/logs/default-windows-2012.log +0 -0
  270. data/test/integration/.kitchen/logs/default-windows-2012r2.log +0 -0
  271. data/test/integration/.kitchen/logs/kitchen.log +3 -0
  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 +3 -0
  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 +1 -0
  321. data/test/integration/Berksfile.lock +11 -0
  322. data/test/integration/TODO.md +15 -0
  323. data/test/integration/cookbooks/os_prepare/recipes/default.rb +1 -0
  324. data/test/integration/cookbooks/os_prepare/recipes/json_yaml_csv_ini.rb +13 -6
  325. data/test/integration/cookbooks/os_prepare/recipes/mount.rb +29 -0
  326. data/test/integration/test/.DS_Store +0 -0
  327. data/test/integration/test/integration/.DS_Store +0 -0
  328. data/test/integration/test/integration/default/.DS_Store +0 -0
  329. data/test/integration/test/integration/default/certificate_spec.rb +7 -0
  330. data/test/integration/test/integration/default/csv_spec.rb +7 -1
  331. data/test/integration/test/integration/default/file_spec.rb +29 -0
  332. data/test/integration/test/integration/default/ini_spec.rb +7 -1
  333. data/test/integration/test/integration/default/json_spec.rb +7 -1
  334. data/test/integration/test/integration/default/mount_spec.rb +10 -0
  335. data/test/integration/test/integration/default/yaml_spec.rb +7 -1
  336. data/test/serverspec/.kitchen.yml +18 -0
  337. data/test/serverspec/.kitchen/default-ubuntu-1404.yml +6 -0
  338. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  339. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +1 -0
  340. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +1 -0
  341. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  342. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +27 -0
  343. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  344. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/Vagrantfile +9 -0
  345. data/test/serverspec/.kitchen/logs/default-ubuntu-1404.log +2 -0
  346. data/test/serverspec/.kitchen/logs/kitchen.log +3 -0
  347. data/test/serverspec/Berksfile +3 -0
  348. data/test/serverspec/Berksfile.lock +5 -0
  349. data/test/serverspec/TODO.md +2 -0
  350. data/test/serverspec/test/integration/default/serverspec/os_spec.rb +25 -0
  351. data/test/serverspec/test/integration/default/serverspec/spec_helper.rb +48 -0
  352. data/test/serverspec/test/integration/default/serverspec/sysctl_spec.rb +37 -0
  353. data/test/unit/metadata_test.rb +69 -0
  354. data/test/unit/mock/cmd/mount +1 -0
  355. data/test/unit/mock/cmd/mount-multiple +2 -0
  356. data/test/unit/mock/profiles/complete-meta/metadata.rb +7 -0
  357. data/test/unit/mock/profiles/complete-meta/test/.gitkeep +0 -0
  358. data/test/unit/mock/profiles/complete-profile/controls/filesystem_spec.rb +16 -0
  359. data/test/unit/mock/profiles/complete-profile/inspec.yml +10 -0
  360. data/test/unit/profile_context_test.rb +2 -2
  361. data/test/unit/profile_test.rb +63 -6
  362. data/test/unit/resources/file_test.rb +4 -0
  363. data/test/unit/resources/mount_test.rb +26 -0
  364. data/test/unit/utils/{content_parser_test.rb → passwd_parser_test.rb} +2 -2
  365. metadata +588 -5
@@ -108,4 +108,33 @@ if os.unix?
108
108
  its('type') { should eq :directory }
109
109
  end
110
110
 
111
+ # for server spec compatibility
112
+ # Do not use `.with` or `.only_with`, this syntax is deprecated and will be removed
113
+ # in InSpec version 1
114
+ describe file('/mnt/iso-disk') do
115
+ it { should be_mounted }
116
+ it { should be_mounted.with( :type => 'iso9660' ) }
117
+ it { should be_mounted.with( :type => 'iso9660', :options => { :ro => true } ) }
118
+ it { should be_mounted.with( :type => 'iso9660', :device => '/root/alpine-3.3.0-x86_64.iso' ) }
119
+ it { should_not be_mounted.with( :type => 'ext4' ) }
120
+ it { should_not be_mounted.with( :type => 'xfs' ) }
121
+ end
122
+
123
+ # compare with exact match
124
+ # also see mount_spec.rb
125
+ describe file('/mnt/iso-disk') do
126
+ it { should be_mounted.only_with( {
127
+ :device=>"/root/alpine-3.3.0-x86_64.iso",
128
+ :type=>"iso9660",
129
+ :options=>{
130
+ :ro=>true}
131
+ })
132
+ }
133
+ end
134
+
135
+ elsif os.windows?
136
+ describe file('C:\\Windows') do
137
+ it { should exist }
138
+ it { should be_directory }
139
+ end
111
140
  end
@@ -1,5 +1,11 @@
1
1
  # encoding: utf-8
2
2
 
3
- describe ini('/tmp/example.ini') do
3
+ if os.unix?
4
+ filename = '/tmp/example.ini'
5
+ else
6
+ filename = 'c:/windows/temp/example.ini'
7
+ end
8
+
9
+ describe ini(filename) do
4
10
  its(['client','port']) { should eq('3306') }
5
11
  end
@@ -1,5 +1,11 @@
1
1
  # encoding: utf-8
2
2
 
3
- describe json('/tmp/example.json') do
3
+ if os.unix?
4
+ filename = '/tmp/example.json'
5
+ else
6
+ filename = 'c:/windows/temp/example.json'
7
+ end
8
+
9
+ describe json(filename) do
4
10
  its(['cookbook_locks','omnibus','version']) { should eq('2.2.0') }
5
11
  end
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+
3
+ # instead of `.with` or `.only_with` we recommend to use the `mount` resource
4
+ describe mount '/mnt/iso-disk' do
5
+ it { should be_mounted }
6
+ its('count') { should eq 1 }
7
+ its('device') { should eq '/root/alpine-3.3.0-x86_64.iso' }
8
+ its('type') { should eq 'iso9660' }
9
+ its('options') { should eq ['ro'] }
10
+ end
@@ -1,5 +1,11 @@
1
1
  # encoding: utf-8
2
2
 
3
- describe yaml('/tmp/example.yml') do
3
+ if os.unix?
4
+ filename = '/tmp/example.yml'
5
+ else
6
+ filename = 'c:/windows/temp/example.yml'
7
+ end
8
+
9
+ describe yaml(filename) do
4
10
  its(['driver','name']) { should eq('vagrant') }
5
11
  end
@@ -0,0 +1,18 @@
1
+ ---
2
+ driver:
3
+ name: vagrant
4
+
5
+ provisioner:
6
+ name: chef_zero
7
+
8
+ verifier:
9
+ name: inspec
10
+ sudo: true
11
+
12
+ platforms:
13
+ - name: ubuntu-14.04
14
+
15
+ suites:
16
+ - name: default
17
+ run_list:
18
+ attributes:
@@ -0,0 +1,6 @@
1
+ ---
2
+ hostname: 127.0.0.1
3
+ port: '2205'
4
+ username: vagrant
5
+ ssh_key: "/Users/chartmann/Development/vulcano/vulcano-cli/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key"
6
+ last_action: verify
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEowIBAAKCAQEA1KWrGcypqQFzz4ZFYjHBqk/d4QV9c6JYO9xV7mNWmLknpivT
3
+ ry976zBqeV923vUvZ2vndMtI+Z7tg5YpsaJCdbNuc078AyjzG+ahVPWrcMLa+hyk
4
+ VuzLgqyrlWLRc5PcB4JSVVDIVzamarMz9Xo7MOv2KjQBeBSRPQCAWXlrC0zcop5g
5
+ QGgokclPYF780JGBVTFt00y1AS6ZKUbin+YB9RzuQetixe8QIQfKCrljMJeQ9Ppt
6
+ bW2Fiyukfg0YAc3SLZnNyrLWtqgLgCkk86jICKr0cZeqeIeZ8Qojo9ERDi5igItg
7
+ 0HP+W2P47k42NUXTZZ8tZ54HmJ/pWsnclJN5WwIDAQABAoIBADzEOujce384Uwfy
8
+ rtEottcci6NKFld9BQnWJRhCevSZtKLf01Y0k4zaARM+HJIKLsm3JCVUEj6DFAyO
9
+ VMvWOne4FtAMuieNBCvs9B17Nsq6ZCklFjFg6acmAMJnwsLsdewPacfHlfiWPWgw
10
+ XaDAlTmdtHLK+cB+4CI2incHI3fOsbfus/EhT9rNrUhw3Zn5/dq0TaEO5amp8QEN
11
+ /Tblo2LpqEjudqvPO3Yud5WZb1ByFjE1FvPglgrPAsXztInKSHYaURjQ8K6CFNhg
12
+ ITmqBF5Da9Ha8u9pCTPP6a4/FQkK0JcOuiTgy3EIWTa+Ioqz3VWhX4/qXWgQdyAH
13
+ 74jWh4ECgYEA78k8s3ZtCKoVCgZWDVn6Y1cLiAJkl0bMS4sUMwDCHYaghDa5mXiz
14
+ CbkIw/3MGPooXMQhwewJxex0LXEFJhHDyvjIP1G2CE0qEOiScOhSTKeEney/50Xe
15
+ ZC/neay57IlQUNBRfJVokjMTUX40+xahpuS24FKWuv5IbtZcbgek8VkCgYEA4wam
16
+ FAW574ORmqyfi0FXCZarMmaNQnay3IEDk+NWtg67P+gbz7j6UAmYsqqaVOdaAfOs
17
+ DQlu/F/8uESaqlgpRdyH+LkKrIUDBJ6E90XoY21KgYhb6Dyq14iVaVyPt2GMP8+C
18
+ 0JtYn2uEPShC4KvzIKw6ywqdCvTqrnRBeiGuVdMCgYBhSnZtnoxo6pG0ypNZwXtd
19
+ mTDdk5L66kf0Es80Tod0cW5plsbBpX6HYGNVGoIYVE/SK+ZCh6IDg4gz89qR8r1N
20
+ epnNTzsbrSt3RtY8J5dU8NdXOHs4vFmarvEtpk6d0a0bzRpzATA3ua+J7jpS8oDO
21
+ dZhZ9kigQJJlHmbMYh+jqQKBgAGEa9u6ZhG5uWFlQfO2ThScUyyVDuCg1nUuz41P
22
+ eabh1lKJBJaQz+t1BPY8uadTnIBi1oWHyJwbMB8zJi15RV1YKfh5lB6vDOQdAxp7
23
+ 9x+i/Vp8RND6htHF8emwWq2JE1zh0CgAwcje+RVHjZrey1Muk34D5iTKmj7sO/vK
24
+ +dVNAoGBAIphTIYzt1D73qtagNdp5v4qAs87HviY6Us5PC3Hfewm1zqBofeY/DAw
25
+ l/6zjmUNPnTvvV6eiFDPvSgoXeKlO7fCY0Jbpr88Izm/jfClSSdRXPHD59ZS8w6Q
26
+ 0xKjdXvfwmxo8xHKheB1tuiHSTPNlq/eSEFEDw7U51L8pcm2Mx7w
27
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,9 @@
1
+ Vagrant.configure("2") do |c|
2
+ c.berkshelf.enabled = false if Vagrant.has_plugin?("vagrant-berkshelf")
3
+ c.vm.box = "opscode-ubuntu-14.04"
4
+ c.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box"
5
+ c.vm.hostname = "default-ubuntu-1404"
6
+ c.vm.synced_folder ".", "/vagrant", disabled: true
7
+ c.vm.provider :virtualbox do |p|
8
+ end
9
+ end
@@ -0,0 +1,2 @@
1
+ I, [2015-12-08T23:48:01.367628 #25801] INFO -- default-ubuntu-1404: -----> Verifying <default-ubuntu-1404>...
2
+ I, [2015-12-08T23:48:01.990146 #25801] INFO -- default-ubuntu-1404: Finished verifying <default-ubuntu-1404> (0m0.62s).
@@ -0,0 +1,3 @@
1
+ I, [2015-12-08T23:48:00.475985 #25801] INFO -- Kitchen: -----> Starting Kitchen (v1.4.2)
2
+ I, [2015-12-08T23:48:01.367571 #25801] INFO -- Kitchen: -----> Verifying <default-ubuntu-1404>...
3
+ I, [2015-12-08T23:48:01.990267 #25801] INFO -- Kitchen: -----> Kitchen is finished. (0m1.51s)
@@ -0,0 +1,3 @@
1
+ source 'https://supermarket.chef.io'
2
+
3
+ cookbook 'apt'
@@ -0,0 +1,5 @@
1
+ DEPENDENCIES
2
+ apt
3
+
4
+ GRAPH
5
+ apt (2.9.2)
@@ -0,0 +1,2 @@
1
+ - nested describe
2
+ - require 'serverspec'
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe command('find / -name \'.rhosts\' | wc -l ') do
6
+ its(:stdout) { should match(/^0/) }
7
+ end
8
+
9
+ describe command('find / -name \'hosts.equiv\' | wc -l ') do
10
+ its(:stdout) { should match(/^0/) }
11
+ end
12
+
13
+ describe file('/etc/shadow') do
14
+ it { should exist }
15
+ it { should be_file }
16
+ it { should be_owned_by 'root' }
17
+ end
18
+
19
+ describe command('echo $PATH | grep -ci \'\.\'') do
20
+ its(:stdout) { should match(/^0/) }
21
+ end
22
+
23
+ describe file('/etc/login.defs') do
24
+ its(:content) { should match(/^SU_NAME\s*su/) }
25
+ end
@@ -0,0 +1,48 @@
1
+ # encoding: utf-8
2
+
3
+ if ENV['STANDALONE_SPEC']
4
+
5
+ # require 'serverspec'
6
+ require 'pathname'
7
+ require 'net/ssh'
8
+ require 'highline/import'
9
+
10
+ set :backend, :ssh
11
+
12
+ RSpec.configure do |c|
13
+
14
+ if ENV['ASK_SUDO_PASSWORD']
15
+ c.sudo_password = ask('Enter sudo password: ') { |q| q.echo = false }
16
+ else
17
+ c.sudo_password = ENV['SUDO_PASSWORD']
18
+ end
19
+
20
+ options = {}
21
+
22
+ if ENV['ASK_LOGIN_PASSWORD']
23
+ options[:password] = ask("\nEnter login password: ") { |q| q.echo = false }
24
+ else
25
+ options[:password] = ENV['LOGIN_PASSWORD']
26
+ end
27
+
28
+ if ENV['ASK_LOGIN_USERNAME']
29
+ options[:user] = ask("\nEnter login username: ") { |q| q.echo = false }
30
+ else
31
+ options[:user] = ENV['LOGIN_USERNAME'] || ENV['user'] || Etc.getlogin
32
+ end
33
+
34
+ if options[:user].nil?
35
+ puts 'specify login user env LOGIN_USERNAME= or user='
36
+ exit 1
37
+ end
38
+
39
+ c.host = ENV['TARGET_HOST']
40
+ c.ssh_options = options.merge(Net::SSH::Config.for(c.host))
41
+
42
+ end
43
+
44
+ else
45
+ # require 'serverspec'
46
+ #
47
+ set :backend, :exec
48
+ end
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ # do we support nested syntax
6
+ # describe 'IP V4 networking' do
7
+
8
+ context linux_kernel_parameter('net.ipv4.ip_forward') do
9
+ its(:value) { should eq 0 }
10
+ end
11
+
12
+ context linux_kernel_parameter('net.ipv4.conf.all.forwarding') do
13
+ its(:value) { should eq 0 }
14
+ end
15
+
16
+ # end
17
+
18
+ # describe 'ExecShield' do
19
+
20
+ # check if we find the nx flag
21
+ if command('cat /proc/cpuinfo').stdout =~ /^flags.*?:.*? nx( .*?)?$/
22
+ true
23
+ else
24
+ # if no nx flag is present, we require exec-shield
25
+ context 'No nx flag detected' do
26
+ it 'require kernel.exec-shield' do
27
+ context linux_kernel_parameter('kernel.exec-shield') do
28
+ its(:value) { should eq 1 }
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ context linux_kernel_parameter('kernel.randomize_va_space') do
35
+ its(:value) { should eq 2 }
36
+ end
37
+ # end
@@ -0,0 +1,69 @@
1
+ # encoding: utf-8
2
+ # author: Dominik Richter
3
+ # author: Christoph Hartmann
4
+
5
+ require 'helper'
6
+ require 'inspec/metadata'
7
+
8
+ describe 'metadata with supported operating systems' do
9
+ describe 'running on ubuntu 14.04' do
10
+ let (:backend) { MockLoader.new(:ubuntu1404).backend }
11
+
12
+ # Description of method
13
+ #
14
+ # @param [Type] params describe params
15
+ # @return [Type] description of returned object
16
+ def create_meta(params)
17
+ res = Inspec::Metadata.from_yaml('mock', "---", nil)
18
+ # manually inject supported parameters
19
+ res.params[:supports] = params
20
+ Inspec::Metadata.finalize(res, 'mock')
21
+ res
22
+ end
23
+
24
+ it 'load a profile with empty supports clause' do
25
+ m = create_meta(nil)
26
+ m.supports_transport?(backend).must_equal true
27
+ end
28
+
29
+ it 'loads a profile which supports os ubuntu' do
30
+ m = create_meta({ 'os' => 'ubuntu' })
31
+ m.supports_transport?(backend).must_equal true
32
+ end
33
+
34
+ it 'loads a profile which supports os name ubuntu' do
35
+ m = create_meta({ 'os-name' => 'ubuntu' })
36
+ m.supports_transport?(backend).must_equal true
37
+ end
38
+
39
+ it 'loads a profile which supports os family linux' do
40
+ m = create_meta({ 'os-family' => 'linux' })
41
+ m.supports_transport?(backend).must_equal true
42
+ end
43
+
44
+ it 'loads a profile which supports release 14.04' do
45
+ m = create_meta({ 'release' => '14.04' })
46
+ m.supports_transport?(backend).must_equal true
47
+ end
48
+
49
+ it 'rejects a profile which supports release 12.04' do
50
+ m = create_meta({ 'release' => '12.04' })
51
+ m.supports_transport?(backend).must_equal false
52
+ end
53
+
54
+ it 'loads a profile which supports ubuntu 14.04' do
55
+ m = create_meta({ 'os-name' => 'ubuntu', 'release' => '14.04' })
56
+ m.supports_transport?(backend).must_equal true
57
+ end
58
+
59
+ it 'rejects a profile which supports ubuntu 12.04' do
60
+ m = create_meta({ 'os-name' => 'ubuntu', 'release' => '12.04' })
61
+ m.supports_transport?(backend).must_equal false
62
+ end
63
+
64
+ it 'reject unsupported os' do
65
+ m = create_meta({ 'os-name' => 'windows' })
66
+ m.supports_transport?(backend).must_equal false
67
+ end
68
+ end
69
+ end
@@ -0,0 +1 @@
1
+ /dev/xvda1 on / type ext4 (rw,discard)
@@ -0,0 +1,2 @@
1
+ /root/alpine-3.3.0-x86_64.iso on /mnt/iso-disk type iso9660 (ro)
2
+ /root/alpine-3.3.0-x86_64_2.iso on /mnt/iso-disk type iso9660 (ro)
@@ -0,0 +1,7 @@
1
+ name 'name'
2
+ version '1.2.3'
3
+ maintainer 'bob'
4
+ title 'title'
5
+ copyright 'left'
6
+ summary 'nothing'
7
+ supports nil
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ # copyright: 2015, Chef Software, Inc
3
+ # license: All rights reserved
4
+
5
+ title 'Proc Filesystem Configuration'
6
+
7
+ control 'test01' do
8
+ impact 0.5
9
+ title 'Catchy title'
10
+ desc '
11
+ There should always be a /proc
12
+ '
13
+ describe file('/proc') do
14
+ it { should be_mounted }
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ name: complete
2
+ title: complete example profile
3
+ maintainer: Chef Software, Inc.
4
+ copyright: Chef Software, Inc.
5
+ copyright_email: support@chef.io
6
+ license: Proprietary, All rights reserved
7
+ summary: Testing stub
8
+ version: 1.0.0
9
+ supports:
10
+ - os-family: linux
@@ -34,7 +34,7 @@ describe Inspec::ProfileContext do
34
34
  load('describe true do; it { should_eq true }; end')
35
35
  .must_output ''
36
36
  profile.rules.keys.length.must_equal 1
37
- profile.rules.keys[0].must_match /^unknown:1 [0-9a-f]+$/
37
+ profile.rules.keys[0].must_match /^\(generated from unknown:1 [0-9a-f]+\)$/
38
38
  profile.rules.values[0].must_be_kind_of Inspec::Rule
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ describe Inspec::ProfileContext do
43
43
  .must_output ''
44
44
  profile.rules.keys.length.must_equal 3
45
45
  [0, 1, 2].each do |i|
46
- profile.rules.keys[i].must_match /^unknown:2 [0-9a-f]+$/
46
+ profile.rules.keys[i].must_match /^\(generated from unknown:2 [0-9a-f]+\)$/
47
47
  profile.rules.values[i].must_be_kind_of Inspec::Rule
48
48
  end
49
49
  end
@@ -4,11 +4,6 @@
4
4
 
5
5
  require 'helper'
6
6
 
7
- def load_profile(name)
8
- pwd = File.dirname(__FILE__)
9
- Inspec::Profile.from_path("#{pwd}/mock/profiles/#{name}")
10
- end
11
-
12
7
  describe Inspec::Profile do
13
8
  before {
14
9
  # mock up the profile runner
@@ -16,13 +11,20 @@ describe Inspec::Profile do
16
11
  # currently it's stopped at test runner conflicts
17
12
  class Inspec::Profile::Runner
18
13
  def initialize(opts) end
19
- def add_tests(tests) end
14
+ def add_tests(tests, options=nil) end
20
15
  def rules
21
16
  {}
22
17
  end
23
18
  end
24
19
  }
25
20
 
21
+ let(:logger) { Minitest::Mock.new }
22
+ let(:home) { File.dirname(__FILE__) }
23
+
24
+ def load_profile(name, opts = {})
25
+ Inspec::Profile.from_path("#{home}/mock/profiles/#{name}", opts)
26
+ end
27
+
26
28
  describe 'with empty profile' do
27
29
  let(:profile) { load_profile('empty') }
28
30
 
@@ -46,4 +48,59 @@ describe Inspec::Profile do
46
48
  profile.params[:rules].must_equal({})
47
49
  end
48
50
  end
51
+
52
+ describe 'when checking' do
53
+ describe 'an empty profile' do
54
+ let(:profile) { load_profile('empty', {logger: logger}) }
55
+
56
+ it 'prints loads of warnings' do
57
+ logger.expect :info, nil, ["Checking profile in #{home}/mock/profiles/empty"]
58
+ logger.expect :warn, nil, ['The use of `metadata.rb` is deprecated. Use `inspec.yml`.']
59
+ logger.expect :error, nil, ['Missing profile name in metadata.rb']
60
+ logger.expect :error, nil, ['Missing profile version in metadata.rb']
61
+ logger.expect :warn, nil, ['Missing profile title in metadata.rb']
62
+ logger.expect :warn, nil, ['Missing profile summary in metadata.rb']
63
+ logger.expect :warn, nil, ['Missing profile maintainer in metadata.rb']
64
+ logger.expect :warn, nil, ['Missing profile copyright in metadata.rb']
65
+ logger.expect :warn, nil, ['No controls or tests were defined.']
66
+
67
+ profile.check
68
+ logger.verify
69
+ end
70
+ end
71
+
72
+ describe 'a complete metadata profile' do
73
+ let(:profile) { load_profile('complete-meta', {logger: logger}) }
74
+
75
+ it 'prints ok messages' do
76
+ logger.expect :info, nil, ["Checking profile in #{home}/mock/profiles/complete-meta"]
77
+ logger.expect :warn, nil, ['The use of `metadata.rb` is deprecated. Use `inspec.yml`.']
78
+ logger.expect :info, nil, ['Metadata OK.']
79
+ logger.expect :warn, nil, ["Profile uses deprecated `test` directory, rename it to `controls`"]
80
+ logger.expect :warn, nil, ['No controls or tests were defined.']
81
+
82
+ profile.check
83
+ logger.verify
84
+ end
85
+ end
86
+
87
+ describe 'a complete metadata profile with controls' do
88
+ let(:profile) { load_profile('complete-profile', {logger: logger, ignore_supports: true}) }
89
+
90
+ it 'prints ok messages and counts the rules' do
91
+ logger.expect :info, nil, ["Checking profile in #{home}/mock/profiles/complete-profile"]
92
+ logger.expect :info, nil, ['Metadata OK.']
93
+
94
+ # TODO: cannot load rspec in unit tests, therefore we get a loading warn
95
+ # RSpec does not work with minitest tests
96
+ logger.expect :warn, nil, ['No controls or tests were defined.']
97
+ # we expect that this should work:
98
+ # logger.expect :info, nil, ['Found 1 rules.']
99
+ # logger.expect :info, nil, ['Rule definitions OK.']
100
+
101
+ profile.check
102
+ logger.verify
103
+ end
104
+ end
105
+ end
49
106
  end