inspec 0.30.0 → 0.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (316) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +50 -2
  3. data/Gemfile +2 -1
  4. data/docs/cli.rst +1 -17
  5. data/docs/resources.rst +128 -0
  6. data/docs/shell.rst +130 -0
  7. data/inspec.gemspec +3 -4
  8. data/lib/bundles/inspec-compliance/.kitchen.yml +0 -1
  9. data/lib/bundles/inspec-compliance/README.md +8 -3
  10. data/lib/bundles/inspec-compliance/api.rb +21 -6
  11. data/lib/bundles/inspec-compliance/bootstrap.sh +13 -9
  12. data/lib/bundles/inspec-compliance/cli.rb +23 -19
  13. data/lib/bundles/inspec-compliance/target.rb +1 -0
  14. data/lib/bundles/inspec-compliance/test/integration/default/cli.rb +42 -5
  15. data/lib/bundles/inspec-init/cli.rb +9 -0
  16. data/lib/bundles/inspec-supermarket/cli.rb +9 -0
  17. data/lib/bundles/inspec-supermarket/target.rb +2 -1
  18. data/lib/fetchers/local.rb +5 -2
  19. data/lib/fetchers/url.rb +1 -0
  20. data/lib/inspec/base_cli.rb +2 -1
  21. data/lib/inspec/cli.rb +14 -5
  22. data/lib/inspec/dependencies/dependency_set.rb +38 -0
  23. data/lib/inspec/dependencies/requirement.rb +103 -0
  24. data/lib/inspec/{dependencies.rb → dependencies/resolver.rb} +13 -132
  25. data/lib/inspec/dependencies/vendor_index.rb +98 -0
  26. data/lib/inspec/plugins/source_reader.rb +4 -0
  27. data/lib/inspec/profile.rb +2 -2
  28. data/lib/inspec/resource.rb +2 -0
  29. data/lib/inspec/runner.rb +13 -1
  30. data/lib/inspec/runner_mock.rb +4 -0
  31. data/lib/inspec/runner_rspec.rb +6 -2
  32. data/lib/inspec/shell.rb +22 -1
  33. data/lib/inspec/version.rb +1 -1
  34. data/lib/resources/iis_site.rb +107 -0
  35. data/lib/resources/port.rb +11 -4
  36. data/lib/resources/ssh_conf.rb +10 -2
  37. data/lib/resources/ssl.rb +94 -0
  38. data/lib/resources/xinetd.rb +11 -2
  39. data/lib/utils/parser.rb +6 -1
  40. metadata +17 -561
  41. data/lib/utils/hash_map.rb +0 -37
  42. data/tasks/maintainers.rb +0 -213
  43. data/test/bench/startup/startup.flat.txt +0 -1005
  44. data/test/bench/startup/startup.graph.html +0 -71958
  45. data/test/bench/startup/startup.grind.dat +0 -101602
  46. data/test/bench/startup/startup.stack.html +0 -24516
  47. data/test/bench/startup.flat.txt +0 -998
  48. data/test/bench/startup.graph.html +0 -71420
  49. data/test/bench/startup.grind.dat +0 -103554
  50. data/test/bench/startup.stack.html +0 -25015
  51. data/test/cookbooks/os_prepare/attributes/default.rb +0 -2
  52. data/test/cookbooks/os_prepare/files/empty.iso +0 -0
  53. data/test/cookbooks/os_prepare/files/example.csv +0 -7
  54. data/test/cookbooks/os_prepare/files/example.ini +0 -6
  55. data/test/cookbooks/os_prepare/files/example.json +0 -12
  56. data/test/cookbooks/os_prepare/files/example.yml +0 -7
  57. data/test/cookbooks/os_prepare/metadata.rb +0 -13
  58. data/test/cookbooks/os_prepare/recipes/_runit_service_centos.rb +0 -34
  59. data/test/cookbooks/os_prepare/recipes/_upstart_service_centos.rb +0 -25
  60. data/test/cookbooks/os_prepare/recipes/apache.rb +0 -14
  61. data/test/cookbooks/os_prepare/recipes/apt.rb +0 -20
  62. data/test/cookbooks/os_prepare/recipes/auditctl.rb +0 -8
  63. data/test/cookbooks/os_prepare/recipes/default.rb +0 -29
  64. data/test/cookbooks/os_prepare/recipes/file.rb +0 -46
  65. data/test/cookbooks/os_prepare/recipes/iptables.rb +0 -13
  66. data/test/cookbooks/os_prepare/recipes/json_yaml_csv_ini.rb +0 -34
  67. data/test/cookbooks/os_prepare/recipes/mount.rb +0 -33
  68. data/test/cookbooks/os_prepare/recipes/package.rb +0 -25
  69. data/test/cookbooks/os_prepare/recipes/postgres.rb +0 -20
  70. data/test/cookbooks/os_prepare/recipes/prep_container.rb +0 -15
  71. data/test/cookbooks/os_prepare/recipes/registry_key.rb +0 -87
  72. data/test/cookbooks/os_prepare/recipes/service.rb +0 -19
  73. data/test/cookbooks/os_prepare/templates/default/sv-default-svlog-run.erb +0 -2
  74. data/test/docker_run.rb +0 -162
  75. data/test/docker_test.rb +0 -58
  76. data/test/functional/helper.rb +0 -37
  77. data/test/functional/inheritance_test.rb +0 -62
  78. data/test/functional/inspec_archive_test.rb +0 -80
  79. data/test/functional/inspec_compliance_test.rb +0 -61
  80. data/test/functional/inspec_exec_json_test.rb +0 -122
  81. data/test/functional/inspec_exec_jsonmin_test.rb +0 -59
  82. data/test/functional/inspec_exec_test.rb +0 -123
  83. data/test/functional/inspec_json_profile_test.rb +0 -103
  84. data/test/functional/inspec_test.rb +0 -91
  85. data/test/helper.rb +0 -329
  86. data/test/integration/default/_debug_spec.rb +0 -8
  87. data/test/integration/default/apache_conf_spec.rb +0 -21
  88. data/test/integration/default/apt_spec.rb +0 -37
  89. data/test/integration/default/auditd_rules_spec.rb +0 -32
  90. data/test/integration/default/cmp_matcher_spec.rb +0 -115
  91. data/test/integration/default/csv_spec.rb +0 -11
  92. data/test/integration/default/etc_group_spec.rb +0 -29
  93. data/test/integration/default/file_spec.rb +0 -195
  94. data/test/integration/default/group_spec.rb +0 -59
  95. data/test/integration/default/ini_spec.rb +0 -11
  96. data/test/integration/default/iptables_spec.rb +0 -29
  97. data/test/integration/default/json_spec.rb +0 -11
  98. data/test/integration/default/kernel_module_spec.rb +0 -23
  99. data/test/integration/default/kernel_parameter_spec.rb +0 -60
  100. data/test/integration/default/mount_spec.rb +0 -19
  101. data/test/integration/default/os_spec.rb +0 -13
  102. data/test/integration/default/package_spec.rb +0 -30
  103. data/test/integration/default/port_spec.rb +0 -27
  104. data/test/integration/default/postgres_session_spec.rb +0 -13
  105. data/test/integration/default/powershell_spec.rb +0 -42
  106. data/test/integration/default/registry_key_spec.rb +0 -109
  107. data/test/integration/default/secpol_spec.rb +0 -11
  108. data/test/integration/default/service_spec.rb +0 -128
  109. data/test/integration/default/user_spec.rb +0 -96
  110. data/test/integration/default/vbscript_spec.rb +0 -22
  111. data/test/integration/default/wmi_spec.rb +0 -66
  112. data/test/integration/default/yaml_spec.rb +0 -11
  113. data/test/resource/command_test.rb +0 -33
  114. data/test/resource/dsl_test.rb +0 -45
  115. data/test/resource/file_test.rb +0 -146
  116. data/test/resource/ssh_config.rb +0 -9
  117. data/test/resource/sshd_config.rb +0 -9
  118. data/test/test-extra.yaml +0 -11
  119. data/test/test.yaml +0 -11
  120. data/test/unit/control_test.rb +0 -58
  121. data/test/unit/fetchers/local_test.rb +0 -67
  122. data/test/unit/fetchers/mock_test.rb +0 -43
  123. data/test/unit/fetchers/tar_test.rb +0 -36
  124. data/test/unit/fetchers/url_test.rb +0 -152
  125. data/test/unit/fetchers/zip_test.rb +0 -36
  126. data/test/unit/fetchers_test.rb +0 -65
  127. data/test/unit/metadata_test.rb +0 -137
  128. data/test/unit/mock/cmd/$env-PATH +0 -1
  129. data/test/unit/mock/cmd/Get-NetAdapter +0 -24
  130. data/test/unit/mock/cmd/GetUserAccount +0 -33
  131. data/test/unit/mock/cmd/GetWin32Group +0 -23
  132. data/test/unit/mock/cmd/Resolve-DnsName +0 -26
  133. data/test/unit/mock/cmd/Test-NetConnection +0 -4
  134. data/test/unit/mock/cmd/auditctl +0 -3
  135. data/test/unit/mock/cmd/auditctl-legacy +0 -7
  136. data/test/unit/mock/cmd/auditctl-s +0 -8
  137. data/test/unit/mock/cmd/auditpol +0 -2
  138. data/test/unit/mock/cmd/brew-info-jq +0 -1
  139. data/test/unit/mock/cmd/chage-l-root +0 -7
  140. data/test/unit/mock/cmd/dpkg-s-curl +0 -21
  141. data/test/unit/mock/cmd/dscl +0 -5
  142. data/test/unit/mock/cmd/env +0 -1
  143. data/test/unit/mock/cmd/etc-apt +0 -7
  144. data/test/unit/mock/cmd/find-apache2-conf-enabled +0 -1
  145. data/test/unit/mock/cmd/find-apache2-ports-conf +0 -1
  146. data/test/unit/mock/cmd/find-etc-rc-d-name-S +0 -12
  147. data/test/unit/mock/cmd/find-net-interface +0 -9
  148. data/test/unit/mock/cmd/find-xinetd.d +0 -2
  149. data/test/unit/mock/cmd/gem-list-local-a-q-rubocop +0 -1
  150. data/test/unit/mock/cmd/get-net-tcpconnection +0 -24
  151. data/test/unit/mock/cmd/get-netadapter-binding-bridge +0 -4
  152. data/test/unit/mock/cmd/get-package-firefox +0 -30
  153. data/test/unit/mock/cmd/get-package-ruby +0 -18
  154. data/test/unit/mock/cmd/get-service-dhcp +0 -10
  155. data/test/unit/mock/cmd/get-windows-feature +0 -7
  156. data/test/unit/mock/cmd/get-wmiobject +0 -9
  157. data/test/unit/mock/cmd/getent-hosts-example.com +0 -1
  158. data/test/unit/mock/cmd/getent-passwd-jfolmer +0 -1
  159. data/test/unit/mock/cmd/getent-passwd-root +0 -1
  160. data/test/unit/mock/cmd/hpux-netstat-inet +0 -10
  161. data/test/unit/mock/cmd/hpux-netstat-inet6 +0 -11
  162. data/test/unit/mock/cmd/id-chartmann +0 -1
  163. data/test/unit/mock/cmd/id-jfolmer +0 -1
  164. data/test/unit/mock/cmd/id-root +0 -1
  165. data/test/unit/mock/cmd/initctl--version +0 -5
  166. data/test/unit/mock/cmd/initctl-show-config-ssh +0 -3
  167. data/test/unit/mock/cmd/initctl-status-ssh +0 -1
  168. data/test/unit/mock/cmd/iptables-s +0 -6
  169. data/test/unit/mock/cmd/launchctl-list +0 -3
  170. data/test/unit/mock/cmd/logins-x +0 -4
  171. data/test/unit/mock/cmd/ls-1-etc-init.d +0 -2
  172. data/test/unit/mock/cmd/ls-sys-class-net-br +0 -2
  173. data/test/unit/mock/cmd/lsmod +0 -2
  174. data/test/unit/mock/cmd/lsof-nP-i-FpctPn +0 -63
  175. data/test/unit/mock/cmd/mount +0 -1
  176. data/test/unit/mock/cmd/mount-multiple +0 -2
  177. data/test/unit/mock/cmd/netstat-an.utf8 +0 -13
  178. data/test/unit/mock/cmd/netstat-tulpen +0 -6
  179. data/test/unit/mock/cmd/npm-ls-g--json-bower +0 -9
  180. data/test/unit/mock/cmd/pacman-qi-curl +0 -21
  181. data/test/unit/mock/cmd/ping-example.com +0 -6
  182. data/test/unit/mock/cmd/pip-show-jinja2 +0 -11
  183. data/test/unit/mock/cmd/pkg-info-system-file-system-zfs +0 -8
  184. data/test/unit/mock/cmd/pkginfo-l-SUNWzfsr +0 -7
  185. data/test/unit/mock/cmd/ps-aux +0 -5
  186. data/test/unit/mock/cmd/ps-auxZ +0 -3
  187. data/test/unit/mock/cmd/pw-usershow-root-7 +0 -1
  188. data/test/unit/mock/cmd/reg_schedule +0 -6
  189. data/test/unit/mock/cmd/rpm-qia-curl +0 -24
  190. data/test/unit/mock/cmd/s11-netstat-an-finet-finet6 +0 -32
  191. data/test/unit/mock/cmd/sbin_sysctl +0 -1
  192. data/test/unit/mock/cmd/secedit-export +0 -7
  193. data/test/unit/mock/cmd/service-e +0 -2
  194. data/test/unit/mock/cmd/service-sendmail-onestatus +0 -3
  195. data/test/unit/mock/cmd/service-sshd-status +0 -1
  196. data/test/unit/mock/cmd/sockstat +0 -5
  197. data/test/unit/mock/cmd/success +0 -0
  198. data/test/unit/mock/cmd/swlist-l-product +0 -1
  199. data/test/unit/mock/cmd/systemctl-show-all-dbus +0 -6
  200. data/test/unit/mock/cmd/systemctl-show-all-sshd +0 -7
  201. data/test/unit/mock/cmd/win32_product +0 -8
  202. data/test/unit/mock/cmd/yum-repolist-all +0 -52
  203. data/test/unit/mock/files/apache2.conf +0 -14
  204. data/test/unit/mock/files/auditd.conf +0 -4
  205. data/test/unit/mock/files/bond0 +0 -37
  206. data/test/unit/mock/files/etcgroup +0 -3
  207. data/test/unit/mock/files/example.csv +0 -6
  208. data/test/unit/mock/files/grub.conf +0 -21
  209. data/test/unit/mock/files/inetd.conf +0 -2
  210. data/test/unit/mock/files/kitchen.yml +0 -7
  211. data/test/unit/mock/files/limits.conf +0 -5
  212. data/test/unit/mock/files/login.defs +0 -5
  213. data/test/unit/mock/files/mysql.conf +0 -8
  214. data/test/unit/mock/files/mysql2.conf +0 -2
  215. data/test/unit/mock/files/ntp.conf +0 -5
  216. data/test/unit/mock/files/passwd +0 -2
  217. data/test/unit/mock/files/policyfile.lock.json +0 -12
  218. data/test/unit/mock/files/ports.conf +0 -6
  219. data/test/unit/mock/files/rootwrap.conf +0 -7
  220. data/test/unit/mock/files/serve-cgi-bin.conf +0 -20
  221. data/test/unit/mock/files/shadow +0 -2
  222. data/test/unit/mock/files/ssh_config +0 -5
  223. data/test/unit/mock/files/sshd_config +0 -7
  224. data/test/unit/mock/files/sysctl.conf +0 -7
  225. data/test/unit/mock/files/xinetd.conf +0 -9
  226. data/test/unit/mock/files/xinetd.d/.gitkeep +0 -0
  227. data/test/unit/mock/files/xinetd.d_chargen-dgram +0 -9
  228. data/test/unit/mock/files/xinetd.d_chargen-stream +0 -9
  229. data/test/unit/mock/profiles/complete-metadata/inspec.yml +0 -7
  230. data/test/unit/mock/profiles/complete-profile/controls/filesystem_spec.rb +0 -16
  231. data/test/unit/mock/profiles/complete-profile/inspec.yml +0 -10
  232. data/test/unit/mock/profiles/complete-profile/libraries/testlib.rb +0 -1
  233. data/test/unit/mock/profiles/empty-metadata/inspec.yml +0 -0
  234. data/test/unit/mock/profiles/legacy-complete-metadata/metadata.rb +0 -7
  235. data/test/unit/mock/profiles/legacy-complete-metadata/test/.gitkeep +0 -0
  236. data/test/unit/mock/profiles/legacy-empty-metadata/controls/.gitkeep +0 -0
  237. data/test/unit/mock/profiles/legacy-empty-metadata/metadata.rb +0 -0
  238. data/test/unit/mock/profiles/legacy-simple-metadata/metadata.rb +0 -1
  239. data/test/unit/mock/profiles/legacy-simple-metadata/test/.gitkeep +0 -0
  240. data/test/unit/mock/profiles/library/controls/filesystem_spec.rb +0 -7
  241. data/test/unit/mock/profiles/library/inspec.yml +0 -10
  242. data/test/unit/mock/profiles/library/libraries/gordonlib.rb +0 -2
  243. data/test/unit/mock/profiles/library/libraries/testlib.rb +0 -12
  244. data/test/unit/mock/profiles/resource-tiny/inspec.yml +0 -10
  245. data/test/unit/mock/profiles/resource-tiny/libraries/resource.rb +0 -3
  246. data/test/unit/mock/profiles/simple-metadata/inspec.yml +0 -1
  247. data/test/unit/mock/profiles/skippy-profile-os/controls/one.rb +0 -3
  248. data/test/unit/mock/profiles/skippy-profile-os/inspec.yml +0 -5
  249. data/test/unit/mock/profiles/spec_only/specfile.rb +0 -11
  250. data/test/unit/mock/profiles/supported_inspec/inspec.yml +0 -2
  251. data/test/unit/mock/profiles/unsupported_inspec/inspec.yml +0 -2
  252. data/test/unit/objects_test.rb +0 -65
  253. data/test/unit/plugin_test.rb +0 -44
  254. data/test/unit/plugins/resource_test.rb +0 -60
  255. data/test/unit/profile_context_test.rb +0 -345
  256. data/test/unit/profile_test.rb +0 -252
  257. data/test/unit/resources/apache_conf_test.rb +0 -31
  258. data/test/unit/resources/apt_test.rb +0 -46
  259. data/test/unit/resources/audit_policy_test.rb +0 -13
  260. data/test/unit/resources/auditd_conf_test.rb +0 -15
  261. data/test/unit/resources/auditd_rules_test.rb +0 -91
  262. data/test/unit/resources/bash_test.rb +0 -29
  263. data/test/unit/resources/bond_test.rb +0 -24
  264. data/test/unit/resources/bridge_test.rb +0 -56
  265. data/test/unit/resources/csv_test.rb +0 -35
  266. data/test/unit/resources/etc_group_test.rb +0 -37
  267. data/test/unit/resources/file_test.rb +0 -202
  268. data/test/unit/resources/gem_test.rb +0 -20
  269. data/test/unit/resources/group_test.rb +0 -96
  270. data/test/unit/resources/grub_conf_test.rb +0 -29
  271. data/test/unit/resources/host_test.rb +0 -38
  272. data/test/unit/resources/inetd_conf_test.rb +0 -15
  273. data/test/unit/resources/ini_test.rb +0 -16
  274. data/test/unit/resources/interface_test.rb +0 -54
  275. data/test/unit/resources/iptables_test.rb +0 -35
  276. data/test/unit/resources/json_test.rb +0 -36
  277. data/test/unit/resources/kernel_module_test.rb +0 -23
  278. data/test/unit/resources/kernel_parameter_test.rb +0 -13
  279. data/test/unit/resources/limits_conf_test.rb +0 -14
  280. data/test/unit/resources/login_def_test.rb +0 -16
  281. data/test/unit/resources/mount_test.rb +0 -26
  282. data/test/unit/resources/mysql_conf_test.rb +0 -14
  283. data/test/unit/resources/npm_test.rb +0 -20
  284. data/test/unit/resources/ntp_conf_test.rb +0 -16
  285. data/test/unit/resources/oneget_test.rb +0 -45
  286. data/test/unit/resources/os_env_test.rb +0 -18
  287. data/test/unit/resources/os_test.rb +0 -40
  288. data/test/unit/resources/package_test.rb +0 -87
  289. data/test/unit/resources/parse_config_test.rb +0 -26
  290. data/test/unit/resources/passwd_test.rb +0 -111
  291. data/test/unit/resources/pip_test.rb +0 -15
  292. data/test/unit/resources/port_test.rb +0 -165
  293. data/test/unit/resources/powershell_test.rb +0 -32
  294. data/test/unit/resources/processes_test.rb +0 -72
  295. data/test/unit/resources/registry_key_test.rb +0 -18
  296. data/test/unit/resources/security_policy_test.rb +0 -16
  297. data/test/unit/resources/service_test.rb +0 -305
  298. data/test/unit/resources/shadow_test.rb +0 -67
  299. data/test/unit/resources/ssh_conf_test.rb +0 -33
  300. data/test/unit/resources/user_test.rb +0 -124
  301. data/test/unit/resources/vbscript_test.rb +0 -18
  302. data/test/unit/resources/windows_feature.rb +0 -17
  303. data/test/unit/resources/wmi_test.rb +0 -42
  304. data/test/unit/resources/xinetd_test.rb +0 -60
  305. data/test/unit/resources/yaml_test.rb +0 -34
  306. data/test/unit/resources/yum_test.rb +0 -68
  307. data/test/unit/shell_detector_test.rb +0 -78
  308. data/test/unit/source_reader_test.rb +0 -17
  309. data/test/unit/source_readers/flat_test.rb +0 -61
  310. data/test/unit/source_readers/inspec_test.rb +0 -38
  311. data/test/unit/utils/filter_array_test.rb +0 -59
  312. data/test/unit/utils/filter_table_test.rb +0 -177
  313. data/test/unit/utils/find_files_test.rb +0 -23
  314. data/test/unit/utils/passwd_parser_test.rb +0 -32
  315. data/test/unit/utils/simpleconfig_test.rb +0 -80
  316. data/test/unit/utils/solaris_netstat_parser.rb +0 -124
@@ -1,103 +0,0 @@
1
- # encoding: utf-8
2
- # author: Dominik Richter
3
- # author: Christoph Hartmann
4
-
5
- require 'functional/helper'
6
-
7
- describe 'inspec json' do
8
- include FunctionalHelper
9
-
10
- it 'read the profile json' do
11
- out = inspec('json ' + example_profile)
12
- out.stderr.must_equal ''
13
- out.exit_status.must_equal 0
14
- s = out.stdout
15
- JSON.load(s).must_be_kind_of Hash
16
- end
17
-
18
- describe 'json profile data' do
19
- let(:json) { JSON.load(inspec('json ' + example_profile).stdout) }
20
-
21
- it 'has a name' do
22
- json['name'].must_equal 'profile'
23
- end
24
-
25
- it 'has a title' do
26
- json['title'].must_equal 'InSpec Example Profile'
27
- end
28
-
29
- it 'has a summary' do
30
- json['summary'].must_equal 'Demonstrates the use of InSpec Compliance Profile'
31
- end
32
-
33
- it 'has a version' do
34
- json['version'].must_equal '1.0.0'
35
- end
36
-
37
- it 'has a maintainer' do
38
- json['maintainer'].must_equal 'Chef Software, Inc.'
39
- end
40
-
41
- it 'has a copyright' do
42
- json['copyright'].must_equal 'Chef Software, Inc.'
43
- end
44
-
45
- it 'has controls' do
46
- json['controls'].length.must_equal 4
47
- end
48
-
49
- describe 'a control' do
50
- let(:control) { json['controls']['tmp-1.0'] }
51
-
52
- it 'has a title' do
53
- control['title'].must_equal 'Create /tmp directory'
54
- end
55
-
56
- it 'has a description' do
57
- control['desc'].must_equal 'An optional description...'
58
- end
59
-
60
- it 'has an impact' do
61
- control['impact'].must_equal 0.7
62
- end
63
-
64
- it 'has a ref' do
65
- control['refs'].must_equal([{'ref' => 'Document A-12', 'url' => 'http://...'}])
66
- end
67
-
68
- it 'has a source location' do
69
- loc = File.join(example_profile, '/controls/example.rb')
70
- control['source_location']['ref'].must_equal loc
71
- control['source_location']['line'].must_equal 8
72
- end
73
-
74
- it 'has a the source code' do
75
- control['code'].must_match /\Acontrol \"tmp-1.0\" do.*end\n\Z/m
76
- end
77
- end
78
- end
79
-
80
- describe 'filter with --controls' do
81
- let(:out) { inspec('json ' + example_profile + ' --controls tmp-1.0') }
82
-
83
- it 'still succeeds' do
84
- out.stderr.must_equal ''
85
- out.exit_status.must_equal 0
86
- end
87
-
88
- it 'only has one control included' do
89
- json = JSON.load(out.stdout)
90
- json['controls'].keys.must_equal %w{tmp-1.0}
91
- json['groups'].keys.must_equal %w{controls/example.rb}
92
- end
93
- end
94
-
95
- it 'writes json to file' do
96
- out = inspec('json ' + example_profile + ' --output ' + dst.path)
97
- out.stderr.must_equal ''
98
- out.exit_status.must_equal 0
99
- hm = JSON.load(File.read(dst.path))
100
- hm['name'].must_equal 'profile'
101
- hm['controls'].length.must_equal 4
102
- end
103
- end
@@ -1,91 +0,0 @@
1
- # encoding: utf-8
2
- # author: Dominik Richter
3
- # author: Christoph Hartmann
4
-
5
- require 'functional/helper'
6
-
7
- describe 'command tests' do
8
- include FunctionalHelper
9
-
10
- describe 'detect with json' do
11
- it 'runs well on all nodes' do
12
- out = inspec('detect --format json')
13
- out.stderr.must_equal ''
14
- out.exit_status.must_equal 0
15
- j = JSON.load(out.stdout)
16
- j.keys.must_include 'name'
17
- j.keys.must_include 'family'
18
- j.keys.must_include 'arch'
19
- j.keys.must_include 'release'
20
- end
21
- end
22
-
23
- describe 'detect without json' do
24
- it 'runs well on all nodes' do
25
- out = inspec('detect')
26
- out.stderr.must_equal ''
27
- out.exit_status.must_equal 0
28
- std = out.stdout
29
- std.must_include "\n== Operating System Details\n\n"
30
- std.must_include "\nName: \e[0;36m"
31
- std.must_include "\nFamily: \e[0;36m"
32
- std.must_include "\nArch: \e[0;36m"
33
- std.must_include "\nRelease: \e[0;36m"
34
- end
35
- end
36
-
37
- describe 'cmd' do
38
- it 'can run arbitrary ruby' do
39
- x = rand
40
- y = rand
41
- out = inspec("shell -c '#{x} + #{y}'")
42
- out.stderr.must_equal ''
43
- out.exit_status.must_equal 0
44
- j = JSON.load(out.stdout)
45
- j.must_equal x+y
46
- end
47
-
48
- it 'retrieves resources in JSON' do
49
- out = inspec("shell -c 'os.params'")
50
- out.stderr.must_equal ''
51
- out.exit_status.must_equal 0
52
- j = JSON.load(out.stdout)
53
- j.keys.must_include 'name'
54
- j.keys.must_include 'family'
55
- j.keys.must_include 'arch'
56
- j.keys.must_include 'release'
57
- end
58
- end
59
-
60
- describe 'version' do
61
- it 'provides the version number on stdout' do
62
- out = inspec('version')
63
- out.stderr.must_equal ''
64
- out.exit_status.must_equal 0
65
- out.stdout.must_equal Inspec::VERSION+"\n"
66
- end
67
- end
68
-
69
- describe 'shell' do
70
- it 'provides a help command' do
71
- out = CMD.run_command("echo \"help\nexit\" | #{exec_inspec} shell")
72
- out.exit_status.must_equal 0
73
- out.stdout.must_include 'Available commands:'
74
- out.stdout.must_include 'You are currently running on:'
75
- end
76
-
77
- it 'exposes all resources' do
78
- out = CMD.run_command("echo \"os\nexit\" | #{exec_inspec} shell")
79
- out.exit_status.must_equal 0
80
- out.stdout.must_match /^=> .*Operating.* .*System.* .*Detection.*$/
81
- end
82
- end
83
-
84
- describe 'check' do
85
- it 'verifies that a profile is ok' do
86
- out = inspec('check ' + example_profile)
87
- out.stdout.must_match /Valid.*true/
88
- out.exit_status.must_equal 0
89
- end
90
- end
91
- end
data/test/helper.rb DELETED
@@ -1,329 +0,0 @@
1
- # encoding: utf-8
2
- # author: Dominik Richter
3
- # author: Christoph Hartmann
4
-
5
- require 'minitest/autorun'
6
- require 'minitest/spec'
7
- require 'mocha/setup'
8
-
9
- require 'simplecov'
10
- SimpleCov.start do
11
- add_filter '/test/'
12
- add_group 'Resources', 'lib/resources'
13
- add_group 'Matchers', 'lib/matchers'
14
- add_group 'Backends', 'lib/inspec/backend'
15
- end
16
-
17
- require 'fileutils'
18
- require 'pathname'
19
- require 'tempfile'
20
- require 'tmpdir'
21
- require 'zip'
22
-
23
- require 'inspec/base_cli'
24
- require 'inspec/version'
25
- require 'inspec/fetcher'
26
- require 'inspec/source_reader'
27
- require 'inspec/resource'
28
- require 'inspec/backend'
29
- require 'inspec/profile'
30
- require 'inspec/runner'
31
- require 'inspec/runner_mock'
32
- require 'fetchers/mock'
33
-
34
- require 'train'
35
- CMD = Train.create('local').connection
36
- TMP_CACHE = {}
37
-
38
- class MockLoader
39
- # collects emulation operating systems
40
- OPERATING_SYSTEMS = {
41
- arch: { name: 'arch', family: 'arch', release: nil, arch: nil },
42
- centos5: { name: 'centos', family: 'redhat', release: '5.11', arch: 'x86_64' },
43
- centos6: { name: 'centos', family: 'redhat', release: '6.6', arch: 'x86_64' },
44
- centos7: { name: 'centos', family: 'redhat', release: '7.1.1503', arch: 'x86_64' },
45
- debian6: { name: 'debian', family: 'debian', release: '6', arch: 'x86_64' },
46
- debian7: { name: 'debian', family: 'debian', release: '7', arch: 'x86_64' },
47
- debian8: { name: 'debian', family: 'debian', release: '8', arch: 'x86_64' },
48
- freebsd9: { name: 'freebsd', family: 'freebsd', release: '9', arch: 'amd64' },
49
- freebsd10: { name: 'freebsd', family: 'freebsd', release: '10', arch: 'amd64' },
50
- osx104: { name: 'mac_os_x',family: 'darwin', release: '10.10.4', arch: nil },
51
- ubuntu1204: { name: 'ubuntu', family: 'debian', release: '12.04', arch: 'x86_64' },
52
- ubuntu1404: { name: 'ubuntu', family: 'debian', release: '14.04', arch: 'x86_64' },
53
- ubuntu1504: { name: 'ubuntu', family: 'debian', release: '15.04', arch: 'x86_64' },
54
- windows: { name: 'windows', family: 'windows', release: '6.2.9200', arch: 'x86_64' },
55
- wrlinux: { name: 'wrlinux', family: 'redhat', release: '7.0(3)I2(2)', arch: 'x86_64' },
56
- solaris11: { name: "solaris", family: 'solaris', release: '11', arch: 'i386'},
57
- solaris10: { name: "solaris", family: 'solaris', release: '10', arch: 'i386'},
58
- hpux: { name: 'hpux', family: 'hpux', release: 'B.11.31', arch: 'ia64'},
59
- undefined: { name: nil, family: nil, release: nil, arch: nil },
60
- }
61
-
62
- # pass the os identifier to emulate a specific operating system
63
- def initialize(os = nil)
64
- # selects operating system
65
- @os = OPERATING_SYSTEMS[os || :ubuntu1404]
66
- end
67
-
68
- def backend
69
- return @backend if defined?(@backend)
70
- scriptpath = ::File.realpath(::File.dirname(__FILE__))
71
-
72
- # create mock backend
73
- @backend = Inspec::Backend.create({ backend: :mock })
74
- mock = @backend.backend
75
-
76
- # set os emulation
77
- mock.mock_os(@os)
78
-
79
- # create all mock files
80
- local = Train.create('local').connection
81
- mockfile = lambda { |x|
82
- path = ::File.join(scriptpath, '/unit/mock/files', x)
83
- local.file(path)
84
- }
85
- mockdir = lambda { |x|
86
- md = Object.new
87
-
88
- class << md
89
- attr_accessor :isdir
90
- end
91
- md.isdir = x
92
-
93
- def md.directory?
94
- isdir
95
- end
96
- md
97
- }
98
-
99
- mock.files = {
100
- '/proc/net/bonding/bond0' => mockfile.call('bond0'),
101
- '/etc/ssh/ssh_config' => mockfile.call('ssh_config'),
102
- '/etc/ssh/sshd_config' => mockfile.call('sshd_config'),
103
- '/etc/passwd' => mockfile.call('passwd'),
104
- '/etc/shadow' => mockfile.call('shadow'),
105
- '/etc/ntp.conf' => mockfile.call('ntp.conf'),
106
- '/etc/login.defs' => mockfile.call('login.defs'),
107
- '/etc/security/limits.conf' => mockfile.call('limits.conf'),
108
- '/etc/inetd.conf' => mockfile.call('inetd.conf'),
109
- '/etc/group' => mockfile.call('etcgroup'),
110
- '/etc/grub.conf' => mockfile.call('grub.conf'),
111
- '/etc/audit/auditd.conf' => mockfile.call('auditd.conf'),
112
- '/etc/mysql/my.cnf' => mockfile.call('mysql.conf'),
113
- '/etc/mysql/mysql2.conf' => mockfile.call('mysql2.conf'),
114
- 'kitchen.yml' => mockfile.call('kitchen.yml'),
115
- 'example.csv' => mockfile.call('example.csv'),
116
- 'policyfile.lock.json' => mockfile.call('policyfile.lock.json'),
117
- '/sys/class/net/br0/bridge' => mockdir.call(true),
118
- 'rootwrap.conf' => mockfile.call('rootwrap.conf'),
119
- '/etc/apache2/apache2.conf' => mockfile.call('apache2.conf'),
120
- '/etc/apache2/ports.conf' => mockfile.call('ports.conf'),
121
- '/etc/apache2/conf-enabled/serve-cgi-bin.conf' => mockfile.call('serve-cgi-bin.conf'),
122
- '/etc/xinetd.conf' => mockfile.call('xinetd.conf'),
123
- '/etc/xinetd.d' => mockfile.call('xinetd.d'),
124
- '/etc/xinetd.d/chargen-stream' => mockfile.call('xinetd.d_chargen-stream'),
125
- '/etc/xinetd.d/chargen-dgram' => mockfile.call('xinetd.d_chargen-dgram'),
126
- '/etc/sysctl.conf' => mockfile.call('sysctl.conf'),
127
- }
128
-
129
- # create all mock commands
130
- cmd = lambda {|x|
131
- stdout = ::File.read(::File.join(scriptpath, '/unit/mock/cmd/'+x))
132
- mock.mock_command('', stdout, '', 0)
133
- }
134
-
135
- empty = lambda {
136
- mock.mock_command('', '', '', 0)
137
- }
138
-
139
- mock.commands = {
140
- 'ps aux' => cmd.call('ps-aux'),
141
- 'ps auxZ' => cmd.call('ps-auxZ'),
142
- 'Get-Content win_secpol.cfg' => cmd.call('secedit-export'),
143
- 'secedit /export /cfg win_secpol.cfg' => cmd.call('success'),
144
- 'Remove-Item win_secpol.cfg' => cmd.call('success'),
145
- 'env' => cmd.call('env'),
146
- '${Env:PATH}' => cmd.call('$env-PATH'),
147
- # registry key test (winrm 1.6.0, 1.6.1)
148
- 'dd429dd12596fa193ba4111469b4417ecbd78a1d7ba4317c334c9111644bae44' => cmd.call('reg_schedule'),
149
- 'Fdd429dd12596fa193ba4111469b4417ecbd78a1d7ba4317c334c9111644bae44' => cmd.call('reg_schedule'),
150
- 'Auditpol /get /subcategory:\'User Account Management\' /r' => cmd.call('auditpol'),
151
- '/sbin/auditctl -l' => cmd.call('auditctl'),
152
- '/sbin/auditctl -s' => cmd.call('auditctl-s'),
153
- 'yum -v repolist all' => cmd.call('yum-repolist-all'),
154
- 'dpkg -s curl' => cmd.call('dpkg-s-curl'),
155
- 'rpm -qia curl' => cmd.call('rpm-qia-curl'),
156
- 'pacman -Qi curl' => cmd.call('pacman-qi-curl'),
157
- 'gem list --local -a -q ^rubocop$' => cmd.call('gem-list-local-a-q-rubocop'),
158
- 'npm ls -g --json bower' => cmd.call('npm-ls-g--json-bower'),
159
- 'pip show jinja2' => cmd.call('pip-show-jinja2'),
160
- "Get-Package -Name 'Mozilla Firefox' | ConvertTo-Json" => cmd.call('get-package-firefox'),
161
- "Get-Package -Name 'Ruby 2.1.6-p336-x64' | ConvertTo-Json" => cmd.call('get-package-ruby'),
162
- "New-Object -Type PSObject | Add-Member -MemberType NoteProperty -Name Service -Value (Get-Service -Name dhcp| Select-Object -Property Name, DisplayName, Status) -PassThru | Add-Member -MemberType NoteProperty -Name WMI -Value (Get-WmiObject -Class Win32_Service | Where-Object {$_.Name -eq 'dhcp' -or $_.DisplayName -eq 'dhcp'} | Select-Object -Property StartMode) -PassThru | ConvertTo-Json" => cmd.call('get-service-dhcp'),
163
- "Get-WindowsFeature | Where-Object {$_.Name -eq 'dhcp' -or $_.DisplayName -eq 'dhcp'} | Select-Object -Property Name,DisplayName,Description,Installed,InstallState | ConvertTo-Json" => cmd.call('get-windows-feature'),
164
- 'lsmod' => cmd.call('lsmod'),
165
- '/sbin/sysctl -q -n net.ipv4.conf.all.forwarding' => cmd.call('sbin_sysctl'),
166
- # ports on windows
167
- 'Get-NetTCPConnection | Select-Object -Property State, Caption, Description, LocalAddress, LocalPort, RemoteAddress, RemotePort, DisplayName, Status | ConvertTo-Json' => cmd.call('get-net-tcpconnection'),
168
- 'netstat -an' => cmd.call('netstat-an.utf8'),
169
- # lsof formatted list of ports (should be quite cross platform)
170
- 'lsof -nP -i -FpctPn' => cmd.call('lsof-nP-i-FpctPn'),
171
- # ports on linux
172
- 'netstat -tulpen' => cmd.call('netstat-tulpen'),
173
- # ports on freebsd
174
- 'sockstat -46l' => cmd.call('sockstat'),
175
- # packages on windows
176
- "Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq 'Microsoft Visual C++ 2008 Redistributable - x64 9.0.30729.6161'} | Select-Object -Property Name,Version,Vendor,PackageCode,Caption,Description | ConvertTo-Json" => cmd.call('win32_product'),
177
- # service status upstart on ubuntu
178
- 'initctl status ssh' => cmd.call('initctl-status-ssh'),
179
- # service config for upstart on ubuntu
180
- 'initctl show-config ssh' => cmd.call('initctl-show-config-ssh'),
181
- # upstart version on ubuntu
182
- 'initctl --version' => cmd.call('initctl--version'),
183
- # show ssh service Centos 7
184
- 'systemctl show --all sshd' => cmd.call('systemctl-show-all-sshd'),
185
- '/path/to/systemctl show --all sshd' => cmd.call('systemctl-show-all-sshd'),
186
- 'systemctl show --all dbus' => cmd.call('systemctl-show-all-dbus'),
187
- '/path/to/systemctl show --all dbus' => cmd.call('systemctl-show-all-dbus'),
188
- # services on macos
189
- 'launchctl list' => cmd.call('launchctl-list'),
190
- # services on freebsd 10
191
- 'service -e' => cmd.call('service-e'),
192
- 'service sendmail onestatus' => cmd.call('service-sendmail-onestatus'),
193
- # services for system 5 e.g. centos6, debian 6
194
- 'service sshd status' => cmd.call('service-sshd-status'),
195
- 'find /etc/rc*.d -name S*' => cmd.call('find-etc-rc-d-name-S'),
196
- 'ls -1 /etc/init.d/' => cmd.call('ls-1-etc-init.d'),
197
- # user information for linux
198
- 'id root' => cmd.call('id-root'),
199
- 'getent passwd root' => cmd.call('getent-passwd-root'),
200
- 'chage -l root' => cmd.call('chage-l-root'),
201
- # user information for ldap test
202
- 'id jfolmer' => cmd.call('id-jfolmer'),
203
- 'getent passwd jfolmer' => cmd.call('getent-passwd-jfolmer'),
204
- 'chage -l jfolmer' => cmd.call('chage-l-root'),
205
- # user info for mac
206
- 'id chartmann' => cmd.call('id-chartmann'),
207
- 'dscl -q . -read /Users/chartmann NFSHomeDirectory PrimaryGroupID RecordName UniqueID UserShell' => cmd.call('dscl'),
208
- # user info for freebsd
209
- 'pw usershow root -7' => cmd.call('pw-usershow-root-7'),
210
- # user info for windows (winrm 1.6.0, 1.6.1)
211
- '650b6b72a66316418b25421a54afe21a230704558082914c54711904bb10e370' => cmd.call('GetUserAccount'),
212
- '174686f0441b8dd387b35cf1cbeed3f98441544351de5d8fb7b54f655e75583f' => cmd.call('GetUserAccount'),
213
- # group info for windows
214
- 'Get-WmiObject Win32_Group | Select-Object -Property Caption, Domain, Name, SID, LocalAccount | ConvertTo-Json' => cmd.call('GetWin32Group'),
215
- # network interface
216
- '9e80f048a1af5a0f6ab8a465e46ea5ed5ba6587e9b5e54a7a0c0a1a02bb6f663' => cmd.call('find-net-interface'),
217
- 'c33821dece09c8b334e03a5bb9daefdf622007f73af4932605e758506584ec3f' => empty.call,
218
- 'Get-NetAdapter | Select-Object -Property Name, InterfaceDescription, Status, State, MacAddress, LinkSpeed, ReceiveLinkSpeed, TransmitLinkSpeed, Virtual | ConvertTo-Json' => cmd.call('Get-NetAdapter'),
219
- # bridge on linux
220
- 'ls -1 /sys/class/net/br0/brif/' => cmd.call('ls-sys-class-net-br'),
221
- # bridge on Windows
222
- 'Get-NetAdapterBinding -ComponentID ms_bridge | Get-NetAdapter | Select-Object -Property Name, InterfaceDescription | ConvertTo-Json' => cmd.call('get-netadapter-binding-bridge'),
223
- # host for Windows
224
- 'Resolve-DnsName –Type A microsoft.com | ConvertTo-Json' => cmd.call('Resolve-DnsName'),
225
- 'Test-NetConnection -ComputerName microsoft.com | Select-Object -Property ComputerName, PingSucceeded | ConvertTo-Json' => cmd.call('Test-NetConnection'),
226
- # host for Linux
227
- 'getent hosts example.com' => cmd.call('getent-hosts-example.com'),
228
- 'ping -w 1 -c 1 example.com' => cmd.call('ping-example.com'),
229
- # apt
230
- "find /etc/apt/ -name *.list -exec sh -c 'cat {} || echo -n' \\;" => cmd.call('etc-apt'),
231
- # iptables
232
- 'iptables -S' => cmd.call('iptables-s'),
233
- # apache_conf
234
- 'find /etc/apache2/ports.conf -maxdepth 1 -type f' => cmd.call('find-apache2-ports-conf'),
235
- 'find /etc/apache2/conf-enabled/*.conf -maxdepth 1 -type f' => cmd.call('find-apache2-conf-enabled'),
236
- # mount
237
- "mount | grep -- ' on /'" => cmd.call("mount"),
238
- "mount | grep -- ' on /mnt/iso-disk'" => cmd.call("mount-multiple"),
239
- # solaris 10 package manager
240
- 'pkginfo -l SUNWzfsr' => cmd.call('pkginfo-l-SUNWzfsr'),
241
- # solaris 11 package manager
242
- 'pkg info system/file-system/zfs' => cmd.call('pkg-info-system-file-system-zfs'),
243
- # port netstat on solaris 10 & 11
244
- 'netstat -an -f inet -f inet6' => cmd.call('s11-netstat-an-finet-finet6'),
245
- # xinetd configuration
246
- 'find /etc/xinetd.d -type f' => cmd.call('find-xinetd.d'),
247
- # wmi test
248
- "4762fab9e8180997634ae70aae6d5f59e641084111fb9f5e5bf2848a583aa5f5" => cmd.call('get-wmiobject'),
249
- #user info on hpux
250
- "logins -x -l root" => cmd.call('logins-x'),
251
- #packages on hpux
252
- "swlist -l product | grep vim" => cmd.call('swlist-l-product'),
253
- # ipv4 ports on hpux
254
- 'netstat -an -f inet' => cmd.call('hpux-netstat-inet'),
255
- #ipv6 ports on hpux
256
- 'netstat -an -f inet6' => cmd.call('hpux-netstat-inet6'),
257
- }
258
-
259
- @backend
260
- end
261
-
262
- # loads a resource class and instantiates the class with the given arguments
263
- def load_resource(resource, *args)
264
- # initialize resource with backend and parameters
265
- @resource_class = Inspec::Resource.registry[resource]
266
- @resource = @resource_class.new(backend, resource, *args)
267
- end
268
-
269
- def self.mock_os(resource, name)
270
- osinfo = OPERATING_SYSTEMS[name] ||
271
- fail("Can't find operating system to mock: #{name}")
272
- resource.inspec.backend.mock_os(osinfo)
273
- end
274
-
275
- def self.mock_command(resource, cmd, res = {})
276
- resource.inspec.backend
277
- .mock_command(cmd, res[:stdout], res[:stderr], res[:exit_status])
278
- end
279
-
280
- def self.home
281
- File.join(File.dirname(__FILE__), 'unit')
282
- end
283
-
284
- def self.profile_path(name)
285
- dst = name
286
- dst = "#{home}/mock/profiles/#{name}" unless name.start_with?(home)
287
- dst
288
- end
289
-
290
- def self.load_profile(name, opts = {})
291
- opts[:test_collector] = Inspec::RunnerMock.new
292
- Inspec::Profile.for_target(profile_path(name), opts)
293
- end
294
-
295
- def self.profile_tgz(name)
296
- path = File.join(home, 'mock', 'profiles', name)
297
- dst = File.join(Dir.tmpdir, Dir::Tmpname.make_tmpname(name, '.tar.gz'))
298
-
299
- # generate relative paths
300
- files = Dir.glob("#{path}/**/*")
301
- relatives = files.map { |e| Pathname.new(e).relative_path_from(Pathname.new(path)).to_s }
302
-
303
- require 'inspec/archive/tar'
304
- tag = Inspec::Archive::TarArchiveGenerator.new
305
- tag.archive(path, relatives, dst)
306
-
307
- dst
308
- end
309
-
310
- def self.profile_zip(name, opts = {})
311
- path = File.join(home, 'mock', 'profiles', name)
312
- dst = File.join(Dir.tmpdir, Dir::Tmpname.make_tmpname(name, '.zip'))
313
-
314
- # rubyzip only works relative paths
315
- files = Dir.glob("#{path}/**/*")
316
- relatives = files.map { |e| Pathname.new(e).relative_path_from(Pathname.new(path)).to_s }
317
-
318
- require 'inspec/archive/zip'
319
- zag = Inspec::Archive::ZipArchiveGenerator.new
320
- zag.archive(path, relatives, dst)
321
-
322
- dst
323
- end
324
- end
325
-
326
- def load_resource(*args)
327
- m = MockLoader.new(:ubuntu1404)
328
- m.send('load_resource', *args)
329
- end
@@ -1,8 +0,0 @@
1
- puts "-----------------------------------"
2
- puts " TEST ENVIRONMENT "
3
- puts "-----------------------------------"
4
- puts " Docker: #{!ENV['DOCKER'].nil?}"
5
- puts " OS name: #{os[:name] || 'unknown' }"
6
- puts "OS release: #{os[:release] || 'unknown'}"
7
- puts " OS family: #{os[:family] || 'unknown'}"
8
- puts "-----------------------------------"
@@ -1,21 +0,0 @@
1
- # encoding: utf-8
2
- if ENV['DOCKER']
3
- STDERR.puts "\033[1;33mTODO: Not running #{__FILE__.split("/").last} because we are running in docker\033[0m"
4
- return
5
- end
6
-
7
- if !os.linux?
8
- STDERR.puts "\033[1;33mTODO: Not running #{__FILE__} because we are not on linux.\033[0m"
9
- return
10
- end
11
-
12
- # direct access to params of apache conf
13
- describe apache_conf do
14
- its('LogLevel') { should cmp 'warn' }
15
- its('MaxKeepAliveRequests') { should cmp 100 }
16
- end
17
-
18
- # only read one param
19
- describe apache_conf.params('LogLevel') do
20
- it { should include 'warn' }
21
- end
@@ -1,37 +0,0 @@
1
- # encoding: utf-8
2
-
3
- if os[:name] == 'ubuntu'
4
-
5
- describe apt('ppa:nginx/stable') do
6
- it { should exist }
7
- it { should be_enabled }
8
- end
9
-
10
- describe apt('nginx/stable') do
11
- it { should exist }
12
- it { should be_enabled }
13
- end
14
-
15
- describe apt('http://ppa.launchpad.net/nginx/stable/ubuntu') do
16
- it { should exist }
17
- it { should be_enabled }
18
- end
19
-
20
- describe apt('https://deb.nodesource.com/node_4.x/dists/precise/') do
21
- it { should_not exist }
22
- it { should_not be_enabled }
23
- end
24
-
25
- elsif os[:family] == 'debian'
26
-
27
- describe apt('http://nginx.org/packages/debian') do
28
- it { should exist }
29
- it { should be_enabled }
30
- end
31
-
32
- describe apt('https://deb.nodesource.com/node_4.x/dists/precise/') do
33
- it { should_not exist }
34
- it { should_not be_enabled }
35
- end
36
-
37
- end
@@ -1,32 +0,0 @@
1
- # encoding: utf-8
2
-
3
- # based on operating system we select the available service
4
- return unless os[:family] == 'centos'
5
-
6
- describe auditd_rules.syscall('open') do
7
- its('action') { should eq(['always']) }
8
- end
9
-
10
- describe auditd_rules.syscall('open').action do
11
- it { should eq(['always']) }
12
- end
13
-
14
- describe auditd_rules.key('sshd_config') do
15
- its('permissions') { should contain_match(/x/) }
16
- end
17
-
18
- describe auditd_rules.file('/etc/ssh/sshd_config').permissions do
19
- it { should eq(['rwxa']) }
20
- end
21
-
22
- describe auditd_rules do
23
- its('lines') { should contain_match(%r{-w /etc/ssh/sshd_config/}) }
24
- end
25
-
26
- describe auditd_rules.syscall('open').action('always').list do
27
- it { should eq(['exit']) }
28
- end
29
-
30
- describe auditd_rules.status('backlog') do
31
- it { should cmp 0 }
32
- end