Handling SNMPv3 Discovery Requests in SNMPAgent Components
When working with SNMPv3, the agent must properly respond to discovery requests initiated by a manager before secure communication can occur. The SNMPAgent and SNMPTCPAgent components support this process either through predefined users or by handling specific events during the discovery sequence.
You can respond to a discovery request sent by the SNMPMgr or SNMPTCPMgr (or another manager application) in two ways:
- Use the AddUser method to predefine users
- Handle events to dynamically respond during the discovery process
The following outlines the event-driven discovery flow on the agent side:
DiscoveryRequest Event Fires
This event is triggered when a discovery request is received. Set Respond to true to allow the agent to respond and proceed with the discovery process.
GetUserSecurityLevel Event Fires
This event requests the security level for the specified user.
The User parameter should be populated with the username. You use this username to determine what the correct security level is. The component is asking you what level of security to give to this user.
Set the SecurityLevel to 1 (Auth - authentication) or 2 (AuthPriv - authentication and encryption) based on the username and what you are expecting knowing how the manager is set up.
- Use the User parameter to identify the user
-
Set SecurityLevel based on the expected configuration:
- 1 – Authentication (Auth)
- 2 – Authentication and Encryption (AuthPriv)
GetUserPassword Event - Authentication
This event requests the authentication password.
- User identifies the user
- PasswordType = 1 indicates authentication
- Provide the appropriate authentication password
GetUserPassword Event - Privacy
This event is triggered again to request the encryption (privacy) password.
PasswordType = 2 indicates privacy Set the encryption password and specify the Algorithm
Supported algorithms:
- 1 – DES (default)
- 2 – AES
- 3 – 3DES
- 4 – AES192
- 5 – AES256
DiscoveryRequest Event - Final Step
This event fires again to complete the discovery process. Set Respond to true to finalize the exchange.
Once the discovery process completes successfully, the manager can send Get and Set requests to the SNMPAgent or SNMPTCPAgent component.
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.