keyval_with_fpath

Description

  • Setup and verify keys in "key value" formatted configuration file.
  • Example files: sshd_config, ssh_config, ntp.conf, ...

Example rule

{
    "keys": [
        {
            "value": "yes",
            "key": "PermitRootLogin",
            "op": "="
        },
        {
            "value": "",
            "key": "PermitRootLogin",
            "op": "reset"
        }
    ],
    "path": "/etc/ssh/sshd_config"
}

Form definition

Desc: |
  A rule to set a list of parameters in simple keyword/value configuration file format. Current values can be checked as set or unset, strictly equal, or superior/inferior to their target value.

Outputs:
  -
    Dest: compliance variable
    Type: json
    Format: dict
    Class: keyval_with_fpath

Inputs:
  -
    Id: path
    Label: Path
    DisplayModeLabel: path
    LabelCss: file16
    Type: string
  -
    Id: separator
    Label: Separator
    DisplayModeLabel: separator
    LabelCss: key
    Default: " "
    Type: string
  -
    Id: keys
    Label: Keys
    DisplayModeLabel: keys
    LabelCss: key
    Type: form
    Form: keyval