[SNMP4J] Does snmp4j allow disabling v3 trap authentication?

Li, Hoiying hli at ciena.com
Wed Nov 21 20:20:17 CET 2012


Hi,

I implemented a simple snmp4j trap listener a while ago which has been receiving SNMPv1 and SNMPv2c traps without any issue. Recently I noticed that my trap listener is not receiving v3 traps. According to the following snmp4j documentation, to receive v3 traps, I have to add the highlighted code with the v3 USM configured. My system allows various v3 credentials to be configured on the agents and the v3 credentials are not naturally known to the trap listener. I'm wondering if snmp4j allows disabling v3 trap authentication in some way so that my current trap listener code can also receive v3 traps without having to configure USM?

Example for Receiving SNMP Messages
import org.snmp4j.*;
import org.snmp4j.smi.*;
import org.snmp4j.mp.SnmpConstants;
...
TransportMapping transport =
    new DefaultUdpTransportMapping(new UdpAddress("0.0.0.0/161"));
Snmp snmp = new Snmp(transport);
if (version == SnmpConstants.version3) {
    byte[] localEngineID =
        ((MPv3)snmp.getMessageProcessingModel(MessageProcessingModel.MPv3)).createLocalEngineID();
    USM usm = new USM(SecurityProtocols.getInstance(),
                      new OctetString(localEngineID), 0);
    SecurityModels.getInstance().addSecurityModel(usm);
    snmp.setLocalEngine(localEngineID, 0, 0);
    // Add the configured user to the USM
    ...
}
snmp.addCommandResponder(this);
snmp.listen();
...
public synchronized void processPdu(CommandResponderEvent e) {
    PDU command = e.getPdu();
    if (command != null) {
    ...
    }
}


Thanks,
Hoiying



More information about the SNMP4J mailing list