RFC 3414
User-based Security Model (USM) for version 3 of the Simple Network Management Protocol (SNMPv3)
RFC 3414: User-based Security Model (USM) for SNMPv3 ๐
Okay bestie, this is RFC 3414, and it's the spec for how SNMP version 3 keeps its messages safe. It's a Standards Track document, so it's an actual Internet standard, not just an idea. It's STD 62 and came out in December 2002 ๐ . It's from the Network Working Group, written by U. Blumenthal and B. Wijnen from Lucent Technologies ๐ผ. The big news: it obsoletes RFC 2574, so this one replaces that older version ๐ .
Status of This Memo โจ
This document is an Internet standards track protocol for the Internet community. It asks for discussion and suggestions for improvements ๐ฌ. If you want to know where this protocol stands in standardization, check the current edition of "Internet Official Protocol Standards" (STD 1) ๐. And the best part: distribution of this memo is unlimited ๐.
Copyright Notice ๐
Copyright (C) The Internet Society (2002). All Rights Reserved.
Abstract ๐ฆ
So this doc describes the User-based Security Model (USM) for SNMP version 3, and it's built for use inside the SNMP architecture ๐ง. It spells out the Elements of Procedure for providing SNMP message level security, which is basically the step-by-step rules for keeping messages locked down ๐. It also comes with a Management Information Base (MIB) so you can remotely monitor and manage the configuration parameters for this Security Model ๐๏ธ. And yes, it obsoletes RFC 2574 ๐.
Table of Contents ๐
1. Introduction.......................................... 4
1.1. Threats............................................... 4
1.2. Goals and Constraints................................. 6
1.3. Security Services..................................... 6
1.4. Module Organization................................... 7
1.4.1. Timeliness Module..................................... 8
1.4.2. Authentication Protocol............................... 8
1.4.3. Privacy Protocol...................................... 8
1.5. Protection against Message Replay, Delay
and Redirection....................................... 9
1.5.1. Authoritative SNMP engine............................. 9
1.5.2. Mechanisms............................................ 9
1.6. Abstract Service Interfaces........................... 11
1.6.1. User-based Security Model Primitives
for Authentication.................................... 11
1.6.2. User-based Security Model Primitives
for Privacy........................................... 12
2. Elements of the Model................................. 12
2.1. User-based Security Model Users....................... 12
2.2. Replay Protection..................................... 13
2.2.1. msgAuthoritativeEngineID.............................. 14
2.2.2. msgAuthoritativeEngineBoots and
msgAuthoritativeEngineTime............................ 14
2.2.3. Time Window........................................... 15
2.3. Time Synchronization.................................. 15
2.4. SNMP Messages Using this Security Model............... 16
2.5. Services provided by the User-based Security Model.... 17
2.5.1. Services for Generating an Outgoing SNMP Message...... 17
2.5.2. Services for Processing an Incoming SNMP Message...... 20
2.6. Key Localization Algorithm............................ 22
3. Elements of Procedure................................. 22
3.1. Generating an Outgoing SNMP Message................... 22
3.2. Processing an Incoming SNMP Message................... 26
4. Discovery............................................. 31
5. Definitions........................................... 32
6. HMAC-MD5-96 Authentication Protocol................... 51
6.1. Mechanisms............................................ 51
6.1.1. Digest Authentication Mechanism....................... 51
6.2. Elements of the Digest Authentication Protocol........ 52
6.2.1. Users................................................. 52
6.2.2. msgAuthoritativeEngineID.............................. 53
6.2.3. SNMP Messages Using this Authentication Protocol...... 53
6.2.4. Services provided by the HMAC-MD5-96
Authentication Module................................. 53
6.2.4.1. Services for Generating an Outgoing SNMP Message...... 53
6.2.4.2. Services for Processing an Incoming SNMP Message...... 54
6.3. Elements of Procedure................................. 55
6.3.1. Processing an Outgoing Message........................ 55
6.3.2. Processing an Incoming Message........................ 56
7. HMAC-SHA-96 Authentication Protocol................... 57
7.1. Mechanisms............................................ 57
7.1.1. Digest Authentication Mechanism....................... 57
7.2. Elements of the HMAC-SHA-96 Authentication Protocol... 58
7.2.1. Users................................................. 58
7.2.2. msgAuthoritativeEngineID.............................. 58
7.2.3. SNMP Messages Using this Authentication Protocol...... 59
7.2.4. Services provided by the HMAC-SHA-96
Authentication Module................................. 59
7.2.4.1. Services for Generating an Outgoing SNMP Message...... 59
7.2.4.2. Services for Processing an Incoming SNMP Message...... 60
7.3. Elements of Procedure................................. 61
7.3.1. Processing an Outgoing Message........................ 61
7.3.2. Processing an Incoming Message........................ 61
8. CBC-DES Symmetric Encryption Protocol................. 63
8.1. Mechanisms............................................ 63
8.1.1. Symmetric Encryption Protocol......................... 63
8.1.1.1. DES key and Initialization Vector..................... 64
8.1.1.2. Data Encryption....................................... 65
8.1.1.3. Data Decryption....................................... 65
8.2. Elements of the DES Privacy Protocol.................. 65
8.2.1. Users................................................. 65
8.2.2. msgAuthoritativeEngineID.............................. 66
8.2.3. SNMP Messages Using this Privacy Protocol............. 66
8.2.4. Services provided by the DES Privacy Module........... 66
8.2.4.1. Services for Encrypting Outgoing Data................. 66
8.2.4.2. Services for Decrypting Incoming Data................. 67
8.3. Elements of Procedure................................. 68
8.3.1. Processing an Outgoing Message........................ 68
8.3.2. Processing an Incoming Message........................ 69
9. Intellectual Property................................. 69
10. Acknowledgements...................................... 70
11. Security Considerations............................... 71
11.1. Recommended Practices................................. 71
11.2. Defining Users........................................ 73
11.3. Conformance........................................... 74
11.4. Use of Reports........................................ 75
11.5. Access to the SNMP-USER-BASED-SM-MIB.................. 75
12. References............................................ 75
A.1. SNMP engine Installation Parameters................... 78
A.2. Password to Key Algorithm............................. 80
A.2.1. Password to Key Sample Code for MD5................... 81
A.2.2. Password to Key Sample Code for SHA................... 82
A.3. Password to Key Sample Results........................ 83
A.3.1. Password to Key Sample Results using MD5.............. 83
A.3.2. Password to Key Sample Results using SHA.............. 83
A.4. Sample encoding of msgSecurityParameters.............. 83
A.5. Sample keyChange Results.............................. 84
A.5.1. Sample keyChange Results using MD5.................... 84
A.5.2. Sample keyChange Results using SHA.................... 85
B. Change Log............................................ 86
Editors' Addresses.................................... 87
Full Copyright Statement.............................. 88
1. Introduction ๐ธ
So the Architecture for describing Internet Management Frameworks, which is [RFC3411], says an SNMP engine is made up of four pieces ๐งฉ:
- a Dispatcher,
- a Message Processing Subsystem,
- a Security Subsystem, and
- an Access Control Subsystem.
Applications get to use the services of these subsystems ๐ .
Ngl, you really need to understand the SNMP architecture and its vocabulary to see where this Security Model fits in and how it talks to the other subsystems ๐ค. The reader is expected to already know the SNMP architecture as defined in [RFC3411] ๐, so if you haven't read that yet, go do it first ๐.
This memo describes the User-based Security Model as it's used inside the SNMP Architecture โจ. The big idea is the traditional concept of a user, identified by a userName, and we attach all the security information to that user ๐.
This memo covers HMAC-MD5-96 and HMAC-SHA-96 as the authentication protocols, and CBC-DES as the privacy protocol ๐. But the User-based Security Model is flexible! It lets other protocols be used instead of these, or alongside them ๐ฆ. That's why HMAC-MD5-96, HMAC-SHA-96, and CBC-DES each get their own self-contained section, so it's clear they can be swapped out or added to later on ๐.
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 [RFC2119] ๐.
1.1. Threats ๐ฅ
Okay so, bestie, a bunch of the classic threats to network protocols totally apply to network management, which means they'd apply to any SNMP Security Model ๐ . Others are literally not relevant to network management, so we can skip those. This section covers the principal threats, the secondary ones, and the ones that are lowkey less important ๐ฆ.
The principal threats this SNMP Security Model should protect against are:
- Modification of Information The modification threat is the danger that some unauthorized entity may alter in-transit SNMP messages generated on behalf of an authorized principal in such a way as to effect unauthorized management operations, including falsifying the value of an object. ๐ฑ
- Masquerade The masquerade threat is the danger that management operations not authorized for some user may be attempted by assuming the identity of another user that has the appropriate authorizations. ๐ญ
Two secondary threats are also identified. The Security Model defined in this memo provides limited protection against:
- Disclosure The disclosure threat is the danger of eavesdropping on the exchanges between managed agents and a management station. Protecting against this threat may be required as a matter of local policy. ๐
- Message Stream Modification The SNMP protocol is typically based upon a connection-less transport service which may operate over any sub-network service. The re-ordering, delay or replay of messages can and does occur through the natural operation of many such sub-network services. The message stream modification threat is the danger that messages may be maliciously re-ordered, delayed or replayed to an extent which is greater than can occur through the natural operation of a sub-network service, in order to effect unauthorized management operations. ๐
There are at least two threats that an SNMP Security Model need not protect against. The security protocols defined in this memo do not provide protection against:
- Denial of Service This SNMP Security Model does not attempt to address the broad range of attacks by which service on behalf of authorized users is denied. Indeed, such denial-of-service attacks are in many cases indistinguishable from the type of network failures with which any viable network management protocol must cope as a matter of course. ๐
- Traffic Analysis This SNMP Security Model does not attempt to address traffic analysis attacks. Indeed, many traffic patterns are predictable (devices may be managed on a regular basis by a relatively small number of management applications), and therefore there is no significant advantage afforded by protecting against traffic analysis. ๐ง
1.2. Goals and Constraints ๐ฏ
Based on the foregoing account of threats in the SNMP network management environment, the goals of this SNMP Security Model are as follows.
- Provide for verification that each received SNMP message has not been modified during its transmission through the network.
- Provide for verification of the identity of the user on whose behalf a received SNMP message claims to have been generated.
- Provide for detection of received SNMP messages, which request or contain management information, whose time of generation was not recent.
- Provide, when necessary, that the contents of each received SNMP message are protected from disclosure.
In addition to the principal goal of supporting secure network management, the design of this SNMP Security Model is also influenced by the following constraints:
- When the requirements of effective management in times of network stress are inconsistent with those of security, the design of USM has given preference to the former. Management first when the network is stressed, babe ๐
- Neither the security protocol nor its underlying security mechanisms should depend upon the ready availability of other network services (e.g., Network Time Protocol (NTP) or key management protocols). โฐ
- A security mechanism should entail no changes to the basic SNMP network management philosophy. ๐ธ
1.3. Security Services ๐ก๏ธ
The security services necessary to support the goals of this SNMP Security Model are as follows:
- Data Integrity is the provision of the property that data has not been altered or destroyed in an unauthorized manner, nor have data sequences been altered to an extent greater than can occur non-maliciously. ๐
- Data Origin Authentication is the provision of the property that the claimed identity of the user on whose behalf received data was originated is corroborated. ๐ชช
- Data Confidentiality is the provision of the property that information is not made available or disclosed to unauthorized individuals, entities, or processes. ๐คซ
- Message timeliness and limited replay protection is the provision of the property that a message whose generation time is outside of a specified time window is not accepted. Note that message reordering is not dealt with and can occur in normal conditions too. โณ
For the protocols specified in this memo, it is not possible to assure the specific originator of a received SNMP message; rather, it is the user on whose behalf the message was originated that is authenticated. ๐ซถ
For these protocols, it is not possible to obtain data integrity without data origin authentication, nor is it possible to obtain data origin authentication without data integrity. Further, there is no provision for data confidentiality without both data integrity and data origin authentication. Everything is connected, no cap ๐
The security protocols used in this memo are considered acceptably secure at the time of writing. However, the procedures allow for new authentication and privacy methods to be specified at a future time if the need arises. ๐ฎ
1.4. Module Organization ๐งฉ
The security protocols defined in this memo are split in three different modules, and each has its specific responsibilities such that together they realize the goals and security services described above:
- The authentication module MUST provide for:
- Data Integrity,
- Data Origin Authentication,
- The timeliness module MUST provide for:
- Protection against message delay or replay (to an extent greater than can occur through normal operation).
- The privacy module MUST provide for
- Protection against disclosure of the message payload.
The timeliness module is fixed for the User-based Security Model, while there is provision for multiple authentication and/or privacy modules, each of which implements a specific authentication or privacy protocol respectively. ๐
1.4.1. Timeliness Module โฑ๏ธ
Section 3 (Elements of Procedure) uses the timeliness values in an SNMP message to do timeliness checking. The timeliness check is only performed if authentication is applied to the message. Since the complete message is checked for integrity, we can assume that the timeliness values in a message that passes the authentication module are trustworthy. โ
1.4.2. Authentication Protocol ๐
Section 6 describes the HMAC-MD5-96 authentication protocol, which is the first authentication protocol that MUST be supported with the User-based Security Model. Section 7 describes the HMAC-SHA-96 authentication protocol, which is another authentication protocol that SHOULD be supported with the User-based Security Model. In the future, additional or replacement authentication protocols may be defined as new needs arise. ๐
The User-based Security Model prescribes that, if authentication is used, then the complete message is checked for integrity in the authentication module. ๐
For a message to be authenticated, it needs to pass the authentication check by the authentication module and the timeliness check, which is a fixed part of this User-based Security model. ๐
1.4.3. Privacy Protocol ๐ค
Section 8 describes the CBC-DES Symmetric Encryption Protocol, which is the first privacy protocol to be used with the User-based Security Model. In the future, additional or replacement privacy protocols may be defined as new needs arise. โจ
The User-based Security Model prescribes that the scopedPDU is protected from disclosure when a message is sent with privacy. ๐
The User-based Security Model also prescribes that a message needs to be authenticated if privacy is in use. ๐
1.5. Protection against Message Replay, Delay and Redirection ๐
1.5.1. Authoritative SNMP Engine ๐
In order to protect against message replay, delay and redirection, one of the SNMP engines involved in each communication is designated to be the authoritative SNMP engine. When an SNMP message contains a payload which expects a response (those messages that contain a Confirmed Class PDU [RFC3411]), then the receiver of such messages is authoritative. When an SNMP message contains a payload which does not expect a response (those messages that contain an Unconfirmed Class PDU [RFC3411]), then the sender of such a message is authoritative. ๐ซง
1.5.2. Mechanisms โจ
okay so here's the toolkit we use ๐งฐ (it's giving organized)
- Timeliness indicators for old messages ๐ฐ๏ธ To protect against message delay or replay (to an extent greater than normal operation can cause), each message generated includes a set of timeliness indicators for the authoritative SNMP engine. An SNMP engine checks them to decide if a received message is recent. An SNMP engine may also check that a message is at least as recent as the last message it received from the same source. A non-authoritative SNMP engine uses received authentic messages to advance its notion of the timeliness indicators at the remote authoritative source.
An SNMP engine MUST also use a mechanism to match incoming Responses to outstanding Requests, and it MUST drop any Responses that do not match an outstanding request. For example, a msgID can be inserted in every message to cater for this ๐
These mechanisms let you detect authenticated messages whose time of generation was not recent.
This protection against delay or replay does not imply nor provide any protection against unauthorized deletion or suppression of messages. Also, an SNMP engine may not be able to detect message reordering if all the messages involved are sent within the Time Window interval. Other mechanisms defined independently of the security protocol can also be used to detect the re-ordering, replay, deletion, or suppression of messages containing Set operations (e.g., the MIB variable snmpSetSerialNo [RFC3418]). ๐
- No replaying messages between engines ๐ We verify that a message sent to or from one authoritative SNMP engine cannot be replayed to, or as if from, another authoritative SNMP engine. Each message includes an identifier unique to the authoritative SNMP engine associated with the sender or intended recipient. ๐ฆ
A message containing an Unconfirmed Class PDU sent by an authoritative SNMP engine to one non-authoritative SNMP engine can potentially be replayed to another non-authoritative SNMP engine. That second engine might (if it knows about the same userName with the same secrets at the authoritative SNMP engine) update its notion of the timeliness indicators of the authoritative SNMP engine as a result, but that is not considered a threat. In this case, a Report or Response message will be discarded by the Message Processing Model, because there should not be an outstanding Request message. A Trap will possibly be accepted. Again, that is not considered a threat, because the communication was authenticated and timely. It is as if the authoritative SNMP engine was configured to start sending Traps to the second SNMP engine, which theoretically can happen without the knowledge of the second SNMP engine anyway. Anyway, the second SNMP engine may not expect to receive this Trap, but is allowed to see the management information contained in it. ๐ง
- Spotting messages that weren't made recently โฑ๏ธ A set of time indicators are included in the message, indicating the time of generation. Messages without recent time indicators are not considered authentic. In addition, an SNMP engine MUST drop any Responses that do not match an outstanding request. This however is the responsibility of the Message Processing Model. ๐ซถ
This memo allows the same user to be defined on multiple SNMP engines. Each SNMP engine maintains a value, snmpEngineID, which uniquely identifies the SNMP engine. This value is included in each message sent to or from the SNMP engine that is authoritative (see section 1.5.1). On receipt of a message, an authoritative SNMP engine checks the value to ensure that it is the intended recipient, and a non-authoritative SNMP engine uses the value to ensure that the message is processed using the correct state information. ๐
Each SNMP engine maintains two values, snmpEngineBoots and snmpEngineTime, which taken together provide an indication of time at that SNMP engine. Both of these values are included in an authenticated message sent to or received from that SNMP engine. On receipt, the values are checked to ensure that the indicated timeliness value is within a Time Window of the current time. The Time Window represents an administrative upper bound on acceptable delivery delay for protocol messages. โณ
For an SNMP engine to generate a message which an authoritative SNMP engine will accept as authentic, and to verify that a message received from that authoritative SNMP engine is authentic, such an SNMP engine must first achieve timeliness synchronization with the authoritative SNMP engine. See section 2.3. ๐ธ
1.6. Abstract Service Interfaces โจ
Abstract service interfaces have been defined to describe the conceptual interfaces between the various subsystems within an SNMP entity. Similarly a set of abstract service interfaces have been defined within the User-based Security Model (USM) to describe the conceptual interfaces between the generic USM services and the self-contained authentication and privacy services. ๐
These abstract service interfaces are defined by a set of primitives that define the services provided and the abstract data elements that must be passed when the services are invoked. This section lists the primitives that have been defined for the User-based Security Model. ๐
1.6.1. User-based Security Model Primitives for Authentication
The User-based Security Model provides the following internal primitives to pass data back and forth between the Security Model itself and the authentication service: ๐
statusInformation =
authenticateOutgoingMsg(
IN authKey -- secret key for authentication
IN wholeMsg -- unauthenticated complete message
OUT authenticatedWholeMsg -- complete authenticated message
)
statusInformation =
authenticateIncomingMsg(
IN authKey -- secret key for authentication
IN authParameters -- as received on the wire
IN wholeMsg -- as received on the wire
OUT authenticatedWholeMsg -- complete authenticated message
)
1.6.2. User-based Security Model Primitives for Privacy
The User-based Security Model provides the following internal primitives to pass data back and forth between the Security Model itself and the privacy service: ๐
statusInformation =
encryptData(
IN encryptKey -- secret key for encryption
IN dataToEncrypt -- data to encrypt (scopedPDU)
OUT encryptedData -- encrypted data (encryptedPDU)
OUT privParameters -- filled in by service provider
)
statusInformation =
decryptData(
IN decryptKey -- secret key for decrypting
IN privParameters -- as received on the wire
IN encryptedData -- encrypted data (encryptedPDU)
OUT decryptedData -- decrypted data (scopedPDU)
)
2. Elements of the Model โจ
This section contains definitions required to realize the security model defined by this memo. ๐งฉ
2.1. User-based Security Model Users
Management operations using this Security Model make use of a defined set of user identities. For any user on whose behalf management operations are authorized at a particular SNMP engine, that SNMP engine must have knowledge of that user. An SNMP engine that wishes to communicate with another SNMP engine must also have knowledge of a user known to that engine, including knowledge of the applicable attributes of that user. ๐
A user and its attributes are defined as follows:
userName: A string representing the name of the user.securityName: A human-readable string representing the user in a format that is Security Model independent. There is a one-to-one relationship between userName and securityName.authProtocol: An indication of whether messages sent on behalf of this user can be authenticated, and if so, the type of authentication protocol which is used. Two such protocols are defined in this memo:- the HMAC-MD5-96 authentication protocol.
- the HMAC-SHA-96 authentication protocol.
authKey: If messages sent on behalf of this user can be authenticated, the (private) authentication key for use with the authentication protocol. Note that a user's authentication key will normally be different at different authoritative SNMP engines. The authKey is not accessible via SNMP. The length requirements of the authKey are defined by the authProtocol in use. ๐authKeyChangeandauthOwnKeyChange: The only way to remotely update the authentication key. Does that in a secure manner, so that the update can be completed without the need to employ privacy protection. ๐ก๏ธprivProtocol: An indication of whether messages sent on behalf of this user can be protected from disclosure, and if so, the type of privacy protocol which is used. One such protocol is defined in this memo: the CBC-DES Symmetric Encryption Protocol. ๐privKey: If messages sent on behalf of this user can be en/decrypted, the (private) privacy key for use with the privacy protocol. Note that a user's privacy key will normally be different at different authoritative SNMP engines. The privKey is not accessible via SNMP. The length requirements of the privKey are defined by the privProtocol in use.privKeyChangeandprivOwnKeyChange: The only way to remotely update the encryption key. Does that in a secure manner, so that the update can be completed without the need to employ privacy protection. โจ
2.2. Replay Protection
Each SNMP engine maintains three objects:
snmpEngineID, which (at least within an administrative domain) uniquely and unambiguously identifies an SNMP engine.snmpEngineBoots, which is a count of the number of times the SNMP engine has re-booted/re-initialized sincesnmpEngineIDwas last configured; and,snmpEngineTime, which is the number of seconds since thesnmpEngineBootscounter was last incremented.
Each SNMP engine is always authoritative with respect to these objects in its own SNMP entity. It is the responsibility of a non-authoritative SNMP engine to synchronize with the authoritative SNMP engine, as appropriate. ๐
An authoritative SNMP engine is required to maintain the values of its snmpEngineID and snmpEngineBoots in non-volatile storage. ๐พ
2.2.1. msgAuthoritativeEngineID
The msgAuthoritativeEngineID value contained in an authenticated message is used to defeat attacks in which messages from one SNMP engine to another SNMP engine are replayed to a different SNMP engine. It represents the snmpEngineID at the authoritative SNMP engine involved in the exchange of the message. ๐ซ
When an authoritative SNMP engine is first installed, it sets its local value of snmpEngineID according to a enterprise-specific algorithm (see the definition of the Textual Convention for SnmpEngineID in the SNMP Architecture document [RFC3411]). ๐
2.2.2. msgAuthoritativeEngineBoots and msgAuthoritativeEngineTime โจ
okay so these two values, msgAuthoritativeEngineBoots and msgAuthoritativeEngineTime, live inside every authenticated message ๐ Their whole job is to shut down replay attacks, where someone grabs an old message and tries to send it again when it's no longer valid. ๐ โโ๏ธ They're basically a copy of snmpEngineBoots and snmpEngineTime from the authoritative SNMP engine taking part in the exchange ๐
Here's the clever part ๐ง An SNMP engine doesn't need a non-volatile clock that keeps ticking while it's powered off. Instead, every time an engine reboots, it grabs its snmpEngineBoots value, increments it, saves it to non-volatile storage, and resets snmpEngineTime to zero โฐ no clock needed, it's giving resourceful ๐
When an SNMP engine is first installed, both of its local values, snmpEngineBoots and snmpEngineTime, start at zero ๐ฑ If snmpEngineTime ever hits its maximum value of 2147483647, snmpEngineBoots gets incremented as if the engine had rebooted, snmpEngineTime goes back to zero, and it starts counting up again ๐
Now, every time an authoritative SNMP engine reboots, any SNMP engine that's holding its snmpEngineBoots and snmpEngineTime values has to re-synchronize before it sends correctly authenticated messages to that engine. The procedures for this are in Section 2.3 ๐ซถ BUT, and this is a fun twist, the procedures still let a notification get accepted as authentic by a receiving SNMP engine, as long as it was sent by an authoritative SNMP engine that has rebooted since the receiver last (re-)synchronized ๐ฆ
If an authoritative SNMP engine can't work out its latest snmpEngineBoots value, it must set snmpEngineBoots to 2147483647 ๐ญ
Once the local value of snmpEngineBoots is 2147483647, it latches there forever, and any authenticated message will always cause a notInTimeWindow authentication failure ๐ซ
To reset an SNMP engine whose snmpEngineBoots has reached 2147483647, you need manual intervention. Someone has to physically visit the engine and reconfigure it, either with a new snmpEngineID value or with new secret values for the authentication and privacy protocols of every user the engine knows about ๐ ๏ธ Fun fact, even if an engine rebooted once a second, it would still take about 68 years to reach that max value of 2147483647 ๐คฏ
2.2.3. Time Window โจ
The Time Window is the window of time in which a message generated on behalf of any user is valid โณ This memo says the same Time Window value, 150 seconds, is used for every user ๐
2.3. Time Synchronization ๐ฐ๏ธ
Time synchronization is what a non-authoritative SNMP engine needs before it can proceed with authentic communications ๐ค It's considered done once the non-authoritative engine has a local notion of the authoritative SNMP engine's snmpEngineBoots and snmpEngineTime values, obtained from that authoritative engine. Those values must be (and remain) within the authoritative SNMP engine's Time Window, so the local notion has to be kept loosely synchronized with the values stored at the authoritative engine ๐
On top of keeping a local copy of snmpEngineBoots and snmpEngineTime, a non-authoritative SNMP engine also has to keep one more local variable, latestReceivedEngineTime. This records the highest snmpEngineTime the non-authoritative engine has ever received from the authoritative engine. It's what stops someone from replaying messages to keep the non-authoritative engine's idea of snmpEngineTime from moving forward ๐ซโช
A non-authoritative SNMP engine must keep local notions of these values (snmpEngineBoots, snmpEngineTime and latestReceivedEngineTime) for each authoritative SNMP engine it wants to talk to ๐ Each authoritative engine is uniquely and unambiguously identified by its snmpEngineID, so the non-authoritative engine can use that snmpEngineID as the key to cache those values ๐๏ธ
Time synchronization happens as part of the procedures for receiving an SNMP message (Section 3.2, step 7b) โจ So there's no explicit time synchronization procedure a non-authoritative engine needs to run on its own, it's built right in ๐ง
One important note ๐ whenever the local value of snmpEngineID changes (for example, through discovery), or when secure communications are first established with an authoritative SNMP engine, the local values of snmpEngineBoots and latestReceivedEngineTime should be set to zero. That makes time synchronization happen on the next authentic message received ๐ธ
2.4. SNMP Messages Using this Security Model ๐
The syntax of an SNMP message using this Security Model follows the message format defined in the version-specific Message Processing Model document, for example [RFC3412] ๐ฆ
The field msgSecurityParameters in SNMPv3 messages has a data type of OCTET STRING. Its value is the BER serialization of the following ASN.1 sequence ๐
USMSecurityParametersSyntax DEFINITIONS IMPLICIT TAGS ::= BEGIN
UsmSecurityParameters ::=
SEQUENCE {
-- global User-based security parameters
msgAuthoritativeEngineID OCTET STRING,
msgAuthoritativeEngineBoots INTEGER (0..2147483647),
msgAuthoritativeEngineTime INTEGER (0..2147483647),
msgUserName OCTET STRING (SIZE(0..32)),
-- authentication protocol specific parameters
msgAuthenticationParameters OCTET STRING,
-- privacy protocol specific parameters
msgPrivacyParameters OCTET STRING
}
END
So, the fields of this sequence are:
- msgAuthoritativeEngineID specifies the snmpEngineID of the authoritative SNMP engine involved in the exchange of the message ๐
- msgAuthoritativeEngineBoots specifies the snmpEngineBoots value at the authoritative SNMP engine involved in the exchange of the message ๐ข
- msgAuthoritativeEngineTime specifies the snmpEngineTime value at the authoritative SNMP engine involved in the exchange of the message โฑ๏ธ
- msgUserName specifies the user (principal) on whose behalf the message is being exchanged. Note that a zero-length userName won't match any user, but it can be used for snmpEngineID discovery ๐
- msgAuthenticationParameters are defined by the authentication protocol in use for the message, as set by the
usmUserAuthProtocolcolumn in the user's entry in theusmUserTable๐ - msgPrivacyParameters are defined by the privacy protocol in use for the message, as set by the
usmUserPrivProtocolcolumn in the user's entry in theusmUserTable๐ญ
bestie, check out appendix A.4 for an example of the BER encoding of the field msgSecurityParameters ๐ซถ
2.5. Services provided by the User-based Security Model ๐
This section describes the services the User-based Security Model provides, along with their inputs and outputs ๐
These services are described as primitives of an abstract service interface, and the inputs and outputs are described as abstract data elements as they get passed in those abstract service primitives ๐ฆ
2.5.1. Services for Generating an Outgoing SNMP Message โจ
Okay bestie, so when the Message Processing (MP) Subsystem asks the User-based Security module to lock down an outgoing SNMP message ๐, it must use the right service that the Security module provides. There are two of them ๐
- A service to generate a Request message. The abstract service primitive looks like this:
statusInformation = -- success or errorIndication
generateRequestMsg(
IN messageProcessingModel -- typically, SNMP version
IN globalData -- message header, admin data
IN maxMessageSize -- of the sending SNMP entity
IN securityModel -- for the outgoing message
IN securityEngineID -- authoritative SNMP entity
IN securityName -- on behalf of this principal
IN securityLevel -- Level of Security requested
IN scopedPDU -- message (plaintext) payload
OUT securityParameters -- filled in by Security Module
OUT wholeMsg -- complete generated message
OUT wholeMsgLength -- length of generated message
)
- A service to generate a Response message. The abstract service primitive looks like this:
statusInformation = -- success or errorIndication
generateResponseMsg(
IN messageProcessingModel -- typically, SNMP version
IN globalData -- message header, admin data
IN maxMessageSize -- of the sending SNMP entity
IN securityModel -- for the outgoing message
IN securityEngineID -- authoritative SNMP entity
IN securityName -- on behalf of this principal
IN securityLevel -- Level of Security requested
IN scopedPDU -- message (plaintext) payload
IN securityStateReference -- reference to security state
-- information from original
-- request
OUT securityParameters -- filled in by Security Module
OUT wholeMsg -- complete generated message
OUT wholeMsgLength -- length of generated message
)
Now let's look at the data elements that get passed into these primitives ๐
statusInformation: This tells you whether encoding and securing the message worked. If it didn't, it tells you what went wrong.
messageProcessingModel: The SNMP version number for the message being generated. The User-based Security module doesn't use this one, so it's not its problem ๐
globalData: The message header, which is the administrative info. Also not used by the User-based Security module.
maxMessageSize: The maximum message size, as it's included in the message. Again, the User-based Security module doesn't use this data.
securityParameters: These are the security parameters. The User-based Security module fills them in for you ๐ง
securityModel: The securityModel in use. It should be the User-based Security Model. The User-based Security module doesn't use this data either.
securityName: Together with the snmpEngineID, this identifies a row in the usmUserTable that gets used to secure the message. The securityName has a format that doesn't depend on the Security Model. For a response, this parameter gets ignored and the value from the cache is used instead ๐
securityLevel: The Level of Security. The User-based Security module looks at this to figure out whether the message needs to be protected from disclosure and whether it needs to be authenticated ๐ฅ
securityEngineID: The snmpEngineID of the authoritative SNMP engine that a dateRequest message is to be sent to. For a response, it's implied to be the processing SNMP engine's snmpEngineID, so if you specify it, it gets ignored.
scopedPDU: The message payload. As far as the User-based Security Model is concerned, the data is opaque ๐ซถ
securityStateReference: A handle or reference to cachedSecurityData, used when securing an outgoing Response message. It's the exact same handle or reference that the User-based Security module generated when it processed the incoming Request message this Response is answering ๐
wholeMsg: The fully encoded and secured message, ready to go out on the wire ๐ฆ
wholeMsgLength: The length of the encoded and secured message (wholeMsg).
When the process is done, the User-based Security module returns statusInformation. If it worked, you get the completed message, with privacy and authentication applied if the specified securityLevel asked for them โจ If it didn't work, you get an errorIndication instead ๐
2.5.2. Services for Processing an Incoming SNMP Message ๐ธ
When the Message Processing (MP) Subsystem asks the User-based Security module to check that an incoming message is secure, it must use the service made for incoming messages. The abstract service primitive is:
statusInformation = -- errorIndication or success
-- error counter OID/value if error
processIncomingMsg(
IN messageProcessingModel -- typically, SNMP version
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 the Response PDU
OUT securityStateReference -- reference to security state
) -- information, needed for response
Here's what each data element means ๐ง
statusInformation: Whether the process worked or not. If it didn't, the statusInformation includes the OID and value of the error counter that got incremented ๐
โโ๏ธ
messageProcessingModel: The SNMP version number, as it was received in the message. The User-based Security module doesn't use this.
maxMessageSize: The maximum message size, as it's included in the message. The User-based Security module uses this value to calculate the maxSizeResponseScopedPDU ๐งฎ
securityParameters: The security parameters, exactly as they were received in the message.
securityModel: The securityModel in use. It should be the User-based Security Model. The User-based Security module doesn't use this data.
securityLevel: The Level of Security. The User-based Security module uses it to decide whether the message needs to be protected from disclosure and whether it needs to be authenticated ๐
wholeMsg: The whole message, exactly as it was received.
wholeMsgLength: The length of the message, as it was received (wholeMsg).
securityEngineID: The snmpEngineID that was extracted from the field msgAuthoritativeEngineID, and that got used to look up the secrets in the usmUserTable ๐๏ธ
securityName: The security name representing the user on whose behalf the message was received. The securityName has a format that doesn't depend on the Security Model.
scopedPDU: The message payload. Once again, opaque as far as the User-based Security Model is concerned ๐
maxSizeResponseScopedPDU: The maximum size of a scopedPDU that can go in a possible Response message. The User-based Security module works this out from the msgMaxSize (as it was received in the message) and the space needed for the Response message's header, including the securityParameters ๐
securityStateReference: A handle or reference to cachedSecurityData, used when securing an outgoing Response message. When the Message Processing Subsystem asks the User-based Security module to generate a response to this incoming message, it must pass this handle or reference back in ๐
When it's done, the User-based Security module returns statusInformation. If the process worked, it also returns the extra data elements that you need to process the message further. If it didn't work, you get an errorIndication, possibly with an OID and value pair for an error counter that got incremented ๐ญ
2.6. Key Localization Algorithm.
A localized key is a secret key shared between a user U and one authoritative SNMP engine E. Even though a user might have only one password, and therefore one key for the whole network, the actual secrets shared between the user and each authoritative SNMP engine are different. This is achieved by key localization [Localized-key] ๐
First, if a user uses a password, the user's password gets converted into a key Ku using one of the two algorithms described in Appendices A.2.1 and A.2.2 ๐
To turn key Ku into a localized key Kul of user U at the authoritative SNMP engine E, you append the snmpEngineID of the authoritative SNMP engine to the key Ku, and then append the key Ku to the result. That wraps the snmpEngineID inside two copies of the user's key Ku ๐ Then you run a secure hash function. Which one depends on the authentication protocol defined for this user U at authoritative SNMP engine E. This document defines two authentication protocols with their associated algorithms, based on MD5 and SHA โจ The output of the hash function is the localized key Kul for user U at the authoritative SNMP engine E ๐
3. Elements of Procedure ๐
This section describes the security-related procedures that an SNMP engine follows when it processes SNMP messages according to the User-based Security Model ๐
3.1. Generating an Outgoing SNMP Message ๐
Okay bestie, this section is the step-by-step recipe an SNMP engine follows whenever it builds a message with a management operation in it (a request, a response, a notification, or a report) on behalf of a user at a particular securityLevel. ๐ฆ
- Step 1 is all about where the user info comes from. โจ
- a) If any
securityStateReferenceis passed (Response or Report message), then information concerning the user is extracted from thecachedSecurityData. ThecachedSecurityDatacan now be discarded. ThesecurityEngineIDis set to the localsnmpEngineID. ThesecurityLevelis set to the value specified by the calling module.
- a) If any
Otherwise,
- b) based on the
securityName, information concerning the user at the destinationsnmpEngineID, specified by thesecurityEngineID, is extracted from the Local Configuration Datastore (LCD,usmUserTable). If information about the user is absent from the LCD, then an error indication (unknownSecurityName) is returned to the calling module. ๐
- If the
securityLevelspecifies that the message is to be protected from disclosure, but the user does not support both an authentication and a privacy protocol, then the message cannot be sent. An error indication (unsupportedSecurityLevel) is returned to the calling module. ๐ - If the
securityLevelspecifies that the message is to be authenticated, but the user does not support an authentication protocol, then the message cannot be sent. An error indication (unsupportedSecurityLevel) is returned to the calling module. ๐ - Encryption time ๐
- a) If the
securityLevelspecifies that the message is to be protected from disclosure, then the octet sequence representing the serializedscopedPDUis encrypted according to the user's privacy protocol. To do that, a call is made to the privacy module that implements the user's privacy protocol, using this abstract primitive:
- a) If the
statusInformation = -- success or failure
encryptData(
IN encryptKey -- user's localized privKey
IN dataToEncrypt -- serialized scopedPDU
OUT encryptedData -- serialized encryptedPDU
OUT privParameters -- serialized privacy parameters
)
statusInformation tells you whether the encryption process was successful or not. The encryptKey is the user's localized private privKey, the secret key the encryption algorithm can use. The dataToEncrypt is the serialized scopedPDU, the data to be encrypted. The encryptedData is the encryptedPDU (the encrypted scopedPDU), encoded as an OCTET STRING. The privParameters are the privacy parameters, encoded as an OCTET STRING.
If the privacy module returns failure, then the message cannot be sent and an error indication (encryptionError) is returned to the calling module.
If the privacy module returns success, then the returned privParameters are put into the msgPrivacyParameters field of the securityParameters, and the encryptedPDU serves as the payload of the message being prepared.
Otherwise,
- b) If the
securityLevelspecifies that the message is not to be protected from disclosure, then a zero-length OCTET STRING is encoded into themsgPrivacyParametersfield of thesecurityParameters, and the plaintextscopedPDUserves as the payload of the message being prepared. ๐ธ
- The
securityEngineIDis encoded as an OCTET STRING into themsgAuthoritativeEngineIDfield of thesecurityParameters. Here's the fun bit: an empty (zero-length)securityEngineIDis OK for a Request message, because it makes the remote (authoritative) SNMP engine send back a Report PDU with the propersecurityEngineIDincluded in themsgAuthoritativeEngineIDin thesecurityParametersof that returned Report PDU. It's giving self-correcting. ๐ง - Timekeeping โฐ
- a) If the
securityLevelspecifies that the message is to be authenticated, then the current values ofsnmpEngineBootsandsnmpEngineTimecorresponding to thesecurityEngineIDfrom the LCD are used.
- a) If the
Otherwise,
- b) If this is a Response or Report message, then the current value of
snmpEngineBootsandsnmpEngineTimecorresponding to the localsnmpEngineIDfrom the LCD are used.
Otherwise,
- c) If this is a Request message, then a zero value is used for both
snmpEngineBootsandsnmpEngineTime. This zero value gets used ifsnmpEngineIDis empty.
The values are encoded as INTEGER, respectively, into the msgAuthoritativeEngineBoots and msgAuthoritativeEngineTime fields of the securityParameters.
- The
userNameis encoded as an OCTET STRING into themsgUserNamefield of thesecurityParameters. ๐ - Authentication time ๐
- a) If the
securityLevelspecifies that the message is to be authenticated, the message is authenticated according to the user's authentication protocol. To do that, a call is made to the authentication module that implements the user's authentication protocol, using this abstract service primitive:
- a) If the
statusInformation =
authenticateOutgoingMsg(
IN authKey -- the user's localized authKey
IN wholeMsg -- unauthenticated message
OUT authenticatedWholeMsg -- authenticated complete message
)
statusInformation indicates whether authentication was successful or not. The authKey is the user's localized private authKey, the secret key the authentication algorithm can use. The wholeMsg is the complete serialized message to be authenticated. The authenticatedWholeMsg is the same as the input given to the authenticateOutgoingMsg service, but with msgAuthenticationParameters properly filled in.
If the authentication module returns failure, then the message cannot be sent and an error indication (authenticationFailure) is returned to the calling module.
If the authentication module returns success, then the msgAuthenticationParameters field is put into the securityParameters, and the authenticatedWholeMsg represents the serialization of the authenticated message being prepared.
Otherwise,
- b) If the
securityLevelspecifies that the message is not to be authenticated, then a zero-length OCTET STRING is encoded into themsgAuthenticationParametersfield of thesecurityParameters. ThewholeMsgis now serialized, and then represents the unauthenticated message being prepared. ๐ซถ
- The completed message, with its length, is returned to the calling module with the
statusInformationset to success. ๐
3.2. Processing an Incoming SNMP Message ๐ฅ
This section describes the procedure an SNMP engine follows whenever it receives a message containing a management operation on behalf of a user, with a particular securityLevel. Let's get into it. ๐
To keep the elements of procedure simple, the release of state information is not always explicitly specified. As a general rule, if state information is available when a message gets discarded, the state information should also be released. Also, an error indication can return an OID and value for an incremented counter, and optionally a value for securityLevel, and values for contextEngineID or contextName for the counter. In addition, the securityStateReference data is returned if any such information is available at the point where the error is detected. ๐ง
- If the received
securityParametersis not the serialization (according to the conventions of [RFC3417]) of an OCTET STRING formatted according to theUsmSecurityParametersdefined in section 2.4, then thesnmpInASNParseErrscounter [RFC3418] is incremented, and an error indication (parseError) is returned to the calling module. Note that we return without the OID and value of the incremented counter, because in this case there is not enough information to generate a Report PDU. ๐ - The values of the security parameter fields are extracted from the
securityParameters. ThesecurityEngineIDto be returned to the caller is the value of themsgAuthoritativeEngineIDfield. ThecachedSecurityDatais prepared, and asecurityStateReferenceis prepared to reference this data. Values to be cached are:
msgUserName
- If the value of the
msgAuthoritativeEngineIDfield in thesecurityParametersis unknown, then:- a) a non-authoritative SNMP engine that performs discovery may optionally create a new entry in its Local Configuration Datastore (LCD) and continue processing;
or
- b) the
usmStatsUnknownEngineIDscounter is incremented, and an error indication (unknownEngineID), together with the OID and value of the incremented counter, is returned to the calling module.
Note: in the event that a zero-length, or other illegally sized, msgAuthoritativeEngineID is received, b) should be chosen to facilitate engineID discovery. Otherwise, the choice between a) and b) is an implementation issue. ๐
- Information about the value of the
msgUserNameandmsgAuthoritativeEngineIDfields is extracted from the Local Configuration Datastore (LCD,usmUserTable). If no information is available for the user, then theusmStatsUnknownUserNamescounter is incremented, and an error indication (unknownSecurityName), together with the OID and value of the incremented counter, is returned to the calling module. ๐ โโ๏ธ - If the information about the user indicates that it does not support the
securityLevelrequested by the caller, then theusmStatsUnsupportedSecLevelscounter is incremented, and an error indication (unsupportedSecurityLevel), together with the OID and value of the incremented counter, is returned to the calling module. ๐ซ - If the
securityLevelspecifies that the message is to be authenticated, then the message is authenticated according to the user's authentication protocol. To do that, a call is made to the authentication module that implements the user's authentication protocol, using this abstract service primitive:
statusInformation = -- success or failure
authenticateIncomingMsg(
IN authKey -- the user's localized authKey
IN authParameters -- as received on the wire
IN wholeMsg -- as received on the wire
OUT authenticatedWholeMsg -- checked for authentication
)
statusInformation indicates whether authentication was successful or not. The authKey is the user's localized private authKey, the secret key the authentication algorithm can use. The wholeMsg is the complete serialized message to be authenticated. The authenticatedWholeMsg is the same as the input given to the authenticateIncomingMsg service, but after authentication has been checked. โ
7. Discovery and the authentication failure path โจ
okay so if the authentication module comes back with a failure ๐, the message can't be trusted. That means the usmStatsWrongDigests counter gets incremented, and an error indication (authenticationFailure) goes back to the calling module along with the OID and value of that counter ๐
โโ๏ธ
if the authentication module says success โจ, then the message is authentic and can be trusted, so processing keeps going ๐ฆ
- bestie, this step is giving time travel โฐ if the securityLevel says the message is authenticated, we pull the local values of
snmpEngineBoots,snmpEngineTimeandlatestReceivedEngineTimethat match themsgAuthoritativeEngineIDfield out of the Local Configuration Datastore.
a) if the extracted value of msgAuthoritativeEngineID is the same as the value of snmpEngineID of the processing SNMP engine (meaning this is the authoritative SNMP engine ๐), then the message is considered to be outside of the Time Window if any of these are true:
- the local value of
snmpEngineBootsis2147483647; - the value of the
msgAuthoritativeEngineBootsfield differs from the local value ofsnmpEngineBoots; or, - the value of the
msgAuthoritativeEngineTimefield differs from the local notion ofsnmpEngineTimeby more than +/- 150 seconds.
if the message is outside the Time Window, then the usmStatsNotInTimeWindows counter gets incremented and an error indication (notInTimeWindow) goes back to the calling module. That indication comes with the OID, the value of the incremented counter, and a note that the error must be reported with a securityLevel of authNoPriv ๐ซถ
b) if the extracted value of msgAuthoritativeEngineID is not the same as the value of snmpEngineID of the processing SNMP engine (meaning this is not the authoritative SNMP engine ๐), then:
- if at least one of these is true:
- the extracted value of the
msgAuthoritativeEngineBootsfield is greater than the local notion of the value ofsnmpEngineBoots; or, - the extracted value of the
msgAuthoritativeEngineBootsfield is equal to the local notion of the value ofsnmpEngineBoots, and the extracted value of themsgAuthoritativeEngineTimefield is greater than the value oflatestReceivedEngineTime,
then the LCD entry for the extracted value of the msgAuthoritativeEngineID field gets updated by setting:
- the local notion of the value of
snmpEngineBootsto the value of themsgAuthoritativeEngineBootsfield, - the local notion of the value of
snmpEngineTimeto the value of themsgAuthoritativeEngineTimefield, and - the
latestReceivedEngineTimeto the value of themsgAuthoritativeEngineTimefield. ๐
- if any of these is true, then the message is considered to be outside of the Time Window:
- the local notion of the value of
snmpEngineBootsis2147483647; - the value of the
msgAuthoritativeEngineBootsfield is less than the local notion of the value ofsnmpEngineBoots; or, - the value of the
msgAuthoritativeEngineBootsfield is equal to the local notion of the value ofsnmpEngineBootsand the value of themsgAuthoritativeEngineTimefield is more than 150 seconds less than the local notion of the value ofsnmpEngineTime.
if the message is outside the Time Window, then an error indication (notInTimeWindow) goes back to the calling module.
Note that this means a too old (possibly replayed) message has been detected and is deemed unauthentic. ๐จ
Note that this procedure lets the value of msgAuthoritativeEngineBoots in the message be greater than the local notion of the value of snmpEngineBoots. That way, messages from an authoritative SNMP engine that has rebooted since the receiving SNMP engine last (re-)synchronized can still be accepted as authentic ๐ฅน
- a) if the securityLevel says the message was protected from disclosure, then the OCTET STRING representing the encryptedPDU is decrypted according to the user's privacy protocol, which gives us an unencrypted serialized scopedPDU value ๐ to do that, we call the privacy module that implements the user's privacy protocol with this abstract primitive:
statusInformation = -- success or failure
decryptData(
IN decryptKey -- the user's localized privKey
IN privParameters -- as received on the wire
IN encryptedData -- encryptedPDU as received
OUT decryptedData -- serialized decrypted scopedPDU
)
statusInformation tells us whether the decryption worked or not.
decryptKey is the user's localized private privKey. It's the secret key the decryption algorithm can use.
privParameters is the msgPrivacyParameters, encoded as an OCTET STRING.
encryptedData is the encryptedPDU, which represents the encrypted scopedPDU, encoded as an OCTET STRING.
decryptedData is the serialized scopedPDU if decryption is successful.
if the privacy module returns failure, then the message can't be processed. The usmStatsDecryptionErrors counter gets incremented and an error indication (decryptionError) goes back to the calling module, along with the OID and value of that counter ๐
if the privacy module returns success, then the decrypted scopedPDU is the message payload that goes back to the calling module โจ
Otherwise,
b) the scopedPDU component is assumed to be plain text, and it's the message payload that goes back to the calling module ๐
- now we calculate the maxSizeResponseScopedPDU. This is the maximum size allowed for a scopedPDU in a possible Response message. We make room for a message header that still allows the same securityLevel as the received Request ๐
- next, we retrieve the securityName for the user from the usmUserTable ๐ง
- we cache the security data as cachedSecurityData, so a possible response to this message can and will use the same authentication and privacy secrets ๐๏ธ the info we save is:
msgUserName,
usmUserAuthProtocol, usmUserAuthKey
usmUserPrivProtocol, usmUserPrivKey
- last step, the statusInformation is set to success, and we return to the calling module, passing back the OUT parameters as specified in the processIncomingMsg primitive ๐
4. Discovery ๐
bestie, the User-based Security Model needs a discovery process to get enough info about other SNMP engines so they can talk to each other ๐ฃ๏ธ a non-authoritative SNMP engine has to learn the authoritative SNMP engine's snmpEngineID value before any communication can happen. One way to do it is to send a Request message with a securityLevel of noAuthNoPriv, a zero-length msgUserName, a zero-length msgAuthoritativeEngineID value, and an empty varBindList. The response is a Report message that carries the snmpEngineID of the authoritative SNMP engine as the value of the msgAuthoritativeEngineID field inside the msgSecurityParameters field. It also has a Report PDU with the usmStatsUnknownEngineIDs counter in the varBindList ๐ง
if authenticated communication is required, then the discovery process should also set up time synchronization with the authoritative SNMP engine โฑ๏ธ to do that, send an authenticated Request message with the msgAuthoritativeEngineID set to the newly learned snmpEngineID, and with msgAuthoritativeEngineBoots and msgAuthoritativeEngineTime both set to zero. For an authenticated Request message, a valid userName must be used in the msgUserName field. The response is a Report message with the up-to-date values of the authoritative SNMP engine's snmpEngineBoots and snmpEngineTime, given as the values of the msgAuthoritativeEngineBoots and msgAuthoritativeEngineTime fields. It also has the usmStatsNotInTimeWindows counter in the varBindList of the Report PDU. After that, time synchronization happens automatically through the procedures in section 3.2 step 7b. See also section 2.3 ๐ฅฐ
5. Definitions ๐
SNMP-USER-BASED-SM-MIB DEFINITIONS ::= BEGIN
IMPORTS
MODULE-IDENTITY, OBJECT-TYPE,
OBJECT-IDENTITY,
snmpModules, Counter32 FROM SNMPv2-SMI
TEXTUAL-CONVENTION, TestAndIncr,
RowStatus, RowPointer,
StorageType, AutonomousType FROM SNMPv2-TC
MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF
SnmpAdminString, SnmpEngineID,
snmpAuthProtocols, snmpPrivProtocols FROM SNMP-FRAMEWORK-MIB;
snmpUsmMIB MODULE-IDENTITY
LAST-UPDATED "200210160000Z" -- 16 Oct 2002, midnight
ORGANIZATION "SNMPv3 Working Group"
CONTACT-INFO "WG-email: snmpv3@lists.tislabs.com
Subscribe: majordomo@lists.tislabs.com
In msg body: subscribe snmpv3
Chair: Russ Mundy
Network Associates Laboratories
postal: 15204 Omega Drive, Suite 300
Rockville, MD 20850-4601
USA
email: mundy@tislabs.com
phone: +1 301-947-7107
Co-Chair: David Harrington
Enterasys Networks
Postal: 35 Industrial Way
P. O. Box 5004
Rochester, New Hampshire 03866-5005
USA
EMail: dbh@enterasys.com
Phone: +1 603-337-2614
Co-editor Uri Blumenthal
Lucent Technologies
postal: 67 Whippany Rd.
Whippany, NJ 07981
USA
email: uri@lucent.com
phone: +1-973-386-2163
Co-editor: Bert Wijnen
Lucent Technologies
postal: Schagen 33
3461 GL Linschoten
Netherlands
email: bwijnen@lucent.com
phone: +31-348-480-685
"
DESCRIPTION "The management information definitions for the
SNMP User-based Security Model.
Copyright (C) The Internet Society (2002). This
version of this MIB module is part of RFC 3414;
see the RFC itself for full legal notices.
"
okay bestie, the revision history is giving full changelog energy ๐ Three revisions, each one a glow-up. The newest one is the 16 Oct 2002 revision, and it's the one that was published as RFC3414 โจ
-- Revision history
REVISION "200210160000Z" -- 16 Oct 2002, midnight
DESCRIPTION "Changes in this revision:
- Updated references and contact info.
- Clarification to usmUserCloneFrom DESCRIPTION
clause
- Fixed 'command responder' into 'command generator'
in last para of DESCRIPTION clause of
usmUserTable.
This revision published as RFC3414.
"
REVISION "199901200000Z" -- 20 Jan 1999, midnight
DESCRIPTION "Clarifications, published as RFC2574"
REVISION "199711200000Z" -- 20 Nov 1997, midnight
DESCRIPTION "Initial version, published as RFC2274"
::= { snmpModules 15 }
-- Administrative assignments ****************************************
usmMIBObjects OBJECT IDENTIFIER ::= { snmpUsmMIB 1 }
usmMIBConformance OBJECT IDENTIFIER ::= { snmpUsmMIB 2 }
-- Identification of Authentication and Privacy Protocols ************
usmNoAuthProtocol OBJECT-IDENTITY
STATUS current
DESCRIPTION "No Authentication Protocol."
::= { snmpAuthProtocols 1 }
usmHMACMD5AuthProtocol OBJECT-IDENTITY
STATUS current
DESCRIPTION "The HMAC-MD5-96 Digest Authentication Protocol."
REFERENCE "- H. Krawczyk, M. Bellare, R. Canetti HMAC:
Keyed-Hashing for Message Authentication,
RFC2104, Feb 1997.
- Rivest, R., Message Digest Algorithm MD5, RFC1321.
"
::= { snmpAuthProtocols 2 }
usmHMACSHAAuthProtocol OBJECT-IDENTITY
STATUS current
DESCRIPTION "The HMAC-SHA-96 Digest Authentication Protocol."
REFERENCE "- H. Krawczyk, M. Bellare, R. Canetti, HMAC:
Keyed-Hashing for Message Authentication,
RFC2104, Feb 1997.
- Secure Hash Algorithm. NIST FIPS 180-1.
"
::= { snmpAuthProtocols 3 }
usmNoPrivProtocol OBJECT-IDENTITY
STATUS current
DESCRIPTION "No Privacy Protocol."
::= { snmpPrivProtocols 1 }
usmDESPrivProtocol OBJECT-IDENTITY
STATUS current
DESCRIPTION "The CBC-DES Symmetric Encryption Protocol."
REFERENCE "- Data Encryption Standard, National Institute of
Standards and Technology. Federal Information
Processing Standard (FIPS) Publication 46-1.
Supersedes FIPS Publication 46,
(January, 1977; reaffirmed January, 1988).
- Data Encryption Algorithm, American National
Standards Institute. ANSI X3.92-1981,
(December, 1980).
- DES Modes of Operation, National Institute of
Standards and Technology. Federal Information
Processing Standard (FIPS) Publication 81,
(December, 1980).
- Data Encryption Algorithm - Modes of Operation,
American National Standards Institute.
ANSI X3.106-1983, (May 1983).
"
::= { snmpPrivProtocols 2 }
Next up is the textual conventions bit, and this is where it gets lowkey intense ๐ซถ The KeyChange convention is basically a whole mini algorithm for swapping keys around safely. Every single detail in here is load-bearing, so I've kept it exactly as written ๐ฅ
-- Textual Conventions ***********************************************
KeyChange ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
"Every definition of an object with this syntax must identify
a protocol P, a secret key K, and a hash algorithm H
that produces output of L octets.
The object's value is a manager-generated, partially-random
value which, when modified, causes the value of the secret
key K, to be modified via a one-way function.
The value of an instance of this object is the concatenation
of two components: first a 'random' component and then a
'delta' component.
The lengths of the random and delta components
are given by the corresponding value of the protocol P;
if P requires K to be a fixed length, the length of both the
random and delta components is that fixed length; if P
allows the length of K to be variable up to a particular
maximum length, the length of the random component is that
maximum length and the length of the delta component is any
length less than or equal to that maximum length.
For example, usmHMACMD5AuthProtocol requires K to be a fixed
length of 16 octets and L - of 16 octets.
usmHMACSHAAuthProtocol requires K to be a fixed length of
20 octets and L - of 20 octets. Other protocols may define
other sizes, as deemed appropriate.
When a requester wants to change the old key K to a new
key keyNew on a remote entity, the 'random' component is
obtained from either a true random generator, or from a
pseudorandom generator, and the 'delta' component is
computed as follows:
- a temporary variable is initialized to the existing value
of K;
- if the length of the keyNew is greater than L octets,
then:
- the random component is appended to the value of the
temporary variable, and the result is input to the
the hash algorithm H to produce a digest value, and
the temporary variable is set to this digest value;
- the value of the temporary variable is XOR-ed with
the first (next) L-octets (16 octets in case of MD5)
of the keyNew to produce the first (next) L-octets
(16 octets in case of MD5) of the 'delta' component.
- the above two steps are repeated until the unused
portion of the keyNew component is L octets or less,
- the random component is appended to the value of the
temporary variable, and the result is input to the
hash algorithm H to produce a digest value;
- this digest value, truncated if necessary to be the same
length as the unused portion of the keyNew, is XOR-ed
with the unused portion of the keyNew to produce the
(final portion of the) 'delta' component.
For example, using MD5 as the hash algorithm H:
iterations = (lenOfDelta - 1)/16; /* integer division */
temp = keyOld;
for (i = 0; i < iterations; i++) {
temp = MD5 (temp || random);
delta[i*16 .. (i*16)+15] =
temp XOR keyNew[i*16 .. (i*16)+15];
}
temp = MD5 (temp || random);
delta[i*16 .. lenOfDelta-1] =
temp XOR keyNew[i*16 .. lenOfDelta-1];
The 'random' and 'delta' components are then concatenated as
described above, and the resulting octet string is sent to
the recipient as the new value of an instance of this object.
At the receiver side, when an instance of this object is set
to a new value, then a new value of K is computed as follows:
- a temporary variable is initialized to the existing value
of K;
- if the length of the delta component is greater than L
octets, then:
- the random component is appended to the value of the
temporary variable, and the result is input to the
hash algorithm H to produce a digest value, and the
temporary variable is set to this digest value;
- the value of the temporary variable is XOR-ed with
the first (next) L-octets (16 octets in case of MD5)
of the delta component to produce the first (next)
L-octets (16 octets in case of MD5) of the new value
of K.
- the above two steps are repeated until the unused
portion of the delta component is L octets or less,
- the random component is appended to the value of the
temporary variable, and the result is input to the
hash algorithm H to produce a digest value;
- this digest value, truncated if necessary to be the same
length as the unused portion of the delta component, is
XOR-ed with the unused portion of the delta component to
produce the (final portion of the) new value of K.
For example, using MD5 as the hash algorithm H:
iterations = (lenOfDelta - 1)/16; /* integer division */
temp = keyOld;
for (i = 0; i < iterations; i++) {
temp = MD5 (temp || random);
keyNew[i*16 .. (i*16)+15] =
temp XOR delta[i*16 .. (i*16)+15];
}
temp = MD5 (temp || random);
keyNew[i*16 .. lenOfDelta-1] =
temp XOR delta[i*16 .. lenOfDelta-1];
The value of an object with this syntax, whenever it is
retrieved by the management protocol, is always the zero
length string.
Note that the keyOld and keyNew are the localized keys.
Note that it is probably wise that when an SNMP entity sends
a SetRequest to change a key, that it keeps a copy of the old
key until it has confirmed that the key change actually
succeeded.
"
SYNTAX OCTET STRING
โ ๏ธ bestie, the note at the very end is the important part: keep a copy of the old key until the key change is confirmed as successful. Don't skip it ๐
Now the statistics section ๐ฆ These are the counters that tell you why a packet got dropped. There are six of them, and each one has its own little reason for existing.
-- Statistics for the User-based Security Model **********************
usmStats OBJECT IDENTIFIER ::= { usmMIBObjects 1 }
usmStatsUnsupportedSecLevels 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 requested a
securityLevel that was unknown to the SNMP engine
or otherwise unavailable.
"
::= { usmStats 1 }
usmStatsNotInTimeWindows 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 appeared
outside of the authoritative SNMP engine's window.
"
::= { usmStats 2 }
usmStatsUnknownUserNames 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
user that was not known to the SNMP engine.
"
::= { usmStats 3 }
usmStatsUnknownEngineIDs 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 an
snmpEngineID that was not known to the SNMP engine.
"
::= { usmStats 4 }
usmStatsWrongDigests 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 didn't
contain the expected digest value.
"
::= { usmStats 5 }
usmStatsDecryptionErrors 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 could not be
decrypted.
"
::= { usmStats 6 }
Next up is the usmUser group, which is where the user stuff lives ๐ง
-- The usmUser Group ************************************************
usmUser OBJECT IDENTIFIER ::= { usmMIBObjects 2 }
usmUserSpinLock OBJECT-TYPE
SYNTAX TestAndIncr
MAX-ACCESS read-write
STATUS current
DESCRIPTION "An advisory lock used to allow several cooperating
Command Generator Applications to coordinate their
use of facilities to alter secrets in the
usmUserTable.
"
::= { usmUser 1 }
๐ The usmUserTable, aka the big list of users โจ
Okay so this part is where the usmUserTable lives, and it's basically the VIP list of every user the SNMP engine knows about for the User-based Security Model ๐ It's literally stored in the engine's Local Configuration Datastore (LCD), so this is the place where users live their whole digital life ๐ก
Here's the thing though: making a brand new user is NOT a one-click situation ๐ The spec gives you a whole choreographed dance with numbered steps, and you have to follow it in order or the vibe is ruined. The steps go roughly: grab the spin lock, clone from a template user that already has the right auth and privacy protocols, then do the keyChange stuff for privacy and/or authentication (depending on what your new user needs), and finally flip the row to active ๐ฆ Each keyChange step has its own little GET-then-check loop too, so you're basically double-checking your work like a responsible bestie ๐ซถ
-- Creating a new user (summary of the numbered steps in the spec)
-- 1) GET(usmUserSpinLock.0) -> sValue
-- 2) SET(usmUserSpinLock.0=sValue, usmUserCloneFrom=templateUser,
-- usmUserStatus=createAndWait)
-- 3) Generate pkcValue from the clone-from user's privKey and the new key
-- 4) GET(usmUserSpinLock.0) -> sValue
-- 5) SET(usmUserSpinLock.0=sValue, usmUserPrivKeyChange=pkcValue,
-- usmUserPublic=randomValue1)
-- 6) GET(usmUserPublic), check randomValue1; if not, repeat 4-6
-- 7) SET(usmUserPrivProtocol=usmNoPrivProtocol) (never privacy)
-- 8) Generate akcValue from the clone-from user's authKey and the new key
-- 9) GET(usmUserSpinLock.0) -> sValue
-- 10) SET(usmUserSpinLock.0=sValue, usmUserAuthKeyChange=akcValue,
-- usmUserPublic=randomValue2)
-- 11) GET(usmUserPublic), check randomValue2; if not, repeat 9-11
-- 12) SET(usmUserAuthProtocol=usmNoAuthProtocol) (never authentication)
-- 13) SET(usmUserStatus=active)
Wait, one super important catch ๐ Making the user exists is only half the story. Access to actual MIB data has to be set up separately through the SNMP-VIEW-BASED-ACM-MIB, so a new user with zero view permissions is basically a guest who can't get past the bouncer ๐
And the whole spin lock thing? That's just there so two command generator apps don't step on each other's toes while they're messing with the usmUserTable ๐ธ Cooperation is everything, bestie ๐ซถ
usmUserEntry OBJECT-TYPE
SYNTAX UsmUserEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "A user configured in the SNMP engine's Local
Configuration Datastore (LCD) for the User-based
Security Model.
"
INDEX { usmUserEngineID,
usmUserName
}
::= { usmUserTable 1 }
UsmUserEntry ::= SEQUENCE
{
usmUserEngineID SnmpEngineID,
usmUserName SnmpAdminString,
usmUserSecurityName SnmpAdminString,
usmUserCloneFrom RowPointer,
usmUserAuthProtocol AutonomousType,
usmUserAuthKeyChange KeyChange,
usmUserOwnAuthKeyChange KeyChange,
usmUserPrivProtocol AutonomousType,
usmUserPrivKeyChange KeyChange,
usmUserOwnPrivKeyChange KeyChange,
usmUserPublic OCTET STRING,
usmUserStorageType StorageType,
usmUserStatus RowStatus
}
usmUserEngineID OBJECT-TYPE
SYNTAX SnmpEngineID
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "An SNMP engine's administratively-unique identifier.
In a simple agent, this value is always that agent's
own snmpEngineID value.
The value can also take the value of the snmpEngineID
of a remote SNMP engine with which this user can
communicate.
"
::= { usmUserEntry 1 }
usmUserName OBJECT-TYPE
SYNTAX SnmpAdminString (SIZE(1..32))
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "A human readable string representing the name of
the user.
This is the (User-based Security) Model dependent
security ID.
"
::= { usmUserEntry 2 }
usmUserSecurityName OBJECT-TYPE
SYNTAX SnmpAdminString
MAX-ACCESS read-only
STATUS current
DESCRIPTION "A human readable string representing the user in
Security Model independent format.
The default transformation of the User-based Security
Model dependent security ID to the securityName and
vice versa is the identity function so that the
securityName is the same as the userName.
"
::= { usmUserEntry 3 }
usmUserCloneFrom OBJECT-TYPE
SYNTAX RowPointer
MAX-ACCESS read-create
STATUS current
DESCRIPTION "A pointer to another conceptual row in this
usmUserTable. The user in this other conceptual
row is called the clone-from user.
When a new user is created (i.e., a new conceptual
row is instantiated in this table), the privacy and
authentication parameters of the new user must be
cloned from its clone-from user. These parameters are:
- authentication protocol (usmUserAuthProtocol)
- privacy protocol (usmUserPrivProtocol)
They will be copied regardless of what the current
value is.
Cloning also causes the initial values of the secret
authentication key (authKey) and the secret encryption
key (privKey) of the new user to be set to the same
values as the corresponding secrets of the clone-from
user to allow the KeyChange process to occur as
required during user creation.
The first time an instance of this object is set by
a management operation (either at or after its
instantiation), the cloning process is invoked.
Subsequent writes are successful but invoke no
action to be taken by the receiver.
The cloning process fails with an 'inconsistentName'
error if the conceptual row representing the
clone-from user does not exist or is not in an active
state when the cloning process is invoked.
When this object is read, the ZeroDotZero OID
is returned.
"
::= { usmUserEntry 4 }
usmUserAuthProtocol OBJECT-TYPE
SYNTAX AutonomousType
MAX-ACCESS read-create
STATUS current
DESCRIPTION "An indication of whether messages sent on behalf of
this user to/from the SNMP engine identified by
usmUserEngineID, can be authenticated, and if so,
the type of authentication protocol which is used.
An instance of this object is created concurrently
with the creation of any other object instance for
the same user (i.e., as part of the processing of
the set operation which creates the first object
instance in the same conceptual row).
If an initial set operation (i.e. at row creation time)
tries to set a value for an unknown or unsupported
protocol, then a 'wrongValue' error MUST be returned.
The value will be overwritten/set when a set operation
is performed on the corresponding instance of
usmUserCloneFrom.
Once instantiated, the value of such an instance of
this object can only be changed via a set operation to
the value of the usmNoAuthProtocol.
If a set operation tries to change the value of an
existing instance of this object to any value other
than usmNoAuthProtocol, then an 'inconsistentValue'
error MUST be returned.
If a set operation tries to set the value to the
usmNoAuthProtocol while the usmUserPrivProtocol value
in the same row is not equal to usmNoPrivProtocol,
then an 'inconsistentValue' error MUST be returned.
That means that an SNMP command generator application
MUST first ensure that the usmUserPrivProtocol is set
to the usmNoPrivProtocol value before it can set
the usmUserAuthProtocol value to usmNoAuthProtocol.
"
DEFVAL { usmNoAuthProtocol }
::= { usmUserEntry 5 }
okay bestie, the key-change crew is up next ๐โจ these definitions are lowkey the most important part of the whole usmUser group, so the MIB stays exactly as written ๐
usmUserAuthKeyChange OBJECT-TYPE
SYNTAX KeyChange -- typically (SIZE (0 | 32)) for HMACMD5
-- typically (SIZE (0 | 40)) for HMACSHA
MAX-ACCESS read-create
STATUS current
DESCRIPTION "An object, which when modified, causes the secret
authentication key used for messages sent on behalf
of this user to/from the SNMP engine identified by
usmUserEngineID, to be modified via a one-way
function.
The associated protocol is the usmUserAuthProtocol.
The associated secret key is the user's secret
authentication key (authKey). The associated hash
algorithm is the algorithm used by the user's
usmUserAuthProtocol.
When creating a new user, it is an 'inconsistentName'
error for a set operation to refer to this object
unless it is previously or concurrently initialized
through a set operation on the corresponding instance
of usmUserCloneFrom.
When the value of the corresponding usmUserAuthProtocol
is usmNoAuthProtocol, then a set is successful, but
effectively is a no-op.
When this object is read, the zero-length (empty)
string is returned.
The recommended way to do a key change is as follows:
1) GET(usmUserSpinLock.0) and save in sValue.
2) generate the keyChange value based on the old
(existing) secret key and the new secret key,
let us call this kcValue.
If you do the key change on behalf of another user:
3) SET(usmUserSpinLock.0=sValue,
usmUserAuthKeyChange=kcValue
usmUserPublic=randomValue)
If you do the key change for yourself:
4) SET(usmUserSpinLock.0=sValue,
usmUserOwnAuthKeyChange=kcValue
usmUserPublic=randomValue)
If you get a response with error-status of noError,
then the SET succeeded and the new key is active.
If you do not get a response, then you can issue a
GET(usmUserPublic) and check if the value is equal
to the randomValue you did send in the SET. If so, then
the key change succeeded and the new key is active
(probably the response got lost). If not, then the SET
request probably never reached the target and so you
can start over with the procedure above.
"
DEFVAL { ''H } -- the empty string
::= { usmUserEntry 6 }
usmUserOwnAuthKeyChange OBJECT-TYPE
SYNTAX KeyChange -- typically (SIZE (0 | 32)) for HMACMD5
-- typically (SIZE (0 | 40)) for HMACSHA
MAX-ACCESS read-create
STATUS current
DESCRIPTION "Behaves exactly as usmUserAuthKeyChange, with one
notable difference: in order for the set operation
to succeed, the usmUserName of the operation
requester must match the usmUserName that
indexes the row which is targeted by this
operation.
In addition, the USM security model must be
used for this operation.
The idea here is that access to this column can be
public, since it will only allow a user to change
his own secret authentication key (authKey).
Note that this can only be done once the row is active.
When a set is received and the usmUserName of the
requester is not the same as the umsUserName that
indexes the row which is targeted by this operation,
then a 'noAccess' error must be returned.
When a set is received and the security model in use
is not USM, then a 'noAccess' error must be returned.
"
DEFVAL { ''H } -- the empty string
::= { usmUserEntry 7 }
usmUserPrivProtocol OBJECT-TYPE
SYNTAX AutonomousType
MAX-ACCESS read-create
STATUS current
DESCRIPTION "An indication of whether messages sent on behalf of
this user to/from the SNMP engine identified by
usmUserEngineID, can be protected from disclosure,
and if so, the type of privacy protocol which is used.
An instance of this object is created concurrently
with the creation of any other object instance for
the same user (i.e., as part of the processing of
the set operation which creates the first object
instance in the same conceptual row).
If an initial set operation (i.e. at row creation time)
tries to set a value for an unknown or unsupported
protocol, then a 'wrongValue' error must be returned.
The value will be overwritten/set when a set operation
is performed on the corresponding instance of
usmUserCloneFrom.
Once instantiated, the value of such an instance of
this object can only be changed via a set operation to
the value of the usmNoPrivProtocol.
If a set operation tries to change the value of an
existing instance of this object to any value other
than usmNoPrivProtocol, then an 'inconsistentValue'
error must be returned.
Note that if any privacy protocol is used, then you
must also use an authentication protocol. In other
words, if usmUserPrivProtocol is set to anything else
than usmNoPrivProtocol, then the corresponding instance
of usmUserAuthProtocol cannot have a value of
usmNoAuthProtocol. If it does, then an
'inconsistentValue' error must be returned.
"
DEFVAL { usmNoPrivProtocol }
::= { usmUserEntry 8 }
usmUserPrivKeyChange OBJECT-TYPE
SYNTAX KeyChange -- typically (SIZE (0 | 32)) for DES
MAX-ACCESS read-create
STATUS current
DESCRIPTION "An object, which when modified, causes the secret
encryption key used for messages sent on behalf
of this user to/from the SNMP engine identified by
usmUserEngineID, to be modified via a one-way
function.
The associated protocol is the usmUserPrivProtocol.
The associated secret key is the user's secret
privacy key (privKey). The associated hash
algorithm is the algorithm used by the user's
usmUserAuthProtocol.
When creating a new user, it is an 'inconsistentName'
error for a set operation to refer to this object
unless it is previously or concurrently initialized
through a set operation on the corresponding instance
of usmUserCloneFrom.
When the value of the corresponding usmUserPrivProtocol
is usmNoPrivProtocol, then a set is successful, but
effectively is a no-op.
When this object is read, the zero-length (empty)
string is returned.
See the description clause of usmUserAuthKeyChange for
a recommended procedure to do a key change.
"
DEFVAL { ''H } -- the empty string
::= { usmUserEntry 9 }
usmUserOwnPrivKeyChange OBJECT-TYPE
SYNTAX KeyChange -- typically (SIZE (0 | 32)) for DES
MAX-ACCESS read-create
STATUS current
DESCRIPTION "Behaves exactly as usmUserPrivKeyChange, with one
notable difference: in order for the Set operation
to succeed, the usmUserName of the operation
requester must match the usmUserName that indexes
the row which is targeted by this operation.
In addition, the USM security model must be
used for this operation.
The idea here is that access to this column can be
public, since it will only allow a user to change
his own secret privacy key (privKey).
Note that this can only be done once the row is active.
When a set is received and the usmUserName of the
requester is not the same as the umsUserName that
indexes the row which is targeted by this operation,
then a 'noAccess' error must be returned.
When a set is received and the security model in use
is not USM, then a 'noAccess' error must be returned.
"
DEFVAL { ''H } -- the empty string
::= { usmUserEntry 10 }
usmUserPublic OBJECT-TYPE
SYNTAX OCTET STRING (SIZE(0..32))
MAX-ACCESS read-create
STATUS current
DESCRIPTION "A publicly-readable value which can be written as part
of the procedure for changing a user's secret
authentication and/or privacy key, and later read to
determine whether the change of the secret was
effected.
"
DEFVAL { ''H } -- the empty string
::= { usmUserEntry 11 }
usmUserStorageType OBJECT-TYPE
SYNTAX StorageType
MAX-ACCESS read-create
STATUS current
DESCRIPTION "The storage type for this conceptual row.
Conceptual rows having the value 'permanent' must
allow write-access at a minimum to:
- usmUserAuthKeyChange, usmUserOwnAuthKeyChange
and usmUserPublic for a user who employs
authentication, and
- usmUserPrivKeyChange, usmUserOwnPrivKeyChange
and usmUserPublic for a user who employs
privacy.
Note that any user who employs authentication or
privacy must allow its secret(s) to be updated and
thus cannot be 'readOnly'.
If an initial set operation tries to set the value to
'readOnly' for a user who employs authentication or
privacy, then an 'inconsistentValue' error must be
returned. Note that if the value has been previously
set (implicit or explicit) to any value, then the rules
as defined in the StorageType Textual Convention apply.
It is an implementation issue to decide if a SET for
a readOnly or permanent row is accepted at all. In some
contexts this may make sense, in others it may not. If
a SET for a readOnly or permanent row is not accepted
at all, then a 'wrongValue' error must be returned.
"
DEFVAL { nonVolatile }
::= { usmUserEntry 12 }
usmUserStatus OBJECT-TYPE
SYNTAX RowStatus
MAX-ACCESS read-create
STATUS current
DESCRIPTION "The status of this conceptual row.
Until instances of all corresponding columns are
appropriately configured, the value of the
corresponding instance of the usmUserStatus column
is 'notReady'.
In particular, a newly created row for a user who
employs authentication, cannot be made active until the
corresponding usmUserCloneFrom and usmUserAuthKeyChange
have been set.
Further, a newly created row for a user who also
employs privacy, cannot be made active until the
usmUserPrivKeyChange has been set.
The RowStatus TC [RFC2579] requires that this
DESCRIPTION clause states under which circumstances
other objects in this row can be modified:
The value of this object has no effect on whether
other objects in this conceptual row can be modified,
except for usmUserOwnAuthKeyChange and
usmUserOwnPrivKeyChange. For these 2 objects, the
value of usmUserStatus MUST be active.
"
::= { usmUserEntry 13 }
-- Conformance Information *******************************************
usmMIBCompliances OBJECT IDENTIFIER ::= { usmMIBConformance 1 }
usmMIBGroups OBJECT IDENTIFIER ::= { usmMIBConformance 2 }
-- Compliance statements
usmMIBCompliance MODULE-COMPLIANCE
STATUS current
DESCRIPTION "The compliance statement for SNMP engines which
implement the SNMP-USER-BASED-SM-MIB.
"
MODULE -- this module
MANDATORY-GROUPS { usmMIBBasicGroup }
OBJECT usmUserAuthProtocol
MIN-ACCESS read-only
DESCRIPTION "Write access is not required."
OBJECT usmUserPrivProtocol
MIN-ACCESS read-only
DESCRIPTION "Write access is not required."
::= { usmMIBCompliances 1 }
-- Units of compliance
usmMIBBasicGroup OBJECT-GROUP
OBJECTS {
usmStatsUnsupportedSecLevels,
usmStatsNotInTimeWindows,
usmStatsUnknownUserNames,
usmStatsUnknownEngineIDs,
usmStatsWrongDigests,
usmStatsDecryptionErrors,
usmUserSpinLock,
usmUserSecurityName,
usmUserCloneFrom,
usmUserAuthProtocol,
usmUserAuthKeyChange,
usmUserOwnAuthKeyChange,
usmUserPrivProtocol,
usmUserPrivKeyChange,
usmUserOwnPrivKeyChange,
usmUserPublic,
usmUserStorageType,
usmUserStatus
}
STATUS current
DESCRIPTION "A collection of objects providing for configuration
of an SNMP engine which implements the SNMP
User-based Security Model.
"
::= { usmMIBGroups 1 }
END
6. HMAC-MD5-96 Authentication Protocol โจ
okay so this is the HMAC-MD5-96 authentication protocol, and it's literally the first one ever defined for the User-based Security Model ๐ It uses the MD5 hash function (described in [RFC1321]) in HMAC mode (described in [RFC2104]), and then the output gets truncated down to 96 bits. Iconic, right? ๐
This protocol is identified by usmHMACMD5AuthProtocol. ๐ฆ
Over time, other authentication protocols may be defined, either as a replacement for this one or alongside it. The future is giving multiverse ๐
6.1. Mechanisms
- In support of data integrity, a message digest algorithm is required. A digest is calculated over an appropriate portion of an SNMP message and included as part of the message sent to the recipient. ๐ง
- In support of data origin authentication and data integrity, a secret value is prepended to SNMP message prior to computing the digest; the calculated digest is partially inserted into the SNMP message prior to transmission, and the prepended value is not transmitted. The secret value is shared by all SNMP engines authorized to originate messages on behalf of the appropriate user. It's giving secret handshake ๐คซ
6.1.1. Digest Authentication Mechanism
The Digest Authentication Mechanism defined in this memo provides for:
- verification of the integrity of a received message, i.e., the message received is the message sent. ๐
The integrity of the message is protected by computing a digest over an appropriate portion of the message. The digest is computed by the originator of the message, transmitted with the message, and verified by the recipient of the message. So the sender makes it, the receiver checks it, no cap ๐ซถ
- verification of the user on whose behalf the message was generated.
A secret value known only to SNMP engines authorized to generate messages on behalf of a user is used in HMAC mode (see [RFC2104]). It also recommends the hash-function output used as Message Authentication Code, to be truncated. Main character energy, the secret stays secret ๐ฅ
This protocol uses the MD5 [RFC1321] message digest algorithm. A 128-bit MD5 digest is calculated in a special (HMAC) way over the designated portion of an SNMP message, and the first 96 bits of this digest are included as part of the message sent to the recipient. The size of the digest carried in a message is 12 octets. The size of the private authentication key (the secret) is 16 octets. For the details see section 6.3. ๐ธ
6.2. Elements of the Digest Authentication Protocol
This section contains definitions required to realize the authentication module defined in this section of this memo. โจ
6.2.1. Users
Authentication using this authentication protocol makes use of a defined set of userNames. For any user on whose behalf a message must be authenticated at a particular SNMP engine, that SNMP engine must have knowledge of that user. An SNMP engine that wishes to communicate with another SNMP engine must also have knowledge of a user known to that engine, including knowledge of the applicable attributes of that user. Bestie, you need to know your people ๐
A user and its attributes are defined as follows:
<userName>: A string representing the name of the user.<authKey>: A user's secret key to be used when calculating a digest. It MUST be 16 octets long for MD5. ๐
6.2.2. msgAuthoritativeEngineID
The msgAuthoritativeEngineID value contained in an authenticated message specifies the authoritative SNMP engine for that particular message (see the definition of SnmpEngineID in the SNMP Architecture document [RFC3411]). ๐ง
The user's (private) authentication key is normally different at each authoritative SNMP engine, and so the snmpEngineID is used to select the proper key for the authentication process. So the engine ID is basically the key's address book ๐๐
6.2.3. SNMP Messages Using this Authentication Protocol
Messages using this authentication protocol carry a msgAuthenticationParameters field as part of the msgSecurityParameters. For this protocol, the msgAuthenticationParameters field is the serialized OCTET STRING representing the first 12 octets of the HMAC-MD5-96 output done over the wholeMsg. ๐
The digest is calculated over the wholeMsg, so if a message is authenticated, that also means that all the fields in the message are intact and have not been tampered with. Zero tampering, full slay ๐
โจ
6.2.4. Services provided by the HMAC-MD5-96 Authentication Module
This section describes the inputs and outputs that the HMAC-MD5-96 Authentication module expects and produces when the User-based Security module calls the HMAC-MD5-96 Authentication module for services. ๐ฆ
6.2.4.1. Services for Generating an Outgoing SNMP Message
The HMAC-MD5-96 authentication protocol assumes that the selection of the authKey is done by the caller, and that the caller passes the secret key to be used. ๐
Upon completion, the authentication module returns statusInformation and, if the message digest was correctly calculated, the wholeMsg with the digest inserted at the proper place. The abstract service primitive is:
statusInformation = -- success or failure
authenticateOutgoingMsg(
IN authKey -- secret key for authentication
IN wholeMsg -- unauthenticated complete message
OUT authenticatedWholeMsg -- complete authenticated message
)
The abstract data elements are:
statusInformation: An indication of whether the authentication process was successful. If not, it is an indication of the problem.authKey: The secret key to be used by the authentication algorithm. The length of this key MUST be 16 octets. ๐จwholeMsg: The message to be authenticated.authenticatedWholeMsg: The authenticated message (including inserted digest) on output.
Note, that authParameters field is filled by the authentication module and this module and this field should be already present in the wholeMsg before the Message Authentication Code (MAC) is generated. ๐
6.2.4.2. Services for Processing an Incoming SNMP Message
Okay bestie, this is the incoming side of the HMAC-MD5-96 module ๐ฅโจ The caller is the one picking the authKey ๐, and it has to pass in the secret key itself. When the module is done, it hands back a statusInformation ๐ and, as long as the digest was calculated correctly, the wholeMsg as it was processed ๐ฆ
Here's the abstract service primitive:
statusInformation = -- success or failure
authenticateIncomingMsg(
IN authKey -- secret key for authentication
IN authParameters -- as received on the wire
IN wholeMsg -- as received on the wire
OUT authenticatedWholeMsg -- complete authenticated message
)
Quick rundown of the abstract data elements ๐
statusInformationtells you whether the authentication process worked. If it didn't, it tells you what went wrong ๐authKeyis the secret key the authentication algorithm uses. It MUST be 16 octets long ๐authParametersis just theauthParametersfrom the incoming message ๐จwholeMsgis the message going in to be authenticated, and the authenticated message coming back out ๐authenticatedWholeMsgis the whole message once the authentication check is finished ๐ธ
6.3. Elements of Procedure
This section lays out the step-by-step procedures for the HMAC-MD5-96 authentication protocol ๐๐ง
6.3.1. Processing an Outgoing Message
This is what an SNMP engine does whenever it needs to authenticate an outgoing message with usmHMACMD5AuthProtocol ๐ค๐
- The
msgAuthenticationParametersfield gets set to the serialization (following the rules in [RFC3417]) of an OCTET STRING holding 12 zero octets ๐งธ - Next up, two keys, K1 and K2, get derived from the secret
authKey๐๏ธ- a) Extend the
authKeyto 64 octets by appending 48 zero octets, and save the result asextendedAuthKeyโจ - b) Get IPAD by replicating the octet
0x3664 times ๐ - c) Get K1 by XORing
extendedAuthKeywith IPAD ๐ซ - d) Get OPAD by replicating the octet
0x5C64 times ๐ - e) Get K2 by XORing
extendedAuthKeywith OPAD ๐ซ
- a) Extend the
- Prepend K1 to the
wholeMsg, then calculate an MD5 digest over it according to [RFC1321] ๐ - Prepend K2 to the result of step 4, then calculate an MD5 digest over that according to [RFC1321]. Take the first 12 octets of the final digest, and that's your Message Authentication Code (MAC) ๐ซถ
- Replace the
msgAuthenticationParametersfield with the MAC you got in step 4 ๐ - Return the
authenticatedWholeMsgto the caller, along with astatusInformationthat says success ๐๐
6.3.2. Processing an Incoming Message
This is the procedure an SNMP engine follows whenever it has to authenticate an incoming message with usmHMACMD5AuthProtocol ๐ฅ๐ฆ
- First check: if the digest in the
msgAuthenticationParametersfield isn't 12 octets long, it's a failure. Return an errorIndication (authenticationError) to the calling module ๐ - Save the MAC that's sitting in the
msgAuthenticationParametersfield ๐พ - Swap the digest in the
msgAuthenticationParametersfield out for 12 zero octets ๐งธ - Next, derive K1 and K2 from the secret
authKey, same as before ๐๏ธ- a) Extend the
authKeyto 64 octets by appending 48 zero octets, and save it asextendedAuthKeyโจ - b) Get IPAD by replicating the octet
0x3664 times ๐ - c) Get K1 by XORing
extendedAuthKeywith IPAD ๐ซ - d) Get OPAD by replicating the octet
0x5C64 times ๐ - e) Get K2 by XORing
extendedAuthKeywith OPAD ๐ซ
- a) Extend the
- Now calculate the MAC over the
wholeMsg๐งฎ- a) Prepend K1 to the
wholeMsgand calculate the MD5 digest over it ๐ - b) Prepend K2 to the result of step 5.a, then calculate the MD5 digest over it ๐
- c) The first 12 octets of the result of step 5.b is the MAC ๐ซถ
- a) Prepend K1 to the
After that, the msgAuthenticationParameters field gets replaced with the MAC value you saved back in step 2 ๐
- Compare the MAC you just calculated with the one you saved in step 2. If they don't match, that's a failure, so return an errorIndication (
authenticationFailure) to the calling module ๐ญ - Last step: return the
authenticatedWholeMsgand astatusInformationsaying success to the caller ๐๐
7. HMAC-SHA-96 Authentication Protocol
Now we're on to the second protocol, HMAC-SHA-96 ๐ฆ๐ธ It uses the SHA hash function described in [SHA-NIST], in the HMAC mode from [RFC2104], and the output gets truncated to 96 bits โ๏ธโจ
This protocol is identified by usmHMACSHAAuthProtocol ๐ท๏ธ
Over time, other authentication protocols may be defined, either to replace this one or to sit alongside it ๐ We'll see what the future brings!
7.1. Mechanisms
Okay, here's how the mechanisms work ๐ง ๐
- For data integrity, a message digest algorithm is required. A digest gets calculated over an appropriate portion of an SNMP message, and it gets included in the message that's sent to the recipient ๐ซถ
- For data origin authentication and data integrity, a secret value gets prepended to the SNMP message before the digest is computed. Then the calculated digest is partially inserted into the message before it's sent ๐ The prepended secret never gets transmitted, which is very much the point ๐ That secret value is shared by all the SNMP engines that are allowed to send messages on behalf of the right user ๐
7.1.1. Digest Authentication Mechanism
The Digest Authentication Mechanism in this memo gives you two things โจ
- Verification of the integrity of a received message, meaning the message you received is the message that was sent ๐ The integrity is protected by computing a digest over an appropriate portion of the message. The originator computes the digest and sends it along with the message, and the recipient verifies it ๐
- Verification of the user on whose behalf the message was generated ๐ง A secret value that only SNMP engines allowed to generate messages for a user know gets used in HMAC mode (see [RFC2104]). It also recommends that the hash-function output used as the Message Authentication Code be truncated ๐
This mechanism uses the SHA [SHA-NIST] message digest algorithm. A 160-bit SHA digest gets calculated in a special (HMAC) way over the designated portion of an SNMP message, and the first 96 bits of that digest are included as part of the message sent to the recipient ๐ธ The digest carried in a message is 12 octets long, and the private authentication key (the secret) is 20 octets long ๐ For the details, see section 7.3 ๐ซถ
7.2. Elements of the HMAC-SHA-96 Authentication Protocol
This section has the definitions you need to make the authentication module in this section of the memo work ๐งฉ๐
7.2.1. Users
Authentication with this protocol uses a defined set of userNames ๐งโ๐ป Any user on whose behalf a message needs to be authenticated at a given SNMP engine has to be known to that engine. And an SNMP engine that wants to talk to another SNMP engine must also know about a user that the other engine knows, including that user's applicable attributes ๐ฆ
Here's how a user and its attributes are defined:
<userName>: a string representing the name of the user ๐<authKey>: a user's secret key, used when calculating a digest. It MUST be 20 octets long for SHA ๐
7.2.2. msgAuthoritativeEngineID
The msgAuthoritativeEngineID value in an authenticated message tells you which authoritative SNMP engine is responsible for that message. (For the definition of SnmpEngineID, check the SNMP Architecture document [RFC3411] ๐)
A user's (private) authentication key is usually different at each authoritative SNMP engine, so the snmpEngineID is what selects the right key for the authentication process ๐๏ธโจ
7.2.3. SNMP Messages Using this Authentication Protocol
Messages using this protocol carry a msgAuthenticationParameters field as part of the msgSecurityParameters ๐ฆ For this protocol, the msgAuthenticationParameters field is the serialized OCTET STRING holding the first 12 octets of the HMAC-SHA-96 output calculated over the wholeMsg ๐ซ
The digest is calculated over the wholeMsg, so if a message is authenticated, that also means every field in it is intact and hasn't been tampered with ๐ก๏ธ๐ซถ
7.2.4. Services Provided by the HMAC-SHA-96 Authentication Module
This section covers the inputs and outputs that the HMAC-SHA-96 Authentication module expects and produces when the User-based Security module calls it for services ๐ง
7.2.4.1. Services for Generating an Outgoing SNMP Message
The HMAC-SHA-96 authentication protocol assumes that the caller picks the authKey and passes in the secret key to use ๐
When it's done, the authentication module returns a statusInformation, and if the message digest was calculated correctly, it returns the wholeMsg with the digest inserted in the right spot ๐ The abstract service primitive looks like this:
statusInformation = -- success or failure
authenticateOutgoingMsg(
IN authKey -- secret key for authentication
IN wholeMsg -- unauthenticated complete message
OUT authenticatedWholeMsg -- complete authenticated message
)
The abstract data elements, quick version ๐
statusInformation: whether the authentication process worked, and if not, what the problem was ๐authKey: the secret key the authentication algorithm uses. It MUST be 20 octets long ๐wholeMsg: the message to be authenticated ๐authenticatedWholeMsg: the authenticated message on output, including the inserted digest ๐ธ
Note that the authParameters field is filled in by the authentication module. This field should already be present in the wholeMsg before the Message Authentication Code (MAC) gets generated ๐ซถ
7.2.4.2. Services for Processing an Incoming SNMP Message
The HMAC-SHA-96 authentication protocol again assumes the caller picks the authKey and passes in the secret key to use ๐
When the module finishes, it returns a statusInformation, and if the message digest was calculated correctly, it returns the wholeMsg as it was processed ๐ฅ The abstract service primitive:
statusInformation = -- success or failure
authenticateIncomingMsg(
IN authKey -- secret key for authentication
IN authParameters -- as received on the wire
IN wholeMsg -- as received on the wire
OUT authenticatedWholeMsg -- complete authenticated message
)
The abstract data elements:
statusInformation: whether the authentication process worked, and if not, what the problem was ๐authKey: the secret key the authentication algorithm uses. It MUST be 20 octets long ๐authParameters: theauthParametersfrom the incoming message ๐จwholeMsg: the message to be authenticated on input, and the authenticated message on output ๐authenticatedWholeMsg: the whole message once the authentication check is complete ๐
7.3. Elements of Procedure
This section describes the procedures for the HMAC-SHA-96 authentication protocol ๐๐ง
7.3.1. Processing an Outgoing Message ๐
okay so this part walks through what an SNMP engine does whenever it has to authenticate an outgoing message with usmHMACSHAAuthProtocol ๐ซถ
- The
msgAuthenticationParametersfield gets set to the serialization (following the rules in [RFC3417]) of an OCTET STRING containing 12 zero octets. - From the secret
authKey, two keys,K1andK2, get derived:- a) extend the
authKeyto 64 octets by tacking on 44 zero octets, and save it asextendedAuthKey; - b) build
IPADby repeating the octet0x3664 times; - c) get
K1by XORingextendedAuthKeywithIPAD; - d) build
OPADby repeating the octet0x5C64 times; - e) get
K2by XORingextendedAuthKeywithOPAD.
- a) extend the
- Prepend
K1to thewholeMsg, then calculate the SHA digest over it according to [SHA-NIST] โจ - Prepend
K2to the result of the step 4, then calculate the SHA digest over it according to [SHA-NIST]. Take the first 12 octets of the final digest. This is the Message Authentication Code (MAC) ๐ - Replace the
msgAuthenticationParametersfield with the MAC obtained in the step 5 ๐ - The
authenticatedWholeMsggets returned to the caller together withstatusInformationindicating success ๐ธ
7.3.2. Processing an Incoming Message ๐ฆ
this section is the incoming side, so it's the same MAC math but in reverse, and it's where the checks happen ๐ this is what an SNMP engine does whenever it has to authenticate an incoming message with usmHMACSHAAuthProtocol
- If the digest received in the
msgAuthenticationParametersfield is not 12 octets long, a failure gets flagged and anerrorIndication(authenticationError) goes back to the calling module ๐ โโ๏ธ - The MAC received in the
msgAuthenticationParametersfield gets saved ๐พ - The digest in the
msgAuthenticationParametersfield gets replaced by 12 zero octets ๐ซง - From the secret
authKey, two keys,K1andK2, get derived:- a) extend the
authKeyto 64 octets by appending 44 zero octets, and save it asextendedAuthKey; - b) build
IPADby repeating the octet0x3664 times; - c) get
K1by XORingextendedAuthKeywithIPAD; - d) build
OPADby repeating the octet0x5C64 times; - e) get
K2by XORingextendedAuthKeywithOPAD.
- a) extend the
- The MAC gets calculated over the
wholeMsg๐งฎ- a) prepend
K1to thewholeMsgand calculate the SHA digest over it; - b) prepend
K2to the result of step 5.a and calculate the SHA digest over it; - c) the first 12 octets of the result of step 5.b is the MAC.
- a) prepend
Then the msgAuthenticationParameters field gets replaced with the MAC value that was saved in step 2.
- The newly calculated MAC gets compared with the MAC saved in step 2. If they don't match, a failure and an
errorIndication(authenticationFailure) get returned to the calling module ๐จ - The
authenticatedWholeMsgandstatusInformationindicating success are then returned to the caller ๐ฅณ
8. CBC-DES Symmetric Encryption Protocol โจ
okay this is the encryption side ๐ this section describes the CBC-DES Symmetric Encryption Protocol, and it's the first privacy protocol ever defined for the User-based Security Model. literally the OG ๐
This protocol is identified by usmDESPrivProtocol.
Over time, other privacy protocols may show up, either replacing this one or sitting alongside it ๐
8.1. Mechanisms
- For data confidentiality, you need an encryption algorithm ๐คซ an appropriate portion of the message gets encrypted before it's sent. The User-based Security Model says the scopedPDU is the part that gets encrypted.
- A secret value combined with a timeliness value is used to create the en/decryption key and the initialization vector. The secret value is shared by all SNMP engines that are authorized to originate messages on behalf of the appropriate user ๐๏ธ
8.1.1. Symmetric Encryption Protocol ๐
The Symmetric Encryption Protocol defined in this memo gives you data confidentiality. The designated portion of an SNMP message gets encrypted and included as part of the message that's sent to the recipient.
Two organizations have published specs defining DES: the National Institute of Standards and Technology (NIST) [DES-NIST] and the American National Standards Institute [DES-ANSI]. Each one has a companion Modes of Operation spec ([DESO-NIST] and [DESO-ANSI], respectively).
NIST has also published three extra docs that implementers might find useful ๐
- There's a guidelines doc for implementing and using DES, with functional specs for DES and its modes of operation [DESG-NIST].
- There's a validation test suite for DES [DEST-NIST]. It's built to test every aspect of DES and is super useful for pinpointing specific problems ๐
- There's a maintenance test for DES [DESM-NIST]. It uses a minimal amount of data and processing to test all the components of DES. It gives a simple yes-or-no answer on whether things are working, and it's handy to run as part of an initialization step, like when a computer reboots ๐
8.1.1.1. DES key and Initialization Vector ๐๏ธ
The first 8 octets of the 16-octet secret (the private privacy key) are used as the DES key. DES only uses 56 bits, so the Least Significant Bit in each octet gets disregarded ๐ซถ
The Initialization Vector (IV) for encryption is obtained with the following procedure ๐ง
The last 8 octets of the 16-octet secret (the private privacy key) are used as the pre-IV.
okay so the IV for two different packets encrypted by the same key can't be the same (the IV can't repeat), so we need to "salt" the pre-IV with something unique for each packet ๐ง An 8-octet string is used as the "salt". The "salt" input is the concatenation of the generating SNMP engine's 32-bit snmpEngineBoots and a local 32-bit integer that the encryption engine maintains. That 32-bit integer gets initialized to an arbitrary value at boot time ๐ฅน
The 32-bit snmpEngineBoots is converted to the first 4 octets of the "salt" (Most Significant Byte first). The 32-bit integer is then converted to the last 4 octets (Most Significant Byte first). The resulting "salt" is XOR-ed with the pre-IV to get the IV. The 8-octet "salt" is then put into the privParameters field, encoded as an OCTET STRING. The "salt" integer is then modified. We recommend incrementing it by one, and wrapping when it reaches the maximum value ๐
How exactly the value of the "salt" (and therefore the IV) varies is an implementation issue, as long as the measures are taken to avoid producing a duplicate IV โจ
The "salt" has to be placed in the privParameters field so the receiving entity can compute the correct IV and decrypt the message ๐
8.1.1.2. Data Encryption ๐ธ
The data to be encrypted is treated as a sequence of octets. Its length should be an integral multiple of 8, and if it isn't, the data gets padded at the end as needed. The actual pad value is irrelevant ๐
The data is encrypted in Cipher Block Chaining mode ๐
The plaintext is divided into 64-bit blocks.
For each block, the plaintext is XOR-ed with the ciphertext of the previous block, the result is encrypted, and the output of the encryption is the ciphertext for that block. This keeps going until there are no more plaintext blocks ๐
For the very first block, the Initialization Vector gets used instead of the ciphertext of the previous block ๐
8.1.1.3. Data Decryption ๐งฉ
Before decryption, the encrypted data length gets verified. If the length of the OCTET STRING to be decrypted is not an integral multiple of 8 octets, the decryption process halts and an appropriate exception gets noted. When decrypting, the padding gets ignored โ
The first ciphertext block is decrypted, the decryption output is XOR-ed with the Initialization Vector, and the result is the first plaintext block ๐ง
For each block after that, the ciphertext block is decrypted, the decryption output is XOR-ed with the previous ciphertext block, and the result is the plaintext block ๐
8.2. Elements of the DES Privacy Protocol ๐ง
This section has the definitions needed to realize the privacy module defined by this memo.
8.2.1. Users ๐ค
Data en/decryption using this Symmetric Encryption Protocol uses a defined set of userNames. For any user on whose behalf a message has to be en/decrypted at a particular SNMP engine, that engine has to know about that user. An SNMP engine that wants to talk to another SNMP engine also has to know a user known to that engine, including the applicable attributes of that user ๐ซ
A user and its attributes are defined as follows:
<userName>
An octet string representing the name of the user.
<privKey>
A user's secret key to be used as input for the DES key and IV.
The length of this key MUST be 16 octets.
8.2.2. msgAuthoritativeEngineID ๐
The msgAuthoritativeEngineID value in an authenticated message specifies the authoritative SNMP engine for that particular message (see the definition of SnmpEngineID in the SNMP Architecture document [RFC3411]) ๐๏ธ
The user's (private) privacy key is normally different at each authoritative SNMP engine, so the snmpEngineID is used to select the proper key for the en/decryption process ๐
8.2.3. SNMP Messages Using this Privacy Protocol ๐จ
Messages using this privacy protocol carry a msgPrivacyParameters field as part of the msgSecurityParameters. For this protocol, the msgPrivacyParameters field is the serialized OCTET STRING representing the "salt" that was used to create the IV ๐
8.2.4. Services Provided by the DES Privacy Module ๐งฐ
This section describes the inputs and outputs that the DES Privacy module expects and produces when the User-based Security module invokes it for services ๐
8.2.4.1. Services for Encrypting Outgoing Data ๐
This DES privacy protocol assumes the caller does the selection of the privKey, and the caller passes in the secret key to be used ๐
When it's finished, the privacy module returns statusInformation and, if the encryption worked, the encryptedPDU and the msgPrivacyParameters encoded as an OCTET STRING. The abstract service primitive looks like this:
statusInformation = -- success of failure
encryptData(
IN encryptKey -- secret key for encryption
IN dataToEncrypt -- data to encrypt (scopedPDU)
OUT encryptedData -- encrypted data (encryptedPDU)
OUT privParameters -- filled in by service provider
)
The abstract data elements are:
statusInformation: an indication of whether the encryption process succeeded or failed. If it failed, it tells you the error ๐ โโ๏ธencryptKey: the secret key to be used by the encryption algorithm. The length of this key MUST be 16 octets ๐๏ธdataToEncrypt: the data that needs encrypting ๐ซงencryptedData: the encrypted data once it's completed successfully ๐ฆprivParameters: the privParameters, encoded as an OCTET STRING ๐
8.2.4.2. Services for Decrypting Incoming Data โจ
okay so this is the decrypt side, bestie ๐ the caller picks the privKey and hands over the secret key itself ๐ this DES privacy protocol assumes that the selection of the privKey is done by the caller and that the caller passes the secret key to be used.
when the privacy module finishes, it returns statusInformation and, if decryption worked, the scopedPDU in plain text ๐ the abstract service primitive looks like this:
statusInformation =
decryptData(
IN decryptKey -- secret key for decryption
IN privParameters -- as received on the wire
IN encryptedData -- encrypted data (encryptedPDU)
OUT decryptedData -- decrypted data (scopedPDU)
)
the abstract data elements are:
statusInformation: whether the data got decrypted successfully, and if not, what went wrong ๐ญdecryptKey: the secret key the decryption algorithm uses. the length of this key MUST be 16 octets ๐privParameters: the "salt" used to calculate the IV ๐งencryptedData: the data to be decrypted ๐decryptedData: the decrypted data ๐ฆ
8.3. Elements of Procedure.
this section is the step-by-step for the DES privacy protocol, so it's giving recipe energy ๐
8.3.1. Processing an Outgoing Message
this part covers what an SNMP engine does whenever it has to encrypt part of an outgoing message using the usmDESPrivProtocol ๐
- the secret cryptKey is used to build the DES encryption key, the "salt", and the DES pre-IV. the IV gets computed from the pre-IV as described in section 8.1.1.1 โจ
- the privParameters field is set to the serialization, following the rules in [RFC3417], of an OCTET STRING holding the "salt" string ๐ง
- the scopedPDU gets encrypted (as described in section 8.1.1.2), and the encrypted data is serialized as an OCTET STRING, again following the rules in [RFC3417] ๐
- the serialized OCTET STRING with the encrypted scopedPDU, plus the privParameters, plus a statusInformation saying success, gets handed back to the calling module ๐ซถ
8.3.2. Processing an Incoming Message
this part covers what an SNMP engine does whenever it has to decrypt part of an incoming message using the usmDESPrivProtocol ๐ต๏ธโโ๏ธ
- if the privParameters field is not an 8-octet OCTET STRING, an error indication (decryptionError) gets returned to the calling module ๐
- the "salt" is pulled out of the privParameters field ๐ง
- the secret cryptKey and the "salt" then get used to build the DES decryption key and pre-IV. the IV gets computed from the pre-IV as described in section 8.1.1.1 โจ
- the encryptedPDU is decrypted (as described in section 8.1.1.3) ๐
- if the encryptedPDU can't be decrypted, an error indication (decryptionError) gets returned to the calling module ๐
- the decrypted scopedPDU and a statusInformation saying success get returned to the calling module ๐
9. Intellectual Property ๐ง
okay, real talk for a sec: the IETF takes no position on whether any intellectual property or other rights that someone might claim over the tech in this document are valid or in scope, or whether any license under those rights might or might not be available. it also doesn't claim it has tried to identify any such rights. info on the IETF's procedures for rights in standards-track and standards-related documents is in BCP-11. copies of claimed rights made available for publication, any assurances of licenses that will be made available, or the result of an attempt to get a general license or permission for implementors or users of this specification to use those proprietary rights, can all be obtained from the IETF Secretariat ๐
the IETF also invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights which may cover technology that may be required to practice this standard. please send that info to the IETF Executive Director ๐
10. Acknowledgements ๐ธ
this document is the result of the efforts of the SNMPv3 Working Group, and there are some special thank-yous owed to these SNMPv3 WG members ๐ซถ
Harald Tveit Alvestrand (Maxware)
Dave Battle (SNMP Research, Inc.)
Alan Beard (Disney Worldwide Services)
Paul Berrevoets (SWI Systemware/Halcyon Inc.)
Martin Bjorklund (Ericsson)
Uri Blumenthal (IBM T.J. Watson Research Center)
Jeff Case (SNMP Research, Inc.)
John Curran (BBN)
Mike Daniele (Compaq Computer Corporation))
T. Max Devlin (Eltrax Systems)
John Flick (Hewlett Packard)
Rob Frye (MCI)
Wes Hardaker (U.C.Davis, Information Technology - D.C.A.S.)
David Harrington (Cabletron Systems Inc.)
Lauren Heintz (BMC Software, Inc.)
N.C. Hien (IBM T.J. Watson Research Center)
Michael Kirkham (InterWorking Labs, Inc.)
Dave Levi (SNMP Research, Inc.)
Louis A Mamakos (UUNET Technologies Inc.)
Joe Marzot (Nortel Networks)
Paul Meyer (Secure Computing Corporation)
Keith McCloghrie (Cisco Systems)
Bob Moore (IBM)
Russ Mundy (TIS Labs at Network Associates)
Bob Natale (ACE*COMM Corporation)
Mike O'Dell (UUNET Technologies Inc.)
Dave Perkins (DeskTalk)
Peter Polkinghorne (Brunel University)
Randy Presuhn (BMC Software, Inc.)
David Reeder (TIS Labs at Network Associates)
David Reid (SNMP Research, Inc.)
Aleksey Romanov (Quality Quorum)
Shawn Routhier (Epilogue)
Juergen Schoenwaelder (TU Braunschweig)
Bob Stewart (Cisco Systems)
Mike Thatcher (Independent Consultant)
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 takes as much as is practical from previous RFCs and drafts ๐ so special thanks go 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.)
11. Security Considerations ๐
okay bestie, this section is the serious one, so pay attention ๐จ it's where all the security stuff lives, and it's giving main character energy because replay attacks and secret leaks are literally the villains here ๐
11.1. Recommended Practices
this section describes practices that help the mechanisms defined in this memo operate securely and effectively ๐ก๏ธ
- An SNMP engine must discard SNMP Response messages that do not correspond to any currently outstanding Request message. it's the Message Processing module's job to take care of this. for example, it can use a msgID for that ๐
An SNMP Command Generator Application must discard any Response Class PDU for which there is no currently outstanding Confirmed Class PDU. for example, for SNMPv2 [RFC3416] PDUs, the request-id component in the PDU can be used to match Responses to outstanding Requests ๐ฏ
even though it'd be typical for an SNMP engine and an SNMP Command Generator Application to do this as a matter of course, it matters a lot when you're using these security protocols, because messages might get duplicated (maliciously or not) ๐ฏ
- If an SNMP engine uses a msgID to correlate Response messages with outstanding Request messages, then it MUST use different msgIDs in all such Request messages that it sends out during a Time Window (150 seconds) period ๐ฅ
A Command Generator or Notification Originator Application MUST use different request-ids in all Request PDUs that it sends out during a TimeWindow (150 seconds) period ๐ฅ
this has to be done to protect against message duplication, whether it's malicious or accidental ๐ก๏ธ
for example, starting operations with a msgID and/or request-id value of zero is not a good idea ๐ฌ initializing them with an unpredictable number (so they don't start out the same after each reboot) and then incrementing by one would be acceptable โจ
- An SNMP engine should perform time synchronization using authenticated messages, so it's protected against message duplication (malicious or otherwise) ๐ฐ๏ธ
- When sending state-altering messages to a managed authoritative SNMP engine, a Command Generator Application should wait before sending successive messages to that managed SNMP engine until it gets a positive acknowledgement for the previous message, or until the previous message expires ๐งโโ๏ธ
no message ordering is imposed by SNMP. messages may be received in any order relative to their generation time, and each one will be processed in the order received ๐ note that when an authenticated message is sent to a managed SNMP engine, it's valid for roughly 150 seconds under normal circumstances, and it's open to replay during that window ๐จ an SNMP engine and SNMP Command Generator Applications must cope with message loss and re-ordering caused by network anomalies as a matter of course ๐ซ
that said, a managed object, snmpSetSerialNo [RFC3418], is specifically defined for use with SNMP Set operations, to give a mechanism for making sure SNMP messages get processed in a specific order ๐
- how often the secrets of a User-based Security Model user should be changed is indirectly related to how often they get used ๐
protecting the secrets from disclosure is critical to the overall security of the protocols ๐ frequent use of a secret gives a steady stream of data that a cryptanalyst could use to exploit known or suspected weaknesses in an algorithm, and frequently changing the secret shuts that down ๐ต๏ธโโ๏ธ
changing a secret after every use is generally considered the most secure practice, but it can carry a lot of overhead ๐
also, in a local environment the threat of disclosure may be less significant, so secrets can be changed less often. however, when public data networks are the communication paths, more caution is wise ๐
11.2. Defining Users ๐
okay so this whole User-based Security Model is built around the idea of users, the people (or roles!) that messages get sent on behalf of ๐. And how "users" get defined is totally up to the network administration's security policy ๐. Users could be individuals (e.g., "joe" or "jane"), or a particular role (e.g., "operator" or "administrator"), or a combo (e.g., "joe-operator", "jane-operator" or "joe-admin") โจ. A user can even be a logical entity, like an SNMP Application or a set of SNMP Applications, acting for an individual, a role, a set of individuals, or a set of roles (combos included) ๐ฆ.
Appendix A explains an algorithm that turns a user "password" into a 16/20 octet value ๐. That value can be used as the user's authentication key, the privacy key, or both. BUT, using the same password (and so the same key) for both authentication and privacy is very poor security practice and should be strongly discouraged ๐. Human-made passwords are often shorter than the 16/20 octets the protocols need, and brute force attacks can be pretty easy on a short ASCII character set ๐. So the Appendix A algorithm transforms the password. If you use it, SNMP implementations (and SNMP configuration applications) must make sure passwords are at least 8 characters long ๐ . Also, longer passwords with repeating strings can end up with exactly the same key. For example, the password 'bertbert' gives exactly the same key as 'bertbertbert' ๐ญ.
Since the Appendix A algorithm uses these passwords (nearly) directly, they really need to be hard to guess ๐ฅ. It's suggested they be a mix of upper and lower case letters, numbers and punctuation, without words or phrases you'd find in a dictionary โญ. Longer passwords make the whole system more secure, and users can even use multi-word phrases to make the string longer while still being memorable ๐.
Here's the tricky bit: it's infeasible for humans to keep a different password for every SNMP engine, but security requirements strongly discourage using the same key on more than one SNMP engine ๐ฉ. So the User-based Security Model uses a compromise proposed in [Localized-key] ๐ซถ. It derives each engine's user key from the user's password in a way that makes it practically impossible to figure out the user's password, or the user's key for another SNMP engine, from any combination of the user's keys on SNMP engines ๐ง.
Okay, big warning bestie ๐จ: if the user's password gets disclosed, key localization won't save you, and network security may be compromised. So a user's password or non-localized key MUST NOT be stored on a managed device/node. Instead, the localized key SHALL be stored (if at all), so that if a device does get compromised, no other managed or managing devices get compromised too ๐ก๏ธ.
11.3. Conformance โ
To be termed a "Secure SNMP implementation" based on the User-based Security Model, an SNMP implementation MUST:
- implement one or more Authentication Protocol(s). The HMAC-MD5-96 and HMAC-SHA-96 Authentication Protocols defined in this memo are examples of such protocols ๐.
- to the maximum extent possible, prohibit access to the secret(s) of each user about which it maintains information in a Local Configuration Datastore (LCD) under all circumstances, except as required to generate and/or validate SNMP messages with respect to that user ๐.
- implement the key-localization mechanism ๐๏ธ.
- implement the SNMP-USER-BASED-SM-MIB ๐ธ.
In addition, an authoritative SNMP engine SHOULD provide initial configuration in accordance with Appendix A.1 ๐.
Implementation of a Privacy Protocol is optional (the DES Symmetric Encryption Protocol defined in this memo is one such protocol) ๐ฆ.
11.4. Use of Reports ๐จ
Using unsecure reports (i.e., sending them with a securityLevel of noAuthNoPriv) can potentially expose a non-authoritative SNMP engine to some form of attack ๐ฌ. Some people consider these denial of service attacks, and others don't ๐คทโโ๏ธ. An installation should evaluate the risk involved before deploying unsecure Report PDUs ๐ .
11.5. Access to the SNMP-USER-BASED-SM-MIB ๐๏ธ
The objects in this MIB may be considered sensitive in many environments ๐. Specifically, the objects in the usmUserTable contain information about users and their authentication and privacy protocols. It's really important to closely control (both read and write) access to these MIB objects, using appropriately configured Access Control models (for example, the View-based Access Control Model specified in [RFC3415]) ๐.
12. References ๐
12.1. Normative References
[RFC1321]Rivest, R., "Message Digest Algorithm MD5", RFC 1321, April 1992.[RFC2104]Krawczyk, H., Bellare, M. and R. Canetti, "HMAC: Keyed-Hashing for Message Authentication", RFC 2104, February 1997.[RFC2119]Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.[RFC2578]McCloghrie, K., Perkins, D., Schoenwaelder, J., Case, J., Rose, M. and S. Waldbusser, "Structure of Management Information Version 2 (SMIv2)", STD 58, RFC 2578, April 1999.[RFC2579]McCloghrie, K., Perkins, D., Schoenwaelder, J., Case, J., Rose, M. and S. Waldbusser, "Textual Conventions for SMIv2", STD 58, RFC 2579, April 1999.[RFC2580]McCloghrie, K., Perkins, D., Schoenwaelder, J., Case, J., Rose, M. and S. Waldbusser, "Conformance Statements for SMIv2", STD 58, RFC 2580, April 1999.[RFC3411]Harrington, D., Presuhn, R. and B. Wijnen, "An Architecture for Describing Simple Network Management Protocol (SNMP) Management Frameworks", STD 62, RFC 3411, December 2002.[RFC3412]Case, J., Harrington, D., Presuhn, R. and B. Wijnen, "Message Processing and Dispatching for the Simple Network Management Protocol (SNMP)", STD 62, RFC 3412, December 2002.[RFC3415]Wijnen, B., Presuhn, R. and K. McCloghrie, "View-based Access Control Model (VACM) for the Simple Network Management Protocol (SNMP)", STD 62, RFC 3415, December 2002.[RFC3416]Presuhn, R., Case, J., McCloghrie, K., Rose, M. and S. Waldbusser, "Version 2 of the Protocol Operations for the Simple Network Management Protocol (SNMP)", STD 62, RFC 3416, December 2002.[RFC3417]Presuhn, R., Case, J., McCloghrie, K., Rose, M. and S. Waldbusser, "Transport Mappings for the Simple Network Management Protocol (SNMP)", STD 62, RFC 3417, December 2002.[RFC3418]Presuhn, R., Case, J., McCloghrie, K., Rose, M. and S. Waldbusser, "Management Information Base (MIB) for the Simple Network Management Protocol (SNMP)", STD 62, RFC 3418, December 2002.[DES-NIST]Data Encryption Standard, National Institute of Standards and Technology. Federal Information Processing Standard (FIPS) Publication 46-1. Supersedes FIPS Publication 46, (January, 1977; reaffirmed January, 1988).[DESO-NIST]DES Modes of Operation, National Institute of Standards and Technology. Federal Information Processing Standard (FIPS) Publication 81, (December, 1980).[SHA-NIST]Secure Hash Algorithm. NIST FIPS 180-1, (April, 1995)http://csrc.nist.gov/fips/fip180-1.txt(ASCII)http://csrc.nist.gov/fips/fip180-1.ps(Postscript)
12.1. Informative References
[Localized-Key]U. Blumenthal, N. C. Hien, B. Wijnen "Key Derivation for Network Management Applications" IEEE Network Magazine, April/May issue, 1997.[DES-ANSI]Data Encryption Algorithm, American National Standards Institute. ANSI X3.92-1981, (December, 1980).[DESO-ANSI]Data Encryption Algorithm - Modes of Operation, American National Standards Institute. ANSI X3.106-1983, (May 1983).[DESG-NIST]Guidelines for Implementing and Using the NBS Data Encryption Standard, National Institute of Standards and Technology. Federal Information Processing Standard (FIPS) Publication 74, (April, 1981).[DEST-NIST]Validating the Correctness of Hardware Implementations of the NBS Data Encryption Standard, National Institute of Standards and Technology. Special Publication 500-20.[DESM-NIST]Maintenance Testing for the Data Encryption Standard, National Institute of Standards and Technology. Special Publication 500-61, (August, 1980).[RFC3174]Eastlake, D. 3rd and P. Jones, "US Secure Hash Algorithm 1 (SHA1)", RFC 3174, September 2001.
APPENDIX A - Installation ๐ง
A.1. SNMP engine Installation Parameters
Okay so, when an authoritative SNMP engine gets installed, it SHOULD (in the meaning as defined in [RFC2119]) be set up with a few starter parameters. ๐ Let's go through them, bestie! โจ
- A Security Posture
The posture you pick decides whether initial configuration happens at all, and if it does, how. There are three options, and you pick exactly one:
minimum-secure,
semi-secure,
very-secure (i.e., no-initial-configuration)
If you go with very-secure, there's no initial configuration, so the steps below don't apply. Totally chill, no stress ๐ธ
- One or More Secrets
These are the authentication and privacy secrets for the first user you set up. ๐
One way to do this is to have the installer type in a "password" for each required secret. The password then gets turned into the actual secret like this:
- Make a string that's 1,048,576 octets long by repeating the password as many times as needed and chopping off the extra. Feed that string into the MD5 algorithm [RFC1321]. The result, called "digest1", is what you use in the next step.
- Next, glue together digest1, the SNMP engine's snmpEngineID value, and digest1 again. Run that string through MD5 [RFC1321] too.
The final digest is the required secret (see Appendix A.2). Ta-da! ๐
With those parameters set, the SNMP engine creates the following usmUserEntry in the usmUserTable. It looks different depending on whether privacy is supported, so here are both versions:
no privacy support privacy support
------------------ ---------------
usmUserEngineID localEngineID localEngineID
usmUserName "initial" "initial"
usmUserSecurityName "initial" "initial"
usmUserCloneFrom ZeroDotZero ZeroDotZero
usmUserAuthProtocol usmHMACMD5AuthProtocol usmHMACMD5AuthProtocol
usmUserAuthKeyChange "" ""
usmUserOwnAuthKeyChange "" ""
usmUserPrivProtocol none usmDESPrivProtocol
usmUserPrivKeyChange "" ""
usmUserOwnPrivKeyChange "" ""
usmUserPublic "" ""
usmUserStorageType anyValidStorageType anyValidStorageType
usmUserStatus active active
It's also recommended to set up a few template usmUserEntry rows. These can be cloned from when you make new usmUserEntry rows, which is so smart and efficient ๐ง Here are the two suggested ones:
no privacy support privacy support
------------------ ---------------
usmUserEngineID localEngineID localEngineID
usmUserName "templateMD5" "templateMD5"
usmUserSecurityName "templateMD5" "templateMD5"
usmUserCloneFrom ZeroDotZero ZeroDotZero
usmUserAuthProtocol usmHMACMD5AuthProtocol usmHMACMD5AuthProtocol
usmUserAuthKeyChange "" ""
usmUserOwnAuthKeyChange "" ""
usmUserPrivProtocol none usmDESPrivProtocol
usmUserPrivKeyChange "" ""
usmUserOwnPrivKeyChange "" ""
usmUserPublic "" ""
usmUserStorageType permanent permanent
usmUserStatus active active
no privacy support privacy support
------------------ ---------------
usmUserEngineID localEngineID localEngineID
usmUserName "templateSHA" "templateSHA"
usmUserSecurityName "templateSHA" "templateSHA"
usmUserCloneFrom ZeroDotZero ZeroDotZero
usmUserAuthProtocol usmHMACSHAAuthProtocol usmHMACSHAAuthProtocol
usmUserAuthKeyChange "" ""
usmUserOwnAuthKeyChange "" ""
usmUserPrivProtocol none usmDESPrivProtocol
usmUserPrivKeyChange "" ""
usmUserOwnPrivKeyChange "" ""
usmUserPublic "" ""
usmUserStorageType permanent permanent
usmUserStatus active active
A.2. Password to Key Algorithm
Here's a sample code fragment (Section A.2.1) that shows the password to key algorithm for mapping a password to an authentication or privacy key using MD5. The reference source code for MD5 is in [RFC1321]. ๐
There's also a second sample fragment (Section A.2.2) that does the same job with SHA, which is documented in SHA-NIST. ๐ฆ
And there's a sample result (Section A.3) so an implementor can check whether their version gives the same answer. Very useful for debugging, no cap ๐
A.2.1. Password to Key Sample Code for MD5
void password_to_key_md5(
u_char *password, /* IN */
u_int passwordlen, /* IN */
u_char *engineID, /* IN - pointer to snmpEngineID */
u_int engineLength,/* IN - length of snmpEngineID */
u_char *key) /* OUT - pointer to caller 16-octet buffer */
{
MD5_CTX MD;
u_char *cp, password_buf[64];
u_long password_index = 0;
u_long count = 0, i;
MD5Init (&MD); /* initialize MD5 */
/**********************************************/
/* Use while loop until we've done 1 Megabyte */
/**********************************************/
while (count < 1048576) {
cp = password_buf;
for (i = 0; i < 64; i++) {
/*************************************************/
/* Take the next octet of the password, wrapping */
/* to the beginning of the password as necessary.*/
/*************************************************/
*cp++ = password[password_index++ % passwordlen];
}
MD5Update (&MD, password_buf, 64);
count += 64;
}
MD5Final (key, &MD); /* tell MD5 we're done */
/*****************************************************/
/* Now localize the key with the engineID and pass */
/* through MD5 to produce final key */
/* May want to ensure that engineLength <= 32, */
/* otherwise need to use a buffer larger than 64 */
/*****************************************************/
memcpy(password_buf, key, 16);
memcpy(password_buf+16, engineID, engineLength);
memcpy(password_buf+16+engineLength, key, 16);
MD5Init(&MD);
MD5Update(&MD, password_buf, 32+engineLength);
MD5Final(key, &MD);
return;
}
A.2.2. Password to Key Sample Code for SHA
void password_to_key_sha(
u_char *password, /* IN */
u_int passwordlen, /* IN */
u_char *engineID, /* IN - pointer to snmpEngineID */
u_int engineLength,/* IN - length of snmpEngineID */
u_char *key) /* OUT - pointer to caller 20-octet buffer */
{
SHA_CTX SH;
u_char *cp, password_buf[72];
u_long password_index = 0;
u_long count = 0, i;
SHAInit (&SH); /* initialize SHA */
/**********************************************/
/* Use while loop until we've done 1 Megabyte */
/**********************************************/
while (count < 1048576) {
cp = password_buf;
for (i = 0; i < 64; i++) {
/*************************************************/
/* Take the next octet of the password, wrapping */
/* to the beginning of the password as necessary.*/
/*************************************************/
*cp++ = password[password_index++ % passwordlen];
}
SHAUpdate (&SH, password_buf, 64);
count += 64;
}
SHAFinal (key, &SH); /* tell SHA we're done */
/*****************************************************/
/* Now localize the key with the engineID and pass */
/* through SHA to produce final key */
/* May want to ensure that engineLength <= 32, */
/* otherwise need to use a buffer larger than 72 */
/*****************************************************/
memcpy(password_buf, key, 20);
memcpy(password_buf+20, engineID, engineLength);
memcpy(password_buf+20+engineLength, key, 20);
SHAInit(&SH);
SHAUpdate(&SH, password_buf, 40+engineLength);
SHAFinal(key, &SH);
return;
}
A.3. Password to Key Sample Results
A.3.1. Password to Key Sample Results using MD5
Here's a sample output of the password to key algorithm for a 16-octet key using MD5. Let's see if it slays for you! ๐
With the password "maplesyrup", the output of the password to key algorithm before the key is localized with the SNMP engine's snmpEngineID is:
'9f af 32 83 88 4e 92 83 4e bc 98 47 d8 ed d9 63'H
After the intermediate key (shown above) is localized with the snmpEngineID value of:
'00 00 00 00 00 00 00 00 00 00 00 02'H
the final output of the password to key algorithm is:
'52 6f 5e ed 9f cc e2 6f 89 64 c2 93 07 87 d8 2b'H
A.3.2. Password to Key Sample Results using SHA
Here's a sample output of the password to key algorithm for a 20-octet key using SHA. Same vibe, bigger key ๐
With the password "maplesyrup", the output of the password to key algorithm before the key is localized with the SNMP engine's snmpEngineID is:
'9f b5 cc 03 81 49 7b 37 93 52 89 39 ff 78 8d 5d 79 14 52 11'H
After the intermediate key (shown above) is localized with the snmpEngineID value of:
'00 00 00 00 00 00 00 00 00 00 00 02'H
the final output of the password to key algorithm is:
'66 95 fe bc 92 88 e3 62 82 23 5f c7 15 1f 12 84 97 b3 8f 3f'H
A.4. Sample Encoding of msgSecurityParameters ๐
okay so the msgSecurityParameters in an SNMP message is an OCTET STRING ๐ซง and outside of a specific Security Model it should be considered opaque, so nobody else gets to peek inside ๐. The User-based Security Model is the one that defines what's actually in there: a SEQUENCE (see section 2.4) โจ. So here's an example of the msgSecurityParameters for the User-based Security Model, encoded as an OCTET STRING:
04 <length>
30 <length>
04 <length> <msgAuthoritativeEngineID>
02 <length> <msgAuthoritativeEngineBoots>
02 <length> <msgAuthoritativeEngineTime>
04 <length> <msgUserName>
04 0c <HMAC-MD5-96-digest>
04 08 <salt>
Here's the same example again but with real values ๐ (except for the digest in msgAuthenticationParameters and the salt in msgPrivacyParameters, since those depend on variable data we haven't defined here ๐คทโโ๏ธ):
Hex Data Description
-------------- -----------------------------------------------
04 39 OCTET STRING, length 57
30 37 SEQUENCE, length 55
04 0c 80000002 msgAuthoritativeEngineID: IBM
01 IPv4 address
09840301 9.132.3.1
02 01 01 msgAuthoritativeEngineBoots: 1
02 02 0101 msgAuthoritativeEngineTime: 257
04 04 62657274 msgUserName: bert
04 0c 01234567 msgAuthenticationParameters: sample value
89abcdef
fedcba98
04 08 01234567 msgPrivacyParameters: sample value
89abcdef
A.5. Sample keyChange Results ๐
A.5.1. Sample keyChange Results using MD5 ๐ฅ
Let's say a user has the current password "maplesyrup" (like in section A.3.1.), and we also assume an snmpEngineID that's 12 octets long:
'00 00 00 00 00 00 00 00 00 00 00 02'H
Now we want to change the password to "newsyrup" ๐ค, so first we calculate the key for the new password. It goes like this:
'01 ad d2 73 10 7c 4e 59 6b 4b 00 f8 2b 1d 42 a7'H
If we localize it for the snmpEngineID above, the localized new key becomes:
'87 02 1d 7b d9 d1 01 ba 05 ea 6e 3b f9 d9 bd 4a'H
Next we use a random value (not the best one, but it's easy to test with) of:
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'H
Then the value we must send for keyChange is:
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
88 05 61 51 41 67 6c c9 19 61 74 e7 42 a3 25 51'H
If this were for the privacy key, it would be exactly the same ๐ธ.
A.5.2. Sample keyChange Results using SHA ๐ฆ
Same vibe here: we start with the password "maplesyrup" from section A.3.2., and an snmpEngineID of 12 octets:
'00 00 00 00 00 00 00 00 00 00 00 02'H
Changing the password to "newsyrup", the key for the new password is:
'3a 51 a6 d7 36 aa 34 7b 83 dc 4a 87 e3 e5 5e e4 d6 98 ac 71'H
Localized for the snmpEngineID above, the localized new key becomes:
'78 e2 dc ce 79 d5 94 03 b5 8c 1b ba a5 bf f4 63 91 f1 cd 25'H
Using a random value (again, not the best one, but easy to test) of:
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'H
Then the value we must send for keyChange is:
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
9c 10 17 f4 fd 48 3d 2d e8 d5 fa db f8 43 92 cb 06 45 70 51'
For the key used for privacy, the new nonlocalized key would be:
'3a 51 a6 d7 36 aa 34 7b 83 dc 4a 87 e3 e5 5e e4 d6 98 ac 71'H
For the privacy key, the new localized key would be (heads up, the localized key gets truncated to 16 octets for DES ๐):
'78 e2 dc ce 79 d5 94 03 b5 8c 1b ba a5 bf f4 63'H
Then we use a random value (also not the best, but easy to test) of:
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'H
And the value we must send for keyChange for the privacy key is:
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
'7e f8 d8 a4 c9 cd b2 6b 47 59 1c d8 52 ff 88 b5'H
B. Change Log ๐
Changes made since RFC2574:
- Updated references
- Updated contact info
- Clarifications
- to first constraint item 1) on page 6.
- to usmUserCloneFrom DESCRIPTION clause
- to securityName in section 2.1
- Fixed "command responder" into "command generator" in last para of DESCRIPTION clause of usmUserTable.
Changes made since RFC2274:
- Fixed msgUserName to allow size of zero and explain that this can be used for snmpEngineID discovery.
- Clarified section 3.1 steps 4.b, 5, 6 and 8.b.
- Clarified section 3.2 paragraph 2.
- Clarified section 3.2 step 7.a last paragraph, step 7.b.1 second bullet and step 7.b.2 third bullet.
- Clarified section 4 to indicate that discovery can use a userName of zero length in unAuthenticated messages, whereas a valid userName must be used in authenticated messages.
- Added REVISION clauses to MODULE-IDENTITY
- Clarified KeyChange TC by adding a note that localized keys must be used when calculating a KeyChange value.
- Added clarifying text to the DESCRIPTION clause of usmUserTable. Added text describes a recommended procedure for adding a new user.
- Clarified the use of usmUserCloneFrom object.
- Clarified how and under which conditions the usmUserAuthProtocol and usmUserPrivProtocol can be initialized and/or changed.
- Added comment on typical sizes for usmUserAuthKeyChange and usmUserPrivKeyChange. Also for usmUserOwnAuthKeyChange and usmUserOwnPrivKeyChange.
- Added clarifications to the DESCRIPTION clauses of usmUserAuthKeyChange, usmUserOwnAuthKeychange, usmUserPrivKeyChange and usmUserOwnPrivKeychange.
- Added clarification to DESCRIPTION clause of usmUserStorageType.
- Added clarification to DESCRIPTION clause of usmUserStatus.
- Clarified IV generation procedure in section 8.1.1.1 and in addition clarified section 8.3.1 step 1 and section 8.3.2. step 3.
- Clarified section 11.2 and added a warning that different size passwords with repetitive strings may result in same key.
- Added template users to appendix A for cloning process.
- Fixed C-code examples in Appendix A.
- Fixed examples of generated keys in Appendix A.
- Added examples of KeyChange values to Appendix A.
- Used PDU Classes instead of RFC1905 PDU types.
- Added text in the security section about Reports and Access Control to the MIB.
- Removed a incorrect note at the end of section 3.2 step 7.
- Added a note in section 3.2 step 3.
- Corrected various spelling errors and typos.
- Corrected procedure for 3.2 step 2.a)
- various clarifications.
- Fixed references to new/revised documents
- Change to no longer cache data that is not used
Editors' Addresses ๐
Uri Blumenthal Lucent Technologies 67 Whippany Rd. Whippany, NJ 07981 USA
Phone: +1-973-386-2163 EMail: uri@lucent.com
Bert Wijnen Lucent Technologies Schagen 33 3461 GL Linschoten Netherlands
Phone: +31-348-480-685 EMail: bwijnen@lucent.com
Full Copyright Statement โ๏ธ
Copyright (C) The Internet Society (2002). All Rights Reserved.
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.
The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.
This document and the information contained herein 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.
Acknowledgement ๐ซถ
Funding for the RFC Editor function is currently provided by the Internet Society.
๐ฆ where this page comes from
- ietf: rfc3414 2002-12
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms