mitre / inspec_tools

A command-line and ruby API of utilities, converters and tools for creating, converting and processing security baseline formats, results and data
https://inspec-tools.mitre.org/
Other
92 stars 30 forks source link

Add modules summary, compliance #45

Closed rx294 closed 5 years ago

rx294 commented 5 years ago

Add Modules:

compliance

compliance parses an inspec results json to check if the compliance level meets a specified threshold.

If the specified threshold is not met, an error code (1) is returned along with non-compliant elements.

USAGE:  inspec_tools compliance [OPTIONS] -j <inspec-json> -i <threshold-inline>
    inspec_tools compliance [OPTIONS] -j <inspec-json> -f <threshold-file>
FLAGS:
    -j --inspec-json <inspec-json>          : path to InSpec results Json
    -i --template-inline <threshold-inline> : inline compliance threshold definition
    -f --template-file <threshold-file>     : yaml file with compliance threshold definition
Examples:

  inspec_tools compliance -j examples/sample_json/rhel-simp.json -i '{compliance.min: 80, failed.critical.max: 0, failed.high.max: 0}'

  inspec_tools compliance -j examples/sample_json/rhel-simp.json -f examples/sample_yaml/threshold.yaml
Possible In-line and yaml file threshold definition styles:
failed:
  critical:
    max: 0
  high:
    max: 1
compliance:
  min: 81
{compliance: {min: 80}, failed: {critical: {max: 0}, high: {max: 0}}}
{compliance.min: 81, failed.critical.max: 10, failed.high.max: 0}
compliance.min: 81
failed.critical.max: 10
failed.high.max: 1

summary

summary parses an inspec results json to create a summary json

USAGE: inspec_tools summary [OPTIONS] -j <inspec-json> -o <summary-csv>

FLAGS:
    -j --inspec-json <inspec-json>  : path to InSpec results Json
    -o --output <output-json>       : path to summary json

Examples:

  inspec_tools summary -j examples/sample_json/rhel-simp.json -o summary.json