mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-08-12 16:02:17 +01:00
fixed odv issue, sync branches
This commit is contained in:
@@ -1522,9 +1522,10 @@ def fill_in_odv(resulting_yaml, parent_values):
|
||||
if "$ODV" in resulting_yaml[field]:
|
||||
resulting_yaml[field] = resulting_yaml[field].replace("$ODV", str(odv))
|
||||
|
||||
for result_value in resulting_yaml["result"]:
|
||||
if "$ODV" in str(resulting_yaml["result"][result_value]):
|
||||
resulting_yaml["result"][result_value] = odv
|
||||
if "result" in resulting_yaml.keys():
|
||||
for result_value in resulting_yaml["result"]:
|
||||
if "$ODV" in str(resulting_yaml["result"][result_value]):
|
||||
resulting_yaml["result"][result_value] = odv
|
||||
|
||||
if resulting_yaml["mobileconfig_info"]:
|
||||
for mobileconfig_type in resulting_yaml["mobileconfig_info"]:
|
||||
@@ -2560,7 +2561,8 @@ def main():
|
||||
rule_srg=srg,
|
||||
)
|
||||
else:
|
||||
if version_yaml['platform'] == "iOS/iPadOS":
|
||||
#using the same rule template for ios/ipados/visionos
|
||||
if version_yaml['platform'] == "iOS/iPadOS" or version_yaml['platform'] == "visionOS":
|
||||
rule_adoc = adoc_rule_ios_template.substitute(
|
||||
rule_title=rule_yaml['title'].replace('|', r'\|'),
|
||||
rule_id=rule_yaml['id'].replace('|', r'\|'),
|
||||
|
||||
@@ -438,6 +438,15 @@ profile:'''.format(other_header,other_header,version_yaml['os'],version_yaml['ve
|
||||
full_baseline = full_baseline + '''
|
||||
- {}'''.format(rule)
|
||||
|
||||
if len(os_section) != 0 and version_yaml['platform'] == "visionOS":
|
||||
full_baseline = full_baseline + '''
|
||||
- section: "visionOS"
|
||||
rules:'''
|
||||
os_section.sort()
|
||||
for rule in os_section:
|
||||
full_baseline = full_baseline + '''
|
||||
- {}'''.format(rule)
|
||||
|
||||
if len(os_section) != 0 and version_yaml['platform'] == "macOS":
|
||||
full_baseline = full_baseline + '''
|
||||
- section: "macOS"
|
||||
|
||||
@@ -120,13 +120,18 @@ def generate_scap(all_rules, all_baselines, args):
|
||||
if "ios" in version_yaml['cpe']:
|
||||
print("OVAL generation is not available on iOS")
|
||||
exit()
|
||||
|
||||
if "visionOS" in version_yaml['cpe']:
|
||||
print("OVAL generation is not available on visionOS")
|
||||
exit()
|
||||
|
||||
if args.oval == None and args.xccdf == None:
|
||||
export_as = "scap"
|
||||
if "ios" in version_yaml['cpe']:
|
||||
print("iOS will only export as XCCDF")
|
||||
export_as = "xccdf"
|
||||
if "visionos" in version_yaml['cpe']:
|
||||
print("visionOS will only export as XCCDF")
|
||||
export_as = "xccdf"
|
||||
|
||||
now = datetime.now()
|
||||
date_time_string = now.strftime("%Y-%m-%dT%H:%M:%S")
|
||||
@@ -135,7 +140,8 @@ def generate_scap(all_rules, all_baselines, args):
|
||||
output = "../build/macOS_{0}_Security_Compliance_Benchmark-{1}".format(version_yaml['os'],filenameversion)
|
||||
if "ios" in version_yaml['cpe']:
|
||||
output = "../build/iOS_{0}_Security_Compliance_Benchmark-{1}".format(version_yaml['os'],filenameversion)
|
||||
|
||||
if "visionos" in version_yaml['cpe']:
|
||||
output = "../build/iOS_{0}_Security_Compliance_Benchmark-{1}".format(version_yaml['os'],filenameversion)
|
||||
if export_as == "xccdf":
|
||||
output = output + "_xccdf.xml"
|
||||
|
||||
@@ -167,8 +173,11 @@ def generate_scap(all_rules, all_baselines, args):
|
||||
</generator>'''.format(date_time_string)
|
||||
|
||||
ostype = "macOS"
|
||||
if "ios" in version_yaml['cpe']:
|
||||
if "ios" in version_yaml['cpe'] or "visionos" in version_yaml['cpe']:
|
||||
ostype = "iOS/iPadOS"
|
||||
if "visionos" in version_yaml['cpe']:
|
||||
ostype = "visionOS"
|
||||
|
||||
xccdfPrefix = '''<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Benchmark xmlns="http://checklists.nist.gov/xccdf/1.2" id="xccdf_gov.nist.mscp.content_benchmark_macOS_{1}" style="SCAP_1.3" resolved="true" xml:lang="en">
|
||||
<status date="{3}">draft</status>
|
||||
|
||||
Reference in New Issue
Block a user