Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions auditbeat/module/file_integrity/ebpfreader_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

//go:build linux && !(amd64 || arm64)

package file_integrity

import (
"errors"

"github.com/elastic/elastic-agent-libs/logp"
)

func newEBPFReader(c Config, l *logp.Logger) (EventProducer, error) {
return nil, errors.New("ebpf reader is not implemented on this system")
}
37 changes: 37 additions & 0 deletions auditbeat/module/file_integrity/ebpfreader_supported.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

//go:build linux && (amd64 || arm64)

package file_integrity

import "github.com/elastic/elastic-agent-libs/logp"

func newEBPFReader(c Config, l *logp.Logger) (EventProducer, error) {
paths := make(map[string]struct{})
for _, p := range c.Paths {
paths[p] = struct{}{}
}

return &ebpfReader{
config: c,
log: l,
parsers: FileParsers(c),
paths: paths,
eventC: make(chan Event),
}, nil
}
2 changes: 1 addition & 1 deletion auditbeat/module/file_integrity/eventreader_ebpf.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build linux
//go:build linux && (amd64 || arm64)

package file_integrity

Expand Down
13 changes: 1 addition & 12 deletions auditbeat/module/file_integrity/eventreader_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,7 @@ func NewEventReader(c Config, logger *logp.Logger) (EventProducer, error) {
l := logger.Named("ebpf")
l.Info("selected backend: ebpf")

paths := make(map[string]struct{})
for _, p := range c.Paths {
paths[p] = struct{}{}
}

return &ebpfReader{
config: c,
log: l,
parsers: FileParsers(c),
paths: paths,
eventC: make(chan Event),
}, nil
return newEBPFReader(c, l)
}

if c.Backend == BackendKprobes {
Expand Down
2 changes: 1 addition & 1 deletion libbeat/ebpf/watcher_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build linux
//go:build linux && (amd64 || arm64)

package ebpf

Expand Down