This section assumes that you have an adequate understanding of the NIS+ security system in general, and in particular of the role that credentials play in that system (see the Security chapter for this information)
This section provides the following general information about credentials.
This section then describes how to use the NIS+ credential administration commands to perform the following tasks.
This section describes how the credential and authentication process works.
The credential/authentication system prevents someone from assuming some other user's identity. That is, it prevents someone with root privileges on one machine from using the su command to assume the identity of a second user who is either not logged in at all or logged in on another machine and then accessing NIS+ objects with the second user's NIS+ access privileges.
Note: NIS+ cannot prevent someone who knows another user's login password from assuming that other user's identity and the other user's NIS+ access privileges, nor can NIS+ prevent a user with root privileges from assuming the identity of another user who is currently logged in on the same machine.
See Security for a description of how NIS+ credentials and authentication work with authorization and access rights to provide security for the NIS+ namespace.
To understand how DES credentials are created and how they work, you need to distinguish between the credential itself and the information that is used to create and verify it.
For the credential/authentication process to work, the following components must be in place:
There are three phases to the authorization process:
These three phases are described in detail in the following subsections.
Prior to an NIS+ principal logging in, an NIS+ administrator must create DES credential information for that principal (user or machine). (The easiest way for an NIS+ adminstrator to create credential information for users is to use the nisclient script as described in the nisclient command description.) The administrator must:
When a principal logs into the system the following steps are automatically performed:
Attention: When a principal's login password is different from his or her Secure RPC password, keylogin cannot decrypt it and the user starts getting "cannot decrypt" errors or the command fails without a message. For a discussion of this problem, see Secure RPC Password versus Login Password Problem.
Note: The decrypted private key remains stored for use by the keyserver until the user does an explicit keylogout. If the user simply logs out (or goes home for the day without logging out), the decrypted private key remains stored in the server. If someone with root privileges on a user's machine switched to the user's login ID, that person would then have use of the user's decrypted private key and could access NIS+ objects using the user's access authorization. Thus, for added security, users should be cautioned to perform an explicit keylogout when they cease work. If they also log out of the system, all they need do is log back in when they return.
Every time a NIS+ principal requests access to an NIS+ object, the NIS+ software performs a multistep process to authenticate that principal:
NIS+ gets the user's DES credential from the cred table of the user's home domain. The encrypted private key is decrypted with the user's password and saved by the keyserver.
If the time stamp is within the window limit, the server checks to see if the time stamp is greater than the one previously received from the principal. This ensures that NIS+ requests are handled in the correct order.
Requests that have a time stamp equal to the previous one are rejected with an error message. This ensures that a replayed request is not acted on twice. For example, if the time stamp is 9:00am and the most recently received request from this principal also had a time stamp of 9:00am, this request would be rejected.
If the time stamp is within the window limit, and greater than the previous request from that principal, the server accepts the request.
The DES credential consists of:
This portion of the credential is used to identify the NIS+ principal. (Remember that an NIS+ principal name always has a trailing dot, while a Secure RPC netname never does.) Every Secure RPC netname contains three components:
Principal | Prefix | Identifier | Domain | Example |
---|---|---|---|---|
User | unix | UID | Domain containing user's password entry and the DES credential itself | unix.24601@sales.wiz.com |
Workstation | unix | hostname | The domain name returned by executing the domainname command on that workstation | unix.machine7@sales.wiz.com |
The verification field is used to make sure the credential is not forged. It is generated from the credential information stored in the cred table.
The verification field is composed of:
To generate its DES credential, the principal depends on the keylogin command, which must have been executed before the principal tries to generate its credential. The keylogin command (often referred to simply as a keylogin) is executed automatically when an NIS+ principal logs in.
Note: If the principal's login password is different from the principal's Secure RPC password, a successful keylogin cannot be performed. See Secure RPC Password versus Login Password Problem for a discussion of this situation.
The purpose of the keylogin is to give the principal access to the principal's private key. keylogin fetches the principal's private key from the cred table, decrypts it with the principal's Secure RPC password (remember that the private key was originally encrypted with the principal's Secure RPC password), and stores it locally with the keyserver for future NIS+ requests.
See figure for more information.To generate its DES credential, the principal still needs the public key of the server to which it will send the request. This information is stored in the principal's directory object. Once the principal has this information, it can form the verification field of the credential.
First, the principal generates a random DES key for encrypting various credential information. The principal uses its own private key (stored in the keyserver) and the server's public key to generate a common key that is used to generate and encrypt the random DES key. It then generates a time stamp that is encrypted with the DES key and combines it with other credential-related information into the verification field. See figure for more information.
When a principal's login password is different from his or her Secure RPC password, keylogin cannot decrypt it at login time because keylogin defaults to using the principal's login password, and the private key was encrypted using the principal's Secure RPC password.
When this occurs, the principal can log in to the system, but for NIS+ purposes the principal is placed in the authorization class of nobody because the keyserver does not have a decrypted private key for that user. Since most NIS+ environments are set up to deny the nobody class create, destroy, and modify rights to most NIS+ objects, this results in "permission denied" errors when the user tries to access NIS+ objects.
To be placed in one of the other authorization classes, a user in this situation must explicitly run the keylogin program and give the principal's Secure RPC password when keylogin prompts for a password. (Note that in this context, network password is sometimes used as a synonym for Secure RPC password. When prompted for your network password, type your Secure RPC password.) (See the keylogin section.)
But an explicit keylogin provides only a temporary solution that is good only for the current login session. The keyserver now has a decrypted private key for the user, but the private key in the user's cred table is still encrypted using the user's Secure RPC password, which is different than the user's login password. The next time the user logs in, the same problem recurs. To permanently solve the problem the user needs to re-encrypt the private key in the cred table to one based on the user's login ID rather than the user's Secure RPC password. To do this, the user needs to run chkey -p as described in Changing Keys for a NIS+ Principal.
Thus, to permanently solve problems related to a difference in Secure RPC password and login password, the user (or an administrator acting for the user) must perform these steps:
Occasionally, you may find that even though you have created the proper credentials and assigned the proper access rights, some principal requests still get denied. The most common cause of this problem is the existence of stale objects with old versions of a server's public key. You can usually correct this problem by:
This section describes where credential-related information is stored throughout the NIS+ namespace.
Credential-related information, such as public keys, is stored in many locations throughout the namespace. NIS+ updates this information periodically, depending on the time-to-live values of the objects that store it, but sometimes, between updates, it gets out of sync. As a result, you may find that operations that should work, do not. The following table lists all the objects, tables, and files that store credential-related information and how to reset it.
Credential information for principals is stored in a cred table. The cred table is one of the standard NIS+ tables. Each domain has one cred table, which stores the credential information of client workstations that belong to that domain and client users who are allowed to log into them. (In other words, the principals of that domain.) The cred tables are located in their domains' org_dir subdirectory.
Attention: Never link a cred table. NIS+ does not operate correctly with linked cred tables. Each org_dir directory should have its own cred table. Do not use a link to some other org_dir cred table.
For users, the cred table stores LOCAL credential information for all users who are allowed to log into any of the machines in the domain. The cred table also stores DES credential information for those users that have the domain as their home domain.
You can view the contents of a cred table with the niscat command, described in Administering NIS+ Tables.
The cred table, as shown in the following table, has five columns:
The Authentication Type column, determines the types of values found in the other four columns.
There are several methods of creating and administering credential information:
When used to create LOCAL credential information, nisaddcred simply extracts the principal user's UID (and GID) from the principal's login record and places it in the domain's cred table.
When used to create DES credential information, nisaddcred goes through a two-part process:
To encrypt the private key, nisaddcred needs the principal's Secure RPC password. When the nisaddcred command is invoked with the des argument, it prompts the principal for a Secure RPC password. Normally, this password is the same as the principal's login password. (If it is different, the user will have to perform additional steps when logging in, as described in Secure RPC Password versus Login Password Problem.)
The nisaddcred command generates a pair of random, but mathematically related 192-bit authentication keys using the Diffie-Hellman cryptography scheme. These keys are called the Diffie-Hellman key-pair, or simply key-pair for short.
One of these is the private key, and the other is the public key. The public key is placed in the public data field of the cred table. The private key is placed in the private data field, but only after being encrypted with the principal's Secure RPC password. See figure.
The principal's private key is encrypted as a security precaution because the cred table, by default, is readable by all NIS+ principals, even unauthenticated ones.
When creating credential information, you will often have to enter a principal's SecureRPC-netname and principal-name. Each has its own syntax:
If a Secure RPC netname identifies a user, it requires the user's UID. If it identifies a workstation, it requires the workstation's host name. (When used with the nisaddcred command it is always preceded by the -p (lowercase) flag.)
A Secure RPC netname always begins with the unix (all lowercase) prefix and ends with a domain name. However, because it follows the Secure RPC protocol, the domain name does not contain a trailing dot.
Whether it identifies a client user or a client workstation, it begins with the principal's name, followed by a dot and the complete domain name, ending in a dot. (When used with nisaddcred to create credential information, it is always preceded by the -P (uppercase) flag. When used to remove credential information, it does not use the -P flag.)
When a namespace is first set up, credential information is created first for the administrators who will support the domain. Once they have credential information, they can create credential information for other administrators, client workstations, and client users.
When you try to create your own credential information, you run into a problem of circularity: you cannot create your own credential information unless you have Create rights to your domain's cred table, but if the NIS+ environment is properly set up, you cannot have such rights until you have credentials. You have to step out of the loop somehow. You can do this in one of two ways:
In either case, your credential information is thus created by another NIS+ principal. To create your own credential information, follow the instructions in Creating Credential Information for NIS+ Principals.
Credential information for NIS+ principals can be created any time after their domain has been set up; in other words, once a cred table exists.
To create credential information for an NIS+ principal:
Once those conditions are met, you can use the nisaddcred command with both the -p and -P options:
For LOCAL credentials:
nisaddcred -p uid -P principal-name local
For DES credentials:
nisaddcred -p SecureRPC-netname -P principal-name des
Remember these principles:
The following example creates both LOCAL and DES credential information for an NIS+ user named morena who has a UID of 11177. She belongs to the sales.wiz.com. domain, so this example enters her credential information from a principal machine of that domain:
salesclient# nisaddcred -p 11177 -P morena.sales.wiz.com. local salesclient# nisaddcred -p unix.11177@sales.wiz.com -P morena.sales.wiz.com. des Adding key pair for unix.11177@sales.wiz.com (morena.sales.wiz.com.). Enter login password:
The proper response to the Enter login password: prompt is morena's login password. If you do not know her login password, you can use a dummy password that she can later change using chkey. The following table shows how another administrator, whose credential information you create using a dummy password, can then use chkey to change his or her own password. In this example, you create credential information for an administrator named eiji who has a UID of 119. eiji belongs to the root domain, so you would enter his credential information from the root master server which is named rmaster.
First, you would create eiji's credential information in the usual way, but using a dummy login password. NIS+ would warn you and ask you to re-type it. When you did, the operation would be complete. The domain's cred table would contain eiji's credential information based on the dummy password. The domain's passwd table (or /etc/passwd file), however, would still have his login password entry so that he can log on to the system.
Then, eiji would log in to the domain's master server, typing his correct login password (since the login procedure checks the password entry in the passwd table or /etc/passwd file). From there, eiji would first run keylogin, using the dummy password (since a keylogin checks the cred table), and then use the chkey -p command to change the cred entry to the real thing.
The two previous examples created credential information for a principal user while the principal user was logged in to the master server of the principal's home domain. However, if you have the proper access rights, you can create credential information in another domain. Simply append the domain name to this syntax:
For LOCAL credentials:
nisaddcred -p uid -P principal-name local domain-name
For DES credentials:
nisaddcred -p SecureRPC-netname -P principal-name des domain-name
The following example first creates LOCAL and DES credential information for an administrator named chou in her home domain, which happens to be the root domain, then adds her LOCAL credential information to the sales.wiz.com domain. chou's UID is 11155. This command is typed on from the root master server. For simplicity, it assumes you are entering chou's correct login password.
rmaster# nisaddcred -p 11155 -P chou.wiz.com. local rmaster# nisaddcred -p unix.11155@wiz.com -P chou.wiz.com. des Adding key pair for unix.11155@wiz.com (chou.wiz.com.). Enter login password: rmaster# nisaddcred -p 11155 -P chou.wiz.com. local sales.wiz.com.
LOCAL credential information maps a UID to an NIS+ principal name. Although an NIS+ principal that is a client user can have different user IDs in different domains, it can have only one NIS+ principal name. So, if an NIS+ principal such as chou will be logging in from a domain other than her home domain, not only should she have a password entry in that domain, but also a LOCAL credential in that domain's cred table.
This example creates credential information for a principal workstation. Its host name is starshine1 and it belongs to the root domain. Therefore, its credential information is created from the root master server. In this example, you create them while logged in as root to the root master; however, if you already have valid credential information and the proper access rights, you could create them while logged in as yourself.
rmaster# nisaddcred -p unix.starshine1@wiz.com -P starshine1.wiz.com. des Adding key pair for unix.starshine1@wiz.com (starshine1.wiz.com.). Enter starshine1.wiz.com.'s root login password: Retype password:
The proper response to the password prompt is the principal workstation's superuser password. Of course, you could use a dummy password that would later be changed by someone logged in as superuser to that principal workstation.
The following sections describe how to use the nisaddcred command to administer existing credential information. You must have create, modify, read, and destroy rights to the cred table to perform these operations.
Updating your own credential information is considerably easier than creating it. Just type the simple versions of the nisaddcred command while logged in as yourself:
# nisaddcred des # nisaddcred local
To update credential information for someone else, you simply perform the same procedure that you would use to create that person's credential information.
The nisaddcred command removes a principal's credential information, but only from the local domain where the command is run.
Thus, to completely remove a principal from the entire system, you must explicitly remove that principal's credential information from the principal's home domain and all domains where the principal has LOCAL credential information.
To remove credential information, you must have modify rights to the local domain's cred table. Use the -r option and specify the principal with a full NIS+ principal name:
# nisaddcred -r principal-name
The following two examples remove the LOCAL and DES credential information of the administrator morena.wiz.com. The first example removes both types of credential information from her home domain (wiz.com.), the second removes her LOCAL credential information from the sales.wiz.com. domain. Note how they are each entered from the appropriate domain's master servers.
rmaster# nisaddcred -r morena.wiz.com. salesmaster# nisaddcred -r morena.wiz.com.
To verify that the credential information was indeed removed, run nismatch on the cred table, as shown below. For more information about nismatch, see Administering NIS+ Tables.
rmaster# nismatch morena.wiz.com. cred.org_dir salesmaster# nismatch morena.wiz.com. cred.org_dir