Closed morrisrob closed 3 years ago
Hi @morrisrob - yes you've picked up on an undocumented feature that half-works at best!
The wireshark info didn't seem to come through, but I could replicate this OK.
What I've done to fix this is to remove the engineID
setting from the user
object and added it to the session's options
object, where it should have been in the first place. I've also improved parsing of the engineID
option, so that it can take a string or a Buffer, and added documentation in the createV3Session
API call for the engineID
option and its default value.
So now, you just add the desired engineID
to your createV3Session
options e.g.:
var user = {
name: "itsallaboutyou",
level: snmp.SecurityLevel.noAuthNoPriv
};
var options = {
engineID: "0102030405"
};
session = snmp.createV3Session ("localhost", user, options);
The fix is published in v3.5.0 of the npm.
Thank you for the info and for getting this implemented, @markabrahams ! I appreciate it.
You're welcome!
Hello, I'm hoping that you can help determine if I'm doing something wrong here; I'm using v3.4.3. I'm trying to send SNMPv3 traps using a session created with snmp.createV3Session() and sending this trap to a device listening for traps with snmptrapd. When troubleshooting with wireshark, it appears that the issue I'm running into is that the traps from this library do not include a msgAuthoritativeEngineID. Wireshark shows this as.
I didn't see this documented, but from looking through the code in this library, it seems that I may need to set the engineID in the user object that is passed to createV3Session(). But, when setting the engine ID here and attempting to send a trap, a "TypeError: argument must be a buffer" error is generated. To fix this and send the trap, I need to modify line 2589 in index.js to "msgAuthoritativeEngineID: Buffer.from(this.user.engineID, 'hex')" After modifying this, I'm able to send the trap with msgAuthoritativeEngineID included in the SNMP message.
Thank you.