-
Notifications
You must be signed in to change notification settings - Fork 71
Improve ApachePlugin log file discovery #980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve ApachePlugin log file discovery #980
Conversation
9a74e80 to
8191b9b
Compare
|
Could this issue be assigned a reviewer @EinatFox? This PR should improve log file detection for the Apache plugin significantly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This pull request improves ApachePlugin log file discovery by enhancing configuration file parsing, including support for processing Include/IncludeOptional directives and substituting Apache environment variables within log file paths.
- Parses Include and IncludeOptional directives in Apache configuration files
- Substitutes Apache envvars in log file locations
- Updates test cases and refactors plugin initialization and log discovery routines
Reviewed Changes
| File | Description |
|---|---|
| tests/plugins/apps/webserver/test_apache.py | Adjusted tests to use the new plugin registration and log discovery |
| dissect/target/plugins/apps/webserver/apache.py | Refactored log discovery logic and added environment variable support |
| tests/plugins/apps/webserver/test_citrix.py | Updated test to verify unsupported plugin registration for Citrix |
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
dissect/target/plugins/apps/webserver/apache.py:409
- The word 'occured' is misspelled; consider using 'occurred'.
self.target.log.warning("An error occured parsing Apache log file %s: %s", path, str(e))
|
The tests |
|
It seems like some form of plugin caching is interfering with the tests here. We have ruled out object bleeding by switching to a factory in 8e127b8. If we make the We can refactor the Apache plugin to prevent this situation from happening, however this seems like a dissect caching bug to us. def _process_conf_file(self, path: Path, seen: set[Path] | None = set()) -> None:
"""Process an Apache ``.conf`` file for ``ServerRoot``, ``CustomLog``, ``Include``
and ``OptionalInclude`` directives. Populates ``self.access_paths`` and ``self.error_paths``.
"""
self.target.log.warning("Parsing %s", path)
self.target.log.warning("Current seen %s", seen)Explicitly setting the |
Schamper
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment, I think this makes the change to a factory redundant.
Co-authored-by: Erik Schamper <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #980 +/- ##
=======================================
Coverage 79.10% 79.11%
=======================================
Files 341 341
Lines 30091 30155 +64
=======================================
+ Hits 23804 23856 +52
- Misses 6287 6299 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Erik Schamper <[email protected]>
Co-authored-by: Erik Schamper <[email protected]>
|
Is this PR good to go? We have another PR ready that depends on this branch :) |
This PR improves the log file discovery of the ApachePlugin on targets.
IncludeandIncludeOptionaldirectives in all apache.conffiles (mods, sites and confs) and extractErrorLogandCustomLogfrom those configuration files.envvarsfrom those log file location directives (e.g.${APACHE_LOG_DIR}).Fixes #1013.