Class: CemAcpt::Config::CemAcptScan

Inherits:
Base
  • Object
show all
Defined in:
lib/cem_acpt/config/cem_acpt_scan.rb

Overview

Holds the configuration for cem_acpt_scan.

Mirrors the CemAcpt pattern: a hardcoded VALID_KEYS list and a #defaults hash. The new top-level key cem_acpt_scan carries scan-specific settings (scanner choice, threshold, profile mapping, daemon port, CIS-CAT Pro source); the rest of the schema reuses keys already understood by other commands so node provisioning code does not have to special-case scan mode.

Constant Summary collapse

VALID_KEYS =
%i[
  cem_acpt_scan
  actions
  image_name_builder
  module_dir
  node_data
  test_data
  tests
].freeze

Constants inherited from Base

Base::BASE_VALID_KEYS, Base::DEEP_MERGE_OPTS

Instance Attribute Summary

Attributes inherited from Base

#config, #env_vars

Instance Method Summary collapse

Methods inherited from Base

#[], #ci_mode?, #debug_mode?, #empty?, #explain, #get, #has?, inherited, #initialize, #inspect, #load, load_hook, #quiet_mode?, #scan?, #to_json, #to_yaml, #valid_keys, #verbose_mode?

Constructor Details

This class inherits a constructor from CemAcpt::Config::Base

Instance Method Details

#defaultsObject

The default configuration



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/cem_acpt/config/cem_acpt_scan.rb', line 35

def defaults
  {
    actions: {},
    cem_acpt_scan: {
      scanner: nil, # nil = derive from test-case framework (cis -> ciscat, stig -> openscap)
      threshold: 80.0,
      test_thresholds: {},
      scan_output: nil, # nil = stdout only; otherwise a file path
      cis_cat_pro_source: nil, # local path or gs:// URI; required when any test resolves to ciscat
      cis_cat_pro_license: nil, # local path or gs:// URI to license bundle (.tar.gz or .zip); required when any test resolves to ciscat. Rotates independently of cis_cat_pro_source.
      daemon: {
        port: 8084,
        ready_timeout: 60,
      },
      profiles: {
        openscap: {},
        cis_cat: {},
      },
      benchmarks: {
        cis_cat: {},
      },
      datastreams: {
        openscap: {},
      },
    },
    ci_mode: false,
    config_file: nil,
    image_name_builder: {
      character_substitutions: [['_', '-']],
      parts: ['cem-acpt', '$image_fam', '$collection', '$firewall'],
      join_with: '-',
    },
    log_level: 'info',
    log_file: nil,
    log_format: 'text',
    module_dir: Dir.pwd,
    node_data: {},
    no_destroy_nodes: false,
    no_ephemeral_ssh_key: false,
    platform: {
      name: 'gcp',
      gcp: {
        windows_bucket: 'win_cem_acpt',
      },
    },
    quiet: false,
    test_data: {
      for_each: {
        collection: %w[puppet8],
      },
      vars: {},
      name_pattern_vars: %r{^(?<framework>[a-z]+)_(?<image_fam>[a-z0-9-]+)_(?<firewall>[a-z]+)_(?<framework_vars>[-_a-z0-9]+)$},
      vars_post_processing: {
        new_vars: [
          {
            name: 'profile',
            string_split: {
              from: 'framework_vars',
              using: '_',
              part: 0,
            },
          },
          {
            name: 'level',
            string_split: {
              from: 'framework_vars',
              using: '_',
              part: 1,
            },
          },
        ],
        delete_vars: %w[framework_vars],
      },
    },
    tests: [],
    verbose: false,
  }
end

#env_var_prefixObject



26
27
28
# File 'lib/cem_acpt/config/cem_acpt_scan.rb', line 26

def env_var_prefix
  'CEM_ACPT_SCAN'
end

#scan_mode?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/cem_acpt/config/cem_acpt_scan.rb', line 30

def scan_mode?
  true
end