Skip to content

Commit

Permalink
Merge pull request #10346 from maage/oval-id-match-1
Browse files Browse the repository at this point in the history
Require OVAL ID to match rule ID
  • Loading branch information
Mab879 authored Mar 22, 2023
2 parents fe29fc2 + 5fa2ed4 commit ba11a53
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{{ oval_metadata("Check if FIPS mode is enabled on the system") }}}
<criteria operator="AND">
<extend_definition comment="check /etc/system-fips exists" definition_ref="etc_system_fips_exists" />
<extend_definition comment="check sysctl crypto.fips_enabled = 1" definition_ref="proc_sys_crypto_fips_enabled" />
<extend_definition comment="check sysctl crypto.fips_enabled = 1" definition_ref="sysctl_crypto_fips_enabled" />
<extend_definition comment="system cryptography policy is configured" definition_ref="configure_crypto_policy" />
<criterion comment="check if system crypto policy selection in var_system_crypto_policy in the profile is set to FIPS" test_ref="test_system_crypto_policy_value" />
</criteria>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<def-group>
<definition class="compliance" id="proc_sys_crypto_fips_enabled" version="1">
<definition class="compliance" id="sysctl_crypto_fips_enabled" version="1">
{{{ oval_metadata("The kernel 'crypto.fips_enabled' parameter should be set to '1' in system runtime.") }}}
<criteria operator="AND">
<criterion comment="kernel runtime parameter crypto.fips_enabled set to 1" test_ref="test_proc_sys_crypto_fips_enabled" />
<criterion comment="kernel runtime parameter crypto.fips_enabled set to 1" test_ref="test_sysctl_crypto_fips_enabled" />
</criteria>
</definition>

<ind:textfilecontent54_test check="all" check_existence="all_exist"
comment="kernel runtime parameter crypto.fips_enabled set to 1"
id="test_proc_sys_crypto_fips_enabled" version="1">
<ind:object object_ref="obj_proc_sys_crypto_fips_enabled" />
id="test_sysctl_crypto_fips_enabled" version="1">
<ind:object object_ref="obj_sysctl_crypto_fips_enabled" />
</ind:textfilecontent54_test>

<ind:textfilecontent54_object id="obj_proc_sys_crypto_fips_enabled" version="1">
<ind:textfilecontent54_object id="obj_sysctl_crypto_fips_enabled" version="1">
<ind:filepath>/proc/sys/crypto/fips_enabled</ind:filepath>
<ind:pattern operation="pattern match">^1$</ind:pattern>
<ind:instance datatype="int">1</ind:instance>
Expand Down
3 changes: 2 additions & 1 deletion ssg/build_ovals.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,10 @@ def _benchmark_specific_actions(
(os.path.dirname(os.path.dirname(file_path))))
self._store_intermediate_file(rule_id, xml_content)
if not _check_rule_id(oval_file_tree, rule_id):
msg = "OVAL definition in '%s' doesn't match rule ID '%s'." % (
msg = "ERROR: OVAL definition in '%s' doesn't match rule ID '%s'." % (
file_path, rule_id)
print(msg, file=sys.stderr)
sys.exit(1)

def _get_context(self, directory, from_benchmark):
if from_benchmark:
Expand Down

0 comments on commit ba11a53

Please sign in to comment.