etingof / pysnmp

Python SNMP library
http://snmplabs.com/pysnmp/
BSD 2-Clause "Simplified" License
583 stars 201 forks source link

SNMPv3 issues with ProCurve device #436

Closed grepmyps closed 1 year ago

grepmyps commented 1 year ago

Howdy,

Running pysnmp 4.4.11, and trying to communicate with a slightly older HP ProCurve switch via SNMPv3, AES/SHA.

Issue: When pysnmp sends out the initial get-next-request message to the switch, the switch responds back with the following: report 1.3.6.1.6.3.15.1.1.3.0, which is SNMP-USER-BASED-SM-MIB::usmStatsUnknownUserNames.0.

pysnmp seems to ignore this and eventually errors out with "No SNMP response received before timeout"

I did a network trace using the NET-SNMP version: 5.6.2.1 tools, which works as expected. The response by the switch is 1.3.6.1.6.3.15.1.1.4.0 SNMP-USER-BASED-SM-MIB::usmStatsUnknownEngineIDs.0

The only difference I found between the NET-SNMP tools and pysnmp is that the msgFlags field of the SNMP request is set to 0x00 for pysnmp, and its set to 0x04 with NET-SNMP. This is the "Reportable" flag.

I did a quick test and setting this flag indeed causes the switch to respond differently. msgFlag == 0x00, the response from the switch is usmStatsUnknownUserNames msgFlag == 0x04, the response from the switch is usmStatsUnknownEngineIDs

I did this test by sending a raw UDP packet to the switch, where I changed only the flags field and I noted the difference in the response.

Question: where in the pysnmp code can I force the msgFlags value to set the Reportable flag so I can query my ProCurve switch fleet using pysnmp? Seems pysnmp is waiting for the usmStatsUnknownEngineIDs response, but it only ever gets usmStatsUnknownUserNames, so it times out.

Thanks, -Walt

grepmyps commented 1 year ago

never mind; ya'll fixed it in 4.4.12. D'oh!