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

[WIP]: bpf & pkg: Add selectors for audit ids #2065

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Jianlin-lv
Copy link

@Jianlin-lv Jianlin-lv commented Feb 5, 2024

This commits introduces the "matchLoginUids" selectors, support
filtering based on the audit id of process.

A process is given an audit ID on user login, that is the loginuid.
This ID set during user authentication and handed down to any child
process started by the initial process of the user, even when the user's
identity changes.

the matchLoginUids filter supports defining up to four operators,

  • Equal
  • NotEqual
  • GreaterThan
  • LessThan
    which are logically AND together.

The loginuid is used to track user's activity. For example, the following
matchLoginUids filter allow to follow operation performed by user id 1000.

- matchLoginUids:
  - operator: "Equal"
    values:
    - 1000

Signed-off-by: Jianlin Lv jianlv@ebay.com

Related: #1943

@Jianlin-lv Jianlin-lv requested review from mtardy and a team as code owners February 5, 2024 15:28
Copy link

netlify bot commented Feb 5, 2024

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit 457c316
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/665c19490612ea00080d4e32
😎 Deploy Preview https://deploy-preview-2065--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mtardy
Copy link
Member

mtardy commented Feb 5, 2024

Hey welcome! Thanks for taking the time to create this PR, would you like to introduce a bit more context on why you wanted to add that? What was your specific use case? :) Thanks!

@tixxdz tixxdz self-requested a review February 5, 2024 16:50
@tixxdz
Copy link
Member

tixxdz commented Feb 5, 2024

Yes we need to write something like:
"The loginuid is used to track user accounts on the system, it is set during user authentication and inheritted by child processes which allows to track user's activity.

A filter on this as an examples allows to follow all operation performed by user id 1000. Another use case is follow all authenticated users, except system services which have a loginuid -1 (4294967295)"

Thanks for the contribution will review it.

@Jianlin-lv
Copy link
Author

The current changes do not support multiple loginuid operators. I will submit patch v2 to support it.
Please review this patch after the next commit.

@Jianlin-lv Jianlin-lv changed the title bpf & pkg: Add selectors for audit ids [WIP]: bpf & pkg: Add selectors for audit ids Feb 7, 2024
@tixxdz
Copy link
Member

tixxdz commented Feb 23, 2024

Hi @Jianlin-lv no worries, thank you very much for your contributions ;-) !

BTW if ci test fail on 4.9 kernel for bpf complexity, you can surround your bpf changes with #ifdef __LARGE_BPF_PROG so it won't run fail on that kernel.

Feel free to convert to draft.

@mtardy mtardy marked this pull request as draft March 1, 2024 10:00
@Jianlin-lv Jianlin-lv force-pushed the pr-auid-support branch 2 times, most recently from b9af5c1 to e76ffe8 Compare March 24, 2024 16:00
@Jianlin-lv
Copy link
Author

Could you give a hint about how to fix vmtest fail about kernel 5.4/4.19/bpf-next? @tixxdz

@kkourt
Copy link
Contributor

kkourt commented Apr 9, 2024

Hi!,

We have some instructions here: https://github.com/cilium/tetragon/tree/main/tests/vmtests

@tixxdz
Copy link
Member

tixxdz commented Apr 9, 2024

Hi @Jianlin-lv as pointed out by Kornilios those tests will help you to isolate tests and better debug. Also I remember when I took a look quickly it hints toward ebpf or assembly.

Sorry past days didn't have enough time, I will pull your branch by end of this week and help.

@Jianlin-lv
Copy link
Author

Thank you both for your help. I will attempt to debug this issue.

@Jianlin-lv
Copy link
Author

hi guys, sorry for interrupt , I didn't have any progress from my side, because vm testing env setup failed on my VM.
Could you help to take a look job failed issue?

@tixxdz
Copy link
Member

tixxdz commented May 15, 2024

hi guys, sorry for interrupt , I didn't have any progress from my side, because vm testing env setup failed on my VM. Could you help to take a look job failed issue?

Sorry, it is on my review list, just didn't have enough time especially past days with releasing OSS and EE versions, I hope we will get to it as we also want this feature.

@kkourt kkourt added the needs-rebase This PR needs to be rebased because it has merge conflicts. label May 22, 2024
@Jianlin-lv Jianlin-lv force-pushed the pr-auid-support branch 2 times, most recently from 457c316 to 44b7bea Compare June 2, 2024 11:50
This commits introduces the "matchLoginUids" selectors, support
filtering based on the audit id of process.

A process is given an audit ID on user login, that is the loginuid.
This ID set during user authentication and handed down to any child
process started by the initial process of the user, even when the user's
identity changes.

the `matchLoginUids` filter supports defining up to four operators,
- `Equal`
- `NotEqual`
- `GreaterThan`
- `LessThan`
which are logically `AND` together.

The loginuid is used to track user's activity. For example, the following
matchLoginUids filter allow to follow operation performed by user id 1000.
```
- matchLoginUids:
  - operator: "Equal"
    values:
    - 1000
```

Signed-off-by: Jianlin Lv <jianlv@ebay.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase This PR needs to be rebased because it has merge conflicts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants