This is a discussion on problem with querying snmpv3 with auth and priv within the SNMP Users forums, part of the Networking and Network Related category; I am using the Net::SNMP module for polling and am tring to use the authkey and privkey feature to ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am using the Net::SNMP module for polling and am tring to use the
authkey and privkey feature to prevent having passwords in the script. I can poll my agent with the following command: # snmpwalk -a md5 -l authpriv -v3 -u test1 10.140.186.65 -x DES -X password -A password 1.3.6.1.2.1.2.1.0 IF-MIB::ifNumber.0 = INTEGER: 57 I generated keys using snmpkey: secengdev07:/home/firesu # snmpkey md5 password 0x800007E580723A9134B3EBC945 des password authKey: 0x2304444b34a3cab354361d9a92f69a14 privKey: 0x2304444b34a3cab354361d9a92f69a14 And I wrote the following test script: #!/usr/bin/perl -w use Net::SNMP; use Data::Dumper; use strict; my $hostname = "10.140.186.65"; my $port = "161"; my $version = "3"; my $domain = "udp"; my $username = "test1"; my $authpasswd = "password"; my $privpasswd = "password"; my $authprotocol = "md5"; my $authkey = "0x2304444b34a3cab354361d9a92f69a14"; my $privprotocol = "des"; my $privkey = "0x2304444b34a3cab354361d9a92f69a14"; my $seconds = 2; my $count = 3; # requires a hostname and a community string as its arguments my ($session, $error) = Net::SNMP->session( -hostname => $hostname, -port => $port, -version => $version, -domain => $domain, -timeout => $seconds, -retries => $count, -username => $username, -authprotocol => $authprotocol, # -authpassword => $authpasswd, # -privpassword => $privpasswd, -authkey => $authkey, -privprotocol => $privprotocol, -privkey => $privkey ); die "session error: $error" unless ($session); # iso.org.dod.internet.mgmt.mib-2.interfaces.ifNumber.0 = # 1.3.6.1.2.1.2.1.0 my $result = $session->get_request("1.3.6.1.2.1.2.1.0"); die "request error: ".$session->error unless (defined $result); $session->close; print Data::Dumper->Dump([$result]), " ", $error; print "Number of interfaces: ".$result->{"1.3.6.1.2.1.2.1.0"}."\n"; If I use the passwords (rather than keys) then I can poll the agent. However if I use the keys, then I see the following when running snmp agent in debug: Feb 8 11:27:35 cluster6-pfw snmpd[16447]: Parsed SNMPv3 message (secName:test1, secLevel:authPriv): USM authentication failure (incorrect password or key) The agent version is: [Expert@cluster6-pfw]# snmpd -v NET-SNMP version: 5.0.9 Web: http://www.net-snmp.org/ Email: net-snmp-coders@lists.sourceforge.net My question is, is my syntax correct for the snmpkey and perl script? Should I contact the vendor of the snmp agent? TIA for your time, Steve. |