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

Added an event for default rule "Detect crypto miners using the Stratum protocol" #173

Conversation

GLVSKiriti
Copy link
Contributor

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind documentation

/kind tests

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area commands

/area pkg

/area events

What this PR does / why we need it:
Added an event for default rule "Detect crypto miners using the Stratum protocol" as mentioned here

Which issue(s) this PR fixes:

Fixes #172

Special notes for your reviewer:

@GLVSKiriti
Copy link
Contributor Author

As expected on executing event code it produces the critical priority log by triggering the rule on left terminal and test is also successful!

CryptominerusingstratumProtovol

@GLVSKiriti
Copy link
Contributor Author

@FedeDP What is your feedback on this approach? 👀

Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

Love this!
/approve

// minersoftware -o stratum+tcp://example.com:3333 -u username -p password
// However, for testing purposes, we're using 'ls' as a placeholder.
cmd := exec.Command("ls", "-o stratum+tcp", "-u user", "-p pass")
cmd.Run()
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, can we return cmd.Run instead of throwing its return error away?

Copy link
Contributor Author

@GLVSKiriti GLVSKiriti Apr 3, 2024

Choose a reason for hiding this comment

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

@FedeDP cmd := exec.Command("ls", "-o stratum+tcp", "-u user", "-p pass")

cmd.Run() always throws an error because this command fails every time.

If we return error then test wont pass due to error even still the rule triggers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Irrespective of whether ls command fails or not the rule gets triggered. So there is no need to return the error

Copy link
Contributor

Choose a reason for hiding this comment

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

Uh i see, you are right! Thank you!

Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

Let's return the Run error

@poiana poiana removed the lgtm label Apr 3, 2024
@poiana poiana requested a review from FedeDP April 3, 2024 07:08
@poiana poiana removed the approved label Apr 3, 2024
Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

/approve

@poiana poiana added the lgtm label Apr 3, 2024
@poiana
Copy link

poiana commented Apr 3, 2024

LGTM label has been added.

Git tree hash: cc42c71b6599b05933b0c355e9ace63cdc8bd25f

@poiana
Copy link

poiana commented Apr 3, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, GLVSKiriti

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana added the approved label Apr 3, 2024
@poiana poiana merged commit 34fb4c3 into falcosecurity:main Apr 3, 2024
4 checks passed
@GLVSKiriti GLVSKiriti deleted the DetectCryptoMinersUsingTheStratumProtocol branch April 3, 2024 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an event for default rule "Detect crypto miners using the Stratum protocol"
3 participants