From: Alexander Popov Date: Wed, 4 Sep 2024 13:38:06 +0000 (+0300) Subject: sysctl parsing: change parsing errors to warnings and improve the messages X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fsysctl-fixes;p=kconfig-hardened-check.git sysctl parsing: change parsing errors to warnings and improve the messages --- diff --git a/kernel_hardening_checker/__init__.py b/kernel_hardening_checker/__init__.py index 4fe2ef2..c3bb75f 100755 --- a/kernel_hardening_checker/__init__.py +++ b/kernel_hardening_checker/__init__.py @@ -222,11 +222,11 @@ def parse_sysctl_file(mode: StrOrNone, parsed_options: Dict[str, str], fname: st # let's check the presence of some ancient sysctl option # to ensure that we are parsing the output of `sudo sysctl -a > file` if 'kernel.printk' not in parsed_options: - sys.exit(f'[!] ERROR: {fname} doesn\'t look like a sysctl output file, please try `sudo sysctl -a > {fname}`') + print(f'[!] WARNING: ancient sysctl options are not found in {fname}, please use the output of `sudo sysctl -a`') # let's check the presence of a sysctl option available for root if 'kernel.cad_pid' not in parsed_options and mode != 'json': - print(f'[!] WARNING: sysctl option "kernel.cad_pid" available for root is not found in {fname}, please try `sudo sysctl -a > {fname}`') + print(f'[!] WARNING: sysctl options available for root are not found in {fname}, please use the output of `sudo sysctl -a`') def main() -> None: