Open lsedlacik opened 2 days ago
hi @lsedlacik
Thank you for taking the time to feedback on this issue. I have rewritten to capture different solutions. This now works with the sudoers example you provided as well as the one set if using the remediation playbook. I have created a new branch issue_39 which i hope resolves the issue you have rightly highlighted.
many thanks
uk-bolly
Describe the Issue The regular expression checking validity of
logfile
value in sudo configuration,'^Defaults logfile=/var/log/*.log'
is woefully insufficient, it doesn't even match the value set by UBUNTU22-CIS remediation playbook (code from the latest release1.4.1
): https://github.com/ansible-lockdown/UBUNTU22-CIS/blob/89821b87ed07712e611cf975757d7c4cdda06e1e/tasks/section_5/cis_5.3.x.yml#L33generates the following line:
Expected Behavior
/etc/sudoers
should have 1 match.Actual Behavior
Control(s) Affected CIS 5.3.3
Environment (please complete the following information):
Additional Notes This got uncovered by merging fix for https://github.com/ansible-lockdown/UBUNTU22-CIS-Audit/issues/36
Possible Solution The regular expression needs to be expanded to match at least the basic format allowed by sudoers(5), and definitely match what the remediation playbook sets.
Suggested regex as a starting point, that keeps the original intention and allows for setting flags or more detailed Defaults, double quotes around the filename, and correctly matches file name wildcard:
It should match the value set by remediation playbook, the example from sudoers(5), etc.