jonnystorm / snmp-elixir

An SNMP client library for Elixir
Mozilla Public License 2.0
33 stars 12 forks source link

About SNMPv3 USM support #36

Closed goldcode88 closed 5 years ago

goldcode88 commented 5 years ago

I run 'snmpget' command. It works well. But I run 'SNMP.get [1, 3, 6, 1, 2, 1, 1, 5, 0],"104.236.166.95",v3_cred', it return timeout. By Fix #6 ,I think 'snmp-elixir' had solved 'snmp get without engine-id' problem, isn't it?

$ snmpget -v 3 -u "usr-md5-des" -a MD5 -A "authkey1" -x DES -X "privkey1" -l authPriv 104.236.166.95 1.3.6.1.2.1.1.1.0 SNMPv2-MIB::sysDescr.0 = STRING: Linux zeus 4.8.6.5-smp #2 SMP Sun Nov 13 14:58:11 CDT 2016 i686

$ iex -S mix Erlang/OTP 21 [erts-10.0.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]

Interactive Elixir (1.7.0) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> SNMP.start iex(3)> v3_cred = SNMP.credential [:v3, :auth_priv, "usr-md5-des", :md5, "authkey1", :aes, "privkey1",] iex(4)> SNMP.get [1, 3, 6, 1, 2, 1, 1, 5, 0],"104.236.166.95",v3_cred

11:43:22.119 [debug] Will register agent snmp://104.236.166.95 with target [164, 78, 169, 166, 59, 86, 100, 147, 54, 157, 220, 138, 210, 27, 109, 232, 145, 64, 121, 172] and config [engine_id: [128, 0, 0, 0, 6], address: [104, 236, 166, 95], port: 161, tdomain: :transportDomainUdpIpv4, sec_level: :authPriv, sec_model: :usm, sec_name: 'usr-md5-des', version: :v3].

11:43:29.121 [error] Timeout! {:error, :etimedout} iex(5)>

jonnystorm commented 5 years ago

That error, though woefully generic, is appropriate when the user is usr-md5-des and the privacy protocol is :aes. Changing the protocol to :des should work as expected.

However, you should know that there is no happy ending for AES. See the comments in #6 for the patch to fix the AES decoder bug in Erlang.

goldcode88 commented 5 years ago

I make a mistake. It works well now. Thanks!