Update audit scripts for find log_file in file /etc/audit/auditd.conf#321
Open
mojtabatavakolzadeh wants to merge 1 commit intoovh:masterfrom
Open
Update audit scripts for find log_file in file /etc/audit/auditd.conf#321mojtabatavakolzadeh wants to merge 1 commit intoovh:masterfrom
mojtabatavakolzadeh wants to merge 1 commit intoovh:masterfrom
Conversation
Contributor
|
Hi @mojtabatavakolzadeh , thank you for your contribution. Could you please add a test case with space in configuration, in the adequat tests ? https://github.com/ovh/debian-cis/tree/master/tests/hardening So we ensure we wont have this issue back in the future |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes incorrect handling of the log_file directive from /etc/audit/auditd.conf in the following hardening scripts:
The original implementations fail when whitespace appears around the = sign in the configuration file, producing invalid paths and causing the checks to fail even on correctly configured systems.
Problem Description
Several scripts extract the audit log path using:
This approach preserves leading whitespace. When auditd.conf contains:
the extracted value becomes:
As a result:
dirname returns ' /var/log/audit' (with leading space)
stat and find operate on a non-existent path
Scripts fail with errors such as: