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

add_process_metadata: enrich process info with process owner (#21068) #21111

Merged
merged 6 commits into from
Jul 19, 2021

Conversation

dddpaul
Copy link
Contributor

@dddpaul dddpaul commented Sep 16, 2020

Type: Enhancement

What does this PR do?

Enrich process metadata with process owner info.

Why is it important?

It's quite useful to know process owner, to control traffic, for example.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • [ ]

How to test this PR locally

  1. Run packetbeat with simply config:
processors:
  - add_process_metadata:
      match_pids: [process.pid]
  1. Exec some curl http://example.comfrom commandline

  2. Flow type event will be enriched with process.username

Related issues

Use cases

Screenshots

Logs

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

1 similar comment
@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 16, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/siem (Team:SIEM)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Sep 16, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented Sep 16, 2020

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-07-15T13:44:42.696+0000

  • Duration: 135 min 22 sec

  • Commit: 06aa7b2

Test stats 🧪

Test Results
Failed 0
Passed 49269
Skipped 5396
Total 54665

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 49269
Skipped 5396
Total 54665

@adriansr adriansr self-requested a review September 16, 2020 10:09
@adriansr
Copy link
Contributor

jenkins run the tests please

Copy link
Contributor

@adriansr adriansr left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

In addition to the comments I left, I think it's necessary to change the title/description of this PR. This isn't actually changing anything in Packetbeat, but updating the add_process_metadata processor to add an username field.

Also, it needs an entry in the CHANGELOG.next.asciidoc file, under Added > Affecting all Beats, so that users know about the new field.

@dddpaul dddpaul changed the title Packetbeat: enrich process info with process owner (#21068) add_process_metadata: enrich process info with process owner (#21068) Sep 28, 2020
@dddpaul dddpaul requested a review from adriansr October 8, 2020 18:37
@dddpaul
Copy link
Contributor Author

dddpaul commented Oct 29, 2020

Hi. I do not understand, what's next requirements? I've resolved all issues.

@dddpaul
Copy link
Contributor Author

dddpaul commented Nov 6, 2020

@adriansr Hi, could you review again please?

@adriansr
Copy link
Contributor

adriansr commented Nov 6, 2020

jenkins run tests

@elasticmachine
Copy link
Collaborator

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 16400
Skipped 1342
Total 17742

Copy link
Contributor

@adriansr adriansr left a comment

Choose a reason for hiding this comment

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

Apart from the CHANGELOG issue, we're discussing a possible rename of the field process.username to align with the Elastic Common Schema.

@@ -21,6 +21,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Remove the deprecated `xpack.monitoring.*` settings. Going forward only `monitoring.*` settings may be used. {issue}9424[9424] {pull}18608[18608]
- Added `certificate` TLS verification mode to ignore server name mismatch. {issue}12283[12283] {pull}20293[20293]
- Autodiscover doesn't generate any configuration when a variable is missing. Previously it generated an incomplete configuration. {pull}20898[20898]
- `AddProcessMetadata` processor enrich process information with owner name. {issue}21068[21068] {pull}21111[21111]
Copy link
Contributor

Choose a reason for hiding this comment

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

This is in the wrong section, Breaking changes. It should be under Added > Affecting All Beats.

Copy link
Contributor Author

@dddpaul dddpaul Nov 10, 2020

Choose a reason for hiding this comment

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

@adriansr I've placed this line to proper section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you think is the proper field name for process owner? The options as I can see are:
process.username
process.owner
process.owner_name

Or process.owner should be an object with it's own fields?
process.owner.uid
process.owner.name
...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @dddpaul, we're still trying to figure out what makes more sense for this use case.

At some point, process.user.* made it into ECS, but then it was reverted. See this comment.
So to align with ECS, we could do two things:

  1. Add user information to the top-level user object.
  2. Add a custom object under process. For example owner.

The first makes more sense, but at the same time is more risky for a processor, as this will cause the processor execution to fail if the input document already contains a user.name or user.id. If overwrite_keys is set, then it will silently overwrite those keys, potentially breaking existing pipelines.

Copy link
Member

Choose a reason for hiding this comment

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

As a general purpose processor I think it lacks the context to know if setting a ^user is the correct thing to do. So setting a key(s) under process is the safest thing to do and what I would most expect as a user.

Another alternative would be to offer an addition target_owner config option that indicates where (or if) process owner info is added to the event. The registered_domain and translate_sid processors take an approach like this.

@dddpaul
Copy link
Contributor Author

dddpaul commented Dec 6, 2020

Hi, @adriansr what's next steps?

@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@adriansr
Copy link
Contributor

adriansr commented Jul 9, 2021

Hi @dddpaul , I know this has been open for a long time, sorry about that. We are reviewing it.

@dddpaul dddpaul requested a review from a team as a code owner July 15, 2021 08:37
@mergify
Copy link
Contributor

mergify bot commented Jul 15, 2021

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b feat/process_owner upstream/feat/process_owner
git merge upstream/master
git push upstream feat/process_owner

@adriansr
Copy link
Contributor

/test

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

LGTM

@adriansr adriansr merged commit 16e2989 into elastic:master Jul 19, 2021
mdelapenya added a commit to mdelapenya/beats that referenced this pull request Jul 20, 2021
* master:
  Forward port 7.13.4 to master (elastic#26971)
  Use MustAddMetricSet in all metricsets (elastic#26907)
  add_process_metadata: enrich process info with process owner (elastic#21068) (elastic#21111)
  Use aws sdk paginator for FilterLogEvents and GetMetricData (elastic#26852)
  [Filebeat] Allow - for source IP for AWS S3 Access pipeline (elastic#26940)
  Increase timeout to 30secs (elastic#26841)
  Add Cluster filter on Kubernetes Overview ECS dashboard (elastic#26919)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Packetbeat: enrich process info with process owner
5 participants