inspec 1.0.0 → 1.35.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +933 -101
  3. data/Gemfile +8 -17
  4. data/MAINTAINERS.md +2 -1
  5. data/MAINTAINERS.toml +9 -4
  6. data/README.md +49 -28
  7. data/Rakefile +54 -39
  8. data/bin/inspec +1 -1
  9. data/docs/dsl_inspec.md +17 -4
  10. data/docs/dsl_resource.md +1 -1
  11. data/docs/habitat.md +192 -0
  12. data/docs/inspec_and_friends.md +4 -2
  13. data/docs/matchers.md +11 -0
  14. data/docs/migration.md +293 -0
  15. data/docs/profiles.md +124 -76
  16. data/docs/resources/aide_conf.md.erb +81 -0
  17. data/docs/resources/apache_conf.md.erb +10 -10
  18. data/docs/resources/apt.md.erb +13 -13
  19. data/docs/resources/audit_policy.md.erb +10 -10
  20. data/docs/resources/auditd_conf.md.erb +10 -10
  21. data/docs/resources/auditd_rules.md.erb +11 -11
  22. data/docs/resources/bash.md.erb +12 -12
  23. data/docs/resources/bond.md.erb +15 -15
  24. data/docs/resources/bridge.md.erb +11 -11
  25. data/docs/resources/bsd_service.md.erb +11 -11
  26. data/docs/resources/command.md.erb +23 -23
  27. data/docs/resources/crontab.md.erb +84 -0
  28. data/docs/resources/csv.md.erb +10 -10
  29. data/docs/resources/dh_params.md +191 -0
  30. data/docs/resources/directory.md.erb +8 -8
  31. data/docs/resources/docker.md.erb +160 -0
  32. data/docs/resources/docker_container.md.erb +89 -0
  33. data/docs/resources/docker_image.md.erb +86 -0
  34. data/docs/resources/etc_group.md.erb +16 -16
  35. data/docs/resources/etc_hosts.md.erb +62 -0
  36. data/docs/resources/file.md.erb +80 -58
  37. data/docs/resources/gem.md.erb +32 -13
  38. data/docs/resources/group.md.erb +12 -12
  39. data/docs/resources/grub_conf.md.erb +11 -11
  40. data/docs/resources/host.md.erb +27 -18
  41. data/docs/resources/http.md.erb +104 -0
  42. data/docs/resources/iis_app.md.erb +126 -0
  43. data/docs/resources/iis_site.md.erb +17 -17
  44. data/docs/resources/inetd_conf.md.erb +10 -10
  45. data/docs/resources/ini.md.erb +9 -9
  46. data/docs/resources/interface.md.erb +13 -13
  47. data/docs/resources/iptables.md.erb +21 -14
  48. data/docs/resources/json.md.erb +11 -11
  49. data/docs/resources/kernel_module.md.erb +73 -12
  50. data/docs/resources/kernel_parameter.md.erb +12 -12
  51. data/docs/resources/key_rsa.md.erb +70 -0
  52. data/docs/resources/launchd_service.md.erb +11 -11
  53. data/docs/resources/limits_conf.md.erb +10 -10
  54. data/docs/resources/login_def.md.erb +12 -12
  55. data/docs/resources/mount.md.erb +14 -14
  56. data/docs/resources/mssql_session.md.erb +62 -0
  57. data/docs/resources/mysql_conf.md.erb +14 -14
  58. data/docs/resources/mysql_session.md.erb +22 -10
  59. data/docs/resources/npm.md.erb +13 -13
  60. data/docs/resources/ntp_conf.md.erb +9 -9
  61. data/docs/resources/oneget.md.erb +11 -11
  62. data/docs/resources/oracledb_session.md.erb +53 -0
  63. data/docs/resources/os.md.erb +17 -17
  64. data/docs/resources/os_env.md.erb +12 -12
  65. data/docs/resources/package.md.erb +29 -16
  66. data/docs/resources/parse_config.md.erb +18 -18
  67. data/docs/resources/parse_config_file.md.erb +29 -23
  68. data/docs/resources/{etc_passwd.md.erb → passwd.md.erb} +17 -17
  69. data/docs/resources/pip.md.erb +15 -15
  70. data/docs/resources/port.md.erb +23 -23
  71. data/docs/resources/postgres_conf.md.erb +15 -13
  72. data/docs/resources/postgres_hba_conf.md.erb +104 -0
  73. data/docs/resources/postgres_ident_conf.md.erb +87 -0
  74. data/docs/resources/postgres_session.md.erb +28 -21
  75. data/docs/resources/powershell.md.erb +14 -14
  76. data/docs/resources/processes.md.erb +123 -0
  77. data/docs/resources/rabbitmq_config.md.erb +55 -0
  78. data/docs/resources/registry_key.md.erb +44 -21
  79. data/docs/resources/runit_service.md.erb +11 -11
  80. data/docs/resources/security_policy.md.erb +10 -10
  81. data/docs/resources/service.md.erb +18 -18
  82. data/docs/resources/{etc_shadow.md.erb → shadow.md.erb} +19 -19
  83. data/docs/resources/ssh_config.md.erb +13 -13
  84. data/docs/resources/sshd_config.md.erb +15 -15
  85. data/docs/resources/ssl.md.erb +13 -13
  86. data/docs/resources/sys_info.md.erb +10 -10
  87. data/docs/resources/systemd_service.md.erb +11 -11
  88. data/docs/resources/sysv_service.md.erb +11 -11
  89. data/docs/resources/upstart_service.md.erb +11 -11
  90. data/docs/resources/user.md.erb +20 -20
  91. data/docs/resources/users.md.erb +19 -19
  92. data/docs/resources/vbscript.md.erb +13 -13
  93. data/docs/resources/virtualization.md.erb +71 -0
  94. data/docs/resources/windows_feature.md.erb +10 -10
  95. data/docs/resources/windows_task.md.erb +103 -0
  96. data/docs/resources/wmi.md.erb +10 -10
  97. data/docs/resources/x509_certificate.md.erb +146 -0
  98. data/docs/resources/xinetd_conf.md.erb +17 -17
  99. data/docs/resources/xml.md.erb +75 -0
  100. data/docs/resources/yaml.md.erb +25 -11
  101. data/docs/resources/yum.md.erb +24 -16
  102. data/docs/resources/zfs_dataset.md.erb +63 -0
  103. data/docs/resources/zfs_pool.md.erb +57 -0
  104. data/docs/ruby_usage.md +50 -0
  105. data/docs/shared/matcher_cmp.md.erb +4 -6
  106. data/examples/inheritance/README.md +49 -3
  107. data/examples/inheritance/controls/example.rb +4 -1
  108. data/examples/inheritance/inspec.yml +3 -1
  109. data/examples/meta-profile/README.md +29 -3
  110. data/examples/meta-profile/controls/example.rb +10 -5
  111. data/examples/meta-profile/inspec.yml +4 -8
  112. data/examples/profile/README.md +1 -1
  113. data/examples/profile/controls/example.rb +0 -1
  114. data/examples/profile/controls/gordon.rb +0 -1
  115. data/examples/profile/inspec.yml +1 -1
  116. data/examples/profile-attribute/inspec.yml +1 -1
  117. data/examples/profile-sensitive/README.md +29 -0
  118. data/examples/profile-sensitive/controls/sensitive-failures.rb +9 -0
  119. data/examples/profile-sensitive/controls/sensitive.rb +9 -0
  120. data/examples/profile-sensitive/inspec.yml +8 -0
  121. data/inspec.gemspec +10 -2
  122. data/lib/bundles/inspec-artifact/README.md +1 -0
  123. data/lib/bundles/inspec-artifact/cli.rb +284 -0
  124. data/lib/bundles/inspec-artifact.rb +7 -0
  125. data/lib/bundles/inspec-compliance/README.md +44 -15
  126. data/lib/bundles/inspec-compliance/api.rb +135 -29
  127. data/lib/bundles/inspec-compliance/cli.rb +128 -21
  128. data/lib/bundles/inspec-compliance/configuration.rb +8 -0
  129. data/lib/bundles/inspec-compliance/http.rb +26 -19
  130. data/lib/bundles/inspec-compliance/target.rb +50 -25
  131. data/lib/bundles/inspec-habitat/cli.rb +31 -0
  132. data/lib/bundles/inspec-habitat/log.rb +10 -0
  133. data/lib/bundles/inspec-habitat/profile.rb +372 -0
  134. data/lib/bundles/inspec-habitat.rb +12 -0
  135. data/lib/bundles/inspec-init/templates/profile/controls/example.rb +0 -1
  136. data/lib/bundles/inspec-init/templates/profile/inspec.yml +1 -1
  137. data/lib/bundles/inspec-supermarket/api.rb +7 -5
  138. data/lib/bundles/inspec-supermarket/cli.rb +2 -2
  139. data/lib/fetchers/git.rb +4 -2
  140. data/lib/fetchers/local.rb +4 -1
  141. data/lib/fetchers/url.rb +64 -10
  142. data/lib/inspec/archive/tar.rb +1 -1
  143. data/lib/inspec/backend.rb +26 -3
  144. data/lib/inspec/base_cli.rb +44 -7
  145. data/lib/inspec/cached_fetcher.rb +2 -2
  146. data/lib/inspec/cli.rb +34 -12
  147. data/lib/inspec/completions/fish.sh.erb +34 -0
  148. data/lib/inspec/control_eval_context.rb +0 -2
  149. data/lib/inspec/dependencies/cache.rb +0 -1
  150. data/lib/inspec/dependencies/dependency_set.rb +2 -2
  151. data/lib/inspec/dependencies/lockfile.rb +13 -6
  152. data/lib/inspec/dependencies/requirement.rb +6 -6
  153. data/lib/inspec/dependencies/resolver.rb +4 -4
  154. data/lib/inspec/dsl.rb +3 -5
  155. data/lib/inspec/env_printer.rb +9 -1
  156. data/lib/inspec/exceptions.rb +8 -0
  157. data/lib/inspec/fetcher.rb +1 -1
  158. data/lib/inspec/file_provider.rb +47 -11
  159. data/lib/inspec/library_eval_context.rb +1 -1
  160. data/lib/inspec/metadata.rb +62 -18
  161. data/lib/inspec/method_source.rb +24 -0
  162. data/lib/inspec/objects/attribute.rb +21 -0
  163. data/lib/inspec/objects/control.rb +21 -3
  164. data/lib/inspec/objects/each_loop.rb +2 -1
  165. data/lib/inspec/objects/list.rb +1 -1
  166. data/lib/inspec/objects/or_test.rb +17 -2
  167. data/lib/inspec/objects/tag.rb +27 -0
  168. data/lib/inspec/objects/test.rb +9 -8
  169. data/lib/inspec/objects.rb +1 -0
  170. data/lib/inspec/plugins/fetcher.rb +4 -5
  171. data/lib/inspec/plugins/resource.rb +1 -2
  172. data/lib/inspec/plugins/source_reader.rb +3 -3
  173. data/lib/inspec/plugins.rb +1 -1
  174. data/lib/inspec/polyfill.rb +0 -1
  175. data/lib/inspec/profile.rb +92 -23
  176. data/lib/inspec/profile_context.rb +1 -1
  177. data/lib/inspec/profile_vendor.rb +66 -0
  178. data/lib/inspec/resource.rb +29 -3
  179. data/lib/inspec/rspec_json_formatter.rb +672 -285
  180. data/lib/inspec/rule.rb +12 -16
  181. data/lib/inspec/runner.rb +26 -15
  182. data/lib/inspec/runner_rspec.rb +1 -0
  183. data/lib/inspec/runtime_profile.rb +26 -0
  184. data/lib/inspec/schema.rb +185 -0
  185. data/lib/inspec/secrets/yaml.rb +8 -1
  186. data/lib/inspec/secrets.rb +1 -1
  187. data/lib/inspec/shell.rb +92 -22
  188. data/lib/inspec/source_reader.rb +1 -1
  189. data/lib/inspec/version.rb +1 -1
  190. data/lib/inspec.rb +1 -1
  191. data/lib/matchers/matchers.rb +67 -17
  192. data/lib/resources/aide_conf.rb +162 -0
  193. data/lib/resources/apache.rb +0 -1
  194. data/lib/resources/apache_conf.rb +3 -3
  195. data/lib/resources/apt.rb +2 -1
  196. data/lib/resources/audit_policy.rb +0 -1
  197. data/lib/resources/auditd_conf.rb +1 -2
  198. data/lib/resources/auditd_rules.rb +5 -5
  199. data/lib/resources/bond.rb +1 -1
  200. data/lib/resources/bridge.rb +1 -1
  201. data/lib/resources/command.rb +5 -3
  202. data/lib/resources/crontab.rb +102 -0
  203. data/lib/resources/csv.rb +18 -1
  204. data/lib/resources/dh_params.rb +84 -0
  205. data/lib/resources/directory.rb +7 -3
  206. data/lib/resources/docker.rb +198 -0
  207. data/lib/resources/docker_container.rb +114 -0
  208. data/lib/resources/docker_image.rb +96 -0
  209. data/lib/resources/etc_group.rb +2 -3
  210. data/lib/resources/etc_hosts.rb +81 -0
  211. data/lib/resources/file.rb +88 -30
  212. data/lib/resources/gem.rb +26 -6
  213. data/lib/resources/groups.rb +4 -5
  214. data/lib/resources/grub_conf.rb +3 -4
  215. data/lib/resources/host.rb +175 -35
  216. data/lib/resources/http.rb +73 -0
  217. data/lib/resources/iis_app.rb +103 -0
  218. data/lib/resources/iis_site.rb +23 -0
  219. data/lib/resources/inetd_conf.rb +9 -4
  220. data/lib/resources/interface.rb +4 -3
  221. data/lib/resources/json.rb +37 -14
  222. data/lib/resources/kernel_module.rb +77 -10
  223. data/lib/resources/kernel_parameter.rb +0 -1
  224. data/lib/resources/key_rsa.rb +67 -0
  225. data/lib/resources/limits_conf.rb +3 -4
  226. data/lib/resources/login_def.rb +2 -3
  227. data/lib/resources/mount.rb +34 -4
  228. data/lib/resources/mssql_session.rb +81 -12
  229. data/lib/resources/mysql.rb +0 -1
  230. data/lib/resources/mysql_conf.rb +1 -2
  231. data/lib/resources/mysql_session.rb +18 -7
  232. data/lib/resources/nginx_conf.rb +95 -0
  233. data/lib/resources/ntp_conf.rb +2 -3
  234. data/lib/resources/oracledb_session.rb +138 -0
  235. data/lib/resources/os_env.rb +7 -5
  236. data/lib/resources/package.rb +70 -13
  237. data/lib/resources/packages.rb +111 -0
  238. data/lib/resources/parse_config.rb +3 -4
  239. data/lib/resources/passwd.rb +4 -5
  240. data/lib/resources/pip.rb +29 -21
  241. data/lib/resources/port.rb +133 -14
  242. data/lib/resources/postgres.rb +53 -43
  243. data/lib/resources/postgres_conf.rb +40 -13
  244. data/lib/resources/postgres_hba_conf.rb +101 -0
  245. data/lib/resources/postgres_ident_conf.rb +79 -0
  246. data/lib/resources/postgres_session.rb +28 -20
  247. data/lib/resources/powershell.rb +2 -2
  248. data/lib/resources/processes.rb +61 -26
  249. data/lib/resources/rabbitmq_conf.rb +53 -0
  250. data/lib/resources/registry_key.rb +34 -11
  251. data/lib/resources/security_policy.rb +2 -2
  252. data/lib/resources/service.rb +17 -7
  253. data/lib/resources/ssh_conf.rb +17 -6
  254. data/lib/resources/ssl.rb +3 -4
  255. data/lib/resources/sys_info.rb +1 -1
  256. data/lib/resources/toml.rb +26 -0
  257. data/lib/resources/users.rb +41 -41
  258. data/lib/resources/virtualization.rb +252 -0
  259. data/lib/resources/windows_task.rb +106 -0
  260. data/lib/resources/x509_certificate.rb +143 -0
  261. data/lib/resources/xinetd.rb +18 -2
  262. data/lib/resources/xml.rb +27 -0
  263. data/lib/resources/yaml.rb +10 -2
  264. data/lib/resources/yum.rb +25 -7
  265. data/lib/resources/zfs_dataset.rb +60 -0
  266. data/lib/resources/zfs_pool.rb +49 -0
  267. data/lib/source_readers/flat.rb +2 -1
  268. data/lib/source_readers/inspec.rb +30 -11
  269. data/lib/utils/command_wrapper.rb +3 -3
  270. data/lib/utils/database_helpers.rb +77 -0
  271. data/lib/utils/erlang_parser.rb +192 -0
  272. data/lib/utils/filter.rb +2 -1
  273. data/lib/utils/filter_array.rb +0 -1
  274. data/lib/utils/find_files.rb +1 -2
  275. data/lib/utils/latest_version.rb +21 -0
  276. data/lib/utils/nginx_parser.rb +76 -0
  277. data/lib/utils/object_traversal.rb +5 -4
  278. data/lib/utils/parser.rb +23 -4
  279. data/lib/utils/plugin_registry.rb +3 -3
  280. data/lib/utils/simpleconfig.rb +25 -8
  281. data/lib/utils/spdx.rb +13 -0
  282. data/lib/utils/spdx.txt +344 -0
  283. metadata +168 -22
  284. data/docs/cli.md +0 -342
  285. data/docs/resources/process.md.erb +0 -73
  286. /data/docs/{plugin_kitchen_inspec.html.md → plugin_kitchen_inspec.md} +0 -0
@@ -6,7 +6,7 @@ title: About the user Resource
6
6
 
7
7
  Use the `user` InSpec audit resource to test user profiles for a single, known/expected local user, including the groups to which that user belongs, the frequency of required password changes, and the directory paths to home and shell.
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  A `user` resource block declares a user name, and then one (or more) matchers:
12
12
 
@@ -29,29 +29,29 @@ where
29
29
  * `it { should exist }` tests if the user exists
30
30
  * `gid`, `group`, `groups`, `home`, `maxdays`, `mindays`, `shell`, `uid`, and `warndays` are valid matchers for this resource
31
31
 
32
- # Matchers
32
+ ## Matchers
33
33
 
34
34
  This InSpec audit resource has the following matchers:
35
35
 
36
- ## be
36
+ ### be
37
37
 
38
38
  <%= partial "/shared/matcher_be" %>
39
39
 
40
- ## cmp
40
+ ### cmp
41
41
 
42
42
  <%= partial "/shared/matcher_cmp" %>
43
43
 
44
- ## eq
44
+ ### eq
45
45
 
46
46
  <%= partial "/shared/matcher_eq" %>
47
47
 
48
- ## exist
48
+ ### exist
49
49
 
50
50
  The `exist` matcher tests if the named user exists:
51
51
 
52
52
  it { should exist }
53
53
 
54
- ## gid
54
+ ### gid
55
55
 
56
56
  The `gid` matcher tests the group identifier:
57
57
 
@@ -59,7 +59,7 @@ The `gid` matcher tests the group identifier:
59
59
 
60
60
  where `1234` represents the user identifier.
61
61
 
62
- ## group
62
+ ### group
63
63
 
64
64
  The `group` matcher tests the group to which the user belongs:
65
65
 
@@ -67,27 +67,27 @@ The `group` matcher tests the group to which the user belongs:
67
67
 
68
68
  where `root` represents the group.
69
69
 
70
- ## groups
70
+ ### groups
71
71
 
72
72
  The `groups` matcher tests two (or more) groups to which the user belongs:
73
73
 
74
74
  its('groups') { should eq ['root', 'other']}
75
75
 
76
- ## home
76
+ ### home
77
77
 
78
78
  The `home` matcher tests the home directory path for the user:
79
79
 
80
80
  its('home') { should eq '/root' }
81
81
 
82
- ## include
82
+ ### include
83
83
 
84
84
  <%= partial "/shared/matcher_include" %>
85
85
 
86
- ## match
86
+ ### match
87
87
 
88
88
  <%= partial "/shared/matcher_match" %>
89
89
 
90
- ## maxdays
90
+ ### maxdays
91
91
 
92
92
  The `maxdays` matcher tests the maximum number of days between password changes:
93
93
 
@@ -95,7 +95,7 @@ The `maxdays` matcher tests the maximum number of days between password changes:
95
95
 
96
96
  where `99` represents the maximum number of days.
97
97
 
98
- ## mindays
98
+ ### mindays
99
99
 
100
100
  The `mindays` matcher tests the minimum number of days between password changes:
101
101
 
@@ -103,13 +103,13 @@ The `mindays` matcher tests the minimum number of days between password changes:
103
103
 
104
104
  where `0` represents the maximum number of days.
105
105
 
106
- ## shell
106
+ ### shell
107
107
 
108
108
  The `shell` matcher tests the path to the default shell for the user:
109
109
 
110
110
  its('shell') { should eq '/bin/bash' }
111
111
 
112
- ## uid
112
+ ### uid
113
113
 
114
114
  The `uid` matcher tests the user identifier:
115
115
 
@@ -117,7 +117,7 @@ The `uid` matcher tests the user identifier:
117
117
 
118
118
  where `1234` represents the user identifier.
119
119
 
120
- ## warndays
120
+ ### warndays
121
121
 
122
122
  The `warndays` matcher tests the number of days a user is warned before a password must be changed:
123
123
 
@@ -125,11 +125,11 @@ The `warndays` matcher tests the number of days a user is warned before a passwo
125
125
 
126
126
  where `5` represents the number of days a user is warned.
127
127
 
128
- # Examples
128
+ ## Examples
129
129
 
130
130
  The following examples show how to use this InSpec audit resource.
131
131
 
132
- ## Verify available users for the MySQL server
132
+ ### Verify available users for the MySQL server
133
133
 
134
134
  describe user('root') do
135
135
  it { should exist }
@@ -142,7 +142,7 @@ The following examples show how to use this InSpec audit resource.
142
142
  it { should_not exist }
143
143
  end
144
144
 
145
- ## Test users on multiple platforms
145
+ ### Test users on multiple platforms
146
146
 
147
147
  The `nginx` user is typically `www-data`, but on CentOS it's `nginx`. The following example shows how to test for the `nginx` user with a single test, but accounting for all platforms:
148
148
 
@@ -6,7 +6,7 @@ title: About the users Resource
6
6
 
7
7
  Use the `users` InSpec audit resource to look up all local users available on the system, and then test specific properties of those users. This resource does not return information about users that may be located on other systems, such as LDAP or Active Directory.
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  A `users` resource block declares a user name, and then one (or more) matchers:
12
12
 
@@ -33,29 +33,29 @@ or:
33
33
  it { should exist }
34
34
  end
35
35
 
36
- # Matchers
36
+ ## Matchers
37
37
 
38
38
  This InSpec audit resource has the following matchers:
39
39
 
40
- ## be
40
+ ### be
41
41
 
42
42
  <%= partial "/shared/matcher_be" %>
43
43
 
44
- ## cmp
44
+ ### cmp
45
45
 
46
46
  <%= partial "/shared/matcher_cmp" %>
47
47
 
48
- ## eq
48
+ ### eq
49
49
 
50
50
  <%= partial "/shared/matcher_eq" %>
51
51
 
52
- ## exist
52
+ ### exist
53
53
 
54
54
  The `exist` matcher tests if the named user exists:
55
55
 
56
56
  it { should exist }
57
57
 
58
- ## gid
58
+ ### gid
59
59
 
60
60
  The `gid` matcher tests the group identifier:
61
61
 
@@ -63,7 +63,7 @@ The `gid` matcher tests the group identifier:
63
63
 
64
64
  where `1234` represents the user identifier.
65
65
 
66
- ## group
66
+ ### group
67
67
 
68
68
  The `group` matcher tests the group to which the user belongs:
69
69
 
@@ -71,27 +71,27 @@ The `group` matcher tests the group to which the user belongs:
71
71
 
72
72
  where `root` represents the group.
73
73
 
74
- ## groups
74
+ ### groups
75
75
 
76
76
  The `groups` matcher tests two (or more) groups to which the user belongs:
77
77
 
78
78
  its('groups') { should eq ['root', 'other']}
79
79
 
80
- ## home
80
+ ### home
81
81
 
82
82
  The `home` matcher tests the home directory path for the user:
83
83
 
84
84
  its('home') { should eq '/root' }
85
85
 
86
- ## include
86
+ ### include
87
87
 
88
88
  <%= partial "/shared/matcher_include" %>
89
89
 
90
- ## match
90
+ ### match
91
91
 
92
92
  <%= partial "/shared/matcher_match" %>
93
93
 
94
- ## maxdays
94
+ ### maxdays
95
95
 
96
96
  The `maxdays` matcher tests the maximum number of days between password changes:
97
97
 
@@ -99,7 +99,7 @@ The `maxdays` matcher tests the maximum number of days between password changes:
99
99
 
100
100
  where `99` represents the maximum number of days.
101
101
 
102
- ## mindays
102
+ ### mindays
103
103
 
104
104
  The `mindays` matcher tests the minimum number of days between password changes:
105
105
 
@@ -107,13 +107,13 @@ The `mindays` matcher tests the minimum number of days between password changes:
107
107
 
108
108
  where `0` represents the maximum number of days.
109
109
 
110
- ## shell
110
+ ### shell
111
111
 
112
112
  The `shell` matcher tests the path to the default shell for the user:
113
113
 
114
114
  its('shell') { should eq '/bin/bash' }
115
115
 
116
- ## uid
116
+ ### uid
117
117
 
118
118
  The `uid` matcher tests the user identifier:
119
119
 
@@ -121,7 +121,7 @@ The `uid` matcher tests the user identifier:
121
121
 
122
122
  where `1234` represents the user identifier.
123
123
 
124
- ## warndays
124
+ ### warndays
125
125
 
126
126
  The `warndays` matcher tests the number of days a user is warned before a password must be changed:
127
127
 
@@ -129,11 +129,11 @@ The `warndays` matcher tests the number of days a user is warned before a passwo
129
129
 
130
130
  where `5` represents the number of days a user is warned.
131
131
 
132
- # Examples
132
+ ## Examples
133
133
 
134
134
  The following examples show how to use this InSpec audit resource.
135
135
 
136
- ## Use a regular expression to find users
136
+ ### Use a regular expression to find users
137
137
 
138
138
  describe users.where { uid =~ /S\-1\-5\-21\-\d+\-\d+\-\d+\-500/ } do
139
139
  it { should exist }
@@ -6,11 +6,11 @@ title: About the vbscript Resource
6
6
 
7
7
  Use the `vbscript` InSpec audit resource to test a VBScript on the Windows platform.
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  A `vbscript` resource block tests the output of a VBScript on the Windows platform:
12
12
 
13
- describe vbscript('script_name') do
13
+ describe vbscript('script contents') do
14
14
  its('stdout') { should eq 'output' }
15
15
  end
16
16
 
@@ -20,50 +20,50 @@ where
20
20
  * `('output')` is the expected output of the VBScript
21
21
 
22
22
 
23
- # Matchers
23
+ ## Matchers
24
24
 
25
25
  This InSpec audit resource has the following matchers:
26
26
 
27
- ## be
27
+ ### be
28
28
 
29
29
  <%= partial "/shared/matcher_be" %>
30
30
 
31
- ## cmp
31
+ ### cmp
32
32
 
33
33
  <%= partial "/shared/matcher_cmp" %>
34
34
 
35
- ## eq
35
+ ### eq
36
36
 
37
37
  <%= partial "/shared/matcher_eq" %>
38
38
 
39
- ## include
39
+ ### include
40
40
 
41
41
  <%= partial "/shared/matcher_include" %>
42
42
 
43
- ## match
43
+ ### match
44
44
 
45
45
  <%= partial "/shared/matcher_match" %>
46
46
 
47
- # Examples
47
+ ## Examples
48
48
 
49
49
  The following examples show how to use this InSpec audit resource.
50
50
 
51
- ## Test a VBScript
51
+ ### Test a VBScript
52
52
 
53
53
  A VBScript file similar to:
54
54
 
55
- vbscript = <<-EOH
55
+ script = <<-EOH
56
56
  WScript.Echo "hello"
57
57
  EOH
58
58
 
59
59
  may be tested for multiple lines:
60
60
 
61
- describe vbscript(vbscript) do
61
+ describe vbscript(script) do
62
62
  its('stdout') { should eq "hello\r\n" }
63
63
  end
64
64
 
65
65
  and tested for whitespace removal from standard output:
66
66
 
67
- describe vbscript(vbscript) do
67
+ describe vbscript(script) do
68
68
  its('strip') { should eq "hello" }
69
69
  end
@@ -0,0 +1,71 @@
1
+ ---
2
+ title: About the virtualization Resource
3
+ ---
4
+
5
+ # virtualization
6
+
7
+ Use the `virtualization` InSpec audit resource to test the virtualization platform on which the system is running.
8
+
9
+ ## Syntax
10
+
11
+ An `virtualization` resource block declares the virtualization platform that should be tested:
12
+
13
+ describe virtualization do
14
+ its('system') { should MATCHER 'value' }
15
+ end
16
+
17
+ where
18
+
19
+ * `('system')` is the name of the system information of the virtualization platform (e.g. docker, lxc, vbox, kvm, etc)
20
+ * `MATCHER` is a valid matcher for this resource
21
+ * `'value'` is the value to be tested
22
+
23
+ ## Matchers
24
+
25
+ This InSpec audit resource has the following matchers:
26
+
27
+ ### be
28
+
29
+ <%= partial "/shared/matcher_be" %>
30
+
31
+ ### cmp
32
+
33
+ <%= partial "/shared/matcher_cmp" %>
34
+
35
+ ### eq
36
+
37
+ <%= partial "/shared/matcher_eq" %>
38
+
39
+ ### include
40
+
41
+ <%= partial "/shared/matcher_include" %>
42
+
43
+ ### match
44
+
45
+ <%= partial "/shared/matcher_match" %>
46
+
47
+ ## Examples
48
+
49
+ The following examples show how to use this InSpec audit resource.
50
+
51
+ ### Test for Docker
52
+
53
+ describe virtualization do
54
+ its('system') { should eq 'docker' }
55
+ end
56
+
57
+ ### Test for VirtualBox
58
+
59
+ describe virtualization do
60
+ its('system') { should eq 'vbox' }
61
+ its('role') { should eq 'guest' }
62
+ end
63
+
64
+ ### Detect the virtualization platform
65
+
66
+ if virtualization.system == 'vbox'
67
+ describe package('name') do
68
+ it { should be_installed }
69
+ end
70
+ end
71
+
@@ -6,7 +6,7 @@ title: About the windows_feature Resource
6
6
 
7
7
  Use the `windows_feature` InSpec audit resource to test features on Windows via the `Get-WindowsFeature` cmdlet.
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  A `windows_feature` resource block declares the name of the Windows feature, tests if that feature is installed, and then returns information about that feature:
12
12
 
@@ -20,41 +20,41 @@ where
20
20
  * `be_installed` is a valid matcher for this resource
21
21
 
22
22
 
23
- # Matchers
23
+ ## Matchers
24
24
 
25
25
  This InSpec audit resource has the following matchers:
26
26
 
27
- ## be
27
+ ### be
28
28
 
29
29
  <%= partial "/shared/matcher_be" %>
30
30
 
31
- ## be_installed
31
+ ### be_installed
32
32
 
33
33
  The `be_installed` matcher tests if the named Windows feature is installed:
34
34
 
35
35
  it { should be_installed }
36
36
 
37
- ## cmp
37
+ ### cmp
38
38
 
39
39
  <%= partial "/shared/matcher_cmp" %>
40
40
 
41
- ## eq
41
+ ### eq
42
42
 
43
43
  <%= partial "/shared/matcher_eq" %>
44
44
 
45
- ## include
45
+ ### include
46
46
 
47
47
  <%= partial "/shared/matcher_include" %>
48
48
 
49
- ## match
49
+ ### match
50
50
 
51
51
  <%= partial "/shared/matcher_match" %>
52
52
 
53
- # Examples
53
+ ## Examples
54
54
 
55
55
  The following examples show how to use this InSpec audit resource.
56
56
 
57
- ## Test the DHCP Server feature
57
+ ### Test the DHCP Server feature
58
58
 
59
59
  describe windows_feature('DHCP Server') do
60
60
  it{ should be_installed }
@@ -0,0 +1,103 @@
1
+ ---
2
+ title: About the windows_task Resource
3
+ ---
4
+
5
+ # windows_task
6
+
7
+ Use the `windows_task` Inspec audit resource to test a scheduled tasks configuration on a Windows platform.
8
+ Microsoft and application vendors use scheduled tasks to perform a variety of system maintaince tasks but system administrators can schedule their own.
9
+
10
+ ## Syntax
11
+
12
+ A `windows_task` resource block declares the name of the task (as its full path) and tests its configuration:
13
+
14
+ describe windows_task('task name uri') do
15
+ its('parameter') { should eq 'value' }
16
+ it { should be_enabled }
17
+ end
18
+
19
+ where
20
+
21
+ * `'parameter'` must be a valid parameter defined within this resource ie `logon_mode`, `last_result`, `task_to_run`, `run_as_user`
22
+ * `'value'` will be used to compare the value gather from your chosen parameter
23
+ * `'be_enabled'` is an example of a valid matcher that checks the state of a task, other examples are `exist` or `be_disabled`
24
+
25
+ ## Matchers
26
+
27
+ This InSpec audit resource has the following matchers:
28
+
29
+ ### be
30
+
31
+ <%= partial "/shared/matcher_be" %>
32
+
33
+ ### cmp
34
+
35
+ <%= partial "/shared/matcher_cmp" %>
36
+
37
+ ### eq
38
+
39
+ <%= partial "/shared/matcher_eq" %>
40
+
41
+ ### include
42
+
43
+ <%= partial "/shared/matcher_include" %>
44
+
45
+ ### match
46
+
47
+ <%= partial "/shared/matcher_match" %>
48
+
49
+ ## Examples
50
+
51
+ The following examples show how to use this InSpec resource.
52
+
53
+ ### Test's that a task is enabled
54
+ ```
55
+ describe windows_task('\Microsoft\Windows\Time Synchronization\SynchronizeTime') do
56
+ it { should be_enabled }
57
+ end
58
+ ```
59
+
60
+ ### Test's that a task is disabled
61
+ ```
62
+ describe windows_task('\Microsoft\Windows\AppID\PolicyConverter') do
63
+ it { should be_disabled }
64
+ end
65
+ ```
66
+
67
+ ### Test's the configuration parameters of a task
68
+ ```
69
+ describe windows_task('\Microsoft\Windows\AppID\PolicyConverter') do
70
+ its('logon_mode') { should eq 'Interactive/Background' }
71
+ its('last_result') { should eq '1' }
72
+ its('task_to_run') { should cmp '%Windir%\system32\appidpolicyconverter.exe' }
73
+ its('run_as_user') { should eq 'LOCAL SERVICE' }
74
+ end
75
+ ```
76
+
77
+ ### Test's that a task is defined
78
+ ```
79
+ describe windows_task('\Microsoft\Windows\Defrag\ScheduledDefrag') do
80
+ it { should exist }
81
+ end
82
+ ```
83
+
84
+ ## Gathering Tasknames
85
+ Rather then use the GUI you can use the `schtasks.exe` to output a full list of tasks available on the system
86
+
87
+ `schtasks /query /FO list`
88
+
89
+ rather than use the `list` output you can use `CSV` if it is easier.
90
+
91
+ Please make sure you use the full TaskName (include the prefix `\`) within your control
92
+
93
+ ```
94
+ C:\>schtasks /query /FO list
95
+ ...
96
+ Folder: \Microsoft\Windows\Diagnosis
97
+ HostName: XPS15
98
+ TaskName: \Microsoft\Windows\Diagnosis\Scheduled
99
+ Next Run Time: N/A
100
+ Status: Ready
101
+ Logon Mode: Interactive/Background
102
+ ...
103
+ ```
@@ -6,7 +6,7 @@ title: About the wmi Resource
6
6
 
7
7
  Use the `wmi` InSpec audit resource to test WMI settings on the Windows platform.
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  A `wmi` resource block tests WMI settings on the Windows platform:
12
12
 
@@ -47,35 +47,35 @@ and the second uses a filter in the Ruby Hash to first identify WinRM, and then
47
47
  end
48
48
 
49
49
 
50
- # Matchers
50
+ ## Matchers
51
51
 
52
52
  This InSpec audit resource has the following matchers:
53
53
 
54
- ## be
54
+ ### be
55
55
 
56
56
  <%= partial "/shared/matcher_be" %>
57
57
 
58
- ## cmp
58
+ ### cmp
59
59
 
60
60
  <%= partial "/shared/matcher_cmp" %>
61
61
 
62
- ## eq
62
+ ### eq
63
63
 
64
64
  <%= partial "/shared/matcher_eq" %>
65
65
 
66
- ## include
66
+ ### include
67
67
 
68
68
  <%= partial "/shared/matcher_include" %>
69
69
 
70
- ## match
70
+ ### match
71
71
 
72
72
  <%= partial "/shared/matcher_match" %>
73
73
 
74
- # Examples
74
+ ## Examples
75
75
 
76
76
  The following examples show how to use this InSpec audit resource.
77
77
 
78
- ## Test a password expiration policy
78
+ ### Test a password expiration policy
79
79
 
80
80
  describe wmi({
81
81
  class: 'RSOP_SecuritySettingNumeric',
@@ -85,7 +85,7 @@ The following examples show how to use this InSpec audit resource.
85
85
  its('Setting') { should eq 1 }
86
86
  end
87
87
 
88
- ## Test if an anonymous user can query the Local Security Authority (LSA)
88
+ ### Test if an anonymous user can query the Local Security Authority (LSA)
89
89
 
90
90
  describe wmi({
91
91
  namespace: 'root\rsop\computer',