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

Fixes to ElasticSearch's startup and VirusTotal reporting #206

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

LM-CT
Copy link

@LM-CT LM-CT commented Mar 17, 2025

Description

This PR fixes 3 issues I have encountered. They are:

  • Cuckoo not starting due to ElasticSearch being running, but not actually up yet.
  • Failures to startup Cuckoo when the local ElasticSearch is not using TLS.
  • The reporting module for VirusTotal failing to display results in the web.

For the first two, my changes delay Cuckoo3's startup by up to 60 seconds to give time for ElasticSearch to be fully functional and check if the first ElasticSearch endpoint in the config is using HTTPS as a transport, respectively.

For the latter, the vt library that is used to query VirusTotal changed the returned results class wrapper, so I added an additional check before serialising the returned object to disk.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Tried unsuccessfully to start Cuckoo3 a bunch of times after pulling the latest updates.
  • Debugged the errors and made live-changes in prod until it started.
  • Debugged the errors in the reporting causing it to go HTTP 500 and confirmed, by disabling the module, that this was caused by problems with jinja parsing VirusTotal results on disk.
  • Changed the serialize_disk_json() function from strictcontainer.py to take into account the new return class (WhistleBlowerDict) of the object, re-enabled the VT processor module and tested a bunch of files (known-good and known-bad) in Cuckoo to see if it would fail again.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have docstrings in all functions, classes and methods
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have made only one pull request for this issue
  • I have separated testing and production environments

@cert-ee-raidar cert-ee-raidar self-requested a review March 18, 2025 04:37
@cert-ee-raidar cert-ee-raidar self-assigned this Mar 18, 2025
@cert-ee-raidar cert-ee-raidar added bug Something isn't working enhancement New feature or request labels Mar 18, 2025
Comment on lines +102 to +117
log.debug("Connecting to Elasticsearch.")
if self.client.ping():
verified = True
failures = 0
else:
verified = False
failures = 1

while not verified and failures < 6:
time.sleep(10)
if not self.client.ping():
failures += 1
else:
verified = True

if not verified:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already discussed this privately, but I'll try to re implement this using async methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants