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

adding an event for modifying shell configuration file #110

Merged
merged 5 commits into from
Apr 2, 2024

Conversation

h4l0gen
Copy link
Contributor

@h4l0gen h4l0gen commented Mar 15, 2024

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:
this PR trigger rule modify shell configuration file
Which issue(s) this PR fixes:

Fixes #107

Special notes for your reviewer:

@poiana poiana requested a review from FedeDP March 15, 2024 06:27
@poiana poiana requested a review from leogr March 15, 2024 06:27
@poiana poiana added the size/M label Mar 15, 2024
@h4l0gen h4l0gen changed the title adding an event for modifying shell configuration file wip: adding an event for modifying shell configuration file Mar 16, 2024
@h4l0gen
Copy link
Contributor Author

h4l0gen commented Mar 29, 2024

@FedeDP this rule is triggered successfully. It is modifying .bashrc file by just adding a comment which is clearly specified that it is written by event-generator without giving harm to other file content.

image

@FedeDP
Copy link
Contributor

FedeDP commented Mar 29, 2024

Once again, I'd avoid touching user configuration files even if it has no side effects nor harm.
I'd prefer to create a /tmp/.bashrc and modify it. I think it should still trigger the rule!

@h4l0gen
Copy link
Contributor Author

h4l0gen commented Mar 29, 2024

Yes @FedeDP It should trigger rule. Thanks for advice, I will make changes.

return err
}

configFile := filepath.Join(homeDir, ".bashrc")
Copy link
Contributor

Choose a reason for hiding this comment

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

We are still modifying $HOME/.bashrc here right?

@h4l0gen
Copy link
Contributor Author

h4l0gen commented Apr 2, 2024

@FedeDP changes are done. And as expected rule triggered successfully
Screenshot from 2024-04-02 12-57-22
and .bashrc file is also modified

@h4l0gen h4l0gen requested a review from FedeDP April 2, 2024 07:32

// Modify the file
content := []byte("# written by event-generator\n")
err = os.WriteFile(tmpConfigFile, content, 0644)
Copy link
Contributor

Choose a reason for hiding this comment

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

os.WriteFile already creates the file for us !
Thus we can skip the file creation step ;)

@h4l0gen h4l0gen requested a review from FedeDP April 2, 2024 07:51
@FedeDP FedeDP changed the title wip: adding an event for modifying shell configuration file adding an event for modifying shell configuration file Apr 2, 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 2, 2024
@poiana
Copy link

poiana commented Apr 2, 2024

LGTM label has been added.

Git tree hash: 5319889a0e74ef4c74a9f874d91885d3c10cc59d

@poiana
Copy link

poiana commented Apr 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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 2, 2024
@poiana poiana merged commit 767157d into falcosecurity:main Apr 2, 2024
4 checks passed
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.

event on modify shell configuration file
3 participants