Skip to content

Commit

Permalink
Remove broken options runoptions.uid and runoptions.gid (elastic#5261) (
Browse files Browse the repository at this point in the history
elastic#5309)

These were meant to allow dropping privileges in Packetbeat, but they no longer
worked for a good while (since Golang 1.4). As shown in elastic#3542, a better way
of running Packetbeat as a non-root user is to use capabilities:

    setcap cap_net_raw,cap_net_admin=eip packetbeat

Closes elastic#3542.

(cherry picked from commit 7fd75b5)
  • Loading branch information
tsg authored and ruflin committed Oct 4, 2017
1 parent 6cc71cc commit 637f0f3
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 92 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ https://github.com/elastic/beats/compare/v6.0.0-rc1...master[Check the HEAD diff

*Packetbeat*

- Remove not-working `runoptions.uid` and `runoptions.gid` options in Packetbeat. {pull}5261[5261]

*Winlogbeat*

==== Bugfixes
Expand Down
41 changes: 0 additions & 41 deletions libbeat/common/droppriv/droppriv_unix.go

This file was deleted.

17 changes: 0 additions & 17 deletions libbeat/common/droppriv/droppriv_windows.go

This file was deleted.

6 changes: 0 additions & 6 deletions packetbeat/beater/packetbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/elastic/beats/libbeat/beat"
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/common/droppriv"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/libbeat/processors"
"github.com/elastic/beats/libbeat/service"
Expand Down Expand Up @@ -177,11 +176,6 @@ func (pb *packetbeat) Run(b *beat.Beat) error {
}
}()

// This needs to be after the sniffer Init but before the sniffer Run.
if err := droppriv.DropPrivileges(pb.config.RunOptions); err != nil {
return err
}

defer pb.transPub.Stop()
if pb.flows != nil {
pb.flows.Start()
Expand Down
2 changes: 0 additions & 2 deletions packetbeat/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"time"

"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/common/droppriv"
"github.com/elastic/beats/libbeat/processors"
"github.com/elastic/beats/packetbeat/procs"
)
Expand All @@ -17,7 +16,6 @@ type Config struct {
Procs procs.ProcsConfig `config:"procs"`
IgnoreOutgoing bool `config:"ignore_outgoing"`
ShutdownTimeout time.Duration `config:"shutdown_timeout"`
RunOptions droppriv.RunOptions
}

type InterfacesConfig struct {
Expand Down
3 changes: 0 additions & 3 deletions packetbeat/docs/configuring-howto.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ The following topics describe how to configure Packetbeat:
* <<configuration-dashboards>>
* <<configuration-template>>
* <<configuration-logging>>
* <<configuration-run-options>>
* <<using-environ-vars>>
* <<yaml-tips>>

Expand Down Expand Up @@ -63,8 +62,6 @@ include::../../libbeat/docs/setup-config.asciidoc[]

include::../../libbeat/docs/loggingconfig.asciidoc[]

include::./runconfig.asciidoc[]

:standalone:
include::../../libbeat/docs/shared-env-vars.asciidoc[]

Expand Down
23 changes: 0 additions & 23 deletions packetbeat/docs/runconfig.asciidoc

This file was deleted.

0 comments on commit 637f0f3

Please sign in to comment.