sysctl parsing: Allow missing space before '='
authorAlexander Popov <alex.popov@linux.com>
Wed, 4 Sep 2024 13:20:15 +0000 (16:20 +0300)
committerAlexander Popov <alex.popov@linux.com>
Wed, 4 Sep 2024 13:20:15 +0000 (16:20 +0300)
kernel_hardening_checker/__init__.py

index 2f70b4cc5b02726e65377a891cdf69521c52b3a0..e0f1c97a94e79767b4f840ec18772484132dc5a4 100755 (executable)
@@ -206,7 +206,7 @@ def parse_sysctl_file(mode: StrOrNone, parsed_options: Dict[str, str], fname: st
         sys.exit(f'[!] ERROR: unable to open {fname}, are you sure it exists?')
 
     with open(fname, 'r', encoding='utf-8') as f:
-        sysctl_pattern = re.compile(r"[a-zA-Z0-9/\._-]+ =.*$")
+        sysctl_pattern = re.compile(r"[a-zA-Z0-9/\._-]+ ?=.*$")
         for line in f.readlines():
             line = line.strip()
             if not sysctl_pattern.match(line):