Support for AES256 and SHA256 #991
Replies: 21 comments 16 replies
-
Hi @delboy1966 I still answer to such problem here: #974 You're probably right about USM.pm. In the upstream project, there's a patch shared for this file here: https://rt.cpan.org/Public/Bug/Display.html?id=148740 Is it the one you tried ? If not, here is the 6.0.1 patched version: USM.pm-patched.zip You should be able to test it with |
Beta Was this translation helpful? Give feedback.
-
Hi @g-bougard Thanks for the prompt reply. I've tried the USM.pm you have provided and it doesn't seem to work, I beleive its because it doesn't support SHA256, at least thats the error message I'm getting back when I'm testing it with my test script using Net::SNMP
And if I try to use SHA instead, I get
Any advice? Thanks |
Beta Was this translation helpful? Give feedback.
-
Have you tried setting |
Beta Was this translation helpful? Give feedback.
-
Okay, I found this patch: https://www.mail-archive.com/[email protected]/msg106148.html And here is the new patched version (including the previous one): USM.pm-patched-v2.zip You should be able to set |
Beta Was this translation helpful? Give feedback.
-
Thaks for that. I've tried the new one and its giving me an error I've had before, over the past 3 days of trying to find a tix. ERROR: The authProtocol "1.3.6.1.6.3.10.1.1.5" is unknown during discovery And I'm not sure why. |
Beta Was this translation helpful? Give feedback.
-
This is the glpi-inventory line I am using, replacing the actual username and passwords.
and this is the ouput
No matter what SHA protocol I use, it always come back with the OID relating to that protocol in the error message. Can glpi not revert to unix snmp? Most of the software/scripts we use for other stuff does. And I see this as being more common as Cisco force people to use SHA256 and AES256 on new hardware. |
Beta Was this translation helpful? Give feedback.
-
Does this version also work with aes and sha protocols? Just we have switches that use those protocols. Thanks |
Beta Was this translation helpful? Give feedback.
-
I have it working now with AES and SHA. It was strange, it worked and when I tried again directly afterwards it came back with authentication error. Tried another couple of times and same thing. Then when I tried it 20 seconds later it worked. Very strange, I'll have to do some testing when I get back into work on Monday. I can't see it being Net::SNMP, but can't be certain, maybe connection issue? Will try from another box on Monday. Be good if someone else could try the new USM.pm file, with both sets of protocols on 2 different devices. Doesn't glpi-agent just use Net:SNMP? So if the new USM.pm file is present it should work, shouldn't it? I'd like to get the GLPI GUI interface changed to allow selecting AES256 and SHA256, in the Credentials interface. Not sure how that would work, as you have to specify aes256c and not aes256 on the command line. |
Beta Was this translation helpful? Give feedback.
-
As soon as I get back into work on Monday, I will give it a try. |
Beta Was this translation helpful? Give feedback.
-
I got into work this morning and wanted to do some testing on the new USM.pm before implementing your fix for glpi-agent, because of the oddness I saw on Friday. It works fine for SHA256 and AES256. But seeing some strange stuff when it comes to SHA and AES. I can run unix snmp to a router that is using SHA256 and AES256 protocols with no problems, I can run it a number of time, one after the other and get a response back. When it fails on glpi-inventory it gives the error SNMP communication error: authentication error on host 10.108.164.1 When it fails running my test script using Net::SNMP it gives the error _debug: [965] Net::SNMP::PDU::_process_var_bind_list(): { 1.3.6.1.6.3.15.1.1.5.0 => Counter: 185 } I've tried from a number of different boxes and against a number of different routers, and they all give the same results. From my digging, and process of elimination it might be something to do with the engine ID handshake not being handled correctly in Net::SNMP. Does this make any sense? |
Beta Was this translation helpful? Give feedback.
-
I've been testing this most of the day, and trying to find out why its now failing most of the time using AES/SHA, and I've not found out why. All I know is if I replace the patched version of USM.pm with the original USM.pm that came with Net::SNMP, it works everytime with the same glpi-netinvenory command line, but then we are back at square one with it not working with AES256/SHA256. The only thing I have found that works with all protocols is unix snmp v5.9. Would it make sense to have glpi-agent and glpi inventory to use unix snmp? |
Beta Was this translation helpful? Give feedback.
-
Let me resume what you mean and tell me if I'm wrong somewhere:
As far I understand, the error means the remote device answered it didn't authenticate the sent message as the digest is wrong. I deeply reviewed the modified code and for now I don't see where is the mistake. But as perl library for SHA1 digest has been changed, maybe something is different in the logic. I must dive more deeply in that libraries, maybe I'll found something. I guess also you didn't check if md5 digest still works or not. And also you didn't test with DES or 3DES. |
Beta Was this translation helpful? Give feedback.
-
Hi @g-bougard Yes that is exactly what is happening. No, I haven't tested with MD5, DES, or 3DES, as I have no devices to test against. Hopefully you can find where its failing and fix it. I guess falling back to Unix SNMP isn't something you want to do? |
Beta Was this translation helpful? Give feedback.
-
I finally found the problem. With the sha protocols patch, the protocol list hash is set to:
I felt strange with that code when I saw it the first time. It finally triggered me when I remember the provided "sha" protocol in authprotocol params is checked to find the hash value for the protocol by running the keys list against the "sha" via a regexp... Here you have one thing to know: when getting the keys of the hash, they are not sorted and their order is totally random.
... All matches the "sha" string... mixed with the random order, it means if you set just "sha" in authprotocol, USM will randomly choose between AUTH_PROTOCOL_HMACSHA, AUTH_PROTOCOL_HMACSHA224, AUTH_PROTOCOL_HMACSHA256, AUTH_PROTOCOL_HMACSHA384 or AUTH_PROTOCOL_HMACSHA512 protocol value. So with the current USM.pm, this should work if you set authprotocol to "sha1", "sha-1" or "hmac-sha-1". With that value, the protocol can only be AUTH_PROTOCOL_HMACSHA. Then, this is simple to fix. Here is the fixed USM which will always use AUTH_PROTOCOL_HMACSHA if authprotocol is set to "sha" without a following number: USM.pm-patched-v5.zip And here the integration into GLPI-Agent: |
Beta Was this translation helpful? Give feedback.
-
Hi @g-bougard That's great news. I'm away from my PC now, but can test in a live environment in the morning. Once you have sorted glpi-inventory, can the GPLI GUI be updated to include the new protocols in the drop down for SNMP Credentials, so they map to the correct ones in the new USM.pm? |
Beta Was this translation helpful? Give feedback.
-
This morning I copied your modified USM.pm to Net::SNMP and run glpi-netinventory with both pairs of protocols, 256 and none 256, and it was perfect, returned data every time. I then unzipped the support zip file in the glpi-agent directory, and run the glpi-netinventory commands again, again both returned data fine. Use of uninitialized value in split at /usr/share/glpi-agent/lib/GLPI/Agent/SNMP/Live.pm line 58. Not sure if its anything to worry about. |
Beta Was this translation helpful? Give feedback.
-
Ah, its the version on one of our glpi boxes,. I'll update to the newer version. |
Beta Was this translation helpful? Give feedback.
-
Yep, I will do that with the nightly build. I was refering to this part of the GLPI GUI ![]() Or will the update to glpi-inventory plugin change this? |
Beta Was this translation helpful? Give feedback.
-
Just to confirm I run this from /var/www/glpi with patch -p0 snmpv3-protocols-glpi-update.patch |
Beta Was this translation helpful? Give feedback.
-
Ignore that, I got it now. |
Beta Was this translation helpful? Give feedback.
-
Hi @g-bougard Just an update for you. So, thanks for fixing this and your patience. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Your question
glpi-agent uses Net::SNMP to do its SNMP queries, but we have devices that use auth and priv encrytpion types AES256 and SHA256. And the very latest version of NET::SNMP doesn't support those.
The issue is the USM.pl file in the modules Perl directory. I've found a couple of posts in the Internet that say they have patched versions of USM and I've tried them, but they still fail, I suspect the postings were years ago and not related to the version of Net::SNMP we have installed, 6.0.1.
I've even tried to get ChatGPT to rewrite our current USM.pm file, but with mixed results, ultimately it still doesn't work.
We have SNMP v5.9 unix package installed, which doesn't support them. So, is there a way to get glpi-agent to use unix snmp instead? Or has anyone got a patched USM.pm file from Net::SNMP V6.0.1 that works?
I suspect this might be a common thing shortly as people and companies are hardening their devices even more.
Beta Was this translation helpful? Give feedback.
All reactions