Skip to content

Commit

Permalink
fix(fim/ebpf): remove x-pack import from OSS package
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoutsovasilis committed Apr 3, 2024
1 parent d2cf3fb commit 745187f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions libbeat/ebpf/sys/sys.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
package sys

import (
"crypto/sha256"
"encoding/base64"
"encoding/binary"
"sync"
"time"

"github.com/elastic/beats/v7/x-pack/auditbeat/module/system"
"github.com/elastic/go-sysinfo"
"github.com/elastic/go-sysinfo/types"
)
Expand All @@ -48,7 +49,7 @@ func EntityID(pid uint32, start time.Time) (string, error) {
return "", err
}

h := system.NewEntityHash()
h := sha256.New()
if _, err := h.Write([]byte(info.UniqueID)); err != nil {
return "", err
}
Expand All @@ -59,5 +60,9 @@ func EntityID(pid uint32, start time.Time) (string, error) {
return "", err
}

return h.Sum(), nil
sum := h.Sum(nil)
if len(sum) > 12 {
sum = sum[:12]
}
return base64.RawStdEncoding.EncodeToString(sum), nil
}

0 comments on commit 745187f

Please sign in to comment.