inspec 1.0.0.beta2 → 1.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +41 -2
  3. data/Gemfile +4 -0
  4. data/Rakefile +2 -1
  5. data/docs/.gitignore +2 -0
  6. data/docs/README.md +21 -1
  7. data/docs/resources/apache_conf.md.erb +75 -0
  8. data/docs/resources/apt.md.erb +84 -0
  9. data/docs/resources/audit_policy.md.erb +61 -0
  10. data/docs/resources/auditd_conf.md.erb +79 -0
  11. data/docs/resources/auditd_rules.md.erb +132 -0
  12. data/docs/resources/bash.md.erb +84 -0
  13. data/docs/resources/bond.md.erb +97 -0
  14. data/docs/resources/bridge.md.erb +67 -0
  15. data/docs/resources/bsd_service.md.erb +76 -0
  16. data/docs/resources/command.md.erb +151 -0
  17. data/docs/resources/csv.md.erb +62 -0
  18. data/docs/resources/directory.md.erb +43 -0
  19. data/docs/resources/etc_group.md.erb +116 -0
  20. data/docs/resources/etc_passwd.md.erb +155 -0
  21. data/docs/resources/etc_shadow.md.erb +149 -0
  22. data/docs/resources/file.md.erb +460 -0
  23. data/docs/resources/gem.md.erb +73 -0
  24. data/docs/resources/group.md.erb +74 -0
  25. data/docs/resources/grub_conf.md.erb +115 -0
  26. data/docs/resources/host.md.erb +85 -0
  27. data/docs/resources/iis_site.md.erb +142 -0
  28. data/docs/resources/inetd_conf.md.erb +99 -0
  29. data/docs/resources/ini.md.erb +69 -0
  30. data/docs/resources/interface.md.erb +66 -0
  31. data/docs/resources/iptables.md.erb +70 -0
  32. data/docs/resources/json.md.erb +76 -0
  33. data/docs/resources/kernel_module.md.erb +60 -0
  34. data/docs/resources/kernel_parameter.md.erb +72 -0
  35. data/docs/resources/launchd_service.md.erb +76 -0
  36. data/docs/resources/limits_conf.md.erb +80 -0
  37. data/docs/resources/login_def.md.erb +77 -0
  38. data/docs/resources/mount.md.erb +83 -0
  39. data/docs/resources/mysql_conf.md.erb +102 -0
  40. data/docs/resources/mysql_session.md.erb +63 -0
  41. data/docs/resources/npm.md.erb +75 -0
  42. data/docs/resources/ntp_conf.md.erb +76 -0
  43. data/docs/resources/oneget.md.erb +67 -0
  44. data/docs/resources/os.md.erb +154 -0
  45. data/docs/resources/os_env.md.erb +98 -0
  46. data/docs/resources/package.md.erb +115 -0
  47. data/docs/resources/parse_config.md.erb +122 -0
  48. data/docs/resources/parse_config_file.md.erb +143 -0
  49. data/docs/resources/pip.md.erb +74 -0
  50. data/docs/resources/port.md.erb +150 -0
  51. data/docs/resources/postgres_conf.md.erb +90 -0
  52. data/docs/resources/postgres_session.md.erb +75 -0
  53. data/docs/resources/powershell.md.erb +116 -0
  54. data/docs/resources/process.md.erb +73 -0
  55. data/docs/resources/registry_key.md.erb +149 -0
  56. data/docs/resources/runit_service.md.erb +76 -0
  57. data/docs/resources/security_policy.md.erb +61 -0
  58. data/docs/resources/service.md.erb +135 -0
  59. data/docs/resources/ssh_config.md.erb +94 -0
  60. data/docs/resources/sshd_config.md.erb +97 -0
  61. data/docs/resources/ssl.md.erb +133 -0
  62. data/docs/resources/sys_info.md.erb +55 -0
  63. data/docs/resources/systemd_service.md.erb +76 -0
  64. data/docs/resources/sysv_service.md.erb +76 -0
  65. data/docs/resources/upstart_service.md.erb +76 -0
  66. data/docs/resources/user.md.erb +154 -0
  67. data/docs/resources/users.md.erb +140 -0
  68. data/docs/resources/vbscript.md.erb +69 -0
  69. data/docs/resources/windows_feature.md.erb +61 -0
  70. data/docs/resources/wmi.md.erb +95 -0
  71. data/docs/resources/xinetd_conf.md.erb +170 -0
  72. data/docs/resources/yaml.md.erb +69 -0
  73. data/docs/resources/yum.md.erb +103 -0
  74. data/docs/ruby_usage.md +154 -0
  75. data/docs/shared/matcher_be.md.erb +1 -0
  76. data/docs/shared/matcher_cmp.md.erb +45 -0
  77. data/docs/shared/matcher_eq.md.erb +3 -0
  78. data/docs/shared/matcher_include.md.erb +1 -0
  79. data/docs/shared/matcher_match.md.erb +1 -0
  80. data/lib/fetchers/url.rb +27 -29
  81. data/lib/inspec/cached_fetcher.rb +67 -0
  82. data/lib/inspec/dependencies/requirement.rb +6 -7
  83. data/lib/inspec/objects/each_loop.rb +5 -2
  84. data/lib/inspec/plugins/fetcher.rb +2 -0
  85. data/lib/inspec/profile.rb +9 -41
  86. data/lib/inspec/resource.rb +1 -1
  87. data/lib/inspec/rspec_json_formatter.rb +11 -5
  88. data/lib/inspec/version.rb +1 -1
  89. data/lib/resources/groups.rb +190 -0
  90. data/lib/resources/users.rb +3 -2
  91. metadata +79 -6
  92. data/docs/cli.rst +0 -448
  93. data/docs/resources.rst +0 -4836
  94. data/docs/ruby_usage.rst +0 -145
  95. data/lib/resources/group.rb +0 -137
@@ -4,11 +4,12 @@
4
4
 
5
5
  require 'utils/parser'
6
6
  require 'utils/convert'
7
+ require 'utils/filter'
7
8
 
8
9
  module Inspec::Resources
9
10
  # This file contains two resources, the `user` and `users` resource.
10
11
  # The `user` resource is optimized for requests that verify specific users
11
- # that you know upfront for testing. If you need to query all users or find
12
+ # that you know upfront for testing. If you need to query all users or search
12
13
  # specific users with certain properties, use the `users` resource.
13
14
  module UserManagementSelector
14
15
  # select user provider based on the operating system
@@ -65,7 +66,7 @@ module Inspec::Resources
65
66
  def initialize
66
67
  # select user provider
67
68
  @user_provider = select_user_manager(inspec.os)
68
- return skip_resource 'The `user` resource is not supported on your OS yet.' if @user_provider.nil?
69
+ return skip_resource 'The `users` resource is not supported on your OS yet.' if @user_provider.nil?
69
70
  end
70
71
 
71
72
  filter = FilterTable.create
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta2
4
+ version: 1.0.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-22 00:00:00.000000000 Z
11
+ date: 2016-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: train
@@ -224,16 +224,88 @@ files:
224
224
  - README.md
225
225
  - Rakefile
226
226
  - bin/inspec
227
+ - docs/.gitignore
227
228
  - docs/README.md
228
- - docs/cli.rst
229
+ - docs/cli.md
229
230
  - docs/dsl_inspec.md
230
231
  - docs/dsl_resource.md
231
232
  - docs/inspec_and_friends.md
232
233
  - docs/matchers.md
233
234
  - docs/plugin_kitchen_inspec.html.md
234
235
  - docs/profiles.md
235
- - docs/resources.rst
236
- - docs/ruby_usage.rst
236
+ - docs/resources/apache_conf.md.erb
237
+ - docs/resources/apt.md.erb
238
+ - docs/resources/audit_policy.md.erb
239
+ - docs/resources/auditd_conf.md.erb
240
+ - docs/resources/auditd_rules.md.erb
241
+ - docs/resources/bash.md.erb
242
+ - docs/resources/bond.md.erb
243
+ - docs/resources/bridge.md.erb
244
+ - docs/resources/bsd_service.md.erb
245
+ - docs/resources/command.md.erb
246
+ - docs/resources/csv.md.erb
247
+ - docs/resources/directory.md.erb
248
+ - docs/resources/etc_group.md.erb
249
+ - docs/resources/etc_passwd.md.erb
250
+ - docs/resources/etc_shadow.md.erb
251
+ - docs/resources/file.md.erb
252
+ - docs/resources/gem.md.erb
253
+ - docs/resources/group.md.erb
254
+ - docs/resources/grub_conf.md.erb
255
+ - docs/resources/host.md.erb
256
+ - docs/resources/iis_site.md.erb
257
+ - docs/resources/inetd_conf.md.erb
258
+ - docs/resources/ini.md.erb
259
+ - docs/resources/interface.md.erb
260
+ - docs/resources/iptables.md.erb
261
+ - docs/resources/json.md.erb
262
+ - docs/resources/kernel_module.md.erb
263
+ - docs/resources/kernel_parameter.md.erb
264
+ - docs/resources/launchd_service.md.erb
265
+ - docs/resources/limits_conf.md.erb
266
+ - docs/resources/login_def.md.erb
267
+ - docs/resources/mount.md.erb
268
+ - docs/resources/mysql_conf.md.erb
269
+ - docs/resources/mysql_session.md.erb
270
+ - docs/resources/npm.md.erb
271
+ - docs/resources/ntp_conf.md.erb
272
+ - docs/resources/oneget.md.erb
273
+ - docs/resources/os.md.erb
274
+ - docs/resources/os_env.md.erb
275
+ - docs/resources/package.md.erb
276
+ - docs/resources/parse_config.md.erb
277
+ - docs/resources/parse_config_file.md.erb
278
+ - docs/resources/pip.md.erb
279
+ - docs/resources/port.md.erb
280
+ - docs/resources/postgres_conf.md.erb
281
+ - docs/resources/postgres_session.md.erb
282
+ - docs/resources/powershell.md.erb
283
+ - docs/resources/process.md.erb
284
+ - docs/resources/registry_key.md.erb
285
+ - docs/resources/runit_service.md.erb
286
+ - docs/resources/security_policy.md.erb
287
+ - docs/resources/service.md.erb
288
+ - docs/resources/ssh_config.md.erb
289
+ - docs/resources/sshd_config.md.erb
290
+ - docs/resources/ssl.md.erb
291
+ - docs/resources/sys_info.md.erb
292
+ - docs/resources/systemd_service.md.erb
293
+ - docs/resources/sysv_service.md.erb
294
+ - docs/resources/upstart_service.md.erb
295
+ - docs/resources/user.md.erb
296
+ - docs/resources/users.md.erb
297
+ - docs/resources/vbscript.md.erb
298
+ - docs/resources/windows_feature.md.erb
299
+ - docs/resources/wmi.md.erb
300
+ - docs/resources/xinetd_conf.md.erb
301
+ - docs/resources/yaml.md.erb
302
+ - docs/resources/yum.md.erb
303
+ - docs/ruby_usage.md
304
+ - docs/shared/matcher_be.md.erb
305
+ - docs/shared/matcher_cmp.md.erb
306
+ - docs/shared/matcher_eq.md.erb
307
+ - docs/shared/matcher_include.md.erb
308
+ - docs/shared/matcher_match.md.erb
237
309
  - docs/shell.md
238
310
  - examples/README.md
239
311
  - examples/inheritance/README.md
@@ -309,6 +381,7 @@ files:
309
381
  - lib/inspec/archive/zip.rb
310
382
  - lib/inspec/backend.rb
311
383
  - lib/inspec/base_cli.rb
384
+ - lib/inspec/cached_fetcher.rb
312
385
  - lib/inspec/cli.rb
313
386
  - lib/inspec/completions/bash.sh.erb
314
387
  - lib/inspec/completions/zsh.sh.erb
@@ -376,7 +449,7 @@ files:
376
449
  - lib/resources/etc_group.rb
377
450
  - lib/resources/file.rb
378
451
  - lib/resources/gem.rb
379
- - lib/resources/group.rb
452
+ - lib/resources/groups.rb
380
453
  - lib/resources/grub_conf.rb
381
454
  - lib/resources/host.rb
382
455
  - lib/resources/iis_site.rb
data/docs/cli.rst DELETED
@@ -1,448 +0,0 @@
1
- =====================================================
2
- InSpec CLI
3
- =====================================================
4
-
5
- Use the InSpec CLI to run tests and audits against targets using local, SSH, WinRM, or Docker connections.
6
-
7
- archive
8
- =====================================================
9
-
10
- Archive a profile to tar.gz (default) or zip
11
-
12
- Syntax
13
- -----------------------------------------------------
14
-
15
- This subcommand has the following syntax:
16
-
17
- .. code-block:: bash
18
-
19
- $ inspec archive PATH
20
-
21
- Options
22
- -----------------------------------------------------
23
-
24
- This subcommand has additional options:
25
-
26
- ``--ignore-errors``, ``--no-ignore-errors``
27
- Ignore profile warnings.
28
-
29
- ``-o``, ``--output=OUTPUT``
30
- Save the archive to a path
31
-
32
- ``--overwrite``, ``--no-overwrite``
33
- Overwrite existing archive.
34
-
35
- ``--profiles-path=PROFILES_PATH``
36
- Folder which contains referenced profiles.
37
-
38
- ``--tar``, ``--no-tar``
39
- Generates a tar.gz archive.
40
-
41
- ``--zip``, ``--no-zip``
42
- Generates a zip archive.
43
-
44
-
45
-
46
- check
47
- =====================================================
48
-
49
- Verify all tests at the specified path
50
-
51
- Syntax
52
- -----------------------------------------------------
53
-
54
- This subcommand has the following syntax:
55
-
56
- .. code-block:: bash
57
-
58
- $ inspec check PATH
59
-
60
- Options
61
- -----------------------------------------------------
62
-
63
- This subcommand has additional options:
64
-
65
- ``--format=FORMAT``
66
-
67
-
68
- ``--profiles-path=PROFILES_PATH``
69
- Folder which contains referenced profiles.
70
-
71
-
72
-
73
- compliance
74
- =====================================================
75
-
76
- Chef compliance commands
77
-
78
- Syntax
79
- -----------------------------------------------------
80
-
81
- This subcommand has the following syntax:
82
-
83
- .. code-block:: bash
84
-
85
- $ inspec compliance SUBCOMMAND ...
86
-
87
-
88
-
89
- detect
90
- =====================================================
91
-
92
- Detect the target os
93
-
94
- Syntax
95
- -----------------------------------------------------
96
-
97
- This subcommand has the following syntax:
98
-
99
- .. code-block:: bash
100
-
101
- $ inspec detect
102
-
103
- Options
104
- -----------------------------------------------------
105
-
106
- This subcommand has additional options:
107
-
108
- ``-b``, ``--backend=BACKEND``
109
- Choose a backend: local, ssh, winrm, docker.
110
-
111
- ``--format=FORMAT``
112
-
113
-
114
- ``--host=HOST``
115
- Specify a remote host which is tested.
116
-
117
- ``--json-config=JSON_CONFIG``
118
- Read configuration from JSON file (`-` reads from stdin).
119
-
120
- ``-i``, ``--key-files=one two three``
121
- Login key or certificate file for a remote scan.
122
-
123
- ``-l``, ``--log-level=LOG_LEVEL``
124
- Set the log level: info (default), debug, warn, error
125
-
126
- ``--password=PASSWORD``
127
- Login password for a remote scan, if required.
128
-
129
- ``--path=PATH``
130
- Login path to use when connecting to the target (WinRM).
131
-
132
- ``-p``, ``--port=N``
133
- Specify the login port for a remote scan.
134
-
135
- ``--self-signed``, ``--no-self-signed``
136
- Allow remote scans with self-signed certificates (WinRM).
137
-
138
- ``--ssl``, ``--no-ssl``
139
- Use SSL for transport layer encryption (WinRM).
140
-
141
- ``--sudo``, ``--no-sudo``
142
- Run scans with sudo. Only activates on Unix and non-root user.
143
-
144
- ``--sudo-command=SUDO_COMMAND``
145
- Alternate command for sudo.
146
-
147
- ``--sudo-options=SUDO_OPTIONS``
148
- Additional sudo options for a remote scan.
149
-
150
- ``--sudo-password=SUDO_PASSWORD``
151
- Specify a sudo password, if it is required.
152
-
153
- ``-t``, ``--target=TARGET``
154
- Simple targeting option using URIs, e.g. ssh://user:pass@host:port
155
-
156
- ``--user=USER``
157
- The login user for a remote scan.
158
-
159
-
160
-
161
- env
162
- =====================================================
163
-
164
- Output shell-appropriate completion configuration
165
-
166
- Syntax
167
- -----------------------------------------------------
168
-
169
- This subcommand has the following syntax:
170
-
171
- .. code-block:: bash
172
-
173
- $ inspec env
174
-
175
-
176
-
177
- exec
178
- =====================================================
179
-
180
- Run all test files at the specified path.
181
-
182
- Syntax
183
- -----------------------------------------------------
184
-
185
- This subcommand has the following syntax:
186
-
187
- .. code-block:: bash
188
-
189
- $ inspec exec PATHS
190
-
191
- Options
192
- -----------------------------------------------------
193
-
194
- This subcommand has additional options:
195
-
196
- ``--attrs=one two three``
197
- Load attributes file (experimental)
198
-
199
- ``-b``, ``--backend=BACKEND``
200
- Choose a backend: local, ssh, winrm, docker.
201
-
202
- ``--cache=CACHE``
203
- Use the given path for caching dependencies. (default: ~/.inspec/cache)
204
-
205
- ``--color``, ``--no-color``
206
- Use colors in output.
207
-
208
- ``--controls=one two three``
209
- A list of controls to run. Ignore all other tests.
210
-
211
- ``--create-lockfile``, ``--no-create-lockfile``
212
- Write out a lockfile based on this execution (unless one already exists)
213
-
214
- ``--format=FORMAT``
215
- Which formatter to use: cli, progress, documentation, json, json-min
216
-
217
- ``--host=HOST``
218
- Specify a remote host which is tested.
219
-
220
- ``--json-config=JSON_CONFIG``
221
- Read configuration from JSON file (`-` reads from stdin).
222
-
223
- ``-i``, ``--key-files=one two three``
224
- Login key or certificate file for a remote scan.
225
-
226
- ``-l``, ``--log-level=LOG_LEVEL``
227
- Set the log level: info (default), debug, warn, error
228
-
229
- ``--password=PASSWORD``
230
- Login password for a remote scan, if required.
231
-
232
- ``--path=PATH``
233
- Login path to use when connecting to the target (WinRM).
234
-
235
- ``-p``, ``--port=N``
236
- Specify the login port for a remote scan.
237
-
238
- ``--profiles-path=PROFILES_PATH``
239
- Folder which contains referenced profiles.
240
-
241
- ``--self-signed``, ``--no-self-signed``
242
- Allow remote scans with self-signed certificates (WinRM).
243
-
244
- ``--ssl``, ``--no-ssl``
245
- Use SSL for transport layer encryption (WinRM).
246
-
247
- ``--sudo``, ``--no-sudo``
248
- Run scans with sudo. Only activates on Unix and non-root user.
249
-
250
- ``--sudo-command=SUDO_COMMAND``
251
- Alternate command for sudo.
252
-
253
- ``--sudo-options=SUDO_OPTIONS``
254
- Additional sudo options for a remote scan.
255
-
256
- ``--sudo-password=SUDO_PASSWORD``
257
- Specify a sudo password, if it is required.
258
-
259
- ``-t``, ``--target=TARGET``
260
- Simple targeting option using URIs, e.g. ssh://user:pass@host:port
261
-
262
- ``--user=USER``
263
- The login user for a remote scan.
264
-
265
-
266
-
267
- help
268
- =====================================================
269
-
270
- Describe available commands or one specific command
271
-
272
- Syntax
273
- -----------------------------------------------------
274
-
275
- This subcommand has the following syntax:
276
-
277
- .. code-block:: bash
278
-
279
- $ inspec help [COMMAND]
280
-
281
-
282
-
283
- init
284
- =====================================================
285
-
286
- Scaffolds a new project
287
-
288
- Syntax
289
- -----------------------------------------------------
290
-
291
- This subcommand has the following syntax:
292
-
293
- .. code-block:: bash
294
-
295
- $ inspec init TEMPLATE ...
296
-
297
-
298
-
299
- json
300
- =====================================================
301
-
302
- Read all tests in path and generate a json summary
303
-
304
- Syntax
305
- -----------------------------------------------------
306
-
307
- This subcommand has the following syntax:
308
-
309
- .. code-block:: bash
310
-
311
- $ inspec json PATH
312
-
313
- Options
314
- -----------------------------------------------------
315
-
316
- This subcommand has additional options:
317
-
318
- ``--controls=one two three``
319
- A list of controls to include. Ignore all other tests.
320
-
321
- ``-o``, ``--output=OUTPUT``
322
- Save the created profile to a path
323
-
324
- ``--profiles-path=PROFILES_PATH``
325
- Folder which contains referenced profiles.
326
-
327
-
328
-
329
- shell
330
- =====================================================
331
-
332
- Open an interactive debugging shell
333
-
334
- Syntax
335
- -----------------------------------------------------
336
-
337
- This subcommand has the following syntax:
338
-
339
- .. code-block:: bash
340
-
341
- $ inspec shell
342
-
343
- Options
344
- -----------------------------------------------------
345
-
346
- This subcommand has additional options:
347
-
348
- ``-b``, ``--backend=BACKEND``
349
- Choose a backend: local, ssh, winrm, docker.
350
-
351
- ``-c``, ``--command=COMMAND``
352
- A single command string to run instead of launching the shell
353
-
354
- ``--host=HOST``
355
- Specify a remote host which is tested.
356
-
357
- ``--json-config=JSON_CONFIG``
358
- Read configuration from JSON file (`-` reads from stdin).
359
-
360
- ``-i``, ``--key-files=one two three``
361
- Login key or certificate file for a remote scan.
362
-
363
- ``-l``, ``--log-level=LOG_LEVEL``
364
- Set the log level: info (default), debug, warn, error
365
-
366
- ``--password=PASSWORD``
367
- Login password for a remote scan, if required.
368
-
369
- ``--path=PATH``
370
- Login path to use when connecting to the target (WinRM).
371
-
372
- ``-p``, ``--port=N``
373
- Specify the login port for a remote scan.
374
-
375
- ``--self-signed``, ``--no-self-signed``
376
- Allow remote scans with self-signed certificates (WinRM).
377
-
378
- ``--ssl``, ``--no-ssl``
379
- Use SSL for transport layer encryption (WinRM).
380
-
381
- ``--sudo``, ``--no-sudo``
382
- Run scans with sudo. Only activates on Unix and non-root user.
383
-
384
- ``--sudo-command=SUDO_COMMAND``
385
- Alternate command for sudo.
386
-
387
- ``--sudo-options=SUDO_OPTIONS``
388
- Additional sudo options for a remote scan.
389
-
390
- ``--sudo-password=SUDO_PASSWORD``
391
- Specify a sudo password, if it is required.
392
-
393
- ``-t``, ``--target=TARGET``
394
- Simple targeting option using URIs, e.g. ssh://user:pass@host:port
395
-
396
- ``--user=USER``
397
- The login user for a remote scan.
398
-
399
-
400
-
401
- supermarket
402
- =====================================================
403
-
404
- Supermarket commands
405
-
406
- Syntax
407
- -----------------------------------------------------
408
-
409
- This subcommand has the following syntax:
410
-
411
- .. code-block:: bash
412
-
413
- $ inspec supermarket SUBCOMMAND ...
414
-
415
-
416
-
417
- vendor
418
- =====================================================
419
-
420
- Download all dependencies and generate a lockfile
421
-
422
- Syntax
423
- -----------------------------------------------------
424
-
425
- This subcommand has the following syntax:
426
-
427
- .. code-block:: bash
428
-
429
- $ inspec vendor
430
-
431
-
432
-
433
- version
434
- =====================================================
435
-
436
- Prints the version of this tool
437
-
438
- Syntax
439
- -----------------------------------------------------
440
-
441
- This subcommand has the following syntax:
442
-
443
- .. code-block:: bash
444
-
445
- $ inspec version
446
-
447
-
448
-