Skip to content

Commit

Permalink
packetbeat/beater: make sure Npcap installation runs before interface…
Browse files Browse the repository at this point in the history
…s are needed in all cases (#30438)

This is a second attempt to ensure that Npcap is correctly installed; running
packetbeat managed by elastic-agent appears to have a different code path to
that when running vanilla packetbeat and does not execute Create in time (at
all?) to have the installer run. So move the installNpcap call to the earliest
time we have all the needed information to ensure that the library is installed
by the time that it is needed.

(cherry picked from commit 2a181e0)
  • Loading branch information
efd6 authored and mergify-bot committed Feb 18, 2022
1 parent 7829fd3 commit 42d726e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d

*Packetbeat*

- Add automated OEM Npcap installation handling. {pull}29112[29112] {pull}30396[30396]
- Add automated OEM Npcap installation handling. {pull}29112[29112] {pull}30438[30438]
- Add support for capturing TLS random number and OCSP status request details. {issue}29962[29962] {pull}30102[30102]

*Functionbeat*
Expand Down
6 changes: 6 additions & 0 deletions packetbeat/beater/packetbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ func New(b *beat.Beat, rawConfig *common.Config) (beat.Beater, error) {
return nil, err
}

// Install Npcap if needed.
err := installNpcap(b)
if err != nil {
return nil, err
}

return &packetbeat{
config: rawConfig,
factory: factory,
Expand Down
6 changes: 0 additions & 6 deletions packetbeat/beater/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@ func (p *processorFactory) Create(pipeline beat.PipelineConnector, cfg *common.C
return nil, err
}

// Install Npcap if needed.
err = installNpcap(p.beat)
if err != nil {
return nil, err
}

publisher, err := publish.NewTransactionPublisher(
p.beat.Info.Name,
p.beat.Publisher,
Expand Down

0 comments on commit 42d726e

Please sign in to comment.