包含在查找更多文档专项支持资源 | 以 PDF 格式下载本书 (4851 KB)
Chapter 26 Using Kerberos Applications (Tasks)This chapter is intended for anyone on a system with the Kerberos service configured on it. This chapter explains how to use the “Kerberized” commands and services that are provided. You should already be familiar with these commands (in their non-Kerberized versions) before you read about them here. Because this chapter is intended for the general reader, it includes information on tickets: obtaining, viewing, and destroying them. This chapter also includes information on choosing or changing a Kerberos password. This is a list of the information in this chapter: For an overview of the Solaris Kerberos product, see Chapter 21, Introduction to the Kerberos Service. Kerberos Ticket ManagementThis section explains how to obtain, view, and destroy tickets. For an introduction to tickets, see How the Kerberos Service Works. Do You Need to Worry About Tickets?With any of the SEAM releases or the Solaris 10 release installed, Kerberos is built into the login command, and you will obtain tickets automatically when you log in. The Kerberized commands rsh, rcp, rdist, telnet, and rlogin are usually set up to forward copies of your tickets to the other machines, so you don't have to explicitly ask for tickets to get access to those machines. Your configuration might not include this automatic forwarding, but it is the default behavior. See Overview of Kerberized Commands and Forwarding Kerberos Tickets for more information on forwarding tickets. For information on ticket lifetimes, see Ticket Lifetimes. Creating a Kerberos TicketNormally, if PAM is configured properly, a ticket is created automatically when you log in, and you need not do anything special to obtain a ticket. However, you might need to create a ticket if your ticket expires. Also, you might need to use a different principal besides your default principal, for example, if you use rlogin -l to log in to a machine as someone else. To create a ticket, use the kinit command.
The kinit command prompts you for your password. For the full syntax of the kinit command, see the kinit(1) man page. Example 26–1 Creating a Kerberos TicketThis example shows a user, jennifer, creating a ticket on her own system.
Here, the user david creates a ticket that is valid for three hours with the -l option.
This example shows the user david creating a forwardable ticket (with the -f option) for himself. With this forwardable ticket, he can, for example, log in to a second system, and then telnet to a third system.
For more information on how forwarding tickets works, see Forwarding Kerberos Tickets and Types of Tickets. Viewing Kerberos TicketsNot all tickets are alike. One ticket might, for example, be forwardable. Another ticket might be postdated. While a third ticket might be both forwardable and postdated. You can see which tickets you have, and what their attributes are, by using the klist command with the -f option:
The following symbols indicate the attributes that are associated with each ticket, as displayed by klist:
Types of Tickets describes the various attributes that a ticket can have. Example 26–2 Viewing Kerberos TicketsThis example shows that the user jennifer has an initial ticket, which is forwardable (F) and postdated (d), but not yet validated (i).
The following example shows that the user david has two tickets that were forwarded (f) to his host from another host. The tickets are also forwardable (F).
The following example shows how to display the encryption types of the session key and the ticket by using the -e option. The -a option is used to map the host address to a host name if the name service can do the conversion.
Destroying Kerberos TicketsIf you want to destroy all Kerberos tickets acquired during your current session, use the kdestroy command. The command destroys you credential cache, which destroys all your credentials and tickets. While this is not usually necessary, running kdestroy reduces the chance of the credential cache being compromised during times that you are not logged in. To destroy your tickets, use the kdestroy command.
The kdestroy command destroys all your tickets. You cannot use this command to selectively destroy a particular ticket. If you are going to be away from your system and are concerned about an intruder using your permissions, you should use either kdestroy or a screen saver that locks the screen. Kerberos Password ManagementWith the Kerberos service configured, you now have two passwords: your regular Solaris password and a Kerberos password. You can make both passwords the same, or they can be different. Advice on Choosing a PasswordYour password can include almost any character that you can type. The main exceptions are the Control keys and the Return key. A good password is a password that you can remember readily, but no one else can easily guess. Examples of bad passwords include the following:
A good password is at least eight characters long. Moreover, a password should include a mix of characters, such as uppercase and lowercase letters, numbers, and punctuation marks. Examples of passwords that would be good if they didn't appear in this manual include the following:
Don't use these examples. Passwords that appear in manuals are the first passwords that an intruder will try. Changing Your PasswordIf PAM is properly configured, you can change your Kerberos password in two ways:
After you change your password, it takes some time for the change to propagate through a system (especially over a large network). Depending on how your system is set up, this delay might take anywhere from a few minutes to an hour or more. If you need to get new Kerberos tickets shortly after you change your password, try the new password first. If the new password doesn't work, try again using the old password. Kerberos V5 protocol enables system administrators to set criteria about allowable passwords for each user. Such criteria is defined by the policy set for each user (or by a default policy). See Administering Kerberos Policies for more on policies. For example, suppose that user jennifer's policy (call it jenpol) mandates that passwords be at least eight letters long and include a mix of at least two types of characters. kpasswd will therefore reject an attempt to use “sloth” as a password.
Here, jennifer uses “slothrop49” as a password. “slothrop49” meets the criteria, because it is over eight letters long and contains two different types of characters (numbers and lowercase letters).
Example 26–3 Changing Your PasswordIn the following example, user david changes both his UNIX password and Kerberos password with passwd.
Note that passwd asks for both the UNIX password and the Kerberos password. This behavior is established by the default configuration. In that case, user david must use kpasswd to set his Kerberos password to something else, as shown next. This example shows user david changing only his Kerberos password with kpasswd.
In this example, user david changes the password for the Kerberos principal david/admin (which is not a valid UNIX user). He must use kpasswd.
Granting Access to Your AccountIf you need to give someone access to log in to your account (as you), you can do so through Kerberos, without revealing your password, by putting a .k5login file in your home directory. A .k5login file is a list of one or more Kerberos principals corresponding to each person for whom you want to grant access. Each principal must be on a separate line. Suppose that the user david keeps a .k5login file in his home directory that looks like the following:
This file allows the users jennifer and joe to assume david's identity, provided that they already have Kerberos tickets in their respective realms. For example, jennifer can remotely log in to david's machine (boston), as him, without having to give his password. Figure 26–1 Using the .k5login File to Grant Access to Your Account
In the case where david's home directory is NFS-mounted, using Kerberos V5 protocols, from another (third) machine, jennifer must have a forwardable ticket in order to access his home directory. See Creating a Kerberos Ticket for an example of using a forwardable ticket. If you will be logging in to other machines across a network, you'll want to include your own Kerberos principal in .k5login files on those machines. Using a .k5login file is much safer than giving out your password for these reasons:
One common way to use the .k5login file is to put it in root's home directory, giving root access for that machine to the Kerberos principals listed. This configuration allows system administrators to become root locally, or to log in remotely as root, without having to give out the root password, and without requiring anyone to type the root password over the network. Example 26–4 Using the .k5login File to Grant Access to Your AccountSuppose jennifer decides to log in to the machine boston.example.com as root. Because she has an entry for her principal name in the .k5login file in root's home directory on boston.example.com, she again does not have to type in her password.
Kerberos User CommandsKerberos V5 product is a single-sign-on system, which means that you only have to type your password once. The Kerberos V5 programs do the authenticating (and optional encrypting) for you, because Kerberos has been built into each of a suite of existing, familiar network programs. The Kerberos V5 applications are versions of existing UNIX network programs with Kerberos features added. For example, when you use a Kerberized program to connect to a remote host, the program, the KDC, and the remote host perform a set of rapid negotiations. When these negotiations are completed, your program has proven your identity on your behalf to the remote host, and the remote host has granted you access. Note that Kerberized commands try to authenticate with Kerberos first. If Kerberos authentication fails, an error occurs or UNIX authentication is attempted, depending on what options were used with the command. Refer to the Kerberos Security section in each Kerberos command man page for more detailed information. Overview of Kerberized CommandsThe Kerberized network services are programs that connect to another machine somewhere on the Internet. These programs are the following:
These programs have features that transparently use your Kerberos tickets for negotiating authentication and optional encryption with the remote host. In most cases, you'll notice only that you no longer have to type your password to use them, because Kerberos will provide proof of your identity for you. The Kerberos V5 network programs include options that enable you to do the following:
Note – This section assumes you are already familiar with the non-Kerberos versions of these programs, and highlights the Kerberos functionality added by the Kerberos V5 package. For detailed descriptions of the commands described here, see their respective man pages. The following Kerberos options have been added to ftp, rcp, rlogin, rsh, and telnet:
The following table shows which commands have specific options. An “X” indicates that the command has that option. Table 26–1 Kerberos Options for Network Commands
Additionally, ftp allows the protection level for a session to be set at its prompt:
You can also set the protection level at the ftp prompt by typing protect followed by any of the protection levels shown above (clear, private, or safe). Forwarding Kerberos TicketsAs described in Overview of Kerberized Commands, some commands allow you to forward tickets with either the -f or -F option. Forwarding tickets allows you to “chain” your network transactions. You can, for example, remotely log in to one machine and then remotely log in from it to another machine. The -f option allows you to forward a ticket, while the -F option allows you to reforward a forwarded ticket. In Figure 26–2, the user david obtains a non-forwardable ticket-granting ticket (TGT) with kinit. The ticket is non-forwardable because he did not specify the -f option. In scenario 1, he is able to remotely log in to machine B, but he can go no further. In scenario 2, the rlogin -f command fails because he is attempting to forward a ticket that is non-forwardable. Figure 26–2 Using Non-Forwardable Tickets
In actuality, Kerberos configuration files are set up so that kinit obtains forwardable tickets by default. However, your configuration might differ. For the sake of explanation, assume that kinit does not obtain forwardable TGTs unless it is invoked with kinit -f. Notice, by the way, that kinit does not have a -F option. TGTs are either forwardable or not. In Figure 26–3, the user david obtains forwardable TGTs with kinit -f. In scenario 3, he is able to reach machine C because he uses a forwardable ticket with rlogin. In scenario 4, the second rlogin fails because the ticket is not reforwardable. By using the -F option instead, as in scenario 5, the second rlogin succeeds and the ticket can be reforwarded on to machine D. Figure 26–3 Using Forwardable Tickets
Using Kerberized Commands (Examples)The following examples show how the options to the Kerberized commands work. Example 26–5 Using the -a, -f, and -x Options With telnetIn this example, the user david has already logged in, and wants to telnet to the machine denver.example.com. He uses the -f option to forward his existing tickets, the -x option to encrypt the session, and the -a option to perform the login automatically. Because he does not plan to use the services of a third host, he can use -f instead of -F.
Notice that david's machine used Kerberos to authenticate him to denver.example.com, and logged him in automatically as himself. He had an encrypted session, a copy of his tickets already waiting for him, and he never had to type his password. If he had used a non-Kerberos version of telnet, he would have been prompted for his password, and it would have been sent over the network unencrypted. If an intruder had been watching network traffic at the time, the intruder would have known david's password. If you forward your Kerberos tickets, telnet (as well as the other commands discussed here) destroys them when it exits. Example 26–6 Using rlogin With the -F OptionHere, the user jennifer wants to log in to her own machine, boston.example.com. She forwards her existing tickets with the -F option, and encrypts the session with the -x option. She chooses -F rather than -f because after she is logged in to boston, she might want to perform other network transactions requiring tickets to be reforwarded. Also, because she is forwarding her existing tickets, she does not have to type her password.
Example 26–7 Setting the Protection Level in ftpSuppose that joe wants to use ftp to get his mail from the directory ~joe/MAIL from the machine denver.example.com, encrypting the session. The exchange would look like the following:
To encrypt the session, joe sets the protection level to private. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||