-
Notifications
You must be signed in to change notification settings - Fork 67
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
sesearch: -ep option searches for exact matches not supersets #69
Comments
/cc @dburgener |
Interesting. And it looks like this does actually impact the conclusion in my blog post, since using your grep approach does in fact yield a valid rule:
(Although the lack of I feel like the behavior I assumed in my post matches what's written in the man page: "A matching rule must have all specified permissions, instead of matching any of the specified permission." rather than what it seems the actual behavior is. On the other hand, sesearch --help describes the behavior as: "Match permission set exactly instead of matching any listed permission.". This is similar to the behavior described in the docstring for TERuleQuery. My guess based on the "ep" name, is that the permission equality is the intended behavior here, in which case the man page should probably be updated to match the text of the others. I'm happy to submit a PR for that if that's the way we want to go. I would find the behavior I thought I was getting with "ep" valuable though, perhaps as a new argument. |
Correct, |
Digging into this a little bit more, if I've followed the set logic, I think the "perms_subset" flag in _match_perms() provides the behavior I thought I was getting, but it looks like it's only available through apol as a front end, and not exposed in sesearch. I'll see if I can make a PR this afternoon to expose that logic via sesearch if that's something you'd be interested in taking @pebenito? |
Made PR #71 to expose perms_subset via sesearch. It appears to produce the desired behavior for my use case:
|
The blog post https://dburgener.github.io/2022/03/16/pwnkit-and-selinux.html mentions the
-ep
option of sesearch(1):But the option (based on version 4.4.0 and master) seems to not report rules where all the specified permissions are allowed, but all rules where the exact specified rules (and no more) are allowed.
Example based on current Reference Policy:
Maybe the behavior of
-ep
should change or a new option should be introduced to match for supersets.The text was updated successfully, but these errors were encountered: