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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 521db4877e62abdfe0b3314d45f1a1510ca6afc0
4
- data.tar.gz: 53255bfa015cb24273b887670a09eda05e10f12e
3
+ metadata.gz: 05af717dedcf5fea001060356a73c799927a3ac5
4
+ data.tar.gz: 5fb4a23de7019a3f89d806737758e61ae8dace4c
5
5
  SHA512:
6
- metadata.gz: 7a291a8c658ef86fce86c3aedcea6518edf90a0c0314fd3503449349d3ee590b857b6248281d29d9a8ab77baea7dd84d58f1bffe17eccbc3b61fbc62ef906a62
7
- data.tar.gz: 977dafda6c3a71f952ec1a2b043bb6a8cc84482db9a9a501509957444b00de4a676b652e329e7cdc8ff8af5914354e5758ac5ee6fbd30d66105b914bf7ff5e11
6
+ metadata.gz: f0da77acc1e683f4cef31cb497eecba9052e854555357f030e631e9749ad030bfdca6adf26ef5f1501b1d3789aae1377b6a416833ffc9c7c6baa2e074aae6ecf
7
+ data.tar.gz: 4523247eeb675b640da571394253bd47f7f396a1a500140a280b394fa44472ea7a1b60ef0abfd7a1cb66490bbf15596e1cc104bacbc56b5e433dcd2689251825
@@ -1,7 +1,44 @@
1
1
  # Change Log
2
2
 
3
- ## [0.9.7](https://github.com/chef/inspec/tree/0.9.7) (2015-12-21)
4
- [Full Changelog](https://github.com/chef/inspec/compare/v0.9.6...0.9.7)
3
+ ## [0.9.8](https://github.com/chef/inspec/tree/0.9.8) (2016-01-11)
4
+ [Full Changelog](https://github.com/chef/inspec/compare/v0.9.7...0.9.8)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - Control Numbers and Display in Compliance GUI [\#306](https://github.com/chef/inspec/issues/306)
9
+ - Support supports for resources [\#282](https://github.com/chef/inspec/issues/282)
10
+ - Unify metadata and collect it from target resolver [\#342](https://github.com/chef/inspec/pull/342) ([arlimus](https://github.com/arlimus))
11
+ - implement `mount` resource [\#341](https://github.com/chef/inspec/pull/341) ([chris-rock](https://github.com/chris-rock))
12
+ - Update Integration Tests [\#314](https://github.com/chef/inspec/pull/314) ([chris-rock](https://github.com/chris-rock))
13
+ - RFC: Compliance Profile Structure [\#252](https://github.com/chef/inspec/pull/252) ([chris-rock](https://github.com/chris-rock))
14
+
15
+ **Fixed bugs:**
16
+
17
+ - Inspec doesn't read controls [\#351](https://github.com/chef/inspec/issues/351)
18
+ - not working under windows, installed from gem [\#323](https://github.com/chef/inspec/issues/323)
19
+ - Resource 'file' missing 'be\_mounted.with' [\#310](https://github.com/chef/inspec/issues/310)
20
+ - `inspec check` on examples generates errors [\#215](https://github.com/chef/inspec/issues/215)
21
+ - bugfix: ignore supports when generating a profile's json representation [\#355](https://github.com/chef/inspec/pull/355) ([srenatus](https://github.com/srenatus))
22
+ - Support old "supports" field in metadata [\#347](https://github.com/chef/inspec/pull/347) ([srenatus](https://github.com/srenatus))
23
+ - Fix custom resource loading from `libraries` [\#337](https://github.com/chef/inspec/pull/337) ([arlimus](https://github.com/arlimus))
24
+
25
+ **Closed issues:**
26
+
27
+ - Create RFC on profile structure [\#296](https://github.com/chef/inspec/issues/296)
28
+
29
+ **Merged pull requests:**
30
+
31
+ - fix reading profiles bug [\#352](https://github.com/chef/inspec/pull/352) ([srenatus](https://github.com/srenatus))
32
+ - clarify how to bump version in rake [\#348](https://github.com/chef/inspec/pull/348) ([arlimus](https://github.com/arlimus))
33
+ - Add `supports` to metadata to specify supported systems [\#344](https://github.com/chef/inspec/pull/344) ([arlimus](https://github.com/arlimus))
34
+ - Update list of examples [\#340](https://github.com/chef/inspec/pull/340) ([chris-rock](https://github.com/chris-rock))
35
+ - add a description for custom resources [\#339](https://github.com/chef/inspec/pull/339) ([arlimus](https://github.com/arlimus))
36
+ - ignore auto-generated controls during verify check [\#332](https://github.com/chef/inspec/pull/332) ([arlimus](https://github.com/arlimus))
37
+ - Set exit status to return value of Inspec Runner [\#331](https://github.com/chef/inspec/pull/331) ([rbhitchcock](https://github.com/rbhitchcock))
38
+ - Verify profile metadata contents correctly [\#330](https://github.com/chef/inspec/pull/330) ([arlimus](https://github.com/arlimus))
39
+
40
+ ## [v0.9.7](https://github.com/chef/inspec/tree/v0.9.7) (2015-12-21)
41
+ [Full Changelog](https://github.com/chef/inspec/compare/v0.9.6...v0.9.7)
5
42
 
6
43
  **Implemented enhancements:**
7
44
 
@@ -22,6 +59,7 @@
22
59
 
23
60
  **Merged pull requests:**
24
61
 
62
+ - 0.9.7 [\#328](https://github.com/chef/inspec/pull/328) ([arlimus](https://github.com/arlimus))
25
63
  - remove format default for `inspec exec` [\#326](https://github.com/chef/inspec/pull/326) ([srenatus](https://github.com/srenatus))
26
64
  - teach `cmp` matcher octal tricks [\#324](https://github.com/chef/inspec/pull/324) ([srenatus](https://github.com/srenatus))
27
65
 
data/Gemfile CHANGED
@@ -16,6 +16,7 @@ group :integration do
16
16
  gem 'test-kitchen'
17
17
  gem 'kitchen-vagrant'
18
18
  gem 'kitchen-inspec'
19
+ gem 'kitchen-ec2'
19
20
  end
20
21
 
21
22
  group :tools do
data/README.md CHANGED
@@ -214,13 +214,32 @@ You will require:
214
214
  * vagrant with virtualbox
215
215
  * test-kitchen
216
216
 
217
- Run `integration` tests with
217
+ **Run `integration` tests with vagrant:**
218
218
 
219
219
  ```bash
220
220
  cd test/integration
221
- bundle exec kitchen test -t .
221
+ bundle exec kitchen test
222
222
  ```
223
223
 
224
+ **Run `integration` tests with AWS EC2:**
225
+
226
+ ```bash
227
+ export AWS_ACCESS_KEY_ID=enteryouryourkey
228
+ export AWS_SECRET_ACCESS_KEY=enteryoursecreykey
229
+ export AWS_SSH_KEY_ID=enteryoursshkeyid
230
+ cd test/integration
231
+ KITCHEN_LOCAL_YAML=.kitchen.ec2.yml bundle exec kitchen test
232
+ ```
233
+
234
+ In addition you may need to add your ssh key to `.kitchen.ec2.yml`
235
+
236
+ ```
237
+ transport:
238
+ ssh_key: /Users/chartmann/aws/aws_chartmann.pem
239
+ username: ec2-user
240
+ ```
241
+
242
+
224
243
  ### Chef Delivery Tests
225
244
 
226
245
  It may be informative to look at what [tests Chef Delivery](https://github.com/chef/inspec/blob/master/.delivery/build-cookbook/recipes/unit.rb) is running for CI.
data/Rakefile CHANGED
@@ -119,7 +119,7 @@ end
119
119
  desc 'Bump the version of this gem'
120
120
  task :bump_version, [:version] do |_, args|
121
121
  v = args[:version] || ENV['to']
122
- fail "You must specify a target version! rake release[1.2.3]" if v.empty?
122
+ fail "You must specify a target version! rake bump_version to=1.2.3" if v.empty?
123
123
  check_update_requirements
124
124
  inspec_version(v)
125
125
  Rake::Task['changelog'].invoke
data/bin/inspec CHANGED
@@ -52,8 +52,10 @@ class InspecCLI < Thor # rubocop:disable Metrics/ClassLength
52
52
  def json(path)
53
53
  diagnose
54
54
 
55
- profile = Inspec::Profile.from_path(path, opts)
56
- dst = opts[:output].to_s
55
+ o = opts.dup
56
+ o[:ignore_supports] = true
57
+ profile = Inspec::Profile.from_path(path, o)
58
+ dst = o[:output].to_s
57
59
  if dst.empty?
58
60
  puts JSON.pretty_generate(profile.info)
59
61
  else
@@ -73,10 +75,30 @@ class InspecCLI < Thor # rubocop:disable Metrics/ClassLength
73
75
 
74
76
  o = opts.dup
75
77
  o[:logger] = Logger.new(STDOUT)
78
+ o[:ignore_supports] = true # we check for integrity only
76
79
  profile = Inspec::Profile.from_path(path, o)
77
80
  exit 1 unless profile.check
78
81
  end
79
82
 
83
+ desc 'archive PATH', 'archive a profile to tar.gz (default) or zip'
84
+ option :zip, type: :boolean, default: false,
85
+ desc: 'Generates a zip archive.'
86
+ option :tar, type: :boolean, default: false,
87
+ desc: 'Generates a tar.gz archive.'
88
+ option :overwrite, type: :boolean, default: false,
89
+ desc: 'Overwrite existing archive.'
90
+ option :ignore_errors, type: :boolean, default: false,
91
+ desc: 'Ignore profile warnings.'
92
+ def archive(path)
93
+ diagnose
94
+
95
+ o = options.dup
96
+ o[:logger] = Logger.new(STDOUT)
97
+ profile = Inspec::Profile.from_path(path, o)
98
+ # generate archive
99
+ exit 1 unless profile.archive(opts)
100
+ end
101
+
80
102
  desc 'exec PATHS', 'run all test files at the specified PATH.'
81
103
  option :id, type: :string,
82
104
  desc: 'Attach a profile ID to all test results'
@@ -87,7 +109,7 @@ class InspecCLI < Thor # rubocop:disable Metrics/ClassLength
87
109
 
88
110
  runner = Inspec::Runner.new(opts)
89
111
  runner.add_tests(tests)
90
- runner.run
112
+ exit runner.run
91
113
  rescue RuntimeError => e
92
114
  puts e.message
93
115
  end
data/bin/os ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ require 'train'
5
+
6
+ train = Train.create('local')
7
+
8
+ # start or reuse a connection
9
+ conn = train.connection
10
+ os = conn.os
11
+
12
+ # get OS info
13
+ conf = {
14
+ name: os[:name],
15
+ family: os[:family],
16
+ release: os[:release],
17
+ arch: os[:arch],
18
+ }
19
+ puts JSON.dump(conf)
20
+
21
+
22
+ # close the connection
23
+ conn.close
@@ -0,0 +1,90 @@
1
+ =====================================================
2
+ Resource DSL
3
+ =====================================================
4
+
5
+ InSpec provides a mechanism for defining custom resources. These become available with their respective names and provide easy functionality to profiles.
6
+
7
+ Resource location
8
+ -----------------------------------------------------
9
+
10
+ Resources may be added to profiles in the `libraries` folder:
11
+
12
+ .. code-block:: bash
13
+
14
+ $ tree examples/profile
15
+ examples/profile
16
+ ...
17
+ ├── libraries
18
+ │   └── gordon_config.rb
19
+
20
+
21
+ Resource structure
22
+ -----------------------------------------------------
23
+
24
+ The smallest possible resource takes this form:
25
+
26
+ .. code-block:: ruby
27
+
28
+ class Tiny < Inspec.resource(1)
29
+ name 'tiny'
30
+ end
31
+
32
+ Resources are written as a regular Ruby `class` which inherits from `Inspec.resource`. The number (`1`) specifies the version this resource plugin targets. As InSpec evolves, this interface may change and may require a higher version.
33
+
34
+ The following attributes can be configured:
35
+
36
+ * `name` - Identifier of the resource (required)
37
+ * `desc` - Description of the resource (optional)
38
+ * `example` - Example usage of the resource (optional)
39
+
40
+ The following methods are available to the resource:
41
+
42
+ * `inspec` - Contains a registry of all other resources to interact with the operating system or target in general.
43
+ * `skip_resource` - A resource may call this method to indicate, that requirements aren't met. All tests that use this resource will be marked as `skipped`.
44
+
45
+ The following example shows a full resource using attributes and methods to provide simple access to a configuration file:
46
+
47
+ .. code-block:: ruby
48
+
49
+ class GordonConfig < Inspec.resource(1)
50
+ name 'gordon_config'
51
+
52
+ desc '
53
+ Resource description ...
54
+ '
55
+
56
+ example '
57
+ describe gordon_config do
58
+ its("signal") { should eq "on" }
59
+ end
60
+ '
61
+
62
+ # Load the configuration file on initialization
63
+ def initialiaze(path = nil)
64
+ @path = path || '/etc/gordon.conf'
65
+ @params = SimpleConfig.new( read_content )
66
+ end
67
+
68
+ # Expose all parameters of the configuration file.
69
+ def method_missing(name)
70
+ @params[name]
71
+ end
72
+
73
+ private
74
+
75
+ def read_content
76
+ f = inspec.file(@path)
77
+ # Test if the path exist and that it's a file
78
+ if f.file?
79
+ # Retrieve the file's contents
80
+ f.content
81
+ else
82
+ # If the file doesn't exist, skip all tests that use gordon_config
83
+ skip_resource "Can't read config from #{@path}."
84
+ end
85
+ end
86
+ end
87
+
88
+ For a full example, see our `example resource`_.
89
+
90
+ .. _example resource: ../examples/profile
@@ -0,0 +1,167 @@
1
+ =====================================================
2
+ InSpec Profiles
3
+ =====================================================
4
+
5
+ InSpec supports the creation of complex test and compliance profiles, which organize controls to support dependency management and code re-use. These profiles are standalone structures with their own distribution and execution flow.
6
+
7
+ InSpec profile structure
8
+ -----------------------------------------------------
9
+
10
+ To create a new profile just place the files according to the following structure:
11
+
12
+ .. code-block:: bash
13
+
14
+ $ tree examples/profile
15
+ examples/profile
16
+ ├── README.md
17
+ ├── controls
18
+ │   ├── example.rb
19
+ │   └── gordon.rb
20
+ ├── libraries
21
+ │   └── gordon_config.rb
22
+ └── inspec.yml
23
+
24
+
25
+ * `inspec.yml` - includes the profile description (required)
26
+ * `controls` - a folder which contains all tests (required)
27
+ * `libraries` - a folder which contains InSpec resource extensions (optional)
28
+ * `README.md` - a best-practice readme to each explain the profile and its scope
29
+
30
+ For a full example, see our `example profile`_.
31
+
32
+ .. _example profile: ../examples/profile
33
+
34
+ InSpec profile manifest
35
+ -----------------------------------------------------
36
+
37
+ Each profile has a manifest file `inspec.yml`. It looks as follows
38
+
39
+ .. code-block:: yaml
40
+
41
+ name: ssh
42
+ title: Basic SSH
43
+ maintainer: Chef Software, Inc.
44
+ copyright: Chef Software, Inc.
45
+ copyright_email: support@chef.io
46
+ license: Proprietary, All rights reserved
47
+ summary: Verify that SSH Server and SSH Client are configured securely
48
+ version: 1.0.0
49
+ supports:
50
+ - os-family: linux
51
+
52
+
53
+ A manifest description may contain the following values:
54
+
55
+ * `name` - Identifier of the profile (required)
56
+ * `title` - Human-readable name of the profile (optional)
57
+ * `maintainer` - Name of the profile maintainer (optional)
58
+ * `copyright` - Copyright holder (optional)
59
+ * `copyright_email` - Support contact for profile (optional)
60
+ * `license` - License of the profile (optional)
61
+ * `summary` - One-line summary of the profile (optional)
62
+ * `description` - Description of the profile (optional)
63
+ * `version` - Version of the profile (optional)
64
+ * `supports` - A list of supported targets (optional)
65
+
66
+ Supported targets
67
+ -----------------------------------------------------
68
+
69
+ The manifest contains the `supports` flag, which specifies operating systems or even cloud systems that the profile is targeting.
70
+
71
+ This list can contain simple names, names and versions, or detailed flags for the targeted system. These can freely be combined:
72
+
73
+ .. code-block:: yaml
74
+
75
+ name: ssh
76
+ supports:
77
+ // Runs on any version of Debian Linux
78
+ - os-name: debian
79
+
80
+ // Only runs on Ubuntu 14.04
81
+ - os-name: ubuntu
82
+ release: 14.04
83
+
84
+ // Targets RedHat, CentOS, Oracle Linux ...
85
+ - os-family: redhat
86
+
87
+ // Or even broader
88
+ - platform: aws
89
+
90
+
91
+ InSpec profile verification
92
+ -----------------------------------------------------
93
+
94
+ InSpec ships with a verification command that verifies the implementation of a profile
95
+
96
+ $ inspec check examples/profile
97
+
98
+
99
+ InSpec profile archive
100
+ -----------------------------------------------------
101
+
102
+ Profiles are composed of multiple files. This hinders easy distribution of a profile. InSpec solves the problem by offering to collect all files in one archive.
103
+
104
+ The InSpec profile archive format aims for flexibility and reuse of standard and common technologies:
105
+
106
+ * tar and gzip (default)
107
+ * zip
108
+ * HTTP
109
+
110
+ This should enable third-parties to easily build InSpec profile archives:
111
+
112
+ * InSpec archives MUST be named with the stanard suffix
113
+ * InSpec archives MUST be a tar.gz or zip formatted file
114
+ * InSpec archives MUST have no duplicate entries
115
+ * InSpec archives MAY be compressed with gzip, bzip2, or xz.
116
+
117
+ InSpec is able to create profile archive for you. By default it generates a tar-file on Unix and zip on Windows or Mac.
118
+
119
+ .. code-block:: bash
120
+
121
+ # will generate a example-profile.tar.gz
122
+ $ inspec archive examples/profile
123
+
124
+ # will generate a example-profile.zip
125
+ $ inspec archive examples/profile --zip
126
+
127
+
128
+ Profile inheritance
129
+ -----------------------------------------------------
130
+
131
+ **Include controls of existing profile**
132
+
133
+ The `include_controls` keyword allows you to import all rules from an existing profile. This can be easily extended with additional rules.
134
+
135
+ .. code-block:: bash
136
+
137
+ include_controls 'cis-level-1' do
138
+
139
+ control "cis-fs-2.7" do
140
+ impact 1.0
141
+ ...
142
+
143
+ end
144
+
145
+ **Inherit from a profile, but skip some rules**
146
+
147
+ Sometimes, not all requirements can be fullfiled for a legacy application. To manage the derivation, you can skip certain controls with `skip_control`.
148
+
149
+ .. code-block:: bash
150
+
151
+ include_controls 'cis-level-1' do
152
+
153
+ skip_control "cis-fs-2.1"
154
+ skip_control "cis-fs-2.2"
155
+
156
+ end
157
+
158
+ **Load specific controls from another profile**
159
+
160
+ .. code-block:: bash
161
+
162
+ require_controls 'cis-level-1' do
163
+
164
+ control "cis-fs-2.1"
165
+ control "cis-fs-2.2"
166
+
167
+ end