Kerberos is a powerful set of programs which allow you to have encrypted connections to virtually anything: TELNET, FTP and even e-mail. This is of little use to the modem user, but in larger settings where Ethernet is used and sniffing is a real danger, Kerberos provides a viable and powerful solution. There is, however, one problem—Kerberos is notoriously known for being overly complex and difficult to install. This article is designed to help you make a good start; before you know it, with a little experimentation everything will (kind of) work. I wish I could explain everything in detail here, but then, this would be a book, not an article.
Like almost every major upgrade/change, it would be ideal to make a backup of your system. If you can, do it. If you don't have a tape drive be careful installing, Kereberos shouldn't write over your files, but if you want to be sure, make copies of /sbin somewhere. It takes two seconds and if something goes wrong it will be well worth your time.
Now we go grab the files. There are binary and source distributions of Kerberos for Linux. I've found that the source usually causes me less problems than the binaries. If you are up to playing around a bit go ahead and get the source, otherwise grab the binaries. Either can be found at http://web.mit.edu/kerberos/www/. I'll cover only the binaries here—simply because compiling the source isn't part of the scope of this article. I'm going to assume you managed to install things right. One important note: If you do choose to use the source (I recommend you do) make sure you extract all the tar archive files, not just the one containing the source. Also, if you install things in a different directory (not /krb5) then you will need to modify the files mentioned below to reflect your installation directory.
These two files control virtually everything. They control the name of your REALM (see below) and who can connect; however, they can be fairly complex. Before you set them up, you will probably need to understand a few terms:
REALM: I think of a realm as a “group”. Machines will belong to this group. It has become almost standard procedure to make the realm the same as your domain name, just with capital letters. In my case, I called it UNDER, but you could call it anything you wanted. Yes, you can have more than one REALM, but you probably won't need one. Remember—the REALM is case sensitive! Pick a standard and stick to it.
KEYTAB: a file that contains encrypted information allowing users/machines to authenticate themselves. Each machine that attempts to authenticate itself to the KDC (see below) must have one. This is done by issuing the ktadd command under kadmin.
KDC: the Kerberos Distribution Center—the one that causes you headaches. This is the machine that controls access.
PRINCIPAL: a principal is a “definition” of a user or a host. It is, effectively, what tells the server a user exists or a server is trusted.
INCIDENT: when making a new principal, the notation is as follows: incident/host@REALM. For example, with ktadd, doing something like
would make the incident host for the machine pepsi.kellogg.nwu.edu which is part of the UNDER realm.
Take a look at my /etc/krb5.conf file and notice the following:
default_realm = UNDER: name of your realm.
profile = /krb5/var/krb5kdc/kdc.conf: location of your kdc.conf file
Also note the section called [realms]. Under it, I have the name of my realm, UNDER, and the machine that hosts that information, in this case, underground.kellogg.nwu.edu. This will be the hostname of where you just installed Kerberos. [domain_realm] explains who can connect to the realm: anyone from anywhere within kellogg and within res-hall (the dorm rooms at Northwestern). Replace all the information mentioned above with the name of your REALM and the name of the machine you installed the server on.
Now on to your kdc.conf file. You are going to need to place it wherever you defined it in /etc/krb5.conf. My suggestion is you place it in the same directory I did. This will mean making these directories. If you do that, you can just copy my kdc.conf and save yourself some time. Just change the name of the realm to whatever you picked when making krb5.conf file. These two files are integral to making things work. You may want to double check for typos and possibly save yourself some headaches later.
Now, some tedious but easy work must be done. Create the database that controls who can login where by issuing the following command:
# kdb5_util create -r Initializing database '/krb5/lvar/krb5kdc/principal' for realm ' master key name 'K/M@YOUR_REALM'
In my case, YOUR_REALM would have been UNDER. Just replace it with whatever the host name of the machine you are on right now is. You will be asked for a master password; pick something you won't forget.
Now you must make an ACL file. This basically controls who can connect and administer the REALM. It can also be complex, but for our purposes we will keep it simple. Edit the file (or create) defined by acl = in the kdc.conf file. Place the following on a line by itself:
This means the administrator can control things. I don't see why you would want anything else anyway.