Skip to content

Commit 84608c1

Browse files
committed
added proposed modifications
Signed-off-by: George M Dias <GDIAS@MITRE.ORG>
1 parent 7f31dff commit 84608c1

File tree

3 files changed

+76
-39
lines changed

3 files changed

+76
-39
lines changed

src/courses/delta/03.md

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,48 @@ next: 04.md
44
title: 3. Delta Process CLI Tools
55
author: Daniel Medina, George Dias
66
---
7+
The [SAF CLI](https://saf-cli.mitre.org/) is a collection of libraries, tools developed by MITRE and the security community
8+
to streamline security automation for systems and DevOps pipelines. The delta process is one
9+
of the libraries provided by the SAF CLI.
710

811
## 3.1 CLI Tools
912

10-
The delta process consists of one or both of the following commands:
11-
12-
1. Update Controls for Delta (`update_controls4delta`)
13-
2. Delta (`delta`)
13+
The delta process consists of either or both of the following commands:
14+
1. Updates Controls for Delta
15+
2. Delta
1416

1517
::: note About InSpec Profiles
16-
When referring to InSpec profiles, there are distinctions:
17-
18-
- InSpec profile repository: Contains the controls, code, etc.
19-
- InSpec profile file: A JSON formatted file containing a profile summary, used as input for the delta process.
18+
When referring to InSpec Profiles, there are distinctions:
19+
InSpec profile repository: contains the controls, code, etc.
20+
InSpec profile file: JSON formatted file containing profile summary, used as input for the delta process.
2021
:::
2122

2223
### 3.2 Update Controls for Delta
2324

24-
The `update_controls4delta` process is used to prepare profile controls from one [SRG](./02.md#glossary-of-terms) or [STIG/CIS](./02.md#glossary-of-terms) benchmark baseline to another. The controls are updated based on guidance provided by the appropriate Extensible Configuration Checklist Description Format ([XCCDF](./02.md#glossary-of-terms)).
25+
The `update_controls4delta` process is used to prepare profile controls from one [SRG](./02.md#glossary-of-terms) or [STIG/CIS](./02.md#glossary-of-terms) benchmark baseline to another. The controls are updated based on guidance provided by the appropriate Extendible Configuration Checklist Description Format ([XCCDF](./02.md#glossary-of-terms)).
2526

26-
The `update_controls4delta` process may be the only command needed as it specifically updates existing controls from one baseline to another. Refer to [use cases for running delta](./04.html#use-cases-for-running-delta).
27+
The `update_controls4delta` process may be the only command needed as it specifically updates existing controls from one baseline to another, refer to [use cases for running delta](./04.html#use-cases-for-running-delta).
2728

2829
The process of preparing controls from one baseline to another (baseline X to Y) consists of:
2930

30-
1. Providing the directory where baseline X controls are located.
31-
2. Providing or generating an InSpec JSON formatted file containing all baseline X controls.
32-
- The JSON file is generated using the [InSpec or Cinc-Auditor] JSON CLI command.
33-
3. Providing an XCCDF file containing the new baseline Y guidance. The file is obtained from the appropriate site.
34-
- The baseline Y XCCDF lists all controls appropriate for the provided baseline. It often includes a field (legacy) indicating the control's previous name(s). The process uses this field to map old control names to the new controls.
35-
- If no mapping is found, then the `delta` process must be invoked to convert the baselines ([see use cases](./04.html#use-cases-for-running-delta)).
31+
1. The directory where baseline X controls are located is provided.
32+
3. An InSpec json formatted file containing all baseline X controls is provided or generated.
33+
a - The json file is generated using the [inspec or cinc-auditor] json CLI command
34+
3. A XCCDF file containing the new baseline Y guidance is provided. The file is obtained from the appropriate site.
35+
a - The baseline Y XCCDF lists all controls appropriate for the provided baseline. It also includes (most often) a field (legacy) where it indicates the control's previous name(s). The process uses this field to map old control names to the new controls.
36+
b - If there is no mapping found, then the `delta` process must be invoked to convert the baselines ([see use cases](./04.html#use-cases-for-running-delta))
3637

37-
You can invoke the command as follows:
38-
39-
```sh
38+
You can invoke the command as such:
39+
```
4040
saf generate update_controls4delta -X ./baseline_Y_xccdf_guidance_file.xml -J baseline_X_summary.json -c baseline_X_controls_directory
4141
```
4242

4343
Additional capabilities can be obtained using the `-h or --help` flag on the `update_controls4delta` command as such:
44-
45-
```sh
44+
```
4645
saf generate update_controls4delta --help
4746
```
4847

49-
Renaming of controls can be done either by guidance rules (rule ID, default) or using the group ID. When using rule ID legacy fields contained within the XCCDF are used for identifying the proper mapping for the controls.
48+
Renaming of controls can be done either by guidance rules (rule ID, default) or using the group ID. When using rule ID legacy fields contained within the XCCDF are used for identifying the proper mapping for the controls.
5049

5150
If there is no way to trace controls in baseline X to its corresponding controls in baseline Y, then `update_controls4delta` will not update any controls (no mapping).
5251

@@ -60,24 +59,29 @@ The `delta` process extends the capabilities of the `update_controls4delta` proc
6059
b - For controls which a match is found, the describe block (code) within the old control is mapped over to the new control
6160
3. Detailed logging
6261
a - report file (.md), mapping statistics (CliProcessOutput.log)
62+
<br>
6363

6464
You can invoke the command as such:
65-
66-
```sh
65+
```
6766
saf generate delta -X ./baseline_Y_xccdf_guidance_file.xml -J baseline_X_summary.json -o new_baseline_Y_controls_directory -M -c baseline_X_controls_directory
6867
```
68+
<br>
6969

7070
::: tip Optional Fuzzy Matching Flags
7171
The `-M` and `-c` flags can be removed if not using fuzzy matching feature.
7272
:::
7373

7474
Additional capabilities can be obtained using the `-h or --help` flag on the `delta` command as such:
75-
76-
```sh
75+
```
7776
saf generate delta --help
7877
```
7978

8079
For more information on these commands, refer to the following documentation:
8180

8281
- [update_controls4delta](https://saf-cli.mitre.org/#delta-supporting-options)
83-
- [saf generate delta](https://saf-cli.mitre.org/#delta)
82+
- [saf generate delta](https://saf-cli.mitre.org/#delta)
83+
<br>
84+
85+
::: warning Delta Process Limitations
86+
The Delta process has been tested using DISA XCCDF STIG Benchmark Guidances only.
87+
:::

src/courses/delta/04.md

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ There are several situations that warrant the use of the delta process. These ar
1919

2020
### 4.1.1 Use Case 1
2121

22-
Updated guidances sometimes modifies the control identification (ID) values of a given control. To make these modifications from baseline X to baseline Y, use the update controls process with the provided XCCDF STIG guidance file. The process checks if the new guidance changes the control numbers and updates the internal metadata if necessary.
22+
Updated guidances sometimes modifies the control identification (ID) values of a given control. To make these modifications from baseline X to baseline Y, use the update controls process with the provided XCCDF STIG guidance file. The process checks if the new guidance changes the control numbers and updates the internal metadata if necessary (testing code is retained).
2323

2424
Suppose we want to update our [Windows Server 2019 inspec profile repository](https://github.com/mitre/microsoft-windows-server-2019-stig-baseline/) from [version 1 release 3](https://github.com/mitre/microsoft-windows-server-2019-stig-baseline/releases/tag/1.3.0) to version 3 release 2.
2525

@@ -35,8 +35,11 @@ Use the `inspec json` command to generate a profile summary of the inspec profil
3535

3636
#### Step 3: Run Update Controls
3737
Use the `update_controls4delta` method using the profile summary file, the STIG guidance file, and the controls directory for the inspec profile as inputs.
38-
```
39-
saf generate update_controls4delta -X ./windows-server-2019-v3r2-xccdf.xml -J ./profile.json -c ./microsoft-windows-server-2019-stig-baseline/controls
38+
```sh
39+
saf generate update_controls4delta \
40+
-X ./windows-server-2019-v3r2-xccdf.xml \
41+
-J ./profile.json \
42+
-c ./microsoft-windows-server-2019-stig-baseline/controls
4043
```
4144
![Running the Update Controls command](../../assets/img/Delta_Class/use_case_1-2.gif)
4245

@@ -45,10 +48,10 @@ The output should look like this:
4548
![Update Controls Output](../../assets/img/Delta_Class/use_case_1-3.png)
4649

4750
From these results we can gather that:
48-
1. 31 controls were skipped, because they are not present in the STIG guidance. This indicates that these controls were deleted in the recent revision.
49-
2. 272 controls have had their control IDs updated. Any metadata changes have also been made to the controls as well.
50-
3. 0 controls were found to have the correct identification. This indicated that the STIG guidance renamed all mapped controls.
51-
4. 1 new control was found in the STIG guidance. It is important to note that `update_controls4delta` does not generate this control for you.
51+
1. Thirty-one (31) controls were skipped, because they are not present in the STIG guidance. This indicates that these controls were deleted in the recent revision.
52+
2. Two-hundred-seventy-two (272) controls have had their control IDs updated. Any metadata changes have also been made to the controls as well.
53+
3. Zero (0) controls were found to have the correct identification. This indicated that the STIG guidance renamed all mapped controls.
54+
4. One (1) new control was found in the STIG guidance. It is important to note that `update_controls4delta` does not generate this control for you.
5255

5356
**Process:** Run `update_controls4delta`
5457

@@ -61,26 +64,38 @@ New guidance often contains new controls that weren't previously defined. In thi
6164
Suppose we want to update our [RedHat Enterprise Linux 8 STIG Baseline](https://github.com/mitre/redhat-enterprise-linux-8-stig-baseline) from [Version 1 Release 14](https://github.com/mitre/redhat-enterprise-linux-8-stig-baseline/releases/tag/v1.14.1) to version 2 release 1.
6265

6366
#### Step 1: Collect necessary files
67+
6468
![File directory containing an inspec profile, and XCCDF XML file, and a generated profile summary JSON](../../assets/img/Delta_Class/use_case_2_1.png)
69+
6570
This include the profile summary JSON file generated used `cinc-auditor json redhat-enterprise-linux-8-stig-baseline > profile.json`
6671

6772
#### **OPTIONAL**: Run update_controls4delta
6873
Running the update controls command on this profile can give us information on what needs to be updated:
69-
`saf generate update_controls4delta -X rhel_8_xccdf.xml -J profile.json -c ./redhat-enterprise-linux-8-stig-baseline/controls`
74+
```sh
75+
saf generate update_controls4delta \
76+
-X rhel_8_xccdf.xml \
77+
-J profile.json \
78+
-c ./redhat-enterprise-linux-8-stig-baseline/controls
79+
```
7080

7181
![update_controls4delta output](../../assets/img/Delta_Class/use_case_2-2.png)
7282

7383
From this we can gather:
7484
1. No existing controls needed to be renamed in the new STIG guidance (366 controls with correct identification, 0 processed files).
75-
2. 9 controls were removed in the updated STIG guidance (9 skipped files).
76-
3. 1 new control was found in the updated STIG guidance.
85+
2. Nine (9) controls were removed in the updated STIG guidance (9 skipped files).
86+
3. One (1) new control was found in the updated STIG guidance.
7787

7888
From this output, we know that the Delta command needs to be run, because Delta is able to generate files for new controls and make any changes needed to the other controls.
7989

8090
#### Step 2: Run Delta
8191

8292
Use the `delta` command to perform a delta on the profile and the STIG guidance file:
83-
`saf generate delta -X ./rhel_8_V2R1_xccdf.xml -J ./profile.json -r ./report.md -o ./redhat-8-updated/`
93+
```sh
94+
saf generate delta \
95+
-X ./rhel_8_V2R1_xccdf.xml \
96+
-J ./profile.json \
97+
-r ./report.md -o ./redhat-8-updated/
98+
```
8499
In this case, we will be outputting a report file to `report.md` and the updated inspec profile to the `./redhat-8-updated/` directory.
85100

86101
You should receive the following output:
@@ -89,10 +104,13 @@ You should receive the following output:
89104
The `["+","SV-268322"]` indicates that a new control was created with the ID SV-258322.
90105

91106
After running the command, you should see the following:
107+
92108
![Generated files and folders from delta](../../assets/img/Delta_Class/use_case_2-4.png)
93109

94110
1. `redhat-8-updated` directory: A folder container the updated inspec profile.
111+
95112
![Updated profile output directory](../../assets/img/Delta_Class/use_case_2-5.png)
113+
96114
a. A `controls` directory containing all of the updated and new controls in the STIG guidance file. This does NOT contain removed controls so no further modifications need to be done.
97115
b. A delta.json file containing a JSON formatted summary of the delta process.
98116
2. `report.md`: Markdown report containin formatted version of delta.json summary results.
@@ -114,7 +132,13 @@ In this use case, we will be mapping the Windows Server 2019 STIG profile using
114132
#### Step 2: Run the delta command with fuzzy matching
115133

116134
To enable fuzzy matching, use the `-M` flag and specify the controls directory using the `-c` flag:
117-
`saf generate delta -X ./windows-server-2022-v2r2-xccdf.xml -J ./profile.json -r ./report.md -o ./windows-server-2022-stig-baseline -M -c ./microsoft-windows-server-2019-stig-baseline/controls`
135+
```sh
136+
saf generate delta \
137+
-X ./windows-server-2022-v2r2-xccdf.xml \
138+
-J ./profile.json -r ./report.md \
139+
-o ./windows-server-2022-stig-baseline \
140+
-M -c ./microsoft-windows-server-2019-stig-baseline/controls
141+
```
118142

119143
The output is long, but what's important is the results and statistics section:
120144
![Delta fuzzy matching command output](../../assets/img/Delta_Class/use_case_3-2.png)

src/courses/delta/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@ By the end of this class, you should be able to:
1919
- Use the delta fuzzy matching system to map controls between two profiles
2020
- Identify and review delta process history with generated logs and artifacts
2121
- Format InSpec profile controls appropriately before and/or after executing delta commands
22+
23+
### 1.3 Delta Demystify
24+
Cyber security, the practice of protecting computer systems, networks, and data is an ongoing effort
25+
that demands importance vigilance of continuous monitoring and notification of vulnerabilities.
26+
27+
To effectively established an ongoing monitoring process, we need to know what to check for, and
28+
update the content being checked as vulnerabilities are identified. The MITRE training class [Beginner Security Automation Developer Class](https://deploy-preview-256--mitre-saf-training.netlify.app/courses/beginner/) provides an insight on how to use InSpec Profiles (a collection of automated tests) to conduct testes based on some security guidances.
29+
30+
As long as the testes are based on valid security guidances all is well, but the moment the security guidances change, the tests become obsolete and require new tests or existing tests to be updated, that is where the `delta` process comes in to the rescue.

0 commit comments

Comments
 (0)