Skip to content

Add combined process tree+network event source #19

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

zombiezen
Copy link
Contributor

This obsoletes #17 and #18. This rolls the network observation into the same source as the process tree observation and increases the argument buffer sizes. I'm going to do a fast-follow to correlate the exec arguments with the network calls once I figure out how to reliably detect process exits.

- Add a generic "net" source and event type.
  Attempting to use the source on any platform other than Linux
  results in a runtime error for now.
  The idea would be for other OS implementations to exist over time.
- Provide proof-of-concept Linux eBPF program using CO-RE safe APIs.
  This only handles outbound IPv4 connections for now,
  but can be extended to collect more information.
  The program itself should be usable back to Linux 4.17 kernels,
  but I'm using the new-style BPF link syscalls,
  which came along in Linux 5.7 (from 2020).
- Introduce Nix flake with necessary C/LLVM tooling.
  The LLVM/C toolchain is only needed when modifying the C program:
  .o files are automatically generated for both big-endian and little-endian architectures
  and are checked into version control,
  so casual contributors will not need this for making changes to reveald as a whole.
  For folks working on the C program,
  the Nix flake provides a consistent, reproducible environment for generating the .o files
  regardless of OS being used for development.
Due to eBPF restrictions,
the size of arguments collected is relatively small.
Further iterations of this code should hopefully provide better fidelity,
but I wanted to demonstrate the approach first.
This allows for the source to combine multiple signals together
so more logical signals can be sent to other processes.
I also came up with a better way of passing the arguments back to userspace
so the limits are larger while giving priority to the event stream.
@abraithwaite
Copy link
Member

Hey @zombiezen ! Excited to try this out today. Looks like an internal package still needs to be pushed though, is that the case? I see it in the other branch, maybe I can pull it into this one.

@zombiezen
Copy link
Contributor Author

Ah whoops, I forgot to remove the reference to the network source that no longer exists. Try again now.

zombiezen added 3 commits May 23, 2025 09:20
Allows us to tie the process arguments to PIDs in a bounded manner.
Also picked out a more reliable attach point for detecting forks.
@zombiezen
Copy link
Contributor Author

Now even more exciting: network connect events are correlated with their process information.

@zombiezen
Copy link
Contributor Author

Test config file:

{
  "sources": {
    "processes": {
      "type": "processes",
    },
  },
  "destinations": {
    "printer": {
      "type": "printer",
    },
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants