From f2af58db475666144130382d39c071fac811fdf3 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Wed, 4 Sep 2024 16:38:06 +0300 Subject: [PATCH] sysctl parsing: change parsing errors to warnings and improve the messages --- kernel_hardening_checker/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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: -- 2.31.1