Skip to content

Commit

Permalink
Rename package
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwolf committed Feb 20, 2024
1 parent 7de070e commit 565eaa1
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 71 deletions.
31 changes: 0 additions & 31 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21420,37 +21420,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


--------------------------------------------------------------------------------
Dependency : github.com/mohae/deepcopy
Version: v0.0.0-20170929034955-c48cc78d4826
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/mohae/[email protected]/LICENSE:

The MIT License (MIT)

Copyright (c) 2014 Joel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


--------------------------------------------------------------------------------
Dependency : github.com/olekukonko/tablewriter
Version: v0.0.5
Expand Down
3 changes: 0 additions & 3 deletions auditbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ import (
"github.com/elastic/beats/v7/metricbeat/beater"
"github.com/elastic/beats/v7/metricbeat/mb/module"
"github.com/elastic/elastic-agent-libs/mapstr"

// Import processors
_ "github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata"
)

const (
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ require (
github.com/gorilla/websocket v1.4.2
github.com/icholy/digest v0.1.22
github.com/lestrrat-go/jwx/v2 v2.0.19
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/otiai10/copy v1.12.0
github.com/pierrec/lz4/v4 v4.1.18
github.com/pkg/xattr v0.4.9
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,6 @@ github.com/elastic/bayeux v1.0.5 h1:UceFq01ipmT3S8DzFK+uVAkbCdiPR0Bqei8qIGmUeY0=
github.com/elastic/bayeux v1.0.5/go.mod h1:CSI4iP7qeo5MMlkznGvYKftp8M7qqP/3nzmVZoXHY68=
github.com/elastic/dhcp v0.0.0-20200227161230-57ec251c7eb3 h1:lnDkqiRFKm0rxdljqrj3lotWinO9+jFmeDXIC4gvIQs=
github.com/elastic/dhcp v0.0.0-20200227161230-57ec251c7eb3/go.mod h1:aPqzac6AYkipvp4hufTyMj5PDIphF3+At8zr7r51xjY=
github.com/elastic/ebpfevents v0.3.2 h1:UJ8kW5jw2TpUR5MEMaZ1O62sK9JQ+5xTlj+YpQC6BXc=
github.com/elastic/ebpfevents v0.3.2/go.mod h1:o21z5xup/9dK8u0Hg9bZRflSqqj1Zu5h2dg2hSTcUPQ=
github.com/elastic/ebpfevents v0.4.0 h1:M80eAeJnzvGQgU9cjJqkjFca9pjM3aq/TuZxJeom4bI=
github.com/elastic/ebpfevents v0.4.0/go.mod h1:o21z5xup/9dK8u0Hg9bZRflSqqj1Zu5h2dg2hSTcUPQ=
github.com/elastic/elastic-agent-autodiscover v0.6.7 h1:+KVjltN0rPsBrU8b156gV4lOTBgG/vt0efFCFARrf3g=
Expand Down Expand Up @@ -1501,8 +1499,6 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
Expand Down
3 changes: 3 additions & 0 deletions x-pack/auditbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import (
// Register Auditbeat x-pack modules.
_ "github.com/elastic/beats/v7/x-pack/auditbeat/include"
_ "github.com/elastic/beats/v7/x-pack/libbeat/include"

// Import processors
_ "github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd"
)

// Name of the beat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//go:build linux

package add_session_metadata
package sessionmd

import (
"context"
Expand All @@ -15,10 +15,10 @@ import (

"github.com/elastic/beats/v7/libbeat/beat"
"github.com/elastic/beats/v7/libbeat/processors"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/processdb"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/procfs"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/provider"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/provider/ebpf_provider"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/processdb"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/procfs"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/provider"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/provider/ebpf_provider"
"github.com/elastic/elastic-agent-libs/config"
"github.com/elastic/elastic-agent-libs/logp"
"github.com/elastic/elastic-agent-libs/mapstr"
Expand Down Expand Up @@ -179,9 +179,7 @@ func (p *addSessionMetadata) replaceFields(ev *beat.Event) error {
return nil //nolint:nilerr // processor can be called on unsupported events; not an error
}
switch syscall {
case "execveat":
fallthrough
case "execve":
case "execveat", "execve":
ev.Fields.Put("event.action", []string{"exec", "fork"})
ev.Fields.Put("event.type", []string{"start"})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//go:build linux

package add_session_metadata
package sessionmd

import (
"testing"
Expand All @@ -13,9 +13,9 @@ import (
"github.com/stretchr/testify/assert"

"github.com/elastic/beats/v7/libbeat/beat"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/processdb"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/procfs"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/types"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/processdb"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/procfs"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/types"
"github.com/elastic/elastic-agent-libs/logp"
"github.com/elastic/elastic-agent-libs/mapstr"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//go:build linux

package add_session_metadata
package sessionmd

// Config for add_session_metadata processor.
type Config struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

//go:build !linux

package add_session_metadata
// sessionmd provides a Beat processor that can enrich process event documents with
// additional session metadata for the processes.
package sessionmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"sync"
"time"

"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/procfs"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/timeutils"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/types"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/procfs"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/timeutils"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/types"
"github.com/elastic/elastic-agent-libs/logp"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/stretchr/testify/require"

"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/procfs"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/types"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/procfs"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/types"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"github.com/prometheus/procfs"
"golang.org/x/sys/unix"

"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/timeutils"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/types"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/timeutils"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/types"
"github.com/elastic/elastic-agent-libs/logp"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ import (
"context"
"fmt"

"github.com/mohae/deepcopy"

"github.com/elastic/beats/v7/libbeat/beat"
"github.com/elastic/beats/v7/libbeat/ebpf"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/processdb"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/provider"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/add_session_metadata/types"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/processdb"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/provider"
"github.com/elastic/beats/v7/x-pack/auditbeat/processors/sessionmd/types"
"github.com/elastic/ebpfevents"
"github.com/elastic/elastic-agent-libs/logp"
)
Expand Down Expand Up @@ -50,7 +48,7 @@ func NewProvider(ctx context.Context, logger *logp.Logger, db *processdb.DB) (pr
for {
r := <-records
if r.Error != nil {
logger.Errorf("recv'd error: %w", err)
logger.Warnw("received error from the ebpf subscription", "error", err)
continue
}
if r.Event == nil {
Expand All @@ -61,7 +59,7 @@ func NewProvider(ctx context.Context, logger *logp.Logger, db *processdb.DB) (pr
case ebpfevents.EventTypeProcessFork:
body, ok := ev.Body.(*ebpfevents.ProcessFork)
if !ok {
logger.Errorf("unexpected event body")
logger.Errorf("unexpected event body, got %T", ev.Body)
continue
}
pe := types.ProcessForkEvent{
Expand Down Expand Up @@ -123,8 +121,8 @@ func NewProvider(ctx context.Context, logger *logp.Logger, db *processdb.DB) (pr
Minor: body.CTTY.Minor,
},
Cwd: body.Cwd,
Argv: deepcopy.Copy(body.Argv).([]string),
Env: deepcopy.Copy(body.Env).(map[string]string),
Argv: body.Argv,
Env: body.Env,
Filename: body.Filename,
}
p.db.InsertExec(pe)
Expand Down

0 comments on commit 565eaa1

Please sign in to comment.