Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auditbeat Processor to enrich auditd events with session view information #37640

Merged
merged 55 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
88d0a0e
Add a add_session_metadata auditbeat processor
mjwolf Jan 10, 2024
d5a01bf
Add unit tests for add_session_metadata
mjwolf Jan 12, 2024
7cec455
Calculate process entry leader
mjwolf Jan 15, 2024
7de480d
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Jan 15, 2024
782504c
Add entry leader tests
mjwolf Jan 16, 2024
6b7037b
Update CHANGELOG
mjwolf Jan 16, 2024
0f610cb
Merge branch 'main' into session_view_processor_ebpf
mjwolf Jan 17, 2024
c688f5a
Apply suggestions from code review
mjwolf Jan 17, 2024
f35b4c7
Rework directory structure
mjwolf Jan 17, 2024
bf38e89
Remove DB interface
mjwolf Jan 17, 2024
910aba2
Pass DB by reference in tests
mjwolf Jan 18, 2024
0cbb970
Rework entry leader tests
mjwolf Jan 18, 2024
06b7064
Reformat processor
mjwolf Jan 18, 2024
be57ad8
Only build tests on Linux
mjwolf Jan 18, 2024
9ad7811
Add linux build directive to all files in processor
mjwolf Jan 18, 2024
f6aad7e
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Jan 18, 2024
3598b3c
Changes for PR feedback
mjwolf Jan 22, 2024
743e8da
Merge branch 'elastic:main' into session_view_processor_ebpf
mjwolf Jan 22, 2024
17fdf1c
Add empty file to add_session_metadata package
mjwolf Jan 22, 2024
1ab4752
Fix linter warnings
mjwolf Jan 23, 2024
23e097c
Merge branch 'main' into session_view_processor_ebpf
mjwolf Jan 23, 2024
882f8a4
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Jan 24, 2024
145f627
Use single channel from epbevents
mjwolf Jan 24, 2024
e9aea4d
Use watcher for ebpf events
mjwolf Jan 25, 2024
c001219
remove seccomp init
mjwolf Jan 26, 2024
a5986dd
Update x-pack/auditbeat/internal/ebpf/watcher_linux.go
mjwolf Jan 26, 2024
5658c76
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Jan 27, 2024
d5da140
Add seccomp policy modification
mjwolf Jan 29, 2024
ca81839
Merge branch 'session_view_processor_ebpf' of github.com:mjwolf/beats…
mjwolf Jan 29, 2024
7fe0ba4
Use buffered channel in watcher client
mjwolf Jan 29, 2024
9c59a7b
Move ebpf watcher to libbeat
mjwolf Jan 30, 2024
26d759b
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Feb 1, 2024
4a304df
Remove error return value that was never used
mjwolf Feb 1, 2024
e7a45ea
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Feb 2, 2024
5dbe5dd
Make capNames an array
mjwolf Feb 2, 2024
d675c53
Merge branch 'main' into session_view_processor_ebpf
mjwolf Feb 5, 2024
1837289
Merge branch 'main' into session_view_processor_ebpf
mjwolf Feb 5, 2024
7017a79
Merge branch 'main' into session_view_processor_ebpf
mjwolf Feb 6, 2024
10e9525
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Feb 7, 2024
eeab397
Update ebpfevents lib
mjwolf Feb 7, 2024
7de070e
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Feb 20, 2024
565eaa1
Rename package
mjwolf Feb 20, 2024
12643f4
Merge branch 'elastic:main' into session_view_processor_ebpf
mjwolf Feb 20, 2024
1f05b14
Use consistant capitialization for initialisms
mjwolf Feb 20, 2024
0ecb7bf
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Feb 20, 2024
fe4f0a3
Merge branch 'session_view_processor_ebpf' of github.com:mjwolf/beats…
mjwolf Feb 20, 2024
f2443cd
Change some struct member visibility
mjwolf Feb 22, 2024
9a52b90
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Mar 11, 2024
36c8998
Remove possibilities of panics
mjwolf Mar 14, 2024
5f5f777
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Mar 14, 2024
51949ae
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Mar 28, 2024
52e2b60
Fix up more code
mjwolf Mar 28, 2024
7382b76
Fix lint error
mjwolf Mar 29, 2024
ba0f81a
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Mar 29, 2024
eb9792b
Merge remote-tracking branch 'origin/main' into session_view_processo…
mjwolf Apr 5, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Setting environmental variable ELASTIC_NETINFO:false in Elastic Agent pod will d

- Add `ignore_errors` option to audit module. {issue}15768[15768] {pull}36851[36851]
- Fix copy arguments for strict aligned architectures. {pull}36976[36976]
- Added `add_session_metadata` processor, which enables session viewer on Auditbeat data. {pull}37640[37640]

*Filebeat*

Expand Down
207 changes: 164 additions & 43 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12255,6 +12255,32 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


--------------------------------------------------------------------------------
Dependency : github.com/elastic/ebpfevents
Version: v0.1.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

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

The https://github.com/elastic/ebpfevents repository contains source code under
various licenses:

- Source code in the 'headers/bpf' directory, is dual-licensed under the GNU Lesser General
Public License version 2.1 (LICENSES/LGPL-2.1-only.txt) OR BSD-2-Clause license
(LICENSES/BSD-2-Clause.txt)

- Source code in the 'ebpf' submodule is licensed with multiple licenses. Read more at
https://github.com/elastic/ebpf/blob/main/LICENSE.txt.

- The binary files 'bpf_bpfel_x86.o' and 'bpf_bpfel_amd64.o' are compiled
from dual-licensed GPL-2.0-only OR BSD-2-Clause licensed code, and are distributed with
the GPL-2.0-only License (LICENSES/GPL-2.0-only.txt).

- Source code not listed in the previous points is licensed under the Apache License,
version 2 (LICENSES/Apache-2.0.txt).


--------------------------------------------------------------------------------
Dependency : github.com/elastic/elastic-agent-autodiscover
Version: v0.6.7
Expand Down Expand Up @@ -21118,6 +21144,37 @@ 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 Expand Up @@ -22589,6 +22646,45 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


--------------------------------------------------------------------------------
Dependency : github.com/tklauser/go-sysconf
Version: v0.3.10
Licence type (autodetected): BSD-3-Clause
--------------------------------------------------------------------------------

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

BSD 3-Clause License

Copyright (c) 2018-2021, Tobias Klauser
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


--------------------------------------------------------------------------------
Dependency : github.com/tsg/go-daemon
Version: v0.0.0-20200207173439-e704b93fd89b
Expand Down Expand Up @@ -36165,6 +36261,39 @@ 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/cilium/ebpf
Version: v0.12.3
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

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

MIT License

Copyright (c) 2017 Nathan Sweet
Copyright (c) 2018, 2019 Cloudflare
Copyright (c) 2019 Authors of Cilium

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/codegangsta/inject
Version: v0.0.0-20150114235600-33e0aa1cb7c0
Expand Down Expand Up @@ -38170,11 +38299,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
Dependency : github.com/frankban/quicktest
Version: v1.14.3
Version: v1.14.5
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

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

MIT License

Expand All @@ -38199,6 +38328,37 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


--------------------------------------------------------------------------------
Dependency : github.com/go-faker/faker/v4
Version: v4.2.0
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

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

MIT License

Copyright (c) 2017 Iman Tumorang

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/go-logfmt/logfmt
Version: v0.5.1
Expand Down Expand Up @@ -45641,11 +45801,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

--------------------------------------------------------------------------------
Dependency : github.com/kr/pretty
Version: v0.3.0
Version: v0.3.1
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/kr/[email protected].0/License:
Contents of probable licence file $GOMODCACHE/github.com/kr/[email protected].1/License:

Copyright 2012 Keith Rarick

Expand Down Expand Up @@ -50315,45 +50475,6 @@ 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/tklauser/go-sysconf
Version: v0.3.10
Licence type (autodetected): BSD-3-Clause
--------------------------------------------------------------------------------

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

BSD 3-Clause License

Copyright (c) 2018-2021, Tobias Klauser
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


--------------------------------------------------------------------------------
Dependency : github.com/tklauser/numcpus
Version: v0.4.0
Expand Down
3 changes: 3 additions & 0 deletions auditbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ 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"
mjwolf marked this conversation as resolved.
Show resolved Hide resolved
)

const (
Expand Down
1 change: 1 addition & 0 deletions dev-tools/notice/overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
{"name": "github.com/awslabs/kinesis-aggregation/go/v2", "licenceType": "Apache-2.0", "url": "https://github.com/awslabs/kinesis-aggregation/blob/master/LICENSE.txt"}
{"name": "github.com/dnaeon/go-vcr", "licenceType": "BSD-2-Clause"}
{"name": "github.com/JohnCGriffin/overflow", "licenceType": "MIT"}
{"name": "github.com/elastic/ebpfevents", "licenceType": "Apache-2.0"}
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ require (
github.com/aws/smithy-go v1.13.5
github.com/awslabs/kinesis-aggregation/go/v2 v2.0.0-20220623125934-28468a6701b5
github.com/elastic/bayeux v1.0.5
github.com/elastic/ebpfevents v0.1.0
github.com/elastic/elastic-agent-autodiscover v0.6.7
github.com/elastic/elastic-agent-libs v0.7.3
github.com/elastic/elastic-agent-shipper-client v0.5.1-0.20230228231646-f04347b666f3
Expand All @@ -214,11 +215,13 @@ require (
github.com/gorilla/mux v1.8.0
github.com/icholy/digest v0.1.22
github.com/lestrrat-go/jwx/v2 v2.0.11
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
mjwolf marked this conversation as resolved.
Show resolved Hide resolved
github.com/otiai10/copy v1.12.0
github.com/pierrec/lz4/v4 v4.1.18
github.com/pkg/xattr v0.4.9
github.com/sergi/go-diff v1.3.1
github.com/shirou/gopsutil/v3 v3.22.10
github.com/tklauser/go-sysconf v0.3.10
go.elastic.co/apm/module/apmelasticsearch/v2 v2.4.7
go.elastic.co/apm/module/apmhttp/v2 v2.4.7
go.elastic.co/apm/v2 v2.4.7
Expand Down Expand Up @@ -265,6 +268,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cilium/ebpf v0.12.3 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
Expand Down Expand Up @@ -353,7 +357,6 @@ require (
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/urso/diag v0.0.0-20200210123136-21b3cc8eb797 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
Expand Down
Loading
Loading