-
Notifications
You must be signed in to change notification settings - Fork 23
PrincsFilter to ClientFilter reimplementation #186
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
base: main
Are you sure you want to change the base?
Conversation
4144e3a
to
7220434
Compare
Hi! Thanks, again, for this cool PR! Let's start this (huge) answer with a some history! At first, OpenWEC only supported Kerberos authentication. The Kerberos principal filter was implemented to mimic the subscription ACL of MS WEC, even if explicitly listing principals is quite tedious. I had some plans to parse the Kerberos PAC at some point to enable filtering on AD groups or claims, but I never found the time (and the motivation) to do it. I later added the custom "uri" system to manage which subscriptions are available to which machines, depending on the configuration of the machines. When TLS authentication was implemented, we extended the "Kerberos principal filter" to support TLS subjects, but we did not change the name out of laziness (sorry). In practice, my organization used custom "uri" to tag events based on the location of the machines, but we stopped doing that at some point. We never used the prinicpal/subject filtering feature. I assume you have a specific use case in mind. Could you share it?
|
Thank you for the detailed and thorough explanation. :) I also had a feeling that something bigger needs to be done around the current filtering implementation, so I really like your idea. The case-insensitivity option is also something that I find very useful, I would even consider changing the default (but only with the new config naming, I don't want to break anything when one uses the old option names, of course). In our use-cases, machine filtering is essential, as events are coming from very different domains, locations, etc. towards the same collector, and even with wildcards, it is sometimes non-trivial to achieve the the desired categorization when using TLS. The URI trick sounds good, but managing "what we collect and from where" would be better being stored on the server side, we would like to keep everything unified and stupid on the client side. So all things considered, I would gladly continue this implementation in the direction you suggested as "filter rework". (Sorry for the typo, I usually wrap up conversations terribly, so I asked for a little help :)) |
About the MachineID part: I don't have a specific use case that would not work with principals or cert subjects, I just had a fairly old memory when I was investigating the Microsoft implementation of WEC that in case of the source-initiated push method with TLS, their wildcard filters might have been applied on the Machine field of the request and not on the cert DN or common name. |
Ok. I'm fine with adding such a filter as long as the documentation clearly states that the value can be manipulated by an evil machine.
That's nice! I will be happy to help you if you need it 😄 Do you plan to implement the "single filter" approach or the last one with multiple filters? |
I would go with the single filter list and try to implement it in a way that wouldn't cause too many problems if one wanted to extend the functionality to the ACL-like idea you mentioned. The single filter list with flags (case-sensitivity, pattern) and a type field covers all my use cases. |
Sorry for the delay, I'll update the PR soon. |
7220434
to
3bbb970
Compare
183c7b5
to
b7c61b4
Compare
@vruello I updated the PR description. I'm still learning Rust, and it seems I have made a few relatively bad decisions, so the implementation does not look as clean as I wanted it to be. |
b7c61b4
to
1f5850f
Compare
Hi! Thanks for all your work on this feature! Do you think it is ready for review? |
My pleasure. :)
Yes, I think it is ready. |
Cool! I will check it out as soon as possible 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! (and sorry for being a bit slow to review it)
I think it is much better than before. I wrote some comments. Most of the remaining work seems to be adding a new export version and adding some tests for filters.
I have some doubts about whether the "type/kind" (TLS subject, Kerberos principal, Machine ID) and the "flags" (case sensitive, "exact" or "glob") of targets should be global or target-specific. In fact, it feels more natural (and powerful) to specify them "per target", but I am not sure of how to format them in configuration files.
Do you have an opinion on this? (we need to decide this before (re-)working on the implementation)
I think it would be unnecessary (at least in our use cases) to allow per-target types and flags. My reasoning is something like this: |
Your reasoning is quite convincing. We are probably in one of those cases where perfect is the enemy of good, and supporting limited filtering capabilities is probably the best choice for now. We'll always be able to add a more complete (and complex) filtering syntax later, if the need arises. |
854fa8a
to
edddee0
Compare
@vruello Sorry for the huge delay. I think I've resolved all review notes. |
7e8f709
to
308990b
Compare
308990b
to
99fbca4
Compare
@vruello If you have some free time, could you take a look, please? :) |
We'll integrate this PR into our fork the upcoming week and start using/testing it. |
The name "princs" does not make sense when TLS is used, so an alias has been added: [filter] operation = "Only" cert_subjects = [ "win10.windomain.local", ]
This was used only by the CLI interface, which is deprecated. Subscriptions are now config files, which represents the current state, so no modifier methods are required.
It will be used to filter clients based on their self-advertised name.
99fbca4
to
617ed95
Compare
Client filter
Filtering modes:
Only
: the subscription will only be shown to the listed clientsExcept
: the subscription will be shown to everyone except the listed clientsFiltering types:
KerberosPrinc
: the filter will be evaluated on the Kerberos principalTLSCertSubject
: the filter will be evaluated on the TLS certificate's subject fieldMachineID
: the filtering is done based on the name of the computerThe default is either
KerberosPrinc
orTLSCertSubject
, depending on how server authentication is configured.Warning:
MachineID
is not cryptographically authenticated information, it can be spoofed.Filtering flags:
GlobPattern
: Glob patterns like*
and?
can be used intargets
CaseInsensitive
: Filter matching will be case-insensitiveFlags are composable using the
|
operator.The comparison is case-sensitive by default.
Backward compatibility:
V3
Import/Export API?