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

feat(sensor_download): adds lock files to prevent collision when downloading similar sensors #569

Merged

Conversation

carlosmmatos
Copy link
Contributor

Closes #567

This feature allows multiple hosts downloading the same file to not overstep on each other as was the case before. This route improves overall download times as the module will only download a sensor at most once (assuming uniqueness) while other systems wait.

On top of that - added sane defaults (#567) for download directories to ensure we aren't creating unnecessary directories on multiple runs when a failure might occur.

The reason for the module updates is that after additional testing when implementing the same dest dir - I noticed that each system was trying to download the same file at the same time, causing no visible improvement in time for instances where there are a large amount of hosts.

Fixes CrowdStrike#567

This PR fixes potential speed issues when working with large amounts of
hosts because for each host, it used to create a temp directory and
download the sensor. This of course is not very efficient, thus by
specifying a default such as /tmp - this should speed up download times
as hosts with the same sensor will not have to re-download every time.
This fixes an issue that will cause operations like copying the sensor
to create a new temp directory on the target host everytime it runs. For
example, in scenarios where something happens before the sensor is
cleaned, then running the role again will cause a new directory and
another full copy operation instead of checking to see if the sensor is
already copied.
…ision

This feature allows multiple hosts downloading the same file to not
overstep on each other as was the case before. This route improves
overall download times as the module will only download a sensor at most
once (assuming uniqueness) while other systems wait.
TBD - consider making this an option in the future?
@carlosmmatos carlosmmatos added bugfixes Bug fixes or minor enhancements enhancement New feature or request minor_changes New features, like plugin or module options labels Oct 22, 2024
@carlosmmatos carlosmmatos added this to the 4.7.0 milestone Oct 22, 2024
@carlosmmatos carlosmmatos self-assigned this Oct 22, 2024
@carlosmmatos carlosmmatos added the ok-to-test Run tests label Oct 22, 2024
The win_file module does not return a path attribute. Instead of using
path, we'll just the variable instead as this is the path.
To prevent thundering herd!
@carlosmmatos carlosmmatos added ok-to-test Run tests and removed ok-to-test Run tests labels Oct 22, 2024
@carlosmmatos carlosmmatos added ok-to-test Run tests and removed ok-to-test Run tests labels Oct 22, 2024
@carlosmmatos carlosmmatos added ok-to-test Run tests and removed ok-to-test Run tests labels Oct 22, 2024
@carlosmmatos carlosmmatos added ok-to-test Run tests and removed ok-to-test Run tests labels Oct 22, 2024
Explain that a 0-byte lock file is created and can be safely deleted
The refactoring was not needed and this makes more sense from an
organizational perspective.
@carlosmmatos carlosmmatos merged commit aa8d278 into CrowdStrike:main Oct 23, 2024
6 checks passed
@carlosmmatos carlosmmatos deleted the add-lock-mechanism-sensor-download branch October 23, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfixes Bug fixes or minor enhancements enhancement New feature or request minor_changes New features, like plugin or module options ok-to-test Run tests
Projects
None yet
2 participants