包含在查找更多文档专项支持资源 | 以 PDF 格式下载本书 (647 KB)
Chapter 4 Managing SecurityThis chapter provides background information, practical procedures, and examples related to security within the System Management Agent. With its SNMPv3 features, the System Management Agent provides an enhanced and configurable level of security for the management of users and network devices. This chapter contains information on the following topics: Security OverviewThe System Management Agent supports SNMPv1, SNMPv2c and SNMPv3. The SNMPv1 and SNMPv2c authentication service is based on community strings defined on the management station. The SNMPv3 authentication service is based on users. Each request must contain either a community name or a user name depending upon the protocol being used. The SNMPv3 authentication process implements the User-based Security Model (USM) to obtain a security name and security level from a user name. Similarly, both SNMPv1 and SNMPv2c determine the security level from the community string. The security name and security level are then used together with a context string, a group name and a view name to perform access control. Access control is done through the View-based Access Control Model, (VACM). This access control model is used after the authentication process. So, while USM is designed and used for authentication, VACM is designed and used for authorization. For information about the supported versions of SNMP within the System Management Agent, see SNMP Versions. Using USM for Authentication and Message PrivacyThe User-based Security Model (USM) is used by the System Management Agent for authentication, encryption, and decryption of SNMPv3 packets. USM is used for the following reasons:
The snmpusm utility is an SNMP application for basic maintenance of an SNMP agent's USM table. You must have write access to the usmUserTable MIB table. For more information, see the snmpusm(1M) man page. Note – The snmpusm subcommands are not supported for v1 or v2c versions of SNMP. Without proxying, only SNMPv3 users can execute these commands. The agent enables you to manage user entries through the main snmpd.conf configuration file and by use of the snmpusm command, through the USM MIB. The USM MIB enables the System Management Agent to find information about the user, including whether the user exists. Every request from a user is checked against the USM MIB. If the user exists, the USM MIB checks the following permissions:
The USM MIB uses the local store key to compute a new digest that is based upon the authentication protocol specified by a particular user in the MIB. The computed digest is compared to the digest saved from the incoming packet. If the digests are the same, the user is authenticated. For more information on message digests, see Authentication Protocol Algorithms. The following list describes the USM settings:
Authentication uses a secret key to generate a MAC (Message Authentication Code) stored in msgAuthenticationParameters, which is part of usmSecurityParameters. Both the sending and receiving entities use the same secret key to produce the MAC. The message is therefore authenticated if both the sending and receiving MACs match. Authentication Protocol AlgorithmsIn USM as implemented by the System Management Agent, two authentication protocols are supported. These authentication protocols are described in the following list.
For the System Management Agent, the default authentication protocol is HMAC-MD5–96. Setting is auth proto = MD5. Message PrivacyUSM supports privacy of messages. USM uses the CBC-DES Symmetric Encryption Protocol for encrypting and decrypting SNMPv3 packets. In the same way as with authentication, the same secret privacy key is used to encrypt and decrypt messages on both sides. Only the data portion is encrypted. The auth flag must be enabled and the security level must have privacy enabled to use encryption. Only the scopedPDU is encrypted. For more information, see Where USM Security Information Is Contained. Currently, DES encryption is supported on the Solaris OS. DES encryption uses 56–bit key encryption. This level is the highest encryption level currently supported for DES, in this release of the Solaris software. Public KeysThe System Management Agent supports Public Key Cryptography Standard (PKCS) #11. This token interface standard defines the interface that is used for communication between SSL and PKCS #11 modules. The version of PKCS on which the PKCS library compiled with the System Management Agent is based is the PKCS#11 v2.11 standard. As described in Authentication Protocol Algorithms, the SHA1 algorithm is supported in addition to MD5. If the PKCS library is not found on your system, then the SMA attempts to use the standard Net-SNMP internal MD5, without DES support. Where USM Security Information Is ContainedIn an SNMPv3 packet string, USM information is contained in the following flags:
The MIB definitions for USM can be found at /etc/sma/snmp/mibs/SNMP-USER-BASED-SM-MIB.txt. For more information about USM, see RFC 3414 at http://www.ietf.org/rfc/rfc3414.txt. Using VACM for Access ControlYou 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:
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:
The rwuser token entries specify the minimum allowed access that the user must specify:
Where VACM Security Information Is ContainedVACM 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:
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
Understanding VACM TablesIn 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. Context TableThe 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 EntriesSome typical vacmContextTable entries, created by a module, are:
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. Security to Group TableThe 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:
Each of the rows in the vacmSecurityToGroupTable table contains the following:
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 EntriesCreate 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:
View Tree Family TableThe 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:
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:
Each of the rows in the vacmViewTreeFamilyTable table contains:
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:
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 EntriesYou can create a view in two ways:
Access TableThe 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:
Each of the rows in the vacmAccessTable table contains:
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 EntriesYou can create access table entries in two ways:
Example 4–5 Checking That Users Exist in the VACM TablesUsing 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:
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:
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:
The snmpget command retrieves the following information about system uptime:
Try to set a new value for sysLocation:
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:
Confirm these settings with the snmpget command:
Try the same command without the DES encryption set:
The same result is successfully returned:
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:
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.
For more information, see the snmptrapd.conf(4) and snmpinform(1M) man pages. Troubleshooting Problems With VACM TablesWhen 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:
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. Creating and Managing UsersThis section provides procedures that explain how to create users with security. Several methods are available to create users in the System Management Agent. After you first install the System Management Agent, the default configuration is for new users to be SNMPv1 and SNMPv2c users. Note – The agent is not configured to create SNMPv3 users by default. To create SNMPv3 users in the System Management Agent, first you need to edit the main /etc/sma/snmp/snmpd.conf file. For more information, see the snmpd.conf(4) man page. The first procedure in this section, To Create a New SNMPv3 User, shows you how to create the first, initial new user. Additional users are cloned from this initial user, so that the initial user's authentication and security types can be inherited. These types can be changed later. In cloning, secret key data for the user is set. You must know the passwords for the initial user and later users that you set up. You can only clone one user at a time from the initial user that you set up.
|
# svcadm disable -t svc:/application/management/sma:default |
To create the new user, use the net-snmp-config command.
# /usr/sfw/bin/net-snmp-config --create-snmpv3-user -a "my_password" newuser |
This command causes a new user to be created, named newuser, with a password equal to my_password. The new user creation uses both MD5 and DES, which are described in Authentication Protocol Algorithms.
By default, when creating a user using the net-snmp-config command, these settings are created unless otherwise specified:
auth protocol = MD5security level = rwuser auth
Start the System Management Agent.
# svcadm enable svc:/application/management/sma:default |
Check whether the new user exists.
# snmpget -v 3 -u newuser -l authNoPriv -a MD5 -A my_password localhost sysUpTime.0 |
Passwords must contain at least eight characters.
Giving the new user read and write access is not always useful. If you want to reduce or change the access rights of the new user, edit the /etc/sma/snmp/snmpd.conf file. For more information, see the snmpd.conf(4) man page.
Stop the System Management Agent.
# svcadm disable -t svc:/application/management/sma:default |
To create the new user, named newuser, with a password equal to my_password, use the net-snmp-config command interactively.
# /usr/sfw/bin/net-snmp-config --create-snmpv3-user |
Enter a SNMPv3 user name to create: |
Provide the appropriate user name, in this case:
newuser |
Enter authentication pass-phrase: |
Type the appropriate pass-phrase, in this case:
my_password |
Enter encryption pass-phrase: |
To reuse the authentication pass-phrase, press Return.
adding the following line to /var/sma_snmp/snmpd.conf: createUser newuser MD5 "newuser_pass" DES adding the following line to /etc/sma/snmp/snmpd.conf: rwuser newuser |
By default, when creating a user using the net-snmp-config command, these settings are created unless otherwise specified:
auth protocol = MD5
security level = rwuser auth
Start the System Management Agent.
# svcadm enable svc:/application/management/sma:default |
Check whether the new user exists.
# snmpget -v 3 -u newuser -l authNoPriv -a MD5 -A my_password localhost sysUpTime.0 |
Passwords must contain at least eight characters.
Giving the new user read and write access is not always useful. If you want to reduce or change the access rights of the new user, edit the /etc/sma/snmp/snmpd.conf file. For more information, see the snmpd.conf(4) man page.
The preferred method of creating a new user in secure SNMP is to clone the initial user that you originally set up. This procedure copies the user you set up in To Create a New SNMPv3 User. This procedure uses the snmpusm command described in Using USM for Authentication and Message Privacy. For more information, see the snmpusm(1M) man page.
Check whether the System Management Agent is running.
# svcs svc:/application/management/sma:default |
If the agent is not running, start it.
# svcadm enable svc:/application/management/sma:default |
Create a new user using the snmpusm command.
# snmpusm -v 3 -u newuser -a MD5 -A my_password -l authNoPriv localhost create lee newuser |
This command creates a user named “lee”. This new user has the same password my_password, as the source user, named “newuser”, that you created in To Create a New SNMPv3 User.
Change the new user's password.
# snmpusm -v 3 -u lee -a MD5 -A my_password -l authNoPriv localhost passwd my_password lee_password |
This command gives the user lee a new password, lee_password. The default auth type is MD5.
Create associated VACM entries either by directly editing the /etc/sma/snmp/snmpd.conf file or by using the snmpvacm command.
If you are directly editing the snmpd.conf file you must first temporarily stop the agent.
# svcadm disable -t svc:/application/management/sma:default |
Assign access to lee.
To give lee read and write access, add a new rwuser line to the snmpd.conf file.
rwuser lee |
To give lee read-only access, add a new rouser line to the snmpd.conf file.
rouser lee |
If you do not specify a security level, the System Management Agent defaults to authNoPriv. For more information, see the snmpd.conf(4) or snmpvacm(1M) man pages.
Start the System Management Agent.
# svcadm enable svc:/application/management/sma:default |
Check whether this procedure has been successful.
Check whether your new user exists.
# snmget -v 3 -u lee -a MD5 -A lee_password -l authNoPriv localhost sysUpTime.0 |
For SNMPv1 and SNMPv2c users, community string is used for security. The standard Net-SNMP token, com2sec, is provided with the SMA. The com2sec token enables you to map a host name and community string pair, for SNMPv1 or SNMPv2c, to a security name. In this case, the security level is noAuthNoPriv. For information on the noAuthNoPriv security level and on other security levels, see Where USM Security Information Is Contained.
In the System Management Agent, proxying is supported for SNMPv1 and SNMPv2c users only. For more information, see Proxy Handling for Solstice Enterprise Agents Requests.
Creating a large number of groups in SNMP causes management and administration of these groups to become very complex. If you create a large number of groups, troubleshooting these groups very difficult.
When groups or views are created by editing the snmpd.conf file, the storage type is permanent. If you edit the snmpd.conf file instead of using the snmpvacm command, entries for groups are permanent. You can delete the entries only by removing them from the snmpd.conf file.
Follow the examples provided in Using VACM for Access Control for creating and managing groups.