inspec 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (368) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -1
  3. data/CHANGELOG.md +23 -2
  4. data/Gemfile +1 -1
  5. data/Rakefile +15 -1
  6. data/docs/resources.rst +1 -1
  7. data/examples/profile/controls/gordon.rb +1 -1
  8. data/examples/resource/controls/tiny.rb +3 -0
  9. data/examples/resource/inspec.yml +10 -0
  10. data/examples/resource/libraries/tiny.rb +3 -0
  11. data/lib/inspec/dsl.rb +17 -17
  12. data/lib/inspec/metadata.rb +3 -8
  13. data/lib/inspec/plugins/resource.rb +1 -1
  14. data/lib/inspec/profile.rb +3 -2
  15. data/lib/inspec/profile_context.rb +2 -2
  16. data/lib/inspec/rule.rb +7 -7
  17. data/lib/inspec/shell.rb +5 -8
  18. data/lib/inspec/targets/dir.rb +1 -1
  19. data/lib/inspec/targets/tar.rb +3 -6
  20. data/lib/inspec/targets/url.rb +15 -9
  21. data/lib/inspec/targets/url.rb.orig +87 -0
  22. data/lib/inspec/version.rb +1 -1
  23. data/lib/matchers/matchers.rb +1 -1
  24. data/lib/resources/audit_policy.rb +1 -1
  25. data/lib/resources/command.rb +3 -3
  26. data/lib/resources/etc_group.rb +1 -1
  27. data/lib/resources/file.rb +4 -3
  28. data/lib/resources/group.rb +14 -18
  29. data/lib/resources/iptables.rb +1 -1
  30. data/lib/resources/json.rb +4 -6
  31. data/lib/resources/kernel_parameter.rb +1 -1
  32. data/lib/resources/os.rb +1 -1
  33. data/lib/resources/package.rb +20 -2
  34. data/lib/resources/passwd.rb +1 -1
  35. data/lib/resources/port.rb +112 -42
  36. data/lib/resources/postgres_conf.rb +1 -1
  37. data/lib/resources/postgres_session.rb +2 -2
  38. data/lib/resources/registry_key.rb +2 -1
  39. data/lib/resources/security_policy.rb +2 -2
  40. data/lib/resources/service.rb +50 -1
  41. data/lib/resources/user.rb +45 -0
  42. data/lib/resources/yum.rb +2 -2
  43. data/lib/utils/convert.rb +1 -1
  44. data/lib/utils/find_files.rb +3 -3
  45. data/lib/utils/parser.rb +2 -2
  46. data/tasks/maintainers.rb +6 -6
  47. data/test/helper.rb +4 -2
  48. data/test/integration/cookbooks/os_prepare/recipes/file.rb +9 -2
  49. data/test/integration/cookbooks/os_prepare/recipes/json_yaml_csv_ini.rb +8 -2
  50. data/test/integration/test/integration/default/etc_group_spec.rb +22 -0
  51. data/test/integration/test/integration/default/file_spec.rb +10 -1
  52. data/test/integration/test/integration/default/group_spec.rb +17 -0
  53. data/test/integration/test/integration/default/package_spec.rb +10 -4
  54. data/test/integration/test/integration/default/port_spec.rb +6 -0
  55. data/test/integration/test/integration/default/service_spec.rb +3 -0
  56. data/test/integration/test/integration/default/user_spec.rb +26 -16
  57. data/test/unit/metadata_test.rb +24 -0
  58. data/test/unit/mock/cmd/lsof-nP-i-FpctPn +63 -0
  59. data/test/unit/mock/cmd/netstat-tulpen +1 -0
  60. data/test/unit/mock/cmd/systemctl-show-all-sshd +1 -1
  61. data/test/unit/mock/profiles/complete-meta/metadata.rb +1 -1
  62. data/test/unit/mock/profiles/custom-resource/libraries/resource.rb +3 -0
  63. data/test/unit/mock/profiles/custom-resource/metadata.rb +7 -0
  64. data/{examples/kitchen-ansible/.kitchen/logs/default-centos-71.log → test/unit/mock/profiles/custom-resource/test/.gitkeep} +0 -0
  65. data/test/unit/profile_test.rb +6 -2
  66. data/test/unit/resources/port_test.rb +8 -0
  67. data/test/unit/targets.rb +132 -0
  68. metadata +19 -551
  69. data/bin/os +0 -23
  70. data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1204.log +0 -0
  71. data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1404.log +0 -432
  72. data/examples/kitchen-ansible/.kitchen/logs/kitchen.log +0 -10
  73. data/examples/kitchen-ansible/Gemfile.lock +0 -154
  74. data/examples/kitchen-chef/.kitchen/default-centos-71.yml +0 -6
  75. data/examples/kitchen-chef/.kitchen/default-ubuntu-1204.yml +0 -6
  76. data/examples/kitchen-chef/.kitchen/default-ubuntu-1404.yml +0 -6
  77. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  78. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  79. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/id +0 -1
  80. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  81. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/private_key +0 -27
  82. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  83. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/Vagrantfile +0 -9
  84. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  85. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  86. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +0 -1
  87. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  88. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +0 -27
  89. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  90. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/Vagrantfile +0 -9
  91. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  92. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  93. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
  94. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  95. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
  96. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  97. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/Vagrantfile +0 -9
  98. data/examples/kitchen-chef/.kitchen/logs/default-centos-71.log +0 -4
  99. data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1204.log +0 -4
  100. data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1404.log +0 -4
  101. data/examples/kitchen-chef/.kitchen/logs/kitchen.log +0 -8
  102. data/examples/kitchen-chef/Berksfile.lock +0 -11
  103. data/examples/kitchen-chef/Gemfile.lock +0 -223
  104. data/examples/kitchen-puppet/.bundle/config +0 -2
  105. data/examples/kitchen-puppet/.kitchen/logs/default-centos-71.log +0 -0
  106. data/examples/kitchen-puppet/.kitchen/logs/default-ubuntu-1204.log +0 -0
  107. data/examples/kitchen-puppet/.kitchen/logs/default-ubuntu-1404.log +0 -306
  108. data/examples/kitchen-puppet/.kitchen/logs/kitchen.log +0 -10
  109. data/examples/kitchen-puppet/.librarian/puppet/config +0 -2
  110. data/examples/kitchen-puppet/Gemfile.lock +0 -174
  111. data/examples/kitchen-puppet/Puppetfile.lock +0 -2
  112. data/examples/profile/libraries/.DS_Store +0 -0
  113. data/examples/test-kitchen/.kitchen/logs/default-centos-71.log +0 -5
  114. data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1204.log +0 -5
  115. data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1404.log +0 -5
  116. data/examples/test-kitchen/.kitchen/logs/kitchen.log +0 -5
  117. data/examples/test-kitchen/Berksfile.lock +0 -11
  118. data/examples/test-kitchen/Gemfile.lock +0 -233
  119. data/lib/.DS_Store +0 -0
  120. data/lib/resources/certificate.rb +0 -0
  121. data/lib/resources/private_key.rb +0 -0
  122. data/test/chefdk/.gitignore +0 -16
  123. data/test/chefdk/.kitchen.yml +0 -27
  124. data/test/chefdk/Policyfile.rb +0 -16
  125. data/test/chefdk/README.md +0 -4
  126. data/test/chefdk/chefignore +0 -100
  127. data/test/chefdk/metadata.rb +0 -7
  128. data/test/chefdk/recipes/default.rb +0 -5
  129. data/test/chefdk/spec/spec_helper.rb +0 -2
  130. data/test/chefdk/spec/unit/recipes/default_spec.rb +0 -20
  131. data/test/chefdk/test/integration/default/serverspec/default_spec.rb +0 -9
  132. data/test/chefdk/test/integration/helpers/serverspec/spec_helper.rb +0 -8
  133. data/test/integration/.DS_Store +0 -0
  134. data/test/integration/.kitchen.local.yml +0 -68
  135. data/test/integration/.kitchen/default-aws-linux.yml +0 -4
  136. data/test/integration/.kitchen/default-centos-511.yml +0 -6
  137. data/test/integration/.kitchen/default-centos-67.yml +0 -6
  138. data/test/integration/.kitchen/default-centos-7.yml +0 -4
  139. data/test/integration/.kitchen/default-centos-71.yml +0 -6
  140. data/test/integration/.kitchen/default-debian-6010.yml +0 -6
  141. data/test/integration/.kitchen/default-debian-78.yml +0 -6
  142. data/test/integration/.kitchen/default-debian-8.yml +0 -4
  143. data/test/integration/.kitchen/default-debian-81.yml +0 -6
  144. data/test/integration/.kitchen/default-fedora-21.yml +0 -6
  145. data/test/integration/.kitchen/default-fedora-22.yml +0 -4
  146. data/test/integration/.kitchen/default-freebsd-102.yml +0 -6
  147. data/test/integration/.kitchen/default-freebsd-93.yml +0 -6
  148. data/test/integration/.kitchen/default-opensuse-132-x86-64.yml +0 -6
  149. data/test/integration/.kitchen/default-redhat-65.yml +0 -4
  150. data/test/integration/.kitchen/default-redhat-71.yml +0 -4
  151. data/test/integration/.kitchen/default-suse-11sp3.yml +0 -4
  152. data/test/integration/.kitchen/default-suse-12.yml +0 -4
  153. data/test/integration/.kitchen/default-ubuntu-1004.yml +0 -6
  154. data/test/integration/.kitchen/default-ubuntu-1204.yml +0 -4
  155. data/test/integration/.kitchen/default-ubuntu-1404.yml +0 -4
  156. data/test/integration/.kitchen/default-ubuntu-1510.yml +0 -4
  157. data/test/integration/.kitchen/default-windows-2012.yml +0 -5
  158. data/test/integration/.kitchen/default-windows-2012r2.yml +0 -6
  159. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  160. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  161. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/id +0 -1
  162. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  163. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/private_key +0 -27
  164. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  165. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/Vagrantfile +0 -9
  166. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67-i386/Vagrantfile +0 -9
  167. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  168. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  169. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/id +0 -1
  170. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  171. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/private_key +0 -27
  172. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  173. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/Vagrantfile +0 -9
  174. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  175. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  176. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/id +0 -1
  177. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  178. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/private_key +0 -27
  179. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  180. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/Vagrantfile +0 -9
  181. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  182. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  183. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/id +0 -1
  184. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  185. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/private_key +0 -27
  186. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  187. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/Vagrantfile +0 -9
  188. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  189. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  190. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/id +0 -1
  191. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  192. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/private_key +0 -27
  193. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  194. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/Vagrantfile +0 -9
  195. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  196. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  197. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/id +0 -1
  198. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  199. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/private_key +0 -27
  200. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  201. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/Vagrantfile +0 -9
  202. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  203. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  204. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/id +0 -1
  205. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  206. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/private_key +0 -27
  207. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  208. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/Vagrantfile +0 -9
  209. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  210. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  211. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/id +0 -1
  212. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  213. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/private_key +0 -27
  214. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  215. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/Vagrantfile +0 -9
  216. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  217. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  218. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/id +0 -1
  219. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  220. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/private_key +0 -27
  221. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  222. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/Vagrantfile +0 -9
  223. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  224. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  225. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/id +0 -1
  226. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  227. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/private_key +0 -27
  228. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  229. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/Vagrantfile +0 -9
  230. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  231. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  232. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/id +0 -1
  233. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  234. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/private_key +0 -27
  235. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  236. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/Vagrantfile +0 -9
  237. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  238. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  239. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/id +0 -1
  240. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  241. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/private_key +0 -27
  242. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  243. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/Vagrantfile +0 -9
  244. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  245. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  246. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +0 -1
  247. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  248. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +0 -27
  249. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  250. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/Vagrantfile +0 -9
  251. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  252. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  253. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
  254. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  255. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
  256. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  257. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/Vagrantfile +0 -9
  258. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-new-ubuntu-1404/Vagrantfile +0 -9
  259. data/test/integration/.kitchen/logs/default-aws-linux.log +0 -0
  260. data/test/integration/.kitchen/logs/default-centos-511-i386.log +0 -0
  261. data/test/integration/.kitchen/logs/default-centos-511.log +0 -0
  262. data/test/integration/.kitchen/logs/default-centos-67-i386.log +0 -0
  263. data/test/integration/.kitchen/logs/default-centos-67.log +0 -0
  264. data/test/integration/.kitchen/logs/default-centos-7.log +0 -0
  265. data/test/integration/.kitchen/logs/default-centos-71.log +0 -0
  266. data/test/integration/.kitchen/logs/default-debian-6010-i386.log +0 -0
  267. data/test/integration/.kitchen/logs/default-debian-6010.log +0 -0
  268. data/test/integration/.kitchen/logs/default-debian-78-i386.log +0 -0
  269. data/test/integration/.kitchen/logs/default-debian-78.log +0 -0
  270. data/test/integration/.kitchen/logs/default-debian-8.log +0 -0
  271. data/test/integration/.kitchen/logs/default-debian-81-i386.log +0 -0
  272. data/test/integration/.kitchen/logs/default-debian-81.log +0 -0
  273. data/test/integration/.kitchen/logs/default-fedora-21-i386.log +0 -0
  274. data/test/integration/.kitchen/logs/default-fedora-21.log +0 -0
  275. data/test/integration/.kitchen/logs/default-fedora-22.log +0 -0
  276. data/test/integration/.kitchen/logs/default-freebsd-102.log +0 -0
  277. data/test/integration/.kitchen/logs/default-freebsd-93.log +0 -0
  278. data/test/integration/.kitchen/logs/default-mint-172-cinnamon.log +0 -0
  279. data/test/integration/.kitchen/logs/default-opensuse-132-i386.log +0 -0
  280. data/test/integration/.kitchen/logs/default-opensuse-132-x86-64.log +0 -0
  281. data/test/integration/.kitchen/logs/default-redhat-65.log +0 -0
  282. data/test/integration/.kitchen/logs/default-redhat-71.log +0 -0
  283. data/test/integration/.kitchen/logs/default-suse-11sp3.log +0 -0
  284. data/test/integration/.kitchen/logs/default-suse-12.log +0 -0
  285. data/test/integration/.kitchen/logs/default-ubuntu-1004-i386.log +0 -0
  286. data/test/integration/.kitchen/logs/default-ubuntu-1004.log +0 -0
  287. data/test/integration/.kitchen/logs/default-ubuntu-1204-i386.log +0 -0
  288. data/test/integration/.kitchen/logs/default-ubuntu-1204.log +0 -23
  289. data/test/integration/.kitchen/logs/default-ubuntu-1404-i386.log +0 -0
  290. data/test/integration/.kitchen/logs/default-ubuntu-1404.log +0 -0
  291. data/test/integration/.kitchen/logs/default-ubuntu-1510.log +0 -0
  292. data/test/integration/.kitchen/logs/default-windows-2012.log +0 -0
  293. data/test/integration/.kitchen/logs/default-windows-2012r2.log +0 -0
  294. data/test/integration/.kitchen/logs/kitchen.log +0 -3
  295. data/test/integration/.kitchen/logs/new-centos-511-i386.log +0 -0
  296. data/test/integration/.kitchen/logs/new-centos-511.log +0 -0
  297. data/test/integration/.kitchen/logs/new-centos-67-i386.log +0 -0
  298. data/test/integration/.kitchen/logs/new-centos-67.log +0 -0
  299. data/test/integration/.kitchen/logs/new-centos-71.log +0 -0
  300. data/test/integration/.kitchen/logs/new-debian-6010-i386.log +0 -0
  301. data/test/integration/.kitchen/logs/new-debian-6010.log +0 -0
  302. data/test/integration/.kitchen/logs/new-debian-78-i386.log +0 -0
  303. data/test/integration/.kitchen/logs/new-debian-78.log +0 -0
  304. data/test/integration/.kitchen/logs/new-debian-81-i386.log +0 -0
  305. data/test/integration/.kitchen/logs/new-debian-81.log +0 -0
  306. data/test/integration/.kitchen/logs/new-fedora-21-i386.log +0 -0
  307. data/test/integration/.kitchen/logs/new-fedora-21.log +0 -0
  308. data/test/integration/.kitchen/logs/new-fedora-22.log +0 -0
  309. data/test/integration/.kitchen/logs/new-freebsd-102.log +0 -0
  310. data/test/integration/.kitchen/logs/new-freebsd-93.log +0 -0
  311. data/test/integration/.kitchen/logs/new-opensuse-132-i386.log +0 -0
  312. data/test/integration/.kitchen/logs/new-opensuse-132-x86-64.log +0 -0
  313. data/test/integration/.kitchen/logs/new-ubuntu-1004-i386.log +0 -0
  314. data/test/integration/.kitchen/logs/new-ubuntu-1004.log +0 -0
  315. data/test/integration/.kitchen/logs/new-ubuntu-1204-i386.log +0 -0
  316. data/test/integration/.kitchen/logs/new-ubuntu-1204.log +0 -0
  317. data/test/integration/.kitchen/logs/new-ubuntu-1404-i386.log +0 -0
  318. data/test/integration/.kitchen/logs/new-ubuntu-1404.log +0 -3
  319. data/test/integration/.kitchen/logs/test-centos-511-i386.log +0 -0
  320. data/test/integration/.kitchen/logs/test-centos-511.log +0 -0
  321. data/test/integration/.kitchen/logs/test-centos-67-i386.log +0 -0
  322. data/test/integration/.kitchen/logs/test-centos-67.log +0 -0
  323. data/test/integration/.kitchen/logs/test-centos-71.log +0 -0
  324. data/test/integration/.kitchen/logs/test-debian-6010-i386.log +0 -0
  325. data/test/integration/.kitchen/logs/test-debian-6010.log +0 -0
  326. data/test/integration/.kitchen/logs/test-debian-78-i386.log +0 -0
  327. data/test/integration/.kitchen/logs/test-debian-78.log +0 -0
  328. data/test/integration/.kitchen/logs/test-debian-81-i386.log +0 -0
  329. data/test/integration/.kitchen/logs/test-debian-81.log +0 -0
  330. data/test/integration/.kitchen/logs/test-fedora-21-i386.log +0 -0
  331. data/test/integration/.kitchen/logs/test-fedora-21.log +0 -0
  332. data/test/integration/.kitchen/logs/test-fedora-22.log +0 -0
  333. data/test/integration/.kitchen/logs/test-freebsd-102.log +0 -0
  334. data/test/integration/.kitchen/logs/test-freebsd-93.log +0 -0
  335. data/test/integration/.kitchen/logs/test-opensuse-132-i386.log +0 -0
  336. data/test/integration/.kitchen/logs/test-opensuse-132-x86-64.log +0 -0
  337. data/test/integration/.kitchen/logs/test-ubuntu-1004-i386.log +0 -0
  338. data/test/integration/.kitchen/logs/test-ubuntu-1004.log +0 -0
  339. data/test/integration/.kitchen/logs/test-ubuntu-1204-i386.log +0 -0
  340. data/test/integration/.kitchen/logs/test-ubuntu-1204.log +0 -0
  341. data/test/integration/.kitchen/logs/test-ubuntu-1404-i386.log +0 -0
  342. data/test/integration/.kitchen/logs/test-ubuntu-1404.log +0 -0
  343. data/test/integration/.kitchen/new-ubuntu-1404.yml +0 -1
  344. data/test/integration/Berksfile.lock +0 -11
  345. data/test/integration/TODO.md +0 -15
  346. data/test/integration/test/.DS_Store +0 -0
  347. data/test/integration/test/integration/.DS_Store +0 -0
  348. data/test/integration/test/integration/default/.DS_Store +0 -0
  349. data/test/integration/test/integration/default/certificate_spec.rb +0 -7
  350. data/test/integration/test/integration/default/etc_group.rb +0 -13
  351. data/test/serverspec/.kitchen.yml +0 -18
  352. data/test/serverspec/.kitchen/default-ubuntu-1404.yml +0 -6
  353. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  354. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  355. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
  356. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  357. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
  358. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  359. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/Vagrantfile +0 -9
  360. data/test/serverspec/.kitchen/logs/default-ubuntu-1404.log +0 -2
  361. data/test/serverspec/.kitchen/logs/kitchen.log +0 -3
  362. data/test/serverspec/Berksfile +0 -3
  363. data/test/serverspec/Berksfile.lock +0 -5
  364. data/test/serverspec/TODO.md +0 -2
  365. data/test/serverspec/test/integration/default/serverspec/os_spec.rb +0 -25
  366. data/test/serverspec/test/integration/default/serverspec/spec_helper.rb +0 -48
  367. data/test/serverspec/test/integration/default/serverspec/sysctl_spec.rb +0 -37
  368. data/test/unit/mock/cmd/lsof-np-itcp +0 -4
@@ -58,8 +58,8 @@ class PostgresSession < Inspec.resource(1)
58
58
  # remove the whole header (i.e. up to the first ^-----+------+------$)
59
59
  # remove the tail
60
60
  lines = cmd.stdout
61
- .sub(/(.*\n)+([-]+[+])*[-]+\n/, '')
62
- .sub(/\n[^\n]*\n\n$/, '')
61
+ .sub(/(.*\n)+([-]+[+])*[-]+\n/, '')
62
+ .sub(/\n[^\n]*\n\n$/, '')
63
63
  l = Lines.new(lines.strip, "PostgreSQL query: #{query}")
64
64
  RSpec.__send__('describe', l, &block)
65
65
  end
@@ -26,7 +26,8 @@ class RegistryKey < Inspec.resource(1)
26
26
  reg_key ||= name
27
27
  @name = name
28
28
  @reg_key = reg_key
29
- skip_resource 'The `registry_key` resource is not supported on your OS yet.'
29
+
30
+ return skip_resource 'The `registry_key` resource is not supported on your OS yet.' if !inspec.os.windows?
30
31
  end
31
32
 
32
33
  def exists?
@@ -58,7 +58,7 @@ class SecurityPolicy < Inspec.resource(1)
58
58
  key = Regexp.escape(method.to_s)
59
59
  target = ''
60
60
  @policy.each_line {|s|
61
- target = s.strip if s.match(/^\s*#{key}\s*=\s*(.*)\b/)
61
+ target = s.strip if s =~ /^\s*#{key}\s*=\s*(.*)\b/
62
62
  }
63
63
 
64
64
  # extract variable value
@@ -66,7 +66,7 @@ class SecurityPolicy < Inspec.resource(1)
66
66
 
67
67
  if !result.nil?
68
68
  val = result[:value]
69
- val = val.to_i if val.match(/^\d+$/)
69
+ val = val.to_i if val =~ /^\d+$/
70
70
  else
71
71
  # TODO: we may need to return skip or failure if the
72
72
  # requested value is not available
@@ -80,6 +80,8 @@ class Service < Inspec.resource(1)
80
80
  @service_mgmt = BSDInit.new(inspec)
81
81
  when 'arch', 'opensuse'
82
82
  @service_mgmt = Systemd.new(inspec)
83
+ when 'aix'
84
+ @service_mgmt = SrcMstr.new(inspec)
83
85
  end
84
86
 
85
87
  return skip_resource 'The `service` resource is not supported on your OS yet.' if @service_mgmt.nil?
@@ -142,7 +144,7 @@ class Systemd < ServiceManager
142
144
  params['SubState'] == 'running' ? (running = true) : (running = false)
143
145
  # test via systemctl --quiet is-enabled
144
146
  # ActiveState values eg.g inactive, active
145
- params['ActiveState'] == 'active' ? (enabled = true) : (enabled = false)
147
+ params['UnitFileState'] == 'enabled' ? (enabled = true) : (enabled = false)
146
148
 
147
149
  {
148
150
  name: params['Id'],
@@ -155,6 +157,53 @@ class Systemd < ServiceManager
155
157
  end
156
158
  end
157
159
 
160
+ # AIX services
161
+ class SrcMstr < ServiceManager
162
+ attr_reader :name
163
+
164
+ def info(service_name)
165
+ @name = service_name
166
+ running = status?
167
+ return nil if running.nil?
168
+
169
+ {
170
+ name: service_name,
171
+ description: nil,
172
+ installed: true,
173
+ running: running,
174
+ enabled: enabled?,
175
+ type: 'srcmstr',
176
+ }
177
+ end
178
+
179
+ def status?
180
+ status_cmd = inspec.command("lssrc -s #{@name}")
181
+ return nil if status_cmd.exit_status.to_i != 0
182
+ status_cmd.stdout.split(/\n/).last.chomp =~ /active$/ ? true : false
183
+ end
184
+
185
+ def enabled?
186
+ enabled_rc_tcpip? || enabled_inittab?
187
+ end
188
+
189
+ private
190
+
191
+ # #rubocop:disable Style/TrailingComma
192
+ def enabled_rc_tcpip?
193
+ if inspec.command(
194
+ "grep -v ^# /etc/rc.tcpip | grep 'start ' | grep -Eq '(/{0,1}| )#{@name} '",
195
+ ).exit_status == 0
196
+ true
197
+ else
198
+ false
199
+ end
200
+ end
201
+
202
+ def enabled_inittab?
203
+ inspec.command("lsitab #{@name}").exit_status.to_i == 0 ? true : false
204
+ end
205
+ end
206
+
158
207
  # @see: http://upstart.ubuntu.com
159
208
  class Upstart < ServiceManager
160
209
  def info(service_name)
@@ -62,6 +62,8 @@ class User < Inspec.resource(1)
62
62
  @user_provider = DarwinUser.new(inspec)
63
63
  when 'freebsd'
64
64
  @user_provider = FreeBSDUser.new(inspec)
65
+ when 'aix'
66
+ @user_provider = AixUser.new(inspec)
65
67
  else
66
68
  return skip_resource 'The `user` resource is not supported on your OS yet.'
67
69
  end
@@ -263,6 +265,49 @@ class LinuxUser < UnixUser
263
265
  end
264
266
  end
265
267
 
268
+ class AixUser < UnixUser
269
+ def identity(username)
270
+ id = super(username)
271
+ return nil if id.nil?
272
+ # AIX 'id' command doesn't include the primary group in the supplementary
273
+ # yet it can be somewhere in the supplementary list if someone added root
274
+ # to a groups list in /etc/group
275
+ # we rearrange to expected list if that is the case
276
+ if id[:groups].first != id[:group]
277
+ id[:groups].reject! { |i| i == id[:group] } if id[:groups].include?(id[:group])
278
+ id[:groups].unshift(id[:group])
279
+ end
280
+
281
+ id
282
+ end
283
+
284
+ def meta_info(username)
285
+ lsuser = inspec.command("lsuser -C -a home shell #{username}")
286
+ return nil if lsuser.exit_status != 0
287
+
288
+ user = lsuser.stdout.chomp.split("\n").last.split(':')
289
+ {
290
+ home: user[1],
291
+ shell: user[2],
292
+ }
293
+ end
294
+
295
+ def credentials(username)
296
+ cmd = inspec.command(
297
+ "lssec -c -f /etc/security/user -s #{username} -a minage -a maxage -a pwdwarntime",
298
+ )
299
+ return nil if cmd.exit_status != 0
300
+
301
+ user_sec = cmd.stdout.chomp.split("\n").last.split(':')
302
+
303
+ {
304
+ mindays: user_sec[1].to_i * 7,
305
+ maxdays: user_sec[2].to_i * 7,
306
+ warndays: user_sec[3].to_i,
307
+ }
308
+ end
309
+ end
310
+
266
311
  # we do not use 'finger' for MacOS, because it is harder to parse data with it
267
312
  # @see https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/fingerd.8.html
268
313
  # instead we use 'dscl' to request user data
@@ -57,7 +57,7 @@ class Yum < Inspec.resource(1)
57
57
  in_repo = false
58
58
  @content.each_line do |line|
59
59
  # detect repo start
60
- in_repo = true if line.match(/^\s*Repo-id\s*:\s*(.*)\b/)
60
+ in_repo = true if line =~ /^\s*Repo-id\s*:\s*(.*)\b/
61
61
  # detect repo end
62
62
  if line == "\n" && in_repo
63
63
  in_repo = false
@@ -94,7 +94,7 @@ class Yum < Inspec.resource(1)
94
94
 
95
95
  # Removes lefthand and righthand whitespace
96
96
  def strip(value)
97
- value.lstrip.rstrip if !value.nil?
97
+ value.strip if !value.nil?
98
98
  end
99
99
 
100
100
  # Optimize the key value
@@ -6,7 +6,7 @@ module Converter
6
6
  # convert the value to an integer if we have numbers only
7
7
  # otherwise we return the string
8
8
  def convert_to_i(val)
9
- val = val.to_i if val.match(/^\d+$/)
9
+ val = val.to_i if val =~ /^\d+$/
10
10
  val
11
11
  end
12
12
  end
@@ -14,7 +14,7 @@ module FindFiles
14
14
  link: 'l',
15
15
  socket: 's',
16
16
  door: 'D',
17
- }
17
+ }.freeze
18
18
 
19
19
  # ignores errors
20
20
  def find_files(path, opts = {})
@@ -38,7 +38,7 @@ module FindFiles
38
38
  end
39
39
 
40
40
  result.stdout.split("\n")
41
- .map(&:strip)
42
- .find_all { |x| !x.empty? }
41
+ .map(&:strip)
42
+ .find_all { |x| !x.empty? }
43
43
  end
44
44
  end
@@ -81,9 +81,9 @@ module MountParser
81
81
  name, val = option.split('=')
82
82
  if val.nil?
83
83
  val = true
84
- else
84
+ elsif val =~ /^\d+$/
85
85
  # parse numbers
86
- val = val.to_i if val.match(/^\d+$/)
86
+ val = val.to_i
87
87
  end
88
88
  mount_options[:options][name.to_sym] = val
89
89
  end
@@ -21,7 +21,7 @@ SOURCE = File.join(File.dirname(__FILE__), '..', 'MAINTAINERS.toml')
21
21
  TARGET = File.join(File.dirname(__FILE__), '..', 'MAINTAINERS.md')
22
22
 
23
23
  # The list of repositories that teams should own
24
- REPOSITORIES = ['chef/inspec']
24
+ REPOSITORIES = ['chef/inspec'].freeze
25
25
 
26
26
  begin
27
27
  require 'tomlrb'
@@ -194,11 +194,11 @@ begin
194
194
 
195
195
  # rubocop:disable Metrics/AbcSize
196
196
  def person(list, person)
197
- if list[person].key?('GitHub')
198
- out = "* [#{list[person]['Name']}](https://github.com/#{list[person]['GitHub']})"
199
- else
200
- out = "* #{list[person]['Name']}"
201
- end
197
+ out = if list[person].key?('GitHub')
198
+ "* [#{list[person]['Name']}](https://github.com/#{list[person]['GitHub']})"
199
+ else
200
+ "* #{list[person]['Name']}"
201
+ end
202
202
  out << "\n * IRC - #{list[person]['IRC']}" if list[person].key?('IRC')
203
203
  out << "\n * [@#{list[person]['Twitter']}](https://twitter.com/#{list[person]['Twitter']})" if list[person].key?('Twitter')
204
204
  out << "\n * [#{list[person]['email']}](mailto:#{list[person]['email']})" if list[person].key?('email')
@@ -17,6 +17,8 @@ end
17
17
  require 'inspec/resource'
18
18
  require 'inspec/backend'
19
19
  require 'inspec/profile'
20
+ require 'inspec/targets'
21
+ require 'inspec/targets/zip'
20
22
 
21
23
  class MockLoader
22
24
  # pass the os identifier to emulate a specific operating system
@@ -135,8 +137,8 @@ class MockLoader
135
137
  '/sbin/sysctl -q -n net.ipv4.conf.all.forwarding' => cmd.call('sbin_sysctl'),
136
138
  # ports on windows
137
139
  'Get-NetTCPConnection | Select-Object -Property State, Caption, Description, LocalAddress, LocalPort, RemoteAddress, RemotePort, DisplayName, Status | ConvertTo-Json' => cmd.call('get-net-tcpconnection'),
138
- # ports on mac
139
- 'lsof -nP -iTCP -iUDP -sTCP:LISTEN' => cmd.call('lsof-np-itcp'),
140
+ # lsof formatted list of ports (should be quite cross platform)
141
+ 'lsof -nP -i -FpctPn' => cmd.call('lsof-nP-i-FpctPn'),
140
142
  # ports on linux
141
143
  'netstat -tulpen' => cmd.call('netstat-tulpen'),
142
144
  # ports on freebsd
@@ -6,8 +6,15 @@
6
6
 
7
7
  if node['platform_family'] != 'windows'
8
8
 
9
- gid = 'root'
10
- gid = 'wheel' if node['platform_family'] == 'freebsd'
9
+ gid = case node['platform_family']
10
+ when 'aix'
11
+ 'system'
12
+ when 'freebsd'
13
+ 'wheel'
14
+ else
15
+ 'root'
16
+ end
17
+
11
18
 
12
19
  file '/tmp/file' do
13
20
  mode '0765'
@@ -4,8 +4,14 @@
4
4
  #
5
5
  # adds a yaml file
6
6
 
7
- gid = 'root'
8
- gid = 'wheel' if node['platform_family'] == 'freebsd'
7
+ gid = case node['platform_family']
8
+ when 'aix'
9
+ 'system'
10
+ when 'freebsd'
11
+ 'wheel'
12
+ else
13
+ 'root'
14
+ end
9
15
 
10
16
  ['yml', 'json', 'csv', 'ini'].each { |filetype|
11
17
 
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ root_group = case os[:family]
4
+ when 'aix'
5
+ 'system'
6
+ when 'freebsd'
7
+ 'wheel'
8
+ else
9
+ 'root'
10
+ end
11
+
12
+ if os.unix?
13
+ describe etc_group do
14
+ its('gids') { should_not contain_duplicates }
15
+ its('groups') { should include root_group }
16
+ its('users') { should include 'root' }
17
+ end
18
+
19
+ describe etc_group.where(name: root_group) do
20
+ its('users') { should include 'root' }
21
+ end
22
+ end
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- if os[:family] == 'freebsd'
3
+ case os[:family]
4
+ when 'freebsd'
4
5
  filedata = {
5
6
  user: 'root',
6
7
  group: 'wheel',
@@ -8,6 +9,14 @@ if os[:family] == 'freebsd'
8
9
  dir_md5sum: '598f4fe64aefab8f00bcbea4c9239abf',
9
10
  dir_sha256sum: '9b4fb24edd6d1d8830e272398263cdbf026b97392cc35387b991dc0248a628f9',
10
11
  }
12
+ when 'aix'
13
+ filedata = {
14
+ user: 'root',
15
+ group: 'system',
16
+ dir_content: nil,
17
+ dir_md5sum: nil,
18
+ dir_sha256sum: nil,
19
+ }
11
20
  else
12
21
  filedata = {
13
22
  user: 'root',
@@ -30,3 +30,20 @@ if os[:family] == 'freebsd'
30
30
  its('gid') { should eq nil }
31
31
  end
32
32
  end
33
+
34
+ if os[:family] == 'aix'
35
+ describe group('system') do
36
+ it { should exist }
37
+ its('gid') { should eq 0 }
38
+ end
39
+
40
+ describe group('bin') do
41
+ it { should exist }
42
+ its('gid') { should eq 2 }
43
+ end
44
+
45
+ describe group('noroot') do
46
+ it { should_not exist }
47
+ its('gid') { should eq nil }
48
+ end
49
+ end
@@ -1,11 +1,17 @@
1
1
  # encoding: utf-8
2
2
 
3
- if ['centos', 'fedora', 'opensuse', 'debian', 'ubuntu'].include?(os[:family])
3
+ case os[:family]
4
+ when 'centos', 'fedora', 'opensuse', 'debian', 'ubuntu'
4
5
  describe package('curl') do
5
6
  it { should be_installed }
6
7
  end
7
-
8
- describe package('nginx') do
9
- it { should_not be_installed }
8
+ when 'aix'
9
+ describe package('bos.rte') do
10
+ it { should be_installed }
11
+ its('version') { should match /^(6|7)[.|\d]+\d$/ }
10
12
  end
11
13
  end
14
+
15
+ describe package('nginx') do
16
+ it { should_not be_installed }
17
+ end
@@ -5,5 +5,11 @@ if os.unix?
5
5
  describe port(22) do
6
6
  it { should be_listening }
7
7
  its('protocols') { should include('tcp') }
8
+ its('protocols') { should_not include('udp') }
9
+ its('processes') { should include 'sshd' }
10
+ end
11
+
12
+ describe port(65432) do
13
+ it { should_not be_listening }
8
14
  end
9
15
  end
@@ -17,6 +17,9 @@ elsif ['windows'].include?(os[:family])
17
17
  # Ubuntu
18
18
  unavailable_service = 'sshd'
19
19
  available_service = 'dhcp'
20
+ elsif ['aix'].include?(os[:family])
21
+ unavailable_service = 'clamav'
22
+ available_service = 'xntpd'
20
23
  end
21
24
 
22
25
  describe service(unavailable_service) do
@@ -1,8 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- # root test
4
- if ['centos', 'fedora', 'opensuse', 'debian', 'ubuntu'].include?(os[:family])
5
-
3
+ case os[:family]
4
+ when 'centos', 'redhat', 'fedora', 'opensuse', 'debian', 'ubuntu'
6
5
  userinfo = {
7
6
  name: 'root',
8
7
  group: 'root',
@@ -14,10 +13,10 @@ if ['centos', 'fedora', 'opensuse', 'debian', 'ubuntu'].include?(os[:family])
14
13
  }
15
14
 
16
15
  # different groupset for centos 5
17
- userinfo[:groups] = ["root", "bin", "daemon", "sys", "adm", "disk", "wheel"] if os[:release].to_i == 5
18
-
19
- elsif ['freebsd'].include?(os[:family])
16
+ userinfo[:groups] = ["root", "bin", "daemon", "sys", "adm", "disk", "wheel"] \
17
+ if os[:release].to_i == 5
20
18
 
19
+ when 'freebsd'
21
20
  userinfo = {
22
21
  name: 'root',
23
22
  group: 'wheel',
@@ -28,8 +27,7 @@ elsif ['freebsd'].include?(os[:family])
28
27
  shell: '/bin/csh',
29
28
  }
30
29
 
31
- elsif ['windows'].include?(os[:family])
32
-
30
+ when 'windows'
33
31
  userinfo = {
34
32
  name: 'Administrator',
35
33
  group: nil,
@@ -40,23 +38,35 @@ elsif ['windows'].include?(os[:family])
40
38
  shell: nil,
41
39
  }
42
40
 
41
+ when 'aix'
42
+ userinfo = {
43
+ name: 'bin',
44
+ group: 'bin',
45
+ uid: 2,
46
+ gid: 2,
47
+ groups: %w{bin sys adm},
48
+ home: '/bin',
49
+ shell: nil,
50
+ #mindays: 0,
51
+ #maxdays: 0,
52
+ warndays: 0,
53
+ }
54
+
43
55
  else
44
56
  userinfo = {}
45
57
  end
46
58
 
47
- if !os.windows?
59
+ case os[:family]
60
+ when 'windows'
48
61
  describe user(userinfo[:name]) do
49
62
  it { should exist }
50
- it { should belong_to_group userinfo[:group] }
51
- its('uid') { should eq userinfo[:uid] }
52
- its('gid') { should eq userinfo[:gid] }
53
- its('group') { should eq userinfo[:group] }
54
- its('groups') { should eq userinfo[:groups] }
55
- its('home') { should eq userinfo[:home] }
56
- its('shell') { should eq userinfo[:shell] }
57
63
  end
58
64
  else
59
65
  describe user(userinfo[:name]) do
60
66
  it { should exist }
67
+ userinfo.each do |k, v|
68
+ next if k.to_sym == :name
69
+ its(k) { should eq v }
70
+ end
61
71
  end
62
72
  end