MUICT SNMP v3
MUICT SNMP v3
MUICT SNMP v3
SNMPv3
2
0. Why SNMPv3
SNMPv1 and SNMPv2c message format
SNMPv1/SNMPv2c Message {
version snmpv1=0 snmpv2c=1
community STRING
PDU (operation) {
request-id INTEGER
error-status INTEGER
error-index INTEGER
variable-bindings {
OID, VALUE
…
}
}
}
SNMP v2c (Community Network-Based Simple Protocol)
2 based on RFC 1901 - RFC 1908
3
SNMP Agent
Community (public, private)
READ- READ-
SNMP Access Mode
ONLY WRITE
https://woshub.com/install-configure-snmp-service-windows/
4
SNMPv1 and SNMPv2c problems
5
SNMPv1 example:
% snmpget -d -v 1 -c public localhost sysUpTime.0
6
Goals behind SNMPv3
◼ Security
◼ Security
◼ Security
◼ Provide modularity in the architecture
❑ Replacing new elements in the future should be
easier.
❑ Modularity = many IETF RFCs
◼ Separate “context” of the request from the
authentication
7
I. SNMPv3 Key Features (1)
▪ Provides security for SNMP
▪ Defines a database that determines what parts of each MIB each
user can access
▪ Database entries also determine what protocols are used to
encrypt data
▪ Modularization of architecture
▪ SNMP Entities
❑ Both managers and agents are called SNMP entities
❑ Each entity consists of an SNMP engine and one or more SNMP
applications
▪ Security feature
❑ Secure information
❑ Access control
8
SNMPv3 Key Features (2)
9
SNMPv3 Key Features (3)
▪ More specifically:
❑ Security
✓ authentication and privacy
✓ authorization and access control
❑ Administrative Framework
✓ naming of entities
✓ people and policies
✓ usernames and key management
✓ notification destinations
✓ proxy relationships
❑ Remotely configurable via SNMP operations
▪ SNMPv3 also introduces the ability to dynamically configure
the SNMP agent using SNMP SET commands against the
MIB objects that represent the agent's configuration.
❑ This dynamic configuration support enables addition, deletion, and
modification of configuration entries either locally or remotely.
10
Database Structure
◼ Database consists of USM, VTF, S2G, and VACM
entries.
◼ User based Security Model (USM) entries contain
information about the user including
❑ Username
❑ Authentication key
❑ Encryption key
11
For User to Access MIB
12
II. SNMPv3 Architecture
Consists of a distributed collection of SNMP entities
SNMP ENTITY
SNMP APPLICATIONS
SNMP ENGINE
▪ SNMP entity is a node with an SNMP management element - either an agent or manager
or both
▪ Three names associated with an entity
❑ Entities: SNMP engine
❑ Identities: Principal and security name
❑ Management Information: Context engine
“The architecture is designed to be modular to allow the evolution of the Framework over time.”
-- RFC 2570 & RFC 2571 13
SNMPv3: Standards Breakdown
◼ RFC2570: SNMPv3 Overview
◼ RFC2571: Architecture
◼ RFC2572: Message Processing
◼ RFC2573: Applications
◼ RFC2574: User-based Security Model
◼ RFC2575: View-based Access Control Model
◼ RFC2576: v1/v2c/v3 Coexistence / Transition
◼ RFC2578-80: SMIv2 -- Language of the MIBs
◼ RFC1157: SNMPv1
◼ RFC1901,5: SNMPv2
◼ ...
14
SNMPv3: Framework Architecture
Application Access Control
or Agent
VACM
CG CR NG NR ...
SNMPv1 Kerberos
... ...
Network
15
SNMPv3: Applications (RFC 2573)
◼ Application “types” have been formally defined:
❑ CG: Command Generator (was: Manager)
❑ CR: Command Responder (was: Agent)
❑ NG: Notification Generator
❑ NR: Notification Responder
❑ PF: Proxy Forwarder (not shown in diagram)
16
SNMPv3 Protocol Packet Breakdown
SNMPv3Message {
Version INTEGER Dispatcher
(snmpv3 = 3)
HeaderData {
msgID INTEGER
MaxSize INTEGER MSG Processor
Flags STRING
SecurityModel INTEGER
(USM = 3)
}
UsmSecurityParameters STRING {
AuthoritativeEngineID STRING,
AuthoritativeEngineBoots INTEGER
AuthoritativeEngineTime INTEGER Security Model
UserName STRING
AuthenticationParameters STRING
PrivacyParameters STRING
}
ScopedPduData {
contextEngineID STRING,
contextName STRING,
PDU SNMPv2 PDUs
}
} Application
17
Architecture Components
“The major portions of the architecture are an SNMP engine containing a
Message Processing Subsystem, a Security Subsystem and an Access
Control Subsystem, and possibly multiple SNMP applications which provide
specific functional processing of management data..”
-- RFC 2571
18
SNMP Engine ID
1st
bit
19
SNMPv3 Engine ID Format 5th Octet
Table 7.2 SNMPv3 Engine ID Format (5th octet)
0 Reserved, unused
1 IPv4 address (4 octets)
2 IPv6 (16 octets)
Lowest non-special IP address
3 MAC address (6 octets)
Lowest IEEE MAC address, canonical order
4 Text, administratively assigned
Maximum remaining length 27
5 Octets, administratively assigned
Maximum remaining length 27
6-127 Reserved, unused
128-255 As defined by the enterprises
Maximum remaining length 27
20
Engine ID
◼ Used to create hash user keys and for encryption and
authentication
◼ Older versions of SNMPv3 based it on unit’s IP address.
Bad idea since IP address can change.
◼ This version uses Ethernet MAC address
◼ Should prevent problems with new customers
◼ May create minor problems with customers who already
had SNMPv3
21
https://support.huawei.com/enterprise/en/doc/EDOC1000142063/8213
6ea0/what-is-an-snmp-engine-id-and-how-do-i-configure-it 22
◼ 800007DB03360102101100
◼ 800007DB = enterprise of HUAWEI
◼ 03 = represent MAC address
◼ 360102101100 = MAC address
23
Dispatcher
SNMP Engine (identified by snmpEngineID)
Message Access
Security
Dispatcher Processing Control
Subsystem
Subsystem Subsystem
24
The Dispatcher
Application Access Control
or Agent
VACM
CG CR NG NR ...
SNMPv1 Kerberos
... ...
Network
25
The Dispatcher (RFC 2572)
◼ The simplest component of the architecture
◼ Directs packets to and from the other elements:
❑ Application or agent
◼ CG, CR, NG, NR
❑ The Network (through the appropriate transport layer)
❑ The correct message processor
◼ Makes it’s decision based on:
❑ What component sent it
❑ What protocol version is being sent
❑ What type of PDU is being sent
◼ Knowledge of it not required by the typical user
26
Message Processing Subsystem
SNMP Engine (identified by snmpEngineID)
Message Access
Security
Dispatcher Processing Control
Subsystem
Subsystem Subsystem
27
The Message Processor
Network
28
The SNMPv3 Message Processor (RFC 2572)
◼ Encodes and decodes the majority of the packet
◼ Handles errors and exceptions
❑ Message too big to fit in a packet
❑ Parse errors are detected
❑ ...
◼ Passes to appropriate security model for authentication
and encryption support.
❑ (Currently, the only defined security model is the USM)
29
Security and Access Control
SNMP Engine (identified by snmpEngineID)
Message Access
Security
Dispatcher Processing Control
Subsystem
Subsystem Subsystem
30
Security Model (1)
Application Access Control
or Agent
VACM
CG CR NG NR ...
SNMPv1 Kerberos
... ...
Network
31
Security Model (2)
◼ Authenticates packets to ensure/verify origin
❑ Current authentication methods
◼ Provides message encryption/decryption support
❑ The ScopedPDU can be protected by encryption
◼ Makes it’s decisions based on packet data:
❑ EngineID, Engine Boots, Engine Time
❑ User Name
❑ Authentication field
❑ Privacy field
◼ Currently only one standard security model exists
❑ The “User Based Security Model”, or USM
32
III. SNMPv3 Applications
Application(s)
Proxy
Command Notification
Forwarder
Generator Receiver
Subsystem
Application Example
▪ Command generator get-request
▪ Command responder get-response
▪ Notification originator trap generation
▪ Notification receiver trap processing
▪ Proxy Forwarder get-bulk to get-next
(SNMP versions only)
▪ Other Special application
33
Names
SNMP Engine ID snmpEngineID
Principal principal
Who: person or group or application
Security Name securityName
human readable name
Context Engine ID contextEngineID
Context Name contextName
▪ An SNMP agent can monitor more than one network element (context)
Examples:
SNMP Engine ID IP address
35
SNMP Overview
◼ Network monitoring and Information Collection
RESPONSE: It’s …
36
SNMP Manager
COMMAND NOTIFICATION
GENERATOR RECEIVER
37
SNMP Agent
MANAGEMENT INFORMATION BASE
38
SNMPv3 Flow
39
SNMPv3 Example: Generating a Request
Application Access Control
or Agent
VACM
CG CR NG NR ...
SNMPv1 Kerberos
... ...
40
SNMPv3 Example: Receiving a Request
Application Access Control
or Agent
VACM
CG CR NG NR ...
SNMPv1 Kerberos
... ...
Network
41
SNMPv3 Example: Generating a Response
Application Access Control
or Agent
VACM
CG CR NG NR ...
SNMPv1 Kerberos
... ...
Network
42
SNMPv3 Example: Receiving a Response
Application Access Control
or Agent
VACM
CG CR NG NR ...
SNMPv1 Kerberos
... ...
Network
43
Notification / Proxy
▪ Notification originator
❑ Generates trap and inform messages
❑ Determine target, SNMP version, and security
❑ Decides context information
▪ Notification receiver
❑ Registers with SNMP engine
❑ Receives notification messages
▪ Proxy forwarder
❑ Proxy server
❑ Handles only SNMP messages by
✓ Command generator
✓ Command responder
✓ Notification generator
✓ Report indicator
❑ Uses the translation table in the proxy group MIB
44
IV. SNMPv3 MIB
snmpModules
{1.3.6.1.6.3}
45
SNMPv2 MIB
Internet
{1 3 6 1}
mib-2 snmpMIB
(1) (1)
snmpTargetObjects
(1)
snmpTargetAddrTable snmpTargetParamsTable
(2) (3)
47
SNMPv3 Notification MIB
snmpNotificationMIB
{snmpModules 13}
snmpNotifyObjects
(1)
Management Management
Entity A Entity B
Disclosure
49
Security Services
Security Subsystem
Data Integrity
Authentication
Module
Data Origin Authentication
Message
Privacy
Processing Data Confidentiality
Module
Model
50
Role of SNMP Engines
Non-Authoritative Engine
(NMS)
Authoritative Engine
(Agent)
51
SNMPv3 Message Format
Header Data scopedPDU
Message
Message Message Message Context Context
Security Data
ID Max. Size Flag Engine ID Name
Model
Global/
Security Plaintext / Encrypted
Version Header Whole Message
Parameters scopedPDU Data
Data
Security Parameters
52
Protocol Structure - SNMPv3 Simple Network
Management Protocol version 3
SNMPv3 message format:
53
Version --For SNMPv3 it is 3.
ID --A unique identifier used between two SNMP entities to coordinate request and response
messages
Msg Size -- Maximum size of a message in octets supported by the sender of the message
Msg Flags --An octet string containing three flags in the least significant three bits:
reportableFlag, privFlag, authFlag.
Security Model --An identifier to indicate which security model was used by the sender and
therefore which security model must be used by the receiver to process this message.
AuthoritativeEngineID -- The snmpEngineID of the authoritative SNMP engine involved in
the exchange of this message. Thus, this value refers to the source for a Trap, Response, or
Report, and to the destination for a Get, GetNext, GetBulk, Set, or Inform.
AuthoritativeEngineBoots --The snmpEngineBoots value of the authoritative SNMP engine
involved in the exchange of this message.
AuthoritativeEngineTime -- The snmpEngineTime value of the authoritative SNMP engine
involved in the exchange of this message.
User Name --The user (principal) on whose behalf the message is being exchanged.
AuthenticationParameters -- Null if authentication is not being used for this exchange.
Otherwise, this is an authentication parameter.
PrivacyParameters -- Null if privacy is not being used for this exchange. Otherwise, this is a
privacy parameter.
PDU (Protocol Data Unit)-- The PDU types for SNMPv3 are the same as the SNMPv2. 54
SNMPv3 Message Format
Field Object name Description
Version msgVersion SNMP version number of the
message format
Message ID msgID Administrative ID associated with the
message
Message Max. Size msgMaxSize Maximum size supported by the
sender
Message flags msgFlags Bit fields identifying report,
authentication, and privacy of the
message
Message Security msgSecurityModel Security model used for the message;
Model concurrent multiple models allowed
Security Parameters msgSecurityParameters Security parameters used for
(See Table 7.8) communication between sending and
receiving security modules
Plaintext/Encrypted scopedPduData Choice of plaintext or encrypted
scopedPDU Data scopedPDU; scopedPDU uniquely
identifies context and PDU
Context Engine ID contextEngineID Unique ID of a context (managed
entity) with a context name realized by
an SNMP entity
Context Name contextName Name of the context (managed entity)
PDU data Contains unencrypted PDU
55
VI. SNMPv3 User-Based Security
Model (USM)
▪ Designed to secure against: ▪ Based on traditional user name concept
❑ Modification of information ▪ USM primitives across abstract service
❑ Masquerade interfaces
❑ Message stream modification ❑ Authentication service primitives
❑ Disclosure ✓ authenticateOutgoingMsg
▪ Not intended to secure against: ✓ authenticateIncomingMsg
❑ Denial of Service (DoS attack) ❑ Privacy Services
❑ Traffic analysis ✓ encryptData
✓ decryptData
56
User Based Security: USM (RFC 2574)
◼ The User Based Security model provides:
❑ Authentication via MD5 or SHA1 hash
◼ The hash verifies the authenticity of the entire v3 message.
◼ Modified or forged packets will be rejected
❑ Encryption via DES encryption
◼ The ScopedPDU is encrypted (basically, the payload)
❑ 3 levels of security: noAuthNoPriv, authNoPriv, authPriv
57
USM: About EngineIDs, etc...
◼ EngineIDs are:
❑ A unique “string” of data
❑ Generally defined from one of:
◼ IPv4 address
◼ IPv6 address
◼ MAC address
◼ Administratively defined strings
◼ Implementation dependent
◼ EngineBoots: number of reboots
◼ EngineTime: Time since last initialized
◼ Information is automatically probed by protocol.
58
USM: A User is...
59
USM: The Authoritative Engine
◼ Only one side of a transaction is “authoritative”
❑ Authoritative side == where the master user key exists
❑ Typically this means: the SNMP agents are authoritative
❑ The authoritative side is defined by whether the packet being
sent is expecting a response or not.
◼ An odd effect of this is:
❑ The engine receiving SNMPv3 INFORMs, which expect a “I got it”
response, are authoritative.
❑ The engine sending SNMPv3 TRAPs, which don’t require a response, are
authoritative.
❑ Ick.
60
USM: Keys
◼ USM Keys used to authenticate and encrypt
messages are generated:
❑ A password hashed using the authentication algorithm
(maybe)
❑ The resulting hash is then re-hashed after mixing it with the
authoritative engineID.
◼ This means:
❑ All user keys are different on each host
❑ Pro: A cracked system’s keys can’t be used to gain access to
other systems.
❑ Con: Distributing keys to many systems is difficult
61
USM: Keys
Management
Password
Application
62
Message Authentication Code
63
USM: The math behind the keys
PassLong = repeat(password) till 1Mb long
Ku = hash(PassLong)
Kul = hash(Ku | authEngineID | Ku)
◼ Notes:
❑ Passwords must be at least 8 characters long
❑ Ku need not be generated from a password, but can be generated
randomly instead.
◼ Protects against brute-forcing low entropy passwords
❑ Hash is currently one of: MD5, SHA1
64
Secure Outgoing Message
Security Subsystem
Message Encrypted
Processing scopedPDU
Model
Authentication key
(Authenticated/encrypted)
whole message Whole Message Authentication
Authenticated Module
Whole message length
Whole Message
Security Parameters
Decrypt key
Encrypted PDU
(Decrypted) scopedPDU Privacy Privacy
parameters Module
Decrypted
scopedPDU
66
Security Parameters
snmpModules
{1.3.6.1.6.3}
snmpFrameworkMIB snmpUsmMIB
(10) (15)
UsmUserSpinLock UsmUserTable
(1) (2)
68
Authentication Key
▪ User-based authentication
▪ Secret key for authentication
▪ Derived from user (NMS) password
▪ MD5 or SHA-1 algorithm used
▪ Authentication key is digest2
Procedure:
1. Derive digest0:
Password repeated until it forms 220 octets.
2. Derive digest1:
Hash digest0 using MD5 or SHA-1.
3. Derive digest2:
Concatenate authoritative SNMP engine ID and digest1 and hash
with the same algorithm
69
Encryption Protocol
▪ Cipher Block Chaining mode of Data Encryption Standard (CBC-
DES) protocol
▪ 16-octet privKey is secret key
▪ First 8-octet of privKey used as 56-bit DES key; (Only 7 high-order
bits of each octet used)
▪ Last 8-octet of privKey used as pre-initialization vector
Transmission
Channel
Plaintext Encryption Ciphertext Decryption Plaintext
Secret Key
Secret Key
Figure 13.33 Basic Cryptographic Communication
▪ CBC Mode
❑ Plaintext divided into 64-bit blocks
❑ Each block is XOR-d with cipher text of the previous block and then
encrypted
❑ Use pre-IV (initialization vector) for prefixing the first message block
70
Key Localization Process
71
VII. Access Control (1)
▪ For controlling access to MIB objects
▪ View-based Access Control Model (VACM)
❑ Groups: Name of the group comprising
security model and security name: In ▪ VACM has two
SNMPv1, is community name characteristics:
❑ Security Level ❑ Determines whether access
✓ no authentication - no privacy to a managed object should
✓ authentication - no privacy
be allowed.
✓ authentication - privacy
❑ Make use of an MIB that:
❑ Contexts: Names of the context
✓ Defines the access control
❑ MIB Views and View Families policy for this agent.
✓ MIB view is a combination of view subtrees ✓ Makes it possible for
❑ Access Policy remote configuration to be
✓ read-view used.
✓ write-view
✓ notify-view
✓ not-accessible
72
Access Control (2)
Application Access Control
or Agent
VACM
CG CR NG NR ...
SNMPv1 Kerberos
... ...
Network
73
Access Control (3)
74
View Based Access Control (RFC 2575)
◼ Bases access control decisions on:
❑ Operation type (read, write, notify)
❑ Security model
❑ User performing the action
◼ Users are placed into a “group” and the groups are assigned the
rights, not the user.
❑ Security level of the transaction (authenticated? encrypted?)
❑ Object OID being accessed (and the context information)
❑ OID ranges are “included” or “excluded” from view
◼ I wish:
❑ Value of the object being accessed
❑ Users could be assigned to multiple groups (unix-like)
75
VACM: Access based on OID tree
1
Include .1.2
2 Exclude .1.2.2
Include .1.2.2.3
1 2 3 4
Objects “excluded” are
simply “not visible”
1 2 3 1 2 3
Simple Wild-carding
not shown, but possible
76
VACM Process (1)
Answers 6 questions:
1. Who are you (group)?
2. Where do you want to go (context)?
3. How secured are you to access the information
(security model and security level)?
4. Why do you want to access the information
(read, write, or send notification)?
5. What object (object type) do you want to access?
6. Which object (object instance) do you want to
access?
77
VACM Process (2)
Security
Security Security
Security Name Context
Model Level
Model (Principal) Name
Security-
How secured
Who are you? Context Go Where?
to-Group are you?
Group Table Context
Table Security Level
Context
noSuchContext Model
Name
Group Name Level
noGroupName
Read Write Notify
Why do you
Access Access
want access?
Table Allowed?
View Type
View Name
View Type Object Object
read/write/notify
noAccessEntry Type Instance
noSuchView
View Tree What & Which
Select Variable
Family Object?
Names
Table Variable
noSuchView
notInView Yes / No
Access
Allowed
78
Figure 7.16 VACM Process
VACM Process (3)
Access control decision
79
VACM MIB
snmpVacmMIB
(snmpModules 16)
vacmMIBObjects
(1)
vacmViewSpinLock vacmViewTreeFamilyAccessTable
(1) (2)
80
MIB Views
Simple view:
system 1.3.6.1.2.1.1
Complex view:
All information relevant to a particular interface - system and
interfaces groups
81
VACM MIB View
vacmMIBViews
(vacmMIBObjects 5)
vacmViewSpinLock vacmViewTreeFamilyTable
(1) (2)
vacmViewTreeFamilyEntry
(1)
82