-
Notifications
You must be signed in to change notification settings - Fork 4
Enforce user's security level for received trap messages #75
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
…ntegration-snmp into fix-traps-security-level # Conflicts: # CHANGELOG.md # VERSION
Testing: AuthPriv
AuthNoPriv
NoAuthNoPriv
Everything appears to work as expected with one caveat: When there are issues with the format of the message - an incorrect privilege passphrase or protocol, for example - the event does not get created, and there is no logging to indicate that an event has been received, and has been dropped. This was super tricky to debug, and required me to attach a debugger to the Logstash process to figure out what was going on. |
Tried with the logging library - logs are showing up in the log file:
|
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.
Since the snmptrap
effectively allows us to have zero or one USM's, this feels like a lot of overhead for a check that could be done in the CommandResponder#processPdu
(that already contains logic for dropping non-matching events) in the existing SnmpClient#doTrap
.
Is the idea that we want to be able to emit SNMPv3_USM_UNSUPPORTED_SECURITY_LEVEL
, and allow SNMP4j to build a rejection response? From what I can see in a fork of SNMP4j, that is used as feedback when a payload includes a security_level
that requires additional auth fields without actually providing said auth fields (e.g.,: >= AUTH_NOPRIV
missing auth protocol, AUTH_PRIV
missing privacy protocol), or a payload requests a level of auth that is not supported by the user (e.g., AUTH_PRIV
but USM for the user has no auth or privacy protocols); it appears to be more an indication that the request is malformed than the contents of the payload being non-actionable.
In the contexts of an SNMP trap, I would view security_level
as more of a post-receive filter than a pre-receive override to the USM.
Co-authored-by: Rye Biesemeyer <yaauie@users.noreply.github.com>
I think that things may be a bit conflated here. In the But the While we could use it as a filter, the meaning isn't clear. Is it a minimum threshold? Or are we expecting an exact match? For example, both plugins allow a configuration that has
In both plugins, the In the In the
In this sense, we are expecting the I still think that we should be able to intercept it in the |
Thank you Ry for digging into this, I saw that maintainer message as well while investigating it, and although I agree that it's not part of the USM responsibility to verify authorization, I don't think we should strictly apply that to us, given we're not providing a SNMP library, and there's no need to be compliant (in terms of responsibilities) with the RFC spec. As I mentioned, the idea of overriding the USM was providing a proper response to the clients, without having to implement a VACM system neither paying for their commercial version. Anyway, It doesn't really matter for traps, considering it's fire-and-forget, but it would be useful for supporting
I don't have a strong opinion on that, and I'm fine changing it as suggested considering we don't officially support INFORM messages. Regarding having a single security_name user in the USM, that's a limitation inherited from the old plugins (unfortunately), and it's not the reality of most SNMP environments where devices might have different credentials (security reasons). There's an open issue for extending that support, so users don't need to run a plugin per credential. I'll push the changes soon. Thanks! |
1d85c8f
to
fca421d
Compare
This PR fixes the
snmptrap
input plugin to correctly enforce the configured user security level set by thesecurity_level
config. Received events that do not match the configured value are now dropped.