1.6. Abstract Service Interfaces
1.6. Abstract Service Interfaces
The User-based Security Model is designed to integrate with the SNMPv3 architecture through well-defined abstract service interfaces. These interfaces allow the USM to work independently of other subsystems while providing necessary security services.
Security Model Interface
The USM implements the Security Model interface defined in RFC 3411. This interface consists of two primary primitives:
1. generateRequestMsg
Purpose: Process an outgoing SNMP message by adding security-related information.
Inputs:
messageProcessingModel: The SNMP version (3 for SNMPv3)globalData: Global message header informationmaxMessageSize: Maximum message size supportedsecurityModel: Security model identifier (3 for USM)securityEngineID: The authoritative SNMP engine's identifiersecurityName: The principal on whose behalf the message is being generatedsecurityLevel: The desired security level (noAuthNoPriv, authNoPriv, or authPriv)scopedPDU: The message payload to be secured
Outputs:
securityParameters: USM-specific security parameters (engineID, engineBoots, engineTime, userName, authentication parameters, privacy parameters)wholeMsg: The complete secured message ready for transmissionstatusInformation: Success or error indication
Processing:
- Validate inputs
- Retrieve user's authentication and privacy keys
- Increment and include engineBoots and engineTime
- Apply privacy protocol if securityLevel includes privacy
- Calculate authentication digest if securityLevel includes authentication
- Assemble the complete message
2. processIncomingMsg
Purpose: Process an incoming SNMP message by verifying security-related information.
Inputs:
messageProcessingModel: The SNMP versionmaxMessageSize: Maximum message size supportedsecurityParameters: The received USM security parameterssecurityModel: Security model identifiersecurityLevel: The expected security levelwholeMsg: The complete received messagesecurityEngineID: The authoritative engine's identifier (from message)
Outputs:
securityName: The authenticated principalscopedPDU: The decrypted and verified message payloadmaxSizeResponseScopedPDU: Maximum size for responsesecurityStateReference: Reference for generating responsesstatusInformation: Success or error indication
Processing:
- Parse securityParameters
- Verify msgAuthoritativeEngineID matches local engine (for command responders)
- Verify userName exists in usmUserTable
- Check time window (engineBoots and engineTime)
- Decrypt message if privacy was applied
- Verify authentication digest if authentication was applied
- Extract and return scopedPDU
Integration with Message Processing Subsystem
The Message Processing Subsystem invokes the USM through these interfaces at specific points in message processing:
For Outgoing Messages:
Application → Dispatcher → Message Processing → Security Model (USM) → Transport
For Incoming Messages:
Transport → Dispatcher → Message Processing → Security Model (USM) → Application
Interaction with Access Control
The USM provides the authenticated securityName to the Access Control Subsystem (VACM), which uses it to determine authorization:
- USM authenticates the user and provides
securityName - VACM uses
securityName,securityModel, andsecurityLevelto determine access rights - VACM grants or denies access based on configured policies
This separation ensures that:
- USM focuses on: "Who are you?" (Authentication) and "Is the message intact?" (Integrity)
- VACM focuses on: "What are you allowed to do?" (Authorization)
Error Handling and Reports
When the USM detects a security error, it may generate a Report-PDU:
Common Error Scenarios:
-
Unknown Engine ID:
usmStatsUnknownEngineIDscounter incremented- Used during discovery process
- Report contains the local engine's engineID
-
Time Window Violation:
usmStatsNotInTimeWindowscounter incremented- Used during time synchronization
- Report contains current engineBoots and engineTime
-
Authentication Failure:
usmStatsWrongDigestscounter incremented- Indicates incorrect password/key or message tampering
- Report sent at same security level as received message
-
Decryption Failure:
usmStatsDecryptionErrorscounter incremented- Indicates incorrect privacy key or message corruption
- Report sent at same security level as received message
-
Unknown User:
usmStatsUnknownUserNamescounter incremented- Indicates userName not in usmUserTable
- Report sent without authentication
Service Primitive Sequences
Discovery Sequence
1. Application sends request with empty engineID
2. USM generates message with securityLevel = noAuthNoPriv
3. Authoritative engine receives message
4. USM detects unknown engineID
5. USM generates Report with usmStatsUnknownEngineIDs
6. Application receives Report, learns engineID
Time Synchronization Sequence
1. Application sends request with cached engineID, zero engineBoots/Time
2. USM generates authenticated message
3. Authoritative engine receives message
4. USM detects time window violation
5. USM generates Report with usmStatsNotInTimeWindows and current time values
6. Application receives Report, updates cached time values
7. Application retries original request with synchronized time
Authenticated Communication Sequence
1. Application sends request
2. USM generates authenticated message with current engineBoots/Time
3. USM calculates authentication digest
4. Authoritative engine receives message
5. USM verifies time window
6. USM verifies authentication digest
7. USM extracts scopedPDU
8. Application processes request
9. Application generates response
10. USM generates authenticated response message
11. Non-authoritative engine receives response
12. USM verifies authentication digest
13. USM extracts scopedPDU
14. Application processes response
Asynchronous vs. Synchronous Operation
The abstract service interfaces are designed to support both:
Synchronous Operation:
- Application waits for response
- Typical for command generator/responder model
Asynchronous Operation:
- Application does not wait
- Typical for notification originator/receiver model
The USM does not dictate the operational model; it simply provides security services regardless of how the application chooses to operate.