Skip to content

Commit 6bd7090

Browse files
authored
Stop running auditbeat container as root by default (#21202)
Stop running Auditbeat container as root by default. After this change, when user root is required it will need to be explicitly set on runtime. This is already done in Kubernetes manifests and some other examples in the documentation, so change is probably not so breaking. Also `USER root` is usually not enough to be fully privileged, so some customization was always expected when running Auditbeat on docker.
1 parent 0c8f82b commit 6bd7090

5 files changed

Lines changed: 4 additions & 4 deletions

File tree

CHANGELOG.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
2828
- File integrity dataset (macOS): Replace unnecessary `file.origin.raw` (type keyword) with `file.origin.text` (type `text`). {issue}12423[12423] {pull}15630[15630]
2929
- Change event.kind=error to event.kind=event to comply with ECS. {issue}18870[18870] {pull}20685[20685]
3030
- Change network.direction values to ECS recommended values (inbound, outbound). {issue}12445[12445] {pull}20695[20695]
31+
- Docker container needs to be explicitly run as user root for auditing. {pull}21202[21202]
3132

3233
*Filebeat*
3334

auditbeat/docs/running-on-docker.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ It is also essential to run {beatname_uc} in the host PID namespace.
1010

1111
["source","sh",subs="attributes"]
1212
----
13-
docker run --cap-add=AUDIT_CONTROL,AUDIT_READ --pid=host {dockerimage}
13+
docker run --cap-add=AUDIT_CONTROL --cap-add=AUDIT_READ --user=root --pid=host {dockerimage}
1414
----

auditbeat/magefile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func Package() {
9292

9393
// TestPackages tests the generated packages (i.e. file modes, owners, groups).
9494
func TestPackages() error {
95-
return devtools.TestPackages(devtools.WithRootUserContainer())
95+
return devtools.TestPackages()
9696
}
9797

9898
// Update is an alias for running fields, dashboards, config, includes.

auditbeat/scripts/mage/package.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ func CustomizePackaging(pkgFlavor PackagingFlavor) {
9595
args.Spec.ReplaceFile("/etc/{{.BeatName}}/{{.BeatName}}.reference.yml", referenceConfig)
9696
sampleRulesTarget = "/etc/{{.BeatName}}/" + defaultSampleRulesTarget
9797
case devtools.Docker:
98-
args.Spec.ExtraVar("user", "root")
9998
default:
10099
panic(errors.Errorf("unhandled package type: %v", pkgType))
101100
}

x-pack/auditbeat/magefile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func Package() {
8484

8585
// TestPackages tests the generated packages (i.e. file modes, owners, groups).
8686
func TestPackages() error {
87-
return devtools.TestPackages(devtools.WithRootUserContainer())
87+
return devtools.TestPackages()
8888
}
8989

9090
// Update is an alias for running fields, dashboards, config.

0 commit comments

Comments
 (0)