problem with querying snmpv3 with auth and priv

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 ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Users

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-08-2007
google@lockdown.nu
 
Posts: n/a
Default problem with querying snmpv3 with auth and priv

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.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:20 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0