Skip to content
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

Delete old malware rules files from /var/tmp as well #3625

Merged
merged 1 commit into from
Dec 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion insights/client/apps/malware_detection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,9 @@ def _get_rules(self):
# malware-detection client exits.
# However it can happen that the rules file isn't removed for some reason, so remove any existing
# rules files before beginning a new scan, otherwise they may show up as matches in the scan results.
old_rules_files = glob('/tmp/.tmpmdsigs*') + glob('/tmp/tmp_malware-detection-client_rules.*')
old_rules_files = sum([glob(os.path.join(path, rules))
for path in ('/tmp', '/var/tmp')
for rules in ('.tmpmdsigs*', 'tmp_malware-detection-client_rules.*')], [])
for old_rules_file in old_rules_files:
logger.debug("Removing old rules file %s", old_rules_file)
os.remove(old_rules_file)
Expand Down