java.lang.Object
org.snmp4j.agent.mo.snmp.UsmMIB
- All Implemented Interfaces:
EventListener,MOTableRowListener<UsmMIB.UsmTableRow>,MOValueValidationListener,MOGroup,org.snmp4j.event.CounterListener,org.snmp4j.event.UsmUserListener
public class UsmMIB
extends Object
implements MOGroup, org.snmp4j.event.CounterListener, MOValueValidationListener, MOTableRowListener<UsmMIB.UsmTableRow>, org.snmp4j.event.UsmUserListener
The
UsmMIB implements the SNMP-USER-BASED-SM-MIB defined in
RFC 3414. The MIB implementation is backed by a USM instance.
The configuration of the user based security model can be changed
using the underlying USM or via SNMP but at
least one user must be created programatically in order to allow any access
to the agent via SNMP.
When modifying the USM after having created this MIB, you will have to
register this object as UsmUserListener to the USM.
By using SNMP, a new users can only be created by cloning it from an existing user with the same or higher security level.
- Version:
- 1.2
- Author:
- Frank Fock
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final org.snmp4j.smi.OIDstatic final org.snmp4j.smi.OIDstatic final org.snmp4j.smi.OIDstatic final org.snmp4j.smi.OID -
Constructor Summary
ConstructorsConstructorDescriptionUsmMIB(org.snmp4j.security.USM usm, org.snmp4j.security.SecurityProtocols securityProtocols) Creates a USM MIB implementation connected to the supplied USM. -
Method Summary
Modifier and TypeMethodDescriptionorg.snmp4j.smi.OIDgetProtocolForKeyChange(Request<?, ?, ?> request, org.snmp4j.smi.OID rowIndex, org.snmp4j.security.dh.DHOperations.KeyType keyType) org.snmp4j.security.SecurityProtocolsvoidincrementCounter(org.snmp4j.event.CounterEvent event) static org.snmp4j.security.UsmUserEntrylocalizeUser(org.snmp4j.smi.OctetString securityName, org.snmp4j.smi.OctetString localizationEngineID, org.snmp4j.smi.OID authProtocol, org.snmp4j.smi.OctetString authPassphrase, org.snmp4j.smi.OID privProtocol, org.snmp4j.smi.OctetString privPassphrase, org.snmp4j.security.SecurityProtocols securityProtocols) voidregisterMOs(MOServer server, org.snmp4j.smi.OctetString context) Registers the managed objects of this group with the server for the supplied context.voidA column or a complete row is changed/has been changed.voidunregisterMOs(MOServer server, org.snmp4j.smi.OctetString context) Unregisters the managed objects of this group from the supplied server and from the supplied context.voidusmUserChange(org.snmp4j.event.UsmUserEvent event) voidvalidate(MOValueValidationEvent validationEvent) Validates a value by returning a SNMP error code if validation fails or 0 (SnmpConstants.SNMP_ERROR_SUCCESS) if the validation was successful.
-
Field Details
-
noAuthProtocol
public static final org.snmp4j.smi.OID noAuthProtocol -
noPrivProtocol
public static final org.snmp4j.smi.OID noPrivProtocol -
usmUserSpinLockOID
public static final org.snmp4j.smi.OID usmUserSpinLockOID -
usmUserEntryOID
public static final org.snmp4j.smi.OID usmUserEntryOID -
colUsmUserSecurityName
public static final int colUsmUserSecurityName- See Also:
-
colUsmUserCloneFrom
public static final int colUsmUserCloneFrom- See Also:
-
colUsmUserAuthProtocol
public static final int colUsmUserAuthProtocol- See Also:
-
colUsmUserAuthKeyChange
public static final int colUsmUserAuthKeyChange- See Also:
-
colUsmUserOwnAuthKeyChange
public static final int colUsmUserOwnAuthKeyChange- See Also:
-
colUsmUserPrivProtocol
public static final int colUsmUserPrivProtocol- See Also:
-
colUsmUserPrivKeyChange
public static final int colUsmUserPrivKeyChange- See Also:
-
colUsmUserOwnPrivKeyChange
public static final int colUsmUserOwnPrivKeyChange- See Also:
-
colUsmUserPublic
public static final int colUsmUserPublic- See Also:
-
colUsmUserStorageType
public static final int colUsmUserStorageType- See Also:
-
colUsmUserStatus
public static final int colUsmUserStatus- See Also:
-
colUsmUserAuthPassword
public static final int colUsmUserAuthPassword- See Also:
-
colUsmUserPrivPassword
public static final int colUsmUserPrivPassword- See Also:
-
colUsmUserLocalizationEngineID
public static final int colUsmUserLocalizationEngineID- See Also:
-
colUsmUserAuthKey
public static final int colUsmUserAuthKey- See Also:
-
colUsmUserPrivKey
public static final int colUsmUserPrivKey- See Also:
-
-
Constructor Details
-
UsmMIB
public UsmMIB(org.snmp4j.security.USM usm, org.snmp4j.security.SecurityProtocols securityProtocols) Creates a USM MIB implementation connected to the supplied USM. The MIB contents will reflect any changes to the USM after completion of this constructor if you register this object asUsmUserListenerto the USM!- Parameters:
usm- a User-based Security Model.securityProtocols- the supportedSecurityProtocols.
-
-
Method Details
-
getProtocolForKeyChange
public org.snmp4j.smi.OID getProtocolForKeyChange(Request<?, ?, ?> request, org.snmp4j.smi.OID rowIndex, org.snmp4j.security.dh.DHOperations.KeyType keyType) -
getSecurityProtocols
public org.snmp4j.security.SecurityProtocols getSecurityProtocols() -
registerMOs
public void registerMOs(MOServer server, org.snmp4j.smi.OctetString context) throws DuplicateRegistrationException Description copied from interface:MOGroupRegisters the managed objects of this group with the server for the supplied context.- Specified by:
registerMOsin interfaceMOGroup- Parameters:
server- theMOServerwhere to register the managed objects.context- the context to use (may benullif no specific context is selected).- Throws:
DuplicateRegistrationException- if a managed object's scope (i.e. lower bound) is already registered at the server.
-
unregisterMOs
Description copied from interface:MOGroupUnregisters the managed objects of this group from the supplied server and from the supplied context.- Specified by:
unregisterMOsin interfaceMOGroup- Parameters:
server- theMOServerwhere to unregister the managed objects.context- the context to use (may benullif no specific context is selected).
-
incrementCounter
public void incrementCounter(org.snmp4j.event.CounterEvent event) - Specified by:
incrementCounterin interfaceorg.snmp4j.event.CounterListener
-
validate
Description copied from interface:MOValueValidationListenerValidates a value by returning a SNMP error code if validation fails or 0 (SnmpConstants.SNMP_ERROR_SUCCESS) if the validation was successful. The validation is returned by calling theMOValueValidationEvent.setValidationStatus(int)method. If an error occured the returned status value should be one of the following values:SnmpConstants.SNMP_ERROR_WRONG_LENGTHSnmpConstants.SNMP_ERROR_WRONG_VALUESnmpConstants.SNMP_ERROR_WRONG_TYPESnmpConstants.SNMP_ERROR_WRONG_ENCODINGSnmpConstants.SNMP_ERROR_BAD_VALUE
- Specified by:
validatein interfaceMOValueValidationListener- Parameters:
validationEvent- theMOValueValidationEventcontaining the value to validate.
-
usmUserChange
public void usmUserChange(org.snmp4j.event.UsmUserEvent event) - Specified by:
usmUserChangein interfaceorg.snmp4j.event.UsmUserListener
-
getUsmUserEntry
public DefaultMOTable<UsmMIB.UsmTableRow,MOColumn, getUsmUserEntry()DefaultMOMutableTableModel<UsmMIB.UsmTableRow>> -
rowChanged
Description copied from interface:MOTableRowListenerA column or a complete row is changed/has been changed.- Specified by:
rowChangedin interfaceMOTableRowListener<UsmMIB.UsmTableRow>- Parameters:
event- aMOTableRowEventdescribing the event. To veto the event theMOTableRowEvent.setVetoStatus(int)and optionally also theMOTableRowEvent.setVetoColumn(int)can be called. IfMOTableRowEvent.getNumberOfConsecutiveEventsOfSameOrigin()is greater than zero you need to setMOTableRowEvent.setSendNextEventsOfSameOrigin(boolean)totruein order to receive those consecutive events too. Otherwise they will be ignored and not been propagated to this listener.
-
localizeUser
public static org.snmp4j.security.UsmUserEntry localizeUser(org.snmp4j.smi.OctetString securityName, org.snmp4j.smi.OctetString localizationEngineID, org.snmp4j.smi.OID authProtocol, org.snmp4j.smi.OctetString authPassphrase, org.snmp4j.smi.OID privProtocol, org.snmp4j.smi.OctetString privPassphrase, org.snmp4j.security.SecurityProtocols securityProtocols)
-