diff --git a/scripts/generate_scap.py b/scripts/generate_scap.py index 887d5bb3..a5b2a463 100755 --- a/scripts/generate_scap.py +++ b/scripts/generate_scap.py @@ -2254,7 +2254,57 @@ def generate_scap(all_rules, all_baselines, args): {} '''.format(rule_yaml['id'] + "_" + odv_label,x,key) - x += 1 + + else: + if "authorizationdb" in rule_yaml['check']: + regex = r"=\(.*.\)" + matchy_match = [] + matches = re.finditer(regex, rule_yaml['check'], re.MULTILINE) + for matchNum, match in enumerate(matches, start=1): + matchy_match = match.group().replace('=(',"").replace(")","").replace('"','').split() + + oval_definition = oval_definition + ''' + + + {} + + + {} + + '''.format(x,rule_yaml['title'],cce,rule_yaml['id'] + "_" + odv_label,rule_yaml['discussion']) + + for match in matchy_match: + + oval_definition = oval_definition + ''' + + '''.format(rule_yaml['id'] + "+" + match, x) + oval_test = oval_test + ''' + + + + '''.format(match,x,x,x) + key="shared" + value="" + if "false" in rule_yaml["check"]: + value="false" + else: + value="true" + + oval_object = oval_object + ''' + + {} + boolean(//key[text()="{}"]/following-sibling::{}) + '''.format(match,x,match,key,value) + + oval_state = oval_state + ''' + + + true + '''.format(match,x) + x += 1 + + oval_definition = oval_definition + "" + continue if "/bin/rm" in rule_yaml['fix'] and "/bin/ls" in rule_yaml['check']: oval_definition = oval_definition + '''