1. Introduction to the System Management Agent
2. Configuring the System Management Agent
3. Working with the System Management Agent
Using USM for Authentication and Message Privacy
Authentication Protocol Algorithms
Where USM Security Information Is Contained
To Create a New User Using System Prompts
To Create Additional SNMPv3 Users With Security
Managing SNMPv1 and SNMPv2c Users With SNMPv3 Security
You can use the View-based Access Control Model (VACM) to find out whether access to a specified managed object is authorized. Access control is done at the following points:
When processing retrieval request messages from the manager
When processing modification request messages from the manager
When notification messages must be sent to the manager
The VACM builds on the community string concept mentioned in Community String, by providing access control that you can easily administer in SMA.
Access control is defined by tokens in the main snmpd.conf configuration file. The SMA daemon snmpd recognizes the following tokens for VACM access security that you can use in the main snmpd.conf configuration file:
The first three of these tokens are described in Understanding VACM Tables. The com2sec token takes NAME SOURCE and COMMUNITY options. You can use this token to give SNMPv3 security privileges to SNMPv1 and SNMPv2 users and communities. The com2sec token indicates the mapping from a source and community pair to a security name.
Faster and more usable wrappers are provided with the snmpd.conf file and are recognized by the SMA snmpd agent. These wrappers are defined using read write (rw) and read only (ro) syntax for users and communities, as follows:
rwuser
rouser
rwcommunity
rocommunity
The rwuser token entries specify the minimum allowed access that the user must specify:
User must specify the privacy password.
User can specify the privacy password if the user was created with a privacy password. Otherwise, the user must specify an authentication password.
User can specify either no password or an authentication password. Otherwise, the user can specify the privacy password if the user was created with a privacy password.
VACM information is contained in several parameters in the SNMPv3 packet string. These parameters are passed to the isAccessAllowed mechanism. The isAccessAllowed mechanism is the single entry point in VACM for checking whether access should be granted.
VACM parameters are as follows:
A single octet that indicates how to process the message. For more information, see Where USM Security Information Is Contained.
Indicates which security model was used at message generation, enabling the receiving entity to employ the appropriate model for security processing. You have a choice in SNMPv3 of using one security model or multiple security models.
An octet string containing data about the security model. The security model or models are determined in msgSecurityModel.
Contains the PDU. Shows the administratively unique selector of management information for processing the PDU. In other words, the scopedPDU contains the context and managed object OIDs. The scopedPDU contains the following fields:
Uniquely identifies an SNMP entity that can access an instance of a managed object within a context.
The name of the context to which the PDU data belongs. The contextName is unique.
The Protocol Data Unit (PDU) for SNMPv3 contains an operation for the data in the contextName. Identified by the combination of contextEngineID and the contextName.
For an explanation of the other fields of the SNMPv3 packet string, see SNMP Versions.
Figure 4-1 SNMPv3 Packet Format Showing Scopes of Authentication and Encryption
In determining whether access should be granted to a message, VACM uses four tables:
Each of these VACM tables handles a particular part of the access mechanism. Each table can be remotely configured using the VACM MIB. The VACM MIB is defined in RFC 3415 at http://www.ietf.org/rfc/rfc3415.txt.
The VACM determines whether a request that has been authenticated by the SMA's USM is authorized to access the MIB object that is contained in the request. The snmpvacm utility is an SNMP application for basic maintenance of an SNMP agent's VACM tables. You need to have write access to the snmpvacm MIB table to use the snmpvacm utility. For more information, see the snmpvacm(1M) man page.
This section describes each of the VACM tables, including how the tables are indexed and what each row contains.
The vacmContextTable table stores the contexts that are available locally. A context is the selector of management information. A single managed object can be in several different contexts. For example, consider a single module designed to monitor the status of a printer. For a network with several printers, multiple instances of this module can be implemented, with each instance containing a unique printer name. The printer name in this case is the context.
A single SNMP entity can have access to several contexts.
The vacmContextTable table is indexed by a contextName. Each of its rows gives the context name in the form of a unique, readable string, vacmcontextName.
The System Management Agent looks in the vacmContextTable for the contextName found in the scopedPDU. For information on the scopedPDU, see SNMP Versions. If the System Management Agent does not find the contextName of a particular message in the vacmContextTable, access is denied. In this case, a return value of noSuchContext is returned.
If the contextName exists, access checking continues, as shown in Figure 4-2. An example of typical entries in a vacmContextTable is shown in Example 4-1.
Example 4-1 Creating Typical Context Table Entries
Some typical vacmContextTable entries, created by a module, are:
SNMP-VIEW-BASED-ACM-MIB::vacmContextName."fileX" = STRING: fileX SNMP-VIEW-BASED-ACM-MIB::vacmContextName."fileY" = STRING: fileY
The contextNames in this example are fileX and fileY.
Contexts are further explained in the Solaris System Management Agent Developer’s Guide. To illustrate the concept of contexts, a demo module is supplied with the System Management Agent. This demo module shows the importance of contexts for implementing multiple instances of a module. For more information, see Implementing Multiple Instances of a Module in Solaris System Management Agent Developer’s Guide.
The vacmsecurityToGroupTable table stores group information. A group name is given to a group of users and is used when managing their access rights. A group contains SecurityModel and a SecurityName value pairs. The resulting pair can only map to at most one group. The vacmSecurityToGroupTable table is indexed by the following:
securityModel
securityName
Each of the rows in the vacmSecurityToGroupTable table contains the following:
An SNMPv3 security model, in this case USM. For further information on USM, see Using USM for Authentication and Message Privacy. By using the com2sec token, SNMPv1 and SNMPv2c security models can be used. For more information about the com2sec token, see the snmpd.conf(4) man page.
With USM, the vacmSecurityName is identical to userName. Represents a user in a format that is independent of the security model. By using the com2sec token, SNMPv1 and SNMPv2c security names can be used. For more information on the com2sec token, see the snmpd.conf(4) man page.
A readable string. Indicates the group that is associated with this entry.
The SecurityName is obtained by the msgSecurityModel specifier when a message is successfully authenticated and decrypted. The System Management Agent searches for this msgSecurityModel specifier and associated SecurityName in the vacmSecurityToGroupTable table. If the msgSecurityModel specifier and associated SecurityName are not found in the vacmSecurityToGroupTable, then access is denied. In this case, a return value of noSuchGroupName is returned.
If an entry is found, then the corresponding groupName is returned. Access checking continues, as shown in Figure 4-2.
Typical entries in a vacmsecurityToGroupTable are shown in Example 4-2.
Example 4-2 Creating Typical Security to Group Table Entries
Create a group for two previously created users that are named user2 and user5. In this example, the users are placed in a newly created group that is named grpnam1. Choose from one of two methods:
Add the following lines to the main /etc/sma/snmp/snmpd.conf configuration file:
group grpnam1 usm user2 group grpnam1 usm user5
If the group is created by adding to the main /etc/sma/snmp/snmpd.conf configuration file, then the entries that are created in the vacmsecurityToGroupTable table are as follows:
SNMP-VIEW-BASED-ACM-MIB::vacmGroupName.3."user2" = STRING: grpnam1 SNMP-VIEW-BASED-ACM-MIB::vacmGroupName.3."user5" = STRING: grpnam1 SNMP-VIEW-BASED-ACM-MIB::vacmSecurityToGroupStorageType.3."user2" = INTEGER: permanent(4) SNMP-VIEW-BASED-ACM-MIB::vacmSecurityToGroupStorageType.3."user5" = INTEGER: permanent(4) SNMP-VIEW-BASED-ACM-MIB::vacmSecurityToGroupStatus.3."user2" = INTEGER: active(1) SNMP-VIEW-BASED-ACM-MIB::vacmSecurityToGroupStatus.3."user5" = INTEGER: active(1)
Rebooting does not delete entries. To delete entries in this VACM table, use the snmpvacm deleteGroup command. This method works if the storage type is nonVolatile. For VACM table entries with other storage types, you must manually remove from the table entries from the main /etc/sma/snmp/snmpd.conf configuration file. If the group is created by editing the main /etc/sma/snmp/snmpd.conf configuration file, the vacmsecurityToGroupTable table entries can be deleted only by editing the main /etc/sma/snmp/snmpd.conf configuration file.
Use the snmpvacm command. For user2, a group can be created using the snmpvacm command as follows:
# snmpvacm -v3 -u myuser -a MD5 -A my_password -l authNoPriv localhost createSec2Group 3 user2 grpnam1
For user5, a group can be created using the snmpvacm command as follows:
# snmpvacm -v3 -u myuser -a MD5 -A my_password -l authNoPriv localhost createSec2Group 3 user5 grpnam1
The user myuser has rwuser level access. Therefore, group entries are created in this example as the myuser user where appropriate for the context. The users user2 and user5 do not have rights to update VACM tables.
The vacmViewTreeFamilyTable table stores all collections of view subtree families. These collections are called MIB views. A MIB view is an OID subtree value, which is the family name, together with a bitstring value, which is the family mask. The family mask identifies which sub-identifiers of the family name are in the MIB view. A mask is a list of hex octets, which separated by either “.” or “:” The default is “ff”.
In a MIB view, each view subtree family has a type. The type determines if the view subtree family is included in the MIB view. A managed object instance is contained within a MIB view only if both of these statements are true:
The managed object's OID contains the same number of sub-identifiers as the OID subtree, or more.
If the corresponding bit of the mask is not zero, each of the managed object's OID sub-identifiers match corresponding sub-identifiers in the OID subtree.
If the configured value of the mask is too short to check these statements, the value is implicitly extended by a series of ones. A view family subtree with a mask of zero bits therefore corresponds to a mask of all ones, which in turn corresponds to one MIB subtree.
The vacmViewTreeFamilyTable table is indexed by:
Specified by the access right selected in the vacmAccessTable table. Used for access checking.
The OID of the PDU is compared to the MIB view.
Each of the rows in the vacmViewTreeFamilyTable table contains:
The name of the MIB view.
OID subtree. The OID subtree couples with a mask to make MIB view subtrees.
Bitstring mask. The bitstring mask couples with an OID subtree to make MIB view subtrees.
The type determines whether the view subtree family is included in the MIB view.
If the MIB view does not contain the OID searched for, access is denied. In this case, a return value of notInView is returned. Otherwise, where the MIB view does contain the correct OID, access is granted. In this case a value of accessAllowed is returned.
The overall flow chart for this VACM algorithm is illustrated by Figure 4-2. In this diagram, the guideline terms suggested by the RFC are given for clarity:
Indicate who requires access.
Determines where access is granted.
Determines how access is granted.
Can be read, write or notify. Determines why a particular level of access is required by a group or user.
Indicates what type of management data is checked.
Combines with the object type to deliver which particular instance is checked to be in the MIB view. This decision is yes/no.
Figure 4-2 Overall Flow Chart for VACM
Example 4-3 shows typical entries in a vacmViewTreeFamilyTable.
Example 4-3 Creating Typical View Tree Family Table Entries
You can create a view in two ways:
You can create a view by adding the view to the main /etc/sma/snmp/ configuration file.
view all included .1 FF view none excluded .1 FF view vwnam1 included .1.3.6.1 FF
The “FF” here is the mask.
If the view is created by adding the group to the main /etc/sma/snmp/snmpd.conf configuration file, then the entries that are created in the vacmViewTreeFamilyTable table are as follows:
SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyMask."all".1.1 = STRING: "ÿ" SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyMask."none".1.1 = STRING: "ÿ" SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyMask."vwnam1".4.1.3.6.1 = STRING: "ÿ" SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyType."all".1.1 = INTEGER: included(1) SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyType."none".1.1 = INTEGER: excluded(2) SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyType."vwnam1".4.1.3.6.1 = INTEGER: included(1) SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyStorageType."all".1.1 = INTEGER: permanent(4) SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyStorageType."none".1.1 = INTEGER: permanent(4) SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyStorageType."vwnam1".4.1.3.6.1 = INTEGER: permanent(4) SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyStatus."all".1.1 = INTEGER: active(1) SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyStatus."none".1.1 = INTEGER: active(1) SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyStatus."vwnam1".4.1.3.6.1 = INTEGER: active(1)
You can create a view by using the snmpvacm command.
# snmpvacm -v3 -u myuser -a MD5 -A my_password -l authNoPriv -Ce localhost createView all .1 FF
# snmpvacm -v3 -u myuser -a MD5 -A my_password -l authNoPriv localhost createView none .1 FF
# snmpvacm -v3 -u myuser -a MD5 -A my_password -l authNoPriv localhost createView vwnam1 .1.3.6.1 FF
Here, the user myuser has rwuser level access. Therefore, view entries are created in this example for myuser, where appropriate for the context.
If the view is created by using the snmpvacm command, the storage type would be nonVolatile.
The vacmAccessTable table stores each group's access rights. Each group can have multiple access rights. The most secure access right is chosen. The vacmAccessTable table is indexed by:
Returned from the lookup into the vacmSecurityToGroupTable table.
The valid contextName matched within the vacmContextTable table.
Specified in the message's msgSecurityModel parameter.
Specified in the message's msgFlags parameter.
Each of the rows in the vacmAccessTable table contains:
The group's name. This group has one or multiple access rights.
The contextName must match the value of vacmAccessContextPrefix. See vacmAccessContextMatch.
Indicates the security model that must be used to get access rights.
If vacmAccessContextMatch is set to exact, then the contextName must exactly match the value of the vacmAccessContextPrefix object.
If vacmAccessContextMatch is set to prefix, the contextName can match the first several characters of the vacmAccessContextPrefix object. This contextName is the name already matched within the vacmContextTable table.
Indicates the lowest security level necessary for having access to this access right. For information about security levels, see Where VACM Security Information Is Contained.
Authorized MIB viewName for read access. If vacmAccessReadViewName is empty, no active view exists for read access.
Authorized MIB viewName for write access. If vacmAccessWriteViewName is empty, no active view exists for write access.
Authorized MIB viewName for notify access. If vacmAccessWriteViewName is empty, no active view exists for notify access.
If an access right is not found, access is denied. In this case, a return value of noAccessEntry is returned.
When an access right is selected, then the viewName indicated by that access right is selected. This viewName is determined by the PDU. If the SNMP operation in the PDU is a GETNEXT or GET operation, the vacmAccessReadViewName string is used. If the SNMP operation in the PDU is a TRAP operation, the vacmAccessNotifyViewName string is used. If the viewName is not configured, access is denied. In this case, a return value of noSuchView is returned.
If the access right is selected with a correctly configured viewName, access checking continues, as shown in Figure 4-2. Example 4-4 shows typical access table entries.
An additional example, Example 4-5, shows how to check that the users set up in this example and previous examples exist and are registered in VACM tables.
Example 4-4 Creating Typical Access Table Entries
You can create access table entries in two ways:
You can create an access table entry by adding the entry to the main /etc/sma/snmp/snmpd.conf configuration file:
access grpnam1 fileX usm priv exact all none none access grpnam1 "" usm auth exact all vwnam1 none
If the group is created by adding to the main /etc/sma/snmp/snmpd.conf configuration file, then the entries that are created in the vacmAccessTable table are as follows:
SNMP-VIEW-BASED-ACM-MIB::vacmAccessContextMatch. "grpnam1"."".3.authNoPriv = INTEGER: exact(1) SNMP-VIEW-BASED-ACM-MIB::vacmAccessContextMatch. "grpnam1"."fileX".3.authPriv = INTEGER: exact(1) SNMP-VIEW-BASED-ACM-MIB::vacmAccessReadViewName. "grpnam1"."".3.authNoPriv = STRING: all SNMP-VIEW-BASED-ACM-MIB::vacmAccessReadViewName. "grpnam1"."fileX".3.authPriv = STRING: all SNMP-VIEW-BASED-ACM-MIB::vacmAccessWriteViewName. "grpnam1"."".3.authNoPriv = STRING: vwnam1 SNMP-VIEW-BASED-ACM-MIB::vacmAccessWriteViewName. "grpnam1"."fileX".3.authPriv = STRING: none SNMP-VIEW-BASED-ACM-MIB::vacmAccessNotifyViewName. "grpnam1"."".3.authNoPriv = STRING: none SNMP-VIEW-BASED-ACM-MIB::vacmAccessNotifyViewName. "grpnam1"."fileX".3.authPriv = STRING: none SNMP-VIEW-BASED-ACM-MIB::vacmAccessStorageType. "grpnam1"."".3.authNoPriv = INTEGER: permanent(4) SNMP-VIEW-BASED-ACM-MIB::vacmAccessStorageType. "grpnam1"."fileX".3.authPriv = INTEGER: permanent(4) SNMP-VIEW-BASED-ACM-MIB::vacmAccessStatus. "grpnam1"."".3.authNoPriv = INTEGER: active(1) SNMP-VIEW-BASED-ACM-MIB::vacmAccessStatus. "grpnam1"."fileX".3.authPriv = INTEGER: active(1)
If the group was created by directly editing the main /etc/sma/snmp/snmpd.conf configuration file, the group's storage type would be permanent.
Alternatively, you can create an access table entry by using the snmpvacm command:
# snmpvacm -v3 -u myuser -a MD5 -A my_password -l authNoPriv localhost createAccess grpnam1 "fileX" 3 3 1 all none none
Here, the user myuser has rwuser level access. Therefore, access entries are created in this example as this myuser user where appropriate for the context.
# snmpvacm -v3 -u myuser -a MD5 -A my_password -l authNoPriv localhost createAccess grpnam1 "" 3 2 1 all vwnam1 none
If the group is created by use of the snmpvacm command, then the storage type would be nonvolatile. Objects created by use of either the snmpvacm or snmpusm commands have storage type of nonvolatile.
Example 4-5 Checking That Users Exist in the VACM Tables
Using the information in Example 4-3 and Example 4-4, check that the SNMPv3 user, user2, created in Example 4-2, exists. Validate the access entries already created for user2, by checking and setting values for the user. Use the snmpget and snmpset commands, once with encryption and once with no encryption. This method illustrates that the access entry for user2 is the minimum security level required, defined as auth= 2. The method also illustrates that priv can be used as well, since that level is more secure.
Use the snmpget command to check that the new user exists, with the DES option set for encryption. A context, -n fileX, is specified:
# snmpget -v3 -u user2 -a MD5 -A my_password -l authPriv -x DES -X my_password -n fileX localhost 1.3.6.1.4.1.42.2.2.4.4.6.1.1.0
This command validates one of the access entries that you set up for user2. The options that are associated with use of the snmpget command are described in the snmpcmd(1M) man page.
The snmpget command retrieves the following information:
SNMPv2-SMI::enterprises.42.2.2.4.4.6.1.1.0 = INTEGER: 111
In this returned output, 111 is an integer that is stored in the specified OID.
Similarly, snmpget command can be used to check that the new user exists, without the DES option set. If you do not set the DES option, no encryption is requested. This example shows that the user, user2, can execute an operation not in a context:
# snmpget -v3 -u user2 -a MD5 -A my_password -l authNoPriv localhost 1.3.6.1.2.1.1.3.0
The snmpget command retrieves the following information about system uptime:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (5375) 0:00:53.75
Try to set a new value for sysLocation:
# snmpset -v3 -u user2 -a MD5 -A my_password -l authPriv -x DES -X my_password localhost 1.3.6.1.2.1.1.6.0 s "new val"
In this command, the s indicates “string”. The OID is sysLocation. The value being added to the sysLocation is new val.
Note that user2 has full access rights to the context (authPriv) for DES. The password is my_password. The following is returned:
SNMPv2-MIB::sysLocation.0 = STRING: new val
Confirm these settings with the snmpget command:
# snmpget -v3 -u user2 -a MD5 -A my_password -l authPriv -x DES -X my_password localhost 1.3.6.1.2.1.1.6.0
SNMPv2-MIB::sysLocation.0 = STRING: new val
Try the same command without the DES encryption set:
# snmpset -v3 -u user2 -a MD5 -A my_password -l authNoPriv localhost 1.3.6.1.2.1.1.6.0 s "new val2"
The same result is successfully returned:
SNMPv2-MIB::sysLocation.0 = STRING: new val2
# snmpget -v3 -u user2 -a MD5 -A my_password -l authNoPriv localhost 1.3.6.1.2.1.1.6.0
SNMPv2-MIB::sysLocation.0 = STRING: new val2
This output shows that the user has write access to MIB-II.
If user2 has been defined in the snmptrapd.conf file, then start the SNMP trap daemon using the snmptrapd command:
# /usr/sfw/sbin/snmptrapd
Also, use the snmpinform command to send an INFORM-PDU trap. The snmpinform command validates that the user, user2 or user2, can generate notifications. Notifications can be generated if you perform a cold start. A cold start generates a notification, or a “trap.” The user can see this trap in the /var/log/snmpd.log file.
# /usr/sfw/sbin/snmpinform -v3 -u user2 -a MD5 -A my_password -l authNoPriv localhost 42 coldStart.0
For more information, see the snmptrapd.conf(4) and snmpinform(1M) man pages.
When creating VACM table entries, ensure that you configure access rights correctly for your users and user groups. Incorrectly configured access rights can lead to access being denied to key users.
Avoid creating large numbers of groups of users. Large numbers of groups can be difficult to administrate. Troubleshooting problems when you have created very large numbers of different user groups can become unmanageable.
When working with VACM tables, return values can include the following messages:
This value is returned if the System Management Agent does not find the contextName of a particular message in the vacmContextTable. Access is denied. Check the context table entries. Ensure that these entries are correctly configured. Has each user got a context? For more information, see Context Table.
This value is returned if the msgSecurityModel specifier and associated SecurityName are not found in the vacmSecurityToGroupTable. Access is denied. Check the security to group table entries. Ensure that these entries are correctly configured. Has each user got a group name? Have users been entered into the table correctly? For more information, see Security to Group Table.
This value is returned if the MIB view does not contain the OID searched for. Access is denied. For more information, see View Tree Family Table.
This value is returned if an access right is not found. Access is denied. Have you correctly set up the mask? Although each group can have multiple access rights, only the most secure access right is selected.
Is the vacmAccessContextMatch parameter set to exact? If the vacmAccessContextMatch parameter is set to exact, the contextName must be an exact match. Try setting the vacmAccessContextMatch value to prefix if appropriate. For more information, see Access Table.
Note - Badly configured VACM tables can subject the network to unauthorized, possibly malicious access. Ensure that you check your VACM table configurations in a test environment before implementing these configurations on your network devices.
For more information on VACM, see RFC 3415 at http://www.ietf.org/rfc/rfc3415.txt.
The MIB definitions for VACM can be found at /etc/sma/snmp/mibs/SNMP-VIEW-BASED-ACM-MIB.txt.