RFC 2272

Message Processing and Dispatching for the Simple Network Management Protocol (SNMP)

๐Ÿ“… published January 1998, from ietf

RFC 2272: Message Processing and Dispatching for the Simple Network Management Protocol (SNMP) ๐ŸŽ€

Okay bestie, so this is RFC 2272 ๐Ÿ’–, and it's all about how SNMP messages get processed and dispatched. It's a Standards Track doc from the Network Working Group, dated January 1998 ๐ŸŒธ. The authors are J. Case (SNMP Research, Inc.), D. Harrington (Cabletron Systems, Inc.), R. Presuhn (BMC Software, Inc.), and B. Wijnen (IBM T. J. Watson Research). It obsoletes RFC 2262 ๐Ÿ™ˆ, and the IANA Note explains that this is because of a clerical error in how the snmpModules got numbered. No updates to other RFCs are listed.


Status of this Memo โœจ

This document is an Internet standards track protocol for the Internet community, and it's literally asking for discussion and suggestions for improvements ๐Ÿซถ. If you want the current standardization state and status of this protocol, check the current edition of "Internet Official Protocol Standards" (STD 1) ๐Ÿ“š. Distribution of this memo is unlimited, so share away ๐Ÿ’….

Copyright (C) The Internet Society (1998). All Rights Reserved. Obviously ๐Ÿ’œ.

IANA Note ๐Ÿ”ฅ

So there was a clerical error in how the snmpModules got assigned in an earlier memo ๐Ÿ˜ญ. This RFC fixes that by giving the corrected number assignment for this protocol, and it obsoletes RFC 2262 ๐Ÿ’€.

Abstract ๐Ÿงš

Okay so this doc describes Message Processing and Dispatching for SNMP messages within the SNMP architecture [RFC2271] โœจ. It spells out the procedures for dispatching potentially multiple versions of SNMP messages to the right SNMP Message Processing Models, and for dispatching PDUs to SNMP applications ๐Ÿ“. It also describes one Message Processing Model in particular, the SNMPv3 Message Processing Model ๐Ÿ‘‘.

Table of Contents ๐ŸŒˆ

1. Introduction ...............................................    2
2. Overview ...................................................    3
2.1. The Dispatcher. ..........................................    5
2.2. Message Processing Subsystem .............................    5
3. Elements of Message Processing and Dispatching .............    6
3.1. messageProcessingModel ...................................    6
3.2. pduVersion ...............................................    6
3.3. pduType ..................................................    7
3.4. sendPduHandle ............................................    7
4. Dispatcher Elements of Procedure ...........................    7
4.1. Sending an SNMP Message to the Network ...................    7
4.1.1. Sending a Request or Notification ......................    7
4.1.2. Sending a Response to the Network ......................    9
4.2. Receiving an SNMP Message from the Network ...............   10
4.2.1. Message Dispatching of received SNMP Messages ..........   10
4.2.2. PDU Dispatching for Incoming Messages ..................   11
4.2.2.1. Incoming Requests and Notifications ..................   12
4.2.2.2. Incoming Responses ...................................   13
4.3. Application Registration for Handling PDU types ..........   14
4.4. Application Unregistration for Handling PDU Types ........   14
5. Definitions ................................................   15
5.1. Definitions for SNMP Message Processing and Dispatching ..   15
6. The SNMPv3 Message Format ..................................   18
6.1. msgVersion ...............................................   19
6.2. msgID ....................................................   19
6.3. msgMaxSize ...............................................   19
6.4. msgFlags .................................................   20
6.5. msgSecurityModel .........................................   22
6.6. msgSecurityParameters ....................................   22
6.7. scopedPduData ............................................   22
6.8. scopedPDU ................................................   22
6.8.1. contextEngineID ........................................   22
6.8.2. contextName ............................................   23
6.8.3. data ...................................................   23
7. Elements of Procedure for v3MP .............................   23
7.1. Prepare an Outgoing SNMP Message .........................   24
7.2. Prepare Data Elements from an Incoming SNMP Message ......   29
8. Intellectual Property ......................................   34
9. Acknowledgements ...........................................   35
10. Security Considerations ...................................   36
11. References ................................................   36
12. Editors' Addresses ........................................   38
13. Full Copyright Statement ..................................   39

1. Introduction ๐Ÿ’–

Okay so the Architecture for describing Internet Management Frameworks [RFC2271] tells us that an SNMP engine is made up of four things ๐Ÿงฉ:

  1. a Dispatcher
  2. a Message Processing Subsystem
  3. a Security Subsystem
  4. an Access Control Subsystem

Applications use the services of all of these subsystems ๐Ÿ’….

It's super important to get the SNMP architecture and its terminology down so you can see where the Message Processing Subsystem and Dispatcher from this doc fit in and how they interact with everything else ๐Ÿซถ. You're expected to have already read and understood the SNMP architecture description in [RFC2271], so no skipping that one bestie ๐Ÿ“š.

The Dispatcher is the part of the SNMP engine that sends and receives SNMP messages โœจ. It also dispatches SNMP PDUs to SNMP applications. When an SNMP message needs to be prepared, or data needs to be pulled out of one, the Dispatcher hands that job off to a message version-specific Message Processing Model inside the Message Processing Subsystem ๐Ÿฆ‹.

A Message Processing Model is in charge of processing a version-specific SNMP message ๐Ÿ”ฅ. It also coordinates with the Security Subsystem so the right security gets applied to the message being handled ๐Ÿ”.

The Dispatcher, the Message Processing Subsystem, and applications all talk to each other through abstract data elements and abstract service interface primitives that the SNMP architecture defines ๐Ÿงš.

The Message Processing Subsystem and the Security Subsystem talk the same way, using abstract data elements and abstract service interface primitives from the SNMP architecture too ๐Ÿ’œ.

Now the important bit ๐Ÿ‘‘: the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 โญ.

2. Overview ๐ŸŒธ

Here's a picture of how Message Processing fits in with SNMP applications, the Security Subsystem, and Transport Mappings ๐ŸŽ€.

+-------------------------------------------------------------------+
| SNMP Entity                                                       |
|                                                                   |
| +---------------------------------------------------------------+ |
| | Applications                                                  | |
| | +-----------+  +--------------+                               | |
| | | Command   |  | Notification |                               | |
| | | Generator |  | Originator   | +-----------+ +--------------+| |
| | +-----------+  +--------------+ | Proxy     | | Other         | |
| | +-----------+  +--------------+ | Forwarder | |Application(s)|| |
| | | Command   |  | Notification | +-----------+ +--------------+| |
| | | Responder |  | Receiver     |                               | |
| | +-----------+  +--------------+                               | |
| +---------------------------------------------------------------+ |
|        ^                ^               ^           ^             |
|        |                |               |           |             |
|        v                v               v           v             |
|        +--------+-------+---------------+-----------+             |
|                 ^                                                 |
|                 |    +---------------------+  +-----------------+ |
|                 |    | Message Processing  |  | Security        | |
| Dispatcher      v    | Subsystem           |  | Subsystem       | |
| +------------------+ |     +------------+  |  |                 | |
| | PDU Dispatcher   | |  +->| v1MP     * |<--->| +-------------+ | |
| |                  | |  |  +------------+  |  | | Other       | | |
| |                  | |  |  +------------+  |  | | Security    | | |
| |                  | |  +->| v2cMP    * |<--->| | Model       | | |
| | Message          | |  |  +------------+  |  | +-------------+ | |
| | Dispatcher  <-------->+                  |  |                 | |
| |                  | |  |  +------------+  |  | +-------------+ | |
| |                  | |  +->| v3MP     * |<--->| | User-based  | | |
| | Transport        | |  |  +------------+  |  | | Security    | | |
| | Mapping          | |  |  +------------+  |  | | Model       | | |
| | (e.g RFC1906)    | |  +->| otherMP  * |<--->| +-------------+ | |
| +------------------+ |     +------------+  |  |                 | |
|          ^           +---------------------+  +-----------------+ |
|          |                                                        |
+----------|--------------------------------------------------------+
           v
  +------------------+
  |   Network        |
  +------------------+

2.1. The Dispatcher. ๐Ÿฆ‹

The Dispatcher is a key piece of an SNMP engine ๐Ÿ”ฅ. There's only one in each SNMP engine, and its whole job is to dispatch tasks to the multiple version-specific Message Processing Models and to dispatch PDUs to the various applications ๐Ÿ’….

For outgoing messages, an application hands over a PDU to be sent, plus the data needed to prepare and send the message ๐Ÿ“จ. The application also picks which version-specific Message Processing Model will prepare the message with the desired security processing โœจ. Once the message is prepared, the Dispatcher sends it off ๐Ÿš€.

For incoming messages, the Dispatcher figures out which SNMP version the message is and passes it to the matching version-specific Message Processing Model ๐Ÿงš. That model pulls out the message's components and coordinates the security services for it ๐Ÿ”. After that version-specific processing is done, the PDU Dispatcher decides which application, if any, should get the PDU for processing and forwards it there ๐Ÿ’–.

While it's sending and receiving SNMP messages, the Dispatcher also collects statistics about those messages and about how the SNMP engine is behaving ๐Ÿ“Š. It keeps them in managed objects so remote SNMP entities can access them ๐ŸŒˆ. This document defines those managed objects, the MIB module that contains them, and how these managed objects might be used to provide useful management ๐Ÿ‘‘.

2.2. Message Processing Subsystem โœจ

The Message Processing Subsystem is the part of an SNMP engine that hangs out with the Dispatcher and handles the version-specific SNMP messages ๐Ÿ’… It holds one or more Message Processing Models.

This document describes one Message Processing Model, the SNMPv3 Message Processing Model, in Section 6 ๐Ÿฆ‹ The SNMPv3 model gets its own section to show that multiple (independent) Message Processing Models can exist at the same time, and that they can be described in different documents ๐ŸŒˆ The SNMPv3 Message Processing Model can be replaced or supplemented with other Message Processing Models in the future. Two that are expected to be developed later are the SNMPv1 message format [RFC1157] and the SNMPv2c message format [RFC1901]. Others may be developed as needed ๐Ÿ’–

3. Elements of Message Processing and Dispatching ๐ŸŽ€

See [RFC2271] for the definitions of:

  • contextEngineID
  • contextName
  • scopedPDU
  • maxSizeResponseScopedPDU
  • securityModel
  • securityName
  • securityLevel
  • messageProcessingModel

Okay so, for incoming messages, a version-specific message processing module hands these values over to the Dispatcher ๐Ÿ“ฌ For outgoing messages, it's the application that provides them. โœจ

For some version-specific processing, the values may be pulled out of received messages. For other versions, they may be worked out by an algorithm or by some implementation-defined mechanism ๐Ÿงš The way a value gets determined is totally irrelevant to the Dispatcher, bestie ๐Ÿ’…

The following additional or expanded definitions are for use within the Dispatcher. ๐ŸŒธ

3.1. messageProcessingModel ๐Ÿฆ‹

The value of messageProcessingModel identifies a Message Processing Model. A Message Processing Model is basically the rulebook for a version: it describes the version-specific procedures for extracting data from messages and generating messages ๐Ÿ™ˆ It also calls upon a securityModel to apply its security services to messages, converts data from a version-specific message format into a generic format the Dispatcher can use, and converts data from Dispatcher format back into a version-specific message format. Iconic. ๐Ÿ‘‘

3.2. pduVersion ๐Ÿ’œ

The value of pduVersion represents a specific version of protocol operation and its associated PDU formats, such as SNMPv1 or SNMPv2 [RFC1905]. The values of pduVersion are specific to the version of the PDU contained in a message, and to the PDUs processed by applications. The Dispatcher does not use the value of pduVersion directly. It's not its business, periodt ๐Ÿ’…

An application specifies the pduVersion when it asks the PDU Dispatcher to send a PDU to another SNMP engine. The Dispatcher passes the pduVersion to a Message Processing Model, so that model knows how to handle the PDU properly ๐ŸŽ€

For incoming messages, pduVersion is provided to the Dispatcher by a version-specific Message Processing module. The PDU Dispatcher then passes the pduVersion to the application, so the application knows how to handle the PDU properly. For example, a command responder application needs to know whether to use the [RFC1905] elements of procedure and syntax instead of the ones specified for SNMPv1 ๐Ÿง Main character energy for that app, no cap.

3.3. pduType ๐Ÿ“

A value of pduType represents a specific type of protocol operation. The values of pduType are specific to the version of the PDU contained in a message. โญ

Applications register to support particular pduTypes for particular contextEngineIDs. Register early, register often ๐Ÿซถ

For incoming messages, pduType is provided to the Dispatcher by a version-specific Message Processing module. It is then used to dispatch the PDU to the application that registered for that pduType, for the contextEngineID of the associated scopedPDU. Delivery vibes, literally โœจ

3.4. sendPduHandle ๐ŸŒˆ

This handle is generated to coordinate the processing of requests and responses between the SNMP engine and an application ๐Ÿฆ‹ The handle must be unique across all version-specific Message Processing Models, and it is of local significance only. Local only, not everywhere, lowkey important ๐Ÿ’–

4. Dispatcher Elements of Procedure ๐Ÿ”ฅ

This section describes the procedures the Dispatcher follows when it generates and processes SNMP messages. It's the step-by-step choreography, bestie ๐Ÿ’ƒ

4.1. Sending an SNMP Message to the Network ๐Ÿš€

This section describes the procedure an SNMP engine follows whenever it sends an SNMP message. โœจ

4.1.1. Sending a Request or Notification ๐Ÿ“จ

The following procedures are followed by the Dispatcher when an application wants to send an SNMP PDU to another (remote) application. In other words, this is how you initiate a communication by originating a message, such as one containing a request or a trap ๐ŸŒธ

  1. The application requests this using the abstract service primitive:
statusInformation =              -- sendPduHandle if success
                                 -- errorIndication if failure
  sendPdu(
  IN   transportDomain           -- transport domain to be used
  IN   transportAddress          -- destination network address
  IN   messageProcessingModel    -- typically, SNMP version
  IN   securityModel             -- Security Model to use
  IN   securityName              -- on behalf of this principal
  IN   securityLevel             -- Level of Security requested
  IN   contextEngineID           -- data from/at this entity
  IN   contextName               -- data from/in this context
  IN   pduVersion                -- the version of the PDU
  IN   PDU                       -- SNMP Protocol Data Unit
  IN   expectResponse            -- TRUE or FALSE
       )
  1. If the messageProcessingModel value does not represent a Message Processing Model known to the Dispatcher, then an errorIndication (implementation-dependent) is returned to the calling application. No further processing is performed. ๐Ÿ™…โ€โ™€๏ธ
  2. The Dispatcher generates a sendPduHandle to coordinate subsequent processing. ๐ŸŽŸ๏ธ
  3. The Message Dispatcher sends the request to the version-specific Message Processing module identified by messageProcessingModel, using the abstract service primitive:
statusInformation =              - success or error indication
  prepareOutgoingMessage(
  IN   transportDomain           -- as specified by application
  IN   transportAddress          -- as specified by application
  IN   messageProcessingModel    -- as specified by application
  IN   securityModel             -- as specified by application
  IN   securityName              -- as specified by application
  IN   securityLevel             -- as specified by application
  IN   contextEngineID           -- as specified by application
  IN   contextName               -- as specified by application
  IN   pduVersion                -- the version of the PDU
  IN   PDU                       -- as specified by application
  IN   expectResponse            -- as specified by application
  IN   sendPduHandle             -- as determined in step 3.
  OUT  destTransportDomain       -- destination transport domain
  OUT  destTransportAddress      -- destination transport address
  OUT  outgoingMessage           -- the message to send
  OUT  outgoingMessageLength     -- the message length
       )
  1. If the statusInformation indicates an error, the errorIndication is returned to the calling application. No further processing is performed. ๐Ÿฅฒ
  2. If the statusInformation indicates success, the sendPduHandle is returned to the application, and the outgoingMessage is sent via the transport specified by the transportDomain to the address specified by the transportAddress. Sent, bestie ๐Ÿ•Š๏ธ

Outgoing Message Processing is complete. โœ…

4.1.2. Sending a Response to the Network ๐Ÿ’Œ

The following procedure is followed when an application wants to return a response back to the originator of an SNMP Request. It's the reply game ๐Ÿ’ฌ

  1. An application can request this using the abstract service primitive:
returnResponsePDU(
 IN   messageProcessingModel   -- typically, SNMP version
 IN   securityModel            -- Security Model in use
 IN   securityName             -- on behalf of this principal
 IN   securityLevel            -- same as on incoming request
 IN   contextEngineID          -- data from/at this SNMP entity
 IN   contextName              -- data from/in this context
 IN   pduVersion               -- the version of the PDU
 IN   PDU                      -- SNMP Protocol Data Unit
 IN   maxSizeResponseScopedPDU -- maximum size of Response PDU
 IN   stateReference           -- reference to state information
                               -- as presented with the request
 IN   statusInformation        -- success or errorIndication
 )                             -- (error counter OID and value
                               -- when errorIndication)
  1. The Message Dispatcher sends the request to the appropriate Message Processing Model indicated by the received value of messageProcessingModel, using the abstract service primitive:
result =                        -- SUCCESS or errorIndication
 prepareResponseMessage(
 IN   messageProcessingModel   -- specified by application
 IN   securityModel            -- specified by application
 IN   securityName             -- specified by application
 IN   securityLevel            -- specified by application
 IN   contextEngineID          -- specified by application
 IN   contextName              -- specified by application
 IN   pduVersion               -- specified by application
 IN   PDU                      -- specified by application
 IN   maxSizeResponseScopedPDU -- specified by application
 IN   stateReference           -- specified by application
 IN   statusInformation        -- specified by application
 OUT  destTransportDomain      -- destination transport domain
 OUT  destTransportAddress     -- destination transport address
 OUT  outgoingMessage          -- the message to send
 OUT  outgoingMessageLength    -- the message length
      )
  1. If the result is an errorIndication, the errorIndication is returned to the calling application. No further processing is performed. ๐Ÿ™ƒ
  2. If the result is success, the outgoingMessage is sent over the transport specified by the transportDomain to the address specified by the transportAddress. ๐Ÿ“ค

Message Processing is complete. ๐ŸŽ‰

4.2. Receiving an SNMP Message from the Network ๐Ÿ“ฅ

This section describes the procedure an SNMP engine follows whenever it receives an SNMP message. ๐Ÿ‘€

Please note, that for the sake of clarity and to prevent the text from being even longer and more complicated, some details were omitted from the steps below. In particular, the elements of procedure do not always explicitly indicate when state information needs to be released. The general rule is that if state information is available when a message is to be "discarded without further processing", then the state information must also be released at that same time. Don't skip the release step, bestie, it matters ๐Ÿงน๐Ÿ’œ

4.2.1. Message Dispatching of received SNMP Messages โœจ

okay so this is the receiving flow, and it's giving very step-by-step ๐Ÿ’… Here's what happens when a message lands:

  1. The snmpInPkts counter [RFC1907] is incremented. ๐Ÿ“ˆ
  2. The version of the SNMP message is figured out in an implementation-dependent way. ๐Ÿ” If the packet can't be parsed well enough to tell the version, the snmpInASNParseErrs [RFC1907] counter gets incremented and the message is discarded right away, no further processing ๐Ÿ—‘๏ธ. If the version isn't supported, the snmpInBadVersions [RFC1907] counter gets incremented and the message is discarded without further processing too ๐Ÿ™…โ€โ™€๏ธ
  3. The origin transportDomain and origin transportAddress get determined. ๐Ÿ“
  4. The message gets handed to the version-specific Message Processing Model, which gives back the abstract data elements the Dispatcher needs. This happens with the abstract service primitive below ๐ŸŽ€
result =                        -- SUCCESS or errorIndication
  prepareDataElements(
  IN   transportDomain          -- origin as determined in step 3.
  IN   transportAddress         -- origin as determined in step 3.
  IN   wholeMsg                 -- as received from the network
  IN   wholeMsgLength           -- as received from the network
  OUT  messageProcessingModel   -- typically, SNMP version
  OUT  securityModel            -- Security Model to use
  OUT  securityName             -- on behalf of this principal
  OUT  securityLevel            -- Level of Security requested
  OUT  contextEngineID          -- data from/at this entity
  OUT  contextName              -- data from/in this context
  OUT  pduVersion               -- the version of the PDU
  OUT  PDU                      -- SNMP Protocol Data Unit
  OUT  pduType                  -- SNMP PDU type
  OUT  sendPduHandle            -- handle for a matched request
  OUT  maxSizeResponseScopedPDU -- maximum size of Response PDU
  OUT  statusInformation        -- success or errorIndication
                                -- (error counter OID and value
                                -- when errorIndication)
  OUT  stateReference           -- reference to state information
                                -- to be used for a possible
       )                        -- Response
  1. If the result is a FAILURE errorIndication, the message is discarded without further processing. ๐Ÿšซ
  2. At this point the abstract data elements are all prepared, and processing carries on as described in Section 4.2.2, PDU Dispatching for Incoming Messages. ๐Ÿฆ‹

4.2.2. PDU Dispatching for Incoming Messages

okay the way PDUs get dispatched depends on the value of sendPduHandle ๐Ÿ‘‘ If sendPduHandle is <none>, then it's a request or notification, and the procedures in Section 4.2.2.1 apply. If the value of snmpPduHandle is not <none>, then it's a response, and the procedures in Section 4.2.2.2 apply. ๐ŸŒธ

4.2.2.1. Incoming Requests and Notifications

These are the dispatching procedures when sendPduHandle is <none>, which means it's a request or notification ๐Ÿ“จ

  1. The combination of contextEngineID and pduType is used to figure out which application registered for this request or notification. ๐Ÿ”Ž
  2. If no application has registered for that combination, then:
    • a) The snmpUnknownPDUHandlers counter is incremented. ๐Ÿ“‰
    • b) A Response message is generated using the abstract service primitive below:
result =                         -- SUCCESS or FAILURE
prepareResponseMessage(
IN   messageProcessingModel    -- as provided by MP module
IN   securityModel             -- as provided by MP module
IN   securityName              -- as provided by MP module
IN   securityLevel             -- as provided by MP module
IN   contextEngineID           -- as provided by MP module
IN   contextName               -- as provided by MP module
IN   pduVersion                -- as provided by MP module
IN   PDU                       -- as provided by MP module
IN   maxSizeResponseScopedPDU  -- as provided by MP module
IN   stateReference            -- as provided by MP module
IN   statusInformation         -- errorIndication plus
                                -- snmpUnknownPDUHandlers OID
                                -- value pair.
OUT  transportDomain           -- destination transportDomain
OUT  transportAddress          -- destination transportAddress
OUT  outgoingMessage           -- the message to send
OUT  outgoingMessageLength     -- its length
)
  • c) If the result is SUCCESS, the prepared message is sent back to the originator of the request, identified by the transportDomain and transportAddress. ๐Ÿ“ฌ
  • d) The incoming message is discarded without further processing. Message Processing for this message is complete. ๐Ÿงนโœจ
  1. The PDU is dispatched to the application using the abstract service primitive below ๐Ÿš€
processPdu(                     -- process Request/Notification
  IN   messageProcessingModel   -- as provided by MP module
  IN   securityModel            -- as provided by MP module
  IN   securityName             -- as provided by MP module
  IN   securityLevel            -- as provided by MP module
  IN   contextEngineID          -- as provided by MP module
  IN   contextName              -- as provided by MP module
  IN   pduVersion               -- as provided by MP module
  IN   PDU                      -- as provided by MP module
  IN   maxSizeResponseScopedPDU -- as provided by MP module
  IN   stateReference           -- as provided by MP module
                                -- needed when sending response
)

Message processing for this message is complete. ๐Ÿ’œ

4.2.2.2. Incoming Responses

These are the dispatching procedures when sendPduHandle is not <none>, which means it's a response ๐Ÿ’Œ

  1. The value of sendPduHandle is used to figure out, in an implementation-defined way, which application is waiting for a response PDU linked to this sendPduHandle. ๐Ÿ•ต๏ธโ€โ™€๏ธ
  2. If no waiting application is found, the message is discarded without further processing, and the stateReference is released. The snmpUnknownPDUHandlers counter is incremented. Message Processing is complete for this message. ๐Ÿ™ˆ
  3. Any cached information about the message, including the stateReference, is discarded. ๐Ÿซง
  4. The response is dispatched to the application using the abstract service primitive below ๐Ÿ’–
processResponsePdu(              -- process Response PDU
  IN   messageProcessingModel    -- provided by the MP module
  IN   securityModel             -- provided by the MP module
  IN   securityName              -- provided by the MP module
  IN   securityLevel             -- provided by the MP module
  IN   contextEngineID           -- provided by the MP module
  IN   contextName               -- provided by the MP module
  IN   pduVersion                -- provided by the MP module
  IN   PDU                       -- provided by the MP module
  IN   statusInformation         -- provided by the MP module
  IN   sendPduHandle             -- provided by the MP module
)

Message Processing is complete for this message. ๐ŸŽ€


4.3. Application Registration for Handling PDU types

okay so applications that want to process certain PDUs have to register with the PDU Dispatcher ๐Ÿฆ„ They pick the combination of contextEngineID and pduType(s) they want to be responsible for.

  1. An application registers using the abstract interface primitive below ๐Ÿ“
statusInformation =           -- success or errorIndication
  registerContextEngineID(
  IN   contextEngineID        -- take responsibility for this one
  IN   pduType                -- the pduType(s) to be registered
)

Note: implementations may provide a way to request registration for several contextEngineID values at once, e.g., all contextEngineID values. They may also provide a way to request registration for several pduType values at once. โœจ

  1. The parameters may be checked for validity. If they aren't valid, an errorIndication (invalidParameter) is returned to the application. ๐Ÿ™…โ€โ™€๏ธ
  2. Each combination of contextEngineID and pduType can only be registered once. If another application has already registered for the specified combination, an errorIndication (alreadyRegistered) is returned to the application. ๐Ÿ”’
  3. Otherwise, the registration is saved so SNMP PDUs can be dispatched to this application. ๐Ÿ’พ๐ŸŒˆ

4.4. Application Unregistration for Handling PDU Types

okay so applications that don't want to process certain PDUs anymore have to unregister from the PDU Dispatcher ๐Ÿ‘‹

  1. An application unregisters using the abstract service primitive below ๐Ÿซถ
unregisterContextEngineID(
 IN   contextEngineID        -- give up responsibility for this
 IN   pduType                -- the pduType(s) to be unregistered
)

Note: implementations may provide ways to request unregistration for several contextEngineID values at once, e.g., all contextEngineID values. They may also provide a way to request unregistration for several pduType values at once. ๐Ÿ“

  1. If the contextEngineID and pduType combination has been registered, the registration is deleted. ๐Ÿ—‘๏ธ

If no such registration exists, the request is ignored. ๐Ÿ™ƒ


5. Definitions ๐ŸŒˆ

5.1. Definitions for SNMP Message Processing and Dispatching โœจ

Okay bestie, here's the MIB module for SNMP message processing and dispatching ๐Ÿ’– It's called SNMP-MPD-MIB, and it's basically how you monitor the MPD process from the outside ๐Ÿ”

SNMP-MPD-MIB DEFINITIONS ::= BEGIN

IMPORTS
    MODULE-COMPLIANCE, OBJECT-GROUP         FROM SNMPv2-CONF
    MODULE-IDENTITY, OBJECT-TYPE,
    snmpModules, Counter32                  FROM SNMPv2-SMI;

snmpMPDMIB MODULE-IDENTITY
    LAST-UPDATED "9711200000Z"              -- 20 November 1997
    ORGANIZATION "SNMPv3 Working Group"
    CONTACT-INFO "WG-email:   snmpv3@tis.com
                  Subscribe:  majordomo@tis.com
                              In message body:  subscribe snmpv3

                  Chair:      Russ Mundy
                              Trusted Information Systems
                  postal:     3060 Washington Road
                              Glenwood, MD 21738
                              USA
                  email:      mundy@tis.com
                  phone:      +1 301-854-6889

                  Co-editor:  Jeffrey Case
                              SNMP Research, Inc.
                  postal:     3001 Kimberlin Heights Road
                              Knoxville, TN 37920-9716
                              USA
                  email:      case@snmp.com
                  phone:      +1 423-573-1434
                  Co-editor   Dave Harrington
                              Cabletron Systems, Inc.
                  postal:     Post Office Box 5005
                              MailStop: Durham
                              35 Industrial Way
                              Rochester, NH 03867-5005
                              USA
                  email:      dbh@ctron.com
                  phone:      +1 603-337-7357

                  Co-editor:  Randy Presuhn
                              BMC Software, Inc.
                  postal:     1190 Saratoga Ave, Suite 190
                              San Jose, CA 95120
                              USA
                  email:      rpresuhn@bmc.com
                  phone:      +1 408-556-0720

                  Co-editor:  Bert Wijnen
                              IBM T. J. Watson Research
                  postal:     Schagen 33
                              3461 GL Linschoten
                              Netherlands
                  email:      wijnen@vnet.ibm.com
                  phone:      +31 348-432-794

                 "
    DESCRIPTION  "The MIB for Message Processing and Dispatching"
    ::= { snmpModules 11 }

-- Administrative assignments ***************************************

snmpMPDAdmin           OBJECT IDENTIFIER ::= { snmpMPDMIB 1 }
snmpMPDMIBObjects      OBJECT IDENTIFIER ::= { snmpMPDMIB 2 }
snmpMPDMIBConformance  OBJECT IDENTIFIER ::= { snmpMPDMIB 3 }

-- Statistics for SNMP Messages *************************************

snmpMPDStats           OBJECT IDENTIFIER ::= { snmpMPDMIBObjects 1 }

snmpUnknownSecurityModels OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number of packets received by the SNMP
                 engine which were dropped because they referenced a
                 securityModel that was not known to or supported by
                 the SNMP engine.

                "
    ::= { snmpMPDStats 1 }

snmpInvalidMsgs OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number of packets received by the SNMP
                 engine which were dropped because there were invalid
                 or inconsistent components in the SNMP message.
                "
    ::= { snmpMPDStats 2 }

snmpUnknownPDUHandlers OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number of packets received by the SNMP
                 engine which were dropped because the PDU contained
                 in the packet could not be passed to an application
                 responsible for handling the pduType, e.g. no SNMP
                 application had registered for the proper
                 combination of the contextEngineID and the pduType.
                "
    ::= { snmpMPDStats 3 }

-- Conformance information ******************************************

snmpMPDMIBCompliances OBJECT IDENTIFIER ::= {snmpMPDMIBConformance 1}
snmpMPDMIBGroups      OBJECT IDENTIFIER ::= {snmpMPDMIBConformance 2}

-- Compliance statements

snmpMPDCompliance MODULE-COMPLIANCE
    STATUS       current
    DESCRIPTION "The compliance statement for SNMP entities which
                 implement the SNMP-MPD-MIB.
                "

    MODULE    -- this module

        MANDATORY-GROUPS { snmpMPDGroup }

    ::= { snmpMPDMIBCompliances 1 }

snmpMPDGroup OBJECT-GROUP
    OBJECTS {
              snmpUnknownSecurityModels,
              snmpInvalidMsgs,
              snmpUnknownPDUHandlers
            }
    STATUS       current
    DESCRIPTION "A collection of objects providing for remote
                 monitoring of the SNMP Message Processing and
                 Dispatching process.
                "
    ::= { snmpMPDMIBGroups 1 }

END

6. The SNMPv3 Message Format ๐ŸŽ€

This section is all about the SNMPv3 message format, plus the SNMP version 3 Message Processing Model (v3MP) that goes with it ๐Ÿฆ‹ Here's the whole layout, no cap ๐Ÿ‘‘

SNMPv3MessageSyntax DEFINITIONS IMPLICIT TAGS ::= BEGIN

    SNMPv3Message ::= SEQUENCE {
        -- identify the layout of the SNMPv3Message
        -- this element is in same position as in SNMPv1
        -- and SNMPv2c, allowing recognition
        msgVersion INTEGER { snmpv3 (3) },
        -- administrative parameters
        msgGlobalData HeaderData,
        -- security model-specific parameters
        -- format defined by Security Model
        msgSecurityParameters OCTET STRING,
        msgData  ScopedPduData
    }

    HeaderData ::= SEQUENCE {
        msgID      INTEGER (0..2147483647),
        msgMaxSize INTEGER (484..2147483647),

        msgFlags   OCTET STRING (SIZE(1)),
                   --  .... ...1   authFlag
                   --  .... ..1.   privFlag
                   --  .... .1..   reportableFlag
                   --              Please observe:
                   --  .... ..00   is OK, means noAuthNoPriv
                   --  .... ..01   is OK, means authNoPriv
                   --  .... ..10   reserved, must NOT be used.
                   --  .... ..11   is OK, means authPriv

        msgSecurityModel INTEGER (0..2147483647)
    }
    ScopedPduData ::= CHOICE {
        plaintext    ScopedPDU,
        encryptedPDU OCTET STRING  -- encrypted scopedPDU value
    }

    ScopedPDU ::= SEQUENCE {
        contextEngineID  OCTET STRING,
        contextName      OCTET STRING,
        data             ANY -- e.g., PDUs as defined in RFC1905
    }
END

6.1. msgVersion ๐ŸŒธ

The msgVersion field is set to snmpv3(3), which is how the message gets identified as an SNMP version 3 Message. Easy peasy ๐Ÿ’…

6.2. msgID ๐Ÿ“

The msgID is what two SNMP entities use to match up requests and responses ๐Ÿซถ The v3MP also uses it to coordinate how different subsystem models inside the architecture handle the message.

Values for msgID should be generated in a way that avoids re-use of any outstanding values. Doing that gives you some protection against replay attacks ๐Ÿ”ฅ One possible strategy is to use the low-order bits of snmpEngineBoots [RFC2271] as the high-order portion of the msgID value, with a monotonically increasing integer as the low-order portion.

Now here's the tea โ˜• The request-id in a PDU is what SNMP applications use to identify the PDU, while the msgID is what the engine uses to identify the message carrying that PDU. The engine might still need to identify the message even if decrypting the PDU (and its request-id) fails. No assumption should be made that the value of msgID and the value of request-id are equivalent ๐Ÿ™ˆ

6.3. msgMaxSize ๐ŸŒˆ

The msgMaxSize field tells you the maximum message size supported by the sender of the message. In other words, it's the biggest message the sender can accept when another SNMP engine sends it an SNMP message, whether that's a response or anything else โœจ

When an SNMP message is generated, the SNMP engine that generates it supplies the msgMaxSize. At the receiving SNMP engine, msgMaxSize is used to work out how big the Response to a Request message can be ๐Ÿงš

6.4. msgFlags ๐Ÿ’–

okay so msgFlags is literally the control panel of the message ๐ŸŽ›๏ธ and it's packed with bit fields that tell the receiver how to handle everything. no cap, it's giving very important energy.

bestie, the reportableFlag is the "hey, tell me if something went wrong" switch ๐Ÿ””. When it's one, a Report PDU must be sent back to the sender under the conditions that can trigger Report PDUs. When it's zero, a Report PDU must not be sent. The reportableFlag must always be zero when the message contains a Report PDU, a response-type PDU (like a Response PDU), or an unacknowledged notification-type PDU (like an SNMPv2-trap PDU). It must always be one for a request-type PDU (like a Get PDU) and an acknowledged notification-type PDU (like an Inform PDU). โœจ

If the reportableFlag is one on a message with a Report PDU, a response-type PDU, or an unacknowledged notification-type PDU, the receiver must process it as though the reportableFlag had been set to zero. ๐Ÿ™ˆ

If the reportableFlag is zero on a message with a request-type PDU or an acknowledged notification-type PDU, the receiver must process it as though the reportableFlag had been set to one. ๐Ÿซถ

Report PDUs are engine-to-engine chats ๐Ÿงš. The SNMPv3 Message Processing Model handles them directly and they're generally not passed up to applications, which is different from every other PDU type. so iconic ๐Ÿ‘‘

Here's the tea ๐Ÿ“: the reportableFlag is only a secondary helper for deciding whether a Report PDU must be sent. It only comes into play when the PDU portion can't be decoded, for example because of an incorrect encryption key. If the PDU can be decoded, the PDU type is what drives the decision about sending Report PDUs. periodt ๐Ÿ’…

The authFlag and privFlag bits are set by the sender to show the securityLevel that was applied before the message went out on the wire. The receiver must apply that same securityLevel when the message comes in and its contents are being processed. ๐Ÿ”

There are three securityLevels, and they stack up like this: noAuthNoPriv is less than authNoPriv, which is less than authPriv. For the full scoop, check the SNMP architecture document [RFC2271]. ๐Ÿ“š

a) authFlag

If the authFlag is one, then the securityModel used by the SNMP engine that sent the message must identify the securityName the message was generated on behalf of. It also has to provide, in a securityModel-specific manner, enough data for the receiver to authenticate that identity. This authentication lets the receiver decide with reasonable certainty that the message was:

  • sent on behalf of the principal associated with the securityName,
  • not redirected,
  • not modified in transit, and
  • not replayed.

If the authFlag is zero, then the securityModel used by the sending SNMP engine must still identify the securityName the message was generated on behalf of. It doesn't need to provide enough data for the receiver to authenticate that identity, because there's no need to authenticate the message in this case. ๐Ÿฆ‹

b) privFlag

If the privFlag is set, then the securityModel used by the sending SNMP engine must also protect the scopedPDU from disclosure. In other words, it must encrypt and decrypt the scopedPDU. If the privFlag is zero, the securityModel in use doesn't need to protect the data from disclosure. ๐ŸŒธ

Privacy needs authentication, no exceptions ๐Ÿ™…โ€โ™€๏ธ. It is an explicit requirement of the SNMP architecture that if privacy is selected, then authentication is also required. That means if the privFlag is set, the authFlag must also be set to one.

The authFlag and privFlag together make up the Level of Security like this:

authFlag zero, privFlag zero -> securityLevel is noAuthNoPriv
authFlag zero, privFlag one  -> invalid combination
authFlag one,  privFlag zero -> securityLevel is authNoPriv
authFlag one,  privFlag one  -> securityLevel is authPriv

6.5. msgSecurityModel ๐Ÿ›ก๏ธ

The v3MP supports multiple Security Models existing at the same time to provide security services for SNMPv3 messages. The msgSecurityModel field in an SNMPv3 Message says which Security Model the sender used to generate the message. That tells the receiver which securityModel to use for security processing. How that mapping to the right securityModel implementation happens inside an SNMP engine is implementation-dependent. ๐Ÿงฉ

6.6. msgSecurityParameters ๐ŸŽ€

The msgSecurityParameters field is how the Security Model modules in the sending and receiving SNMP engines talk to each other. Only the Security Model uses this data, and the Security Model decides what the contents and format look like. The v3MP doesn't interpret this OCTET STRING. It just passes it to the local Security Model implementation named in the msgSecurityModel field. ๐Ÿ“จ

6.7. scopedPduData ๐ŸŒˆ

The scopedPduData field holds either the plain text scopedPDU, when the privFlag in msgFlags is zero, or an encryptedPDU (encoded as an OCTET STRING). In the encrypted case, the securityModel in use must decrypt it to produce the plaintext scopedPDU. ๐Ÿ”“

6.8. scopedPDU ๐Ÿง

The scopedPDU has the info needed to identify an administratively unique context and a PDU. The object identifiers in the PDU refer to managed objects that are (expected to be) accessible within that context. ๐Ÿ‘€

6.8.1. contextEngineID ๐Ÿชช

The contextEngineID in the SNMPv3 message uniquely identifies, within an administrative domain, an SNMP entity that may realize an instance of a context with a particular contextName. ๐ŸŒ

For incoming messages, the contextEngineID is used to decide which application the scopedPDU gets sent to for processing. ๐Ÿ“ฌ

For outgoing messages, the v3MP sets the contextEngineID to the value the application provided in the request to send a message. ๐Ÿ’Œ

6.8.2. contextName ๐Ÿท๏ธ

The contextName field, together with the contextEngineID field, identifies the particular context linked to the management information in the PDU portion of the message. The contextName is unique within the SNMP entity given by the contextEngineID, which may realize the managed objects referenced in the PDU. The application that starts a message supplies the contextName value, and an application at the receiving SNMP Engine may use that value while processing. โœจ

6.8.3. data ๐Ÿ“ฆ

The data field of the SNMPv3 Message holds the PDU. Among other things, the PDU carries the PDU type that the v3MP uses to figure out what kind of incoming SNMP message it is. The v3MP specifies that the PDU must be one of those defined in [RFC1905]. ๐Ÿซง

7. Elements of Procedure for v3MP ๐Ÿงš

This section walks through what an SNMP engine does when it generates and processes SNMP messages under the SNMPv3 Message Processing Model. ๐Ÿ—บ๏ธ

Quick heads-up: to keep things clear and stop the text from getting even longer and messier, some details were left out of the steps below. ๐Ÿ™

a) Some steps say that when certain error conditions show up while processing a received message, a message containing a Report PDU is generated and the received message is discarded without further processing. However, a Report-PDU must not be generated unless the reportableFlag is set in the received message. ๐Ÿšซ

b) The elements of procedure don't always say explicitly when state information needs to be released. The general rule is that if state information is available when a message is to be "discarded without further processing", then the state information must also be released at that same time. ๐Ÿงน

7.1. Prepare an Outgoing SNMP Message โœจ

Okay bestie, this is where the Message Dispatcher tells the SNMPv3 side "hey, please get this message ready to ship" ๐Ÿ“ฎ. We're basically going from raw data elements to a finished, ready-to-send SNMPv3 message ๐Ÿ’….

1) The Message Dispatcher may request that an SNMPv3 message containing a GetRequest-PDU, GetNextRequest-PDU, GetBulkRequest-PDU, SetRequest-PDU, InformRequest-PDU, or SNMPv2-Trap-PDU be prepared for sending. ๐ŸŽ€

  • a) It makes that request using this abstract service primitive:
statusInformation =           -- success or errorIndication
  prepareOutgoingMessage(
  IN   transportDomain        -- requested transport domain
  IN   transportAddress       -- requested destination address
  IN   messageProcessingModel -- typically, SNMP version
  IN   securityModel          -- Security Model to use
  IN   securityName           -- on behalf of this principal
  IN   securityLevel          -- Level of Security requested
  IN   contextEngineID        -- data from/at this entity
  IN   contextName            -- data from/in this context
  IN   pduVersion             -- version of the PDU
  IN   PDU                    -- SNMP Protocol Data Unit
  IN   expectResponse         -- TRUE or FALSE
  IN   sendPduHandle          -- the handle for matching
                              -- incoming responses
  OUT  destTransportDomain    -- destination transport domain
  OUT  destTransportAddress   -- destination transport address
  OUT  outgoingMessage        -- the message to send
  OUT  outgoingMessageLength  -- the length of the message
  )
  • b) A unique msgID gets generated ๐Ÿ”‘. The number used for msgID SHOULD NOT have been used recently, and it MUST NOT be the same as any value used for an outstanding request. Main character energy, no duplicates allowed ๐Ÿ™…โ€โ™€๏ธ.
SNMPv3 does not use the values of expectResponse or pduVersion. It's giving "these fields are just not it" ๐Ÿ’€.

2) The Message Dispatcher may request that an SNMPv3 message containing a Response-PDU or Report-PDU be prepared for sending. ๐Ÿฆ‹

  • a) It makes that request using this abstract service primitive:
result =                        -- SUCCESS or FAILURE
prepareResponseMessage(
 IN   messageProcessingModel   -- typically, SNMP version
 IN   securityModel            -- same as on incoming request
 IN   securityName             -- same as on incoming request
 IN   securityLevel            -- same as on incoming request
 IN   contextEngineID          -- data from/at this SNMP entity
 IN   contextName              -- data from/in this context
 IN   pduVersion               -- version of the PDU
 IN   PDU                      -- SNMP Protocol Data Unit
 IN   maxSizeResponseScopedPDU -- maximum size of Response PDU
 IN   stateReference           -- reference to state
                               -- information presented with
                               -- the request
 IN   statusInformation        -- success or errorIndication
                               -- error counter OID and value
                               -- when errorIndication
 OUT  transportDomain          -- destination transport domain
 OUT  transportAddress         -- destination transport address
 OUT  outgoingMessage          -- the message to send
 OUT  outgoingMessageLength    -- the length of the message
 )
  • b) The cached info for the original request gets pulled back out using the stateReference ๐Ÿ—‚๏ธ. That includes:
    • msgID,
    • contextEngineID,
    • contextName,
    • securityModel,
    • securityName,
    • securityLevel,
    • securityStateReference,
    • reportableFlag,
    • transportDomain, and
    • transportAddress.

The SNMPv3 Message Processing Model does not let cached data get overridden, except by error indications (more on that in step 3 below) ๐Ÿ™…โ€โ™€๏ธโœจ.

3) If statusInformation contains values for an OID/value combination (it might also contain a securityLevel value, contextEngineID value, or contextName value), then ๐Ÿšจ:

  • a) If reportableFlag is zero, the original message gets discarded and no further processing happens. A result of FAILURE is returned, and SNMPv3 Message Processing is complete. Bye bye ๐Ÿ‘‹.
  • b) If a PDU is provided, it's the PDU from the original request. If possible, extract the request-id ๐Ÿ”.
  • c) A Report PDU gets prepared:
    • 1) the varBindList is set to contain the OID and value from the statusInformation,
    • 2) error-status is set to 0,
    • 3) error-index is set to 0, and
    • 4) request-id is set to the value extracted in step b). Otherwise, request-id is set to 0.
  • d) The errorIndication in statusInformation may come with a securityLevel value, a contextEngineID value, or a contextName value ๐ŸŽ€.
    • 1) If statusInformation contains a value for securityLevel, then securityLevel is set to that value. Otherwise, it's set to noAuthNoPriv.
    • 2) If statusInformation contains a value for contextEngineID, then contextEngineID is set to that value. Otherwise, it's set to the value of this entity's snmpEngineID.
    • 3) If statusInformation contains a value for contextName, then contextName is set to that value. Otherwise, it's set to the default context of "" (zero-length string).
  • e) PDU is set to refer to the new Report-PDU, and the old PDU gets discarded ๐Ÿ—‘๏ธ.
  • f) Processing continues with step 6) below. โžก๏ธ

4) If contextEngineID isn't determined yet, it gets determined in an implementation-dependent manner, possibly using the transportDomain and transportAddress ๐ŸŒธ.

5) If the contextName isn't determined yet, it gets set to the default context ๐Ÿ’–.

6) A scopedPDU is prepared from the contextEngineID, contextName, and PDU ๐Ÿง.

7) msgGlobalData gets constructed like this ๐ŸŒˆ:

  • a) The msgVersion field is set to snmpv3(3).
  • b) msgID is set as determined in step 1 or 2 above.
  • c) msgMaxSize is set to an implementation-dependent value.
  • d) msgFlags are set as follows:
    • If securityLevel specifies noAuthNoPriv, then authFlag and privFlag are both set to zero.
    • If securityLevel specifies authNoPriv, then authFlag is set to one and privFlag is set to zero.
    • If securityLevel specifies authPriv, then authFlag is set to one and privFlag is set to one.
    • If the PDU is a Response-PDU, Report-PDU or SNMPv2-Trap-PDU, then the reportableFlag is set to zero.
    • If the PDU is a GetRequest-PDU, GetNextRequest-PDU, GetBulkRequest-PDU, SetRequest-PDU, or InformRequest-PDU, then the reportableFlag is set to one.
    • All other msgFlags bits are set to zero.
  • e) msgSecurityModel is set to the value of securityModel.

8) If the PDU is a Response-PDU or Report-PDU, then ๐Ÿ“ฌ:

  • a) The specified Security Model gets called to generate the message, using this primitive:
statusInformation =
  generateResponseMsg(
  IN   messageProcessingModel -- SNMPv3 Message Processing
                              -- Model
  IN   globalData             -- msgGlobalData from step 7
  IN   maxMessageSize         -- from msgMaxSize (step 7c)
  IN   securityModel          -- as determined in step 7e
  IN   securityEngineID       -- the value of snmpEngineID
  IN   securityName           -- on behalf of this principal
  IN   securityLevel          -- for the outgoing message
  IN   scopedPDU              -- as prepared in step 6)
  IN   securityStateReference -- as determined in step 2
  OUT  securityParameters     -- filled in by Security Module
  OUT  wholeMsg               -- complete generated message
  OUT  wholeMsgLength         -- length of generated message
  )

If, once the Security Model returns, the statusInformation includes an errorIndication, then any cached info about the outstanding request message gets discarded, and that errorIndication gets returned so the calling application can see it. SNMPv3 Message Processing is complete ๐Ÿ’”.

  • b) A SUCCESS result is returned. SNMPv3 Message Processing is complete. Slay โœจ.

9) If the PDU is a GetRequest-PDU, GetNextRequest-PDU, GetBulkRequest-PDU, SetRequest-PDU, InformRequest-PDU, or SNMPv2-Trap-PDU, then ๐Ÿš€:

  • a) If the PDU is an SNMPv2-Trap-PDU, securityEngineID is set to the value of this entity's snmpEngineID. Otherwise, the snmpEngineID of the target entity gets determined in an implementation-dependent manner, possibly using transportDomain and transportAddress. The value of securityEngineID is then set to the value of the target entity's snmpEngineID ๐ŸŽฏ.
  • b) The specified Security Model gets called to generate the message, using this primitive:
statusInformation =
  generateRequestMsg(
  IN  messageProcessingModel -- SNMPv3 Message Processing Model
  IN  globalData             -- msgGlobalData, from step 7
  IN  maxMessageSize         -- from msgMaxSize in step 7 c)
  IN  securityModel          -- as provided by caller
  IN  securityEngineID       -- authoritative SNMP entity
  IN  securityName           -- as provided by caller
  IN  securityLevel          -- as provided by caller
  IN  snmpEngineID           -- as determined in step 9 a)
  IN  scopedPDU              -- as prepared in step 6
  OUT securityParameters     -- filled in by Security Module
  OUT wholeMsg               -- complete generated message
  OUT wholeMsgLength         -- length of the generated message
  )

If, once the Security Model returns, the statusInformation includes an errorIndication, then the message gets discarded and the errorIndication gets returned to the calling application. No further processing happens, and SNMPv3 Message Processing is complete ๐Ÿ™ˆ.

  • c) Info about the outgoing message gets cached, and a stateReference is created (this part is implementation-specific) ๐Ÿง . The cached info includes the values of:
    • sendPduHandle
    • msgID
    • snmpEngineID
    • securityModel
    • securityName
    • securityLevel
    • contextEngineID
    • contextName
  • d) A SUCCESS result is returned. SNMPv3 Message Processing is complete, and we are SO done here ๐Ÿ‘‘๐Ÿซถ.

7.2. Prepare Data Elements from an Incoming SNMP Message โœจ

okay so this section is the whole game plan for how an SNMPv3 message gets unpacked and turned into the data elements the Message Dispatcher needs to keep processing it ๐Ÿซถ we're walking through it step by step, bestie

  1. the Message Dispatcher hands the message over using this abstract service primitive ๐Ÿ’Œ
result =                         -- SUCCESS or errorIndication
  prepareDataElements(
  IN  transportDomain          -- origin transport domain
  IN  transportAddress         -- origin transport address
  IN  wholeMsg                 -- as received from the network
  IN  wholeMsgLength           -- as received from the network
  OUT messageProcessingModel   -- typically, SNMP version
  OUT securityModel            -- Security Model to use
  OUT securityName             -- on behalf of this principal
  OUT securityLevel            -- Level of Security requested
  OUT contextEngineID          -- data from/at this entity
  OUT contextName              -- data from/in this context
  OUT pduVersion               -- version of the PDU
  OUT PDU                      -- SNMP Protocol Data Unit
  OUT pduType                  -- SNMP PDU type
  OUT sendPduHandle            -- handle for matched request
  OUT maxSizeResponseScopedPDU -- maximum size of Response PDU
  OUT statusInformation        -- success or errorIndication
                               -- error counter OID and value
                               -- when errorIndication
  OUT stateReference           -- reference to state information
                               -- to be used for a possible
  )                            -- Response
  1. if the received message isn't the serialization (following the conventions of [RFC1906]) of an SNMPv3Message value, then the snmpInASNParseErrs counter [RFC1907] gets incremented ๐Ÿ“ˆ, the message is discarded without any further processing ๐Ÿ—‘๏ธ, and a FAILURE result comes back. SNMPv3 Message Processing is complete, end of story ๐Ÿ’…
  2. the values for msgVersion, msgID, msgMaxSize, msgFlags, msgSecurityModel, msgSecurityParameters, and msgData get pulled out of the message ๐ŸŽ
  3. if the msgSecurityModel component doesn't match a supported securityModel, then the snmpUnknownSecurityModels counter goes up, a Report PDU is generated, the message is discarded, and a FAILURE result is returned. SNMPv3 Message Processing is complete ๐Ÿ™…โ€โ™€๏ธ
  4. the securityLevel gets figured out from the authFlag and privFlag bits of the msgFlags component, like this ๐Ÿ”
  • a) if the authFlag isn't set and the privFlag isn't set either, then securityLevel is set to noAuthNoPriv.
  • b) if the authFlag is set and the privFlag isn't set, then securityLevel is set to authNoPriv.
  • c) if the authFlag is set and the privFlag is set, then securityLevel is set to authPriv.
  • d) if the authFlag isn't set but the privFlag is set, then the snmpInvalidMsgs counter goes up, a Report PDU is generated, the message is discarded without further processing, and a FAILURE result is returned. SNMPv3 Message Processing is complete ๐Ÿ’€
d) is the one that's not it, bestie. privacy without authentication is a no-go ๐Ÿ™…โ€โ™€๏ธ
  1. the security module that implements the securityModel named in the securityModel component gets called for authentication and privacy services ๐Ÿ”’ this happens through this abstract service primitive ๐Ÿ’Œ
statusInformation =            -- errorIndication or success
                               -- error counter OID and
                               -- value if error
  processIncomingMsg(
  IN  messageProcessingModel   -- SNMPv3 Message Processing Model
  IN  expectResponse           -- TRUE or FALSE
  IN  maxMessageSize           -- of the sending SNMP entity
  IN  securityParameters       -- for the received message
  IN  securityModel            -- for the received message
  IN  securityLevel            -- Level of Security
  IN  wholeMsg                 -- as received on the wire
  IN  wholeMsgLength           -- length as received on the wire
  OUT securityEngineID         -- authoritative SNMP entity
  OUT securityName             -- identification of the principal
  OUT scopedPDU,               -- message (plaintext) payload
  OUT maxSizeResponseScopedPDU -- maximum size of Response PDU
  OUT securityStateReference   -- reference to security state
  )                            -- information, needed for
                               -- response

if an errorIndication comes back from the security module, then ๐Ÿšจ

  • a) if statusInformation has values for an OID/value pair, then a Report PDU gets generated ๐Ÿ“
    • 1) if the scopedPDU was returned from ProcessIncomingMsg, then contextEngineID, contextName, and PDU get determined ๐Ÿงฉ
    • 2) information about the message gets cached and a stateReference is created, which is implementation-specific ๐Ÿ—‚๏ธ the info to cache includes the values of:
msgVersion,
msgID,
securityLevel,
msgFlags,
msgMaxSize,
securityModel,
maxSizeResponseScopedPDU,
securityStateReference
  • 3) a Report-PDU gets requested to be prepared and sent, using this abstract service primitive ๐Ÿ“ค
result =                     -- SUCCESS or FAILURE
returnResponsePDU(
IN  messageProcessingModel   -- SNMPv3(3)
IN  securityModel            -- same as on incoming request
IN  securityName             -- from ProcessIncomingMsg
IN  securityLevel            -- same as on incoming request
IN  contextEngineID          -- from step 6 a) 1)
IN  contextName              -- from step 6 a) 1)
IN  pduVersion               -- SNMPv2-PDU
IN  PDU                      -- from step 6 a) 1)
IN  maxSizeResponseScopedPDU -- from ProcessIncomingMsg
IN  stateReference           -- from step 6 a) 2)
IN  statusInformation        -- from ProcessIncomingMsg
OUT transportDomain          -- destination's transport
                             -- domain
OUT transportAddress         -- destination's transport
                             -- address
OUT outgoingMessage          -- the message to send
OUT outgoingMessageLength    -- the length of the message
)
  • b) the incoming message gets discarded without further processing, and a FAILURE result is returned. SNMPv3 Message Processing is complete ๐Ÿซ 
  1. the scopedPDU gets parsed to pull out the contextEngineID, the contextName, and the PDU ๐Ÿ” if any parse error happens, then the snmpInASNParseErrs counter [RFC1907] goes up, the security state information is thrown out, the message is discarded, and a FAILURE result comes back. SNMPv3 Message Processing is complete ๐Ÿ’”
  2. the pduVersion is set to an SNMPv2-PDU ๐ŸŽ€
  3. the pduType is figured out in an implementation-dependent way, and it can be any of these ๐ŸŒˆ
  • a GetRequest-PDU,
  • a GetNextRequest-PDU,
  • a GetBulkRequest-PDU,
  • a SetRequest-PDU,
  • an InformRequest-PDU,
  • an SNMPv2-Trap-PDU,
  • a Response-PDU, or
  • a Report-PDU.
  1. if the pduType is a Response-PDU or a Report-PDU, then ๐Ÿ”
  • a) the value of the msgID component is used to find the cached info for a matching outstanding Request message. if there's no outstanding Request message to match, then the security state information is thrown out, the message is discarded without further processing, and a FAILURE result is returned. SNMPv3 Message Processing is complete ๐Ÿ‘‹
  • b) sendPduHandle gets retrieved from the cached info.

otherwise, sendPduHandle is set to <none>, which is an implementation defined value ๐Ÿซง

  1. if the pduType is a Report-PDU, then ๐Ÿ“‹
  • a) statusInformation gets created from the contents of the Report-PDU, in an implementation-dependent way. this statusInformation is forwarded to the application linked to the sendPduHandle ๐Ÿ’Œ
  • b) any cached info about the outstanding Request message gets discarded ๐Ÿงน
  • c) the security state information for this incoming message gets discarded ๐Ÿงน
  • d) stateReference is set to <none>
  • e) a SUCCESS result is returned. SNMPv3 Message Processing is complete ๐ŸŽ‰
  1. if the pduType is a Response-PDU, then ๐Ÿ“จ
  • a) the cached data for the outstanding request, referenced by stateReference, gets retrieved, including
    • snmpEngineID
    • securityModel
    • securityName
    • securityLevel
    • contextEngineID
    • contextName
  • b) if the values pulled from the incoming message are different from the cached data, then the security state information is thrown out, any cached info about the outstanding Request message is thrown out, the incoming message is discarded without further processing, and a FAILURE result is returned. SNMPv3 Message Processing is complete ๐Ÿšซ
  • c) otherwise, any cached info about the outstanding Request message is discarded, and stateReference is set to <none> โœ…
  • d) a SUCCESS result is returned. SNMPv3 Message Processing is complete ๐Ÿฅณ
  1. if the pduType is a GetRequest-PDU, GetNextRequest-PDU, GetBulkRequest-PDU, SetRequest-PDU, or InformRequest-PDU, then ๐Ÿ™‹โ€โ™€๏ธ
  • a) if the value of securityEngineID isn't equal to the value of snmpEngineID, then the security state information is thrown out, any cached info about the outstanding Request message is thrown out, the incoming message is discarded without further processing, and a FAILURE result is returned. SNMPv3 Message Processing is complete ๐Ÿ›‘
  • b) information about the message gets cached and a stateReference is created, which is implementation-specific ๐Ÿ—ƒ๏ธ the info to cache includes the values of:
msgVersion,
msgID,
securityLevel,
msgFlags,
msgMaxSize,
securityModel,
maxSizeResponseScopedPDU,
securityStateReference
  • c) a SUCCESS result is returned. SNMPv3 Message Processing is complete ๐Ÿ’–
  1. if the pduType is an SNMPv2-Trap-PDU, then a SUCCESS result is returned. SNMPv3 Message Processing is complete ๐Ÿฆ‹

8. Intellectual Property โœจ

okay bestie, this section is the IETF being very careful about legal stuff ๐Ÿ’… The IETF takes no position on whether any intellectual property or other rights someone might claim over this technology are valid, or how far they reach. It also won't say whether a license for those rights is available, and it hasn't tried to find out who holds what ๐Ÿ™ˆ If you want the details on how the IETF handles rights for standards-track and standards-related documents, look at BCP-11. Copies of claimed rights that were offered for publication, any promised licenses, and the results of anyone trying to get a general license or permission to use proprietary rights for this spec can all be requested from the IETF Secretariat ๐Ÿ“ฌ

The IETF also invites anyone to tell it about copyrights, patents, patent applications, or other proprietary rights that might cover technology needed to practice this standard. Send that info to the IETF Executive Director ๐Ÿซถ

9. Acknowledgements ๐Ÿซถ

this doc is the work of the SNMPv3 Working Group, and they deserve SO much love ๐Ÿ’– Special thanks go to these SNMPv3 WG members:

Dave Battle (SNMP Research, Inc.)
Uri Blumenthal (IBM T.J. Watson Research Center)
Jeff Case (SNMP Research, Inc.)
John Curran (BBN)
T. Max Devlin (Hi-TECH Connections)
John Flick (Hewlett Packard)
David Harrington (Cabletron Systems Inc.)
N.C. Hien (IBM T.J. Watson Research Center)
Dave Levi (SNMP Research, Inc.)
Louis A Mamakos (UUNET Technologies Inc.)
Paul Meyer (Secure Computing Corporation)
Keith McCloghrie (Cisco Systems)
Russ Mundy (Trusted Information Systems, Inc.)
Bob Natale (ACE*COMM Corporation)
Mike O'Dell (UUNET Technologies Inc.)
Dave Perkins (DeskTalk)
Peter Polkinghorne (Brunel University)
Randy Presuhn (BMC Software, Inc.)
David Reid (SNMP Research, Inc.)
Shawn Routhier (Epilogue)
Juergen Schoenwaelder (TU Braunschweig)
Bob Stewart (Cisco Systems)
Bert Wijnen (IBM T.J. Watson Research Center)

The document is based on recommendations from the IETF Security and Administrative Framework Evolution for SNMP Advisory Team ๐Ÿงš The members of that Advisory Team were:

David Harrington (Cabletron Systems Inc.)
Jeff Johnson (Cisco Systems)
David Levi (SNMP Research Inc.)
John Linn (Openvision)
Russ Mundy (Trusted Information Systems) chair
Shawn Routhier (Epilogue)
Glenn Waters (Nortel)
Bert Wijnen (IBM T. J. Watson Research Center)

As the Advisory Team and the SNMPv3 Working Group Charter recommended, the design pulls in as much as is practical from earlier RFCs and drafts ๐ŸŒˆ That means special thanks are due to the authors of the earlier designs known as SNMPv2u and SNMPv2* ๐Ÿ‘‘

Jeff Case (SNMP Research, Inc.)
David Harrington (Cabletron Systems Inc.)
David Levi (SNMP Research, Inc.)
Keith McCloghrie (Cisco Systems)
Brian O'Keefe (Hewlett Packard)
Marshall T. Rose (Dover Beach Consulting)
Jon Saperia (BGS Systems Inc.)
Steve Waldbusser (International Network Services)
Glenn W. Waters (Bell-Northern Research Ltd.)

10. Security Considerations ๐Ÿ’€

okay this section is serious, so buckle up ๐Ÿ˜ญ The Dispatcher coordinates how messages get processed. That gives management messages a level of security, and it sends the SNMP PDUs to the right SNMP application(s) ๐Ÿ”ฅ

A Message Processing Model, and especially the V3MP defined in this document, works within Message Processing alongside the Security Models in the Security Subsystem. They talk through the abstract service interface primitives defined in [RFC2271] and explained above ๐Ÿงš

How much security you actually get depends mostly on the specific Security Model implementation(s) and the specific SNMP application implementation(s) plugged into this framework. Applications can reach data that isn't secured, so they should take reasonable steps to protect that data from disclosure. When they send data over the network, they should obey the securityLevel, and they should call on an Access Control Model's services for access control. โš ๏ธ

The values for the msgID element used between SNMP entities must be chosen to avoid replay attacks ๐Ÿšจ The values don't have to be unpredictable. They just can't repeat. ๐Ÿšจ

11. References ๐Ÿ“š

these are the sources the spec leans on, so don't skip them ๐Ÿค“

[RFC1901] Case, J., McCloghrie, K., Rose, M., and S. Waldbusser,
   "Introduction to Community-based SNMPv2",
   RFC 1901, January 1996.

[RFC1902] Case, J., McCloghrie, K., Rose, M., and S. Waldbusser,
   "Structure of Management Information for
   Version  2 of the Simple Network Management Protocol (SNMPv2)",
   RFC 1902, January 1996.

[RFC1905] Case, J., McCloghrie, K., Rose, M., and S. Waldbusser,
   "Protocol Operations for Version 2 of the
   Simple Network Management Protocol (SNMPv2)", RFC 1905, January
   1996.

[RFC1906] Case, J., McCloghrie, K., Rose, M., and S. Waldbusser,
   "Transport Mappings for Version 2 of the
   Simple Network Management Protocol (SNMPv2)", RFC 1906, January
   1996.

[RFC1907] Case, J., McCloghrie, K., Rose, M., and S. Waldbusser,
   "Management Information Base for Version 2
   of the Simple Network Management Protocol (SNMPv2)", RFC 1907
   January 1996.

[RFC1908] Case, J., McCloghrie, K., Rose, M., and S. Waldbusser,
   "Coexistence between Version 1 and Version
   2 of the Internet-standard Network Management Framework", RFC
   1908, January 1996.

[RFC 2028] Hovey, R., and S. Bradner, "The Organizations Involved in
   the IETF Standards Process", BCP 11, RFC 2028, October 1996.

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
   Requirement Levels", RFC 2119, BCP 14, March 1997.

[RFC2271] Harrington, D., Presuhn, R., and B. Wijnen, "An
   Architecture for describing SNMP Management Frameworks",
   RFC 2271, January 1998.

[RFC2274] Blumenthal, U., and B. Wijnen, "The User-Based
   Security Model for Version 3 of the Simple Network
   Management Protocol (SNMPv3)", RFC 2274, January 1998.

[RFC2275] Wijnen, B., Presuhn, R., and K. McCloghrie,
   "View-based Access Control Model for the Simple
   Network Management Protocol (SNMP)", RFC 2275, January 1998.

[RFC2273] Levi, D., Meyer, P., and B. Stewart, "SNMPv3
   Applications", RFC 2273, January 1998.

12. Editors' Addresses ๐ŸŽ€

and here are the editors, the people who wrangled this whole thing together ๐Ÿฆ‹

Jeffrey Case
SNMP Research, Inc.
3001 Kimberlin Heights Road
Knoxville, TN 37920-9716
USA

Phone:     +1 423-573-1434
EMail:     case@snmp.com


Dave Harrington
Cabletron Systems, Inc
Post Office Box 5005
Mail Stop: Durham
35 Industrial Way
Rochester, NH 03867-5005
USA

Phone:      +1 603-337-7357
EMail:      dbh@ctron.com


Randy Presuhn
BMC Software, Inc.
1190 Saratoga Avenue
Suite 130
San Jose, CA 95129
USA

Phone:      +1 408-556-0720
EMail:      rpresuhn@bmc.com


Bert Wijnen
IBM T. J. Watson Research
Schagen 33
3461 GL Linschoten
Netherlands

Phone:      +31 348-432-794
EMail:      wijnen@vnet.ibm.com

copyright time, and it's a whole vibe ๐ŸŒธ The Internet Society owns the copyright here, from 1998, and all rights are reserved โœจ You're free to copy and share this document, and to write derivative works that comment on it, explain it, or help people implement it. You can publish and distribute all of that, in whole or in part, with no restrictions, as long as the copyright notice and this paragraph stay on every copy and derivative work ๐Ÿ’œ

The doc itself can't be modified in any way, though. That includes removing the copyright notice or the references to the Internet Society or other Internet organizations. The exceptions are when you need it to develop Internet standards, in which case the Internet Standards process copyright procedures have to be followed, or when you need to translate it into a language other than English ๐ŸŒˆ

The limited permissions above are perpetual, and the Internet Society and its successors or assigns won't revoke them ๐Ÿซถ

This document and the information in it is provided on an "AS IS" basis, and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. ๐Ÿ™ˆ
๐Ÿ“ฆ where this page comes from