[SNMP4J] Can SNMPv3 user credentials be passed to a new SNMP session?

Frank Fock fock at agentpp.com
Fri Oct 19 00:09:03 CEST 2007


Hi Alex,

It should be no problem to reuse USM users
for different USM security models. However,
you have to make sure, that the user is not
localized and that the engine IDs of the
Snmp/USM instances differ.

Best regards,
Frank

Clamann, Alex wrote:
> I am trying to pass SNMPv3 user credentials from one instance of an
> org.snmp4j.Snmp to another instance. Can this be done?
>  
> I have an SNMP manager that retrieves a list of IP addresses, I would
> like to be able to launch a new manager with the same credentials as the
> first manager, but with a new target and its own org.snmp4j.Snmp object.
>  
> My attempts at this process seem to have disrupted the credentials of
> the original Snmp object. SNMP requests by the newly instantiated SNMP
> manager time out and subsequent SNMP requests from the original manager
> timeout as well.
>  
> Object with Snmp instance #1:
>  
> UsmUserEntry userEntry = snmp.getUSM().getUser( new
> OctetString(snmp.getLocalEngineID()), ( (UserTarget) getTarget()
> ).getSecurityName() );
> int securityLevel = ( (UserTarget) getTarget() ).getSecurityLevel();
>  
>  
> Object with Snmp instance #2:
>  
> private void snmpV3ConnectionUpdate(UsmUserEntry user, int
> securityLevel) {
> 
>         InetAddress host;
>         String hostName = ipAddressTextField.getText();
>         try {
>             host = InetAddress.getByName( hostName );
>         } catch (UnknownHostException ex) {
>             log.warn(ex.getMessage());
>             return;
>         }
>         UdpAddress address = new UdpAddress(host, 161);
>         
>         v3Target = new UserTarget();
>         v3Target.setAddress(address);
>         
>         v3Target.setRetries(snmpRetries);
>         v3Target.setTimeout(snmpTimeout);
>         v3Target.setVersion(SnmpConstants.version3);
>         
>         snmp.getUSM().removeAllUsers();
>         snmp.getUSM().addUser(user.getUserName(), (UsmUser)
> user.getUsmUser().clone());
>         
>         v3Target.setSecurityName(user.getUserName());
>         v3Target.setSecurityLevel(securityLevel);
> }
>  
> Has anyone been able to pass v3 credentials from one SNMP object to
> another?
>  
> Thanks,
> -Alex
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list