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

x-pack/packetbeat: install Npcap at start-up when required #29112

Merged
merged 32 commits into from
Jan 27, 2022

Conversation

efd6
Copy link
Contributor

@efd6 efd6 commented Nov 23, 2021

What does this PR do?

This adds hooks to the startup of packetbeat that installs/updates the Elastic OEM-licensed Npcap library.

Why is it important?

See elastic/integrations#2132.

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.

Integration testing depends on infrastructure that does not yet exist so packetbeat integration tests are expected to fail on Windows. Without an embedded artifact x-pack packetbeat now silently continues.

Author's Checklist

N/A

How to test this PR locally

Run go test in packetbeat/internal/npcap on Windows.

Related issues

Use cases

See elastic/integrations#2132.

Screenshots

N/A

Logs

N/A

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Nov 23, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Nov 24, 2021

💚 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: 2022-01-26T23:55:31.363+0000

  • Duration: 217 min 2 sec

  • Commit: 460a80a

Test stats 🧪

Test Results
Failed 0
Passed 47977
Skipped 4285
Total 52262

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@efd6 efd6 force-pushed the npcap/installer branch 5 times, most recently from 785cbf3 to cf07d80 Compare November 24, 2021 22:56
@efd6 efd6 marked this pull request as ready for review November 25, 2021 01:52
@efd6 efd6 requested a review from a team as a code owner November 25, 2021 01:52
@elasticmachine
Copy link
Collaborator

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

@efd6
Copy link
Contributor Author

efd6 commented Dec 2, 2021

E2E failure looks unrelated.

@efd6
Copy link
Contributor Author

efd6 commented Dec 3, 2021

/test

@mergify
Copy link
Contributor

mergify bot commented Dec 6, 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 npcap/installer upstream/npcap/installer
git merge upstream/master
git push upstream npcap/installer

@efd6 efd6 force-pushed the npcap/installer branch 3 times, most recently from a1e8d80 to 32d89dd Compare December 6, 2021 23:15
@efd6
Copy link
Contributor Author

efd6 commented Dec 6, 2021

I have disentangled and rolled back the license additions to add in a non-technical PR (to come).

@efd6 efd6 changed the title packetbeat: add npcap installer hooks x-pack/packetbeat: install Npcap at start-up when required Dec 6, 2021
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.

Nice work

packetbeat/_meta/config/beat.yml.tmpl Outdated Show resolved Hide resolved
packetbeat/beater/install_npcap.go Outdated Show resolved Hide resolved
x-pack/packetbeat/npcap/installer/README Outdated Show resolved Hide resolved
x-pack/packetbeat/npcap/installer/README Outdated Show resolved Hide resolved
packetbeat/npcap/npcap.go Outdated Show resolved Hide resolved
packetbeat/npcap/npcap.go Outdated Show resolved Hide resolved
@efd6
Copy link
Contributor Author

efd6 commented Jan 26, 2022

/test

@v1v
Copy link
Member

v1v commented Jan 26, 2022

As far as I see the packetbeat stage used the npcap docker image, is that expected? Or it's only enabled for x-pack/packetbeat?

image

https://beats-ci.elastic.co/blue/organizations/jenkins/Beats%2Fbeats%2FPR-29112/detail/PR-29112/68/pipeline/36618#step-36979-log-182

@efd6
Copy link
Contributor Author

efd6 commented Jan 26, 2022

Yes that's expected. The image is the same, but the installer asset is only copied to the build tree in the x-pack builds. It can be made to only be used in the x-pack build at the cost of some code duplication.

Jenkinsfile Outdated Show resolved Hide resolved
@efd6 efd6 requested a review from andrewkroh January 27, 2022 03:33
@efd6 efd6 merged commit 72a43be into elastic:master Jan 27, 2022
@efd6 efd6 deleted the npcap/installer branch January 27, 2022 05:17
mergify bot pushed a commit that referenced this pull request Jan 27, 2022
This add automated installation of an OEM Npcap provided by embedding in the
packetbeat executable. The installation is configurable to allow users to retain
their own version of Npcap if they have one and to specify the location of the
install. To simplify support this configurablity will not be included in the
next release, but is comitted here to allow it to be reverted back out to make it
easier to add if the decision is made to do that later.

(cherry picked from commit 72a43be)

# Conflicts:
#	go.mod
yashtewari pushed a commit to build-security/beats that referenced this pull request Jan 30, 2022
…9112)

This add automated installation of an OEM Npcap provided by embedding in the
packetbeat executable. The installation is configurable to allow users to retain
their own version of Npcap if they have one and to specify the location of the
install. To simplify support this configurablity will not be included in the
next release, but is comitted here to allow it to be reverted back out to make it
easier to add if the decision is made to do that later.
v1v added a commit to v1v/beats that referenced this pull request Jan 31, 2022
…k-version-after-8-0-creation

* upstream/master: (69 commits)
  Update stale config following (elastic#30082)
  Make include_matches backwards compatible with 7.x config (elastic#30032)
  [Filebeat] Update handling of elasticsearch server logs (elastic#30018)
  Remove SSL3 support from libbeat and its documentation. (elastic#30071)
  Revert "Packaging: rename arm64 suffix to aarch64 in the tar.gz artifacts ONLY (elastic#28813)" (elastic#30083)
  [libbeat] Add script processor to all beats (elastic#29752)
  Add fonts to support more different types of characters for multiple languages (elastic#29861)
  libbeat/reader: Fix messge conversion to beat.Event (elastic#30057)
  probot[stale]: ignore issues with the tag flaky-test (elastic#30065)
  [DOCS] Add redirect for GSuite module (elastic#30034)
  [Automation] Update elastic stack version to 8.1.0-aa69d697 for testing (elastic#30012)
  Remove msitools install for windows build, using the latest docker image with msitools preinstalled (elastic#30040)
  filebeat/generator/fields: fix dropped error (elastic#29943)
  Include the error message with auditd module events (elastic#30009)
  [Metricbeat] gcp: add firestore metricset (elastic#29918)
  probot: update stale dates (elastic#29997)
  Metricbeat enterprise search module: add xpack.enabled support (elastic#29871)
  x-pack/packetbeat: install Npcap at start-up when required (elastic#29112)
  [Filebeat] Fix panic in decode_cef when recovering from invalid data (elastic#30038)
  Correctly fixe how selected packages are defined (elastic#30039)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.1-candidate backport-v8.0.0 Automated backport with mergify enhancement Packetbeat Team:Automation Label for the Observability productivity team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants