MIT krb5

From CBLFS
Revision as of 04:43, 9 December 2006 by Kalessin (talk | contribs) (I added the MIT krb5 instructions from BLFS (no multilib instructions added).)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
Download Source: http://web.mit.edu/kerberos/www/dist/krb5/1.4/krb5-1.4.1-signed.tar

Introduction to MIT Krb5

MIT krb5 is a free implementation of Kerberos 5. Kerberos is a network authentication protocol. It centralizes the authentication database and uses kerberized applications to work with servers or services that support Kerberos allowing single logins and encrypted communication over internal networks or the Internet.

Dependencies

Optional

  • xinetd (services servers only)
  • Linux-Pam (for xdm based logins)
  • OpenLDAP (alternative for krb5kdc password database)
Note:
Some sort of time synchronization facility on your system (like NTP)
is required since Kerberos won't authenticate if the time differential
between a kerberized client and the KDC server is more than 5 minutes.

Non-Multilib

MIT krb5 is distributed in a TAR file containing a compressed TAR package and a detached PGP ASC file.

If you have installed GnuPG, you can authenticate the package with the following command:

gpg - -verify krb5-1.4.1.tar.gz.asc

Build MIT krb5 by running the following commands:

cd src &&
./configure --prefix=/usr --sysconfdir=/etc \
   --localstatedir=/var/lib --enable-dns \
   --enable-static --mandir=/usr/share/man &&
make

Install the package:

make install &&
mv -v /usr/bin/ksu /bin &&
mv -v /usr/lib/libkrb5.so.3* /lib &&
mv -v /usr/lib/libkrb4.so.2* /lib &&
mv -v /usr/lib/libdes425.so.3* /lib &&
mv -v /usr/lib/libk5crypto.so.3* /lib &&
mv -v /usr/lib/libcom_err.so.3* /lib &&
ln -v -sf ../../lib/libkrb5.so.3 /usr/lib/libkrb5.so &&
ln -v -sf ../../lib/libkrb4.so.2 /usr/lib/libkrb4.so &&
ln -v -sf ../../lib/libdes425.so.3 /usr/lib/libdes425.so &&
ln -v -sf ../../lib/libk5crypto.so.3 /usr/lib/libk5crypto.so &&
ln -v -sf ../../lib/libcom_err.so.3 /usr/lib/libcom_err.so &&
ldconfig
Warning:
login.krb5 does not support shadow passwords. As a result, when the Kerberos
server is unavailable, the default fall through to /etc/password will not work
because the passwords have been moved to /etc/shadow during the CLFS build
process. Entering the following commands without moving the passwords back
to /etc/password could prevent any logins.

If Linux-Pam is not installed and you understand the above warning, the following can be entered:

mv -v /bin/login /bin/login.shadow &&
cp -v /usr/sbin/login.krb5 /bin/login

If CrackLib is installed, or if any word list has been put in /usr/share/dict, the following should be entered:

ln -s /usr/share/dict/words /var/lib/krb5kdc/kadmin.dict

Command Explanations

--enable-dns: This switch allows realms to be resolved using the DNS server.

--enable-static: This switch builds static libraries in addition to the shared libraries.

mv -v /bin/login /bin/login.shadow && cp -v /usr/sbin/login.krb5 /bin/login && mv -v /usr/bin/ksu /bin: Preserves Shadow's login command, moves ksu and login to the /bin directory.

mv -v ... /lib && ln -v -sf ...: The login and ksu programs are linked against these libraries, therefore these libraries are moved to /lib to allow logins without mounting /usr.

Multilib

32Bit

TODO....

N32

TODO....

64Bit

TODO....

Configuring

Configuration Files

/etc/krb5.conf and /var/lib/krb5kdc/kdc.conf

Kerberos Configuration

Create the Kerberos configuration file with the following command:

 cat > /etc/krb5.conf << "EOF"
 # Begin /etc/krb5.conf
 
 [libdefaults]
     default_realm = <LFS.ORG>
     encrypt = true
 
 [realms]
     <LFS.ORG> = {
         kdc = <belgarath.lfs.org>
         admin_server = <belgarath.lfs.org>
     }
 
 [domain_realm]
     .<lfs.org> = <LFS.ORG>
 
 [logging]
     kdc = SYSLOG[:INFO[:AUTH]]
     admin_server = SYSLOG[INFO[:AUTH]]
     default = SYSLOG[[:SYS]]
 
 # End /etc/krb5.conf
 EOF

You will need to substitute your domain and proper hostname for the occurences of the <belgarath> and <lfs.org> names.

default_realm should be the name of your domain changed to ALL CAPS. This isn't required, but both Heimdal and MIT recommend it.

encrypt = true provides encryption of all traffic between kerberized clients and servers. It's not necessary and can be left off. If you leave it off, you can encrypt all traffic from the client to the server using a switch on the client program instead.

The [realms] parameters tell the client programs where to look for the KDC authentication services.

The [domain_realm] section maps a domain to a realm.

Create the KDC database:

kdb5_util create -r <LFS.ORG> -s

Now you should populate the database with principles (users). For now, just use your regular login name or root.

kadmin.local
kadmin: add_policy dict-only
kadmin: addprinc -policy dict-only <loginname>

The KDC server and any machine running kerberized server daemons must have a host key installed:

kadmin: addprinc -randkey host/<belgarath.lfs.org>

After choosing the defaults when prompted, you will have to export the data to a keytab file:

kadmin: ktadd host/<belgarath.lfs.org>

This should have created a file in /etc named krb5.keytab (Kerberos 5). This file should have 600 (root rw only) permissions. Keeping the keytab files from public access is crucial to the overall security of the Kerberos installation.

Eventually, you'll want to add server daemon principles to the database and extract them to the keytab file. You do this in the same way you created the host principles. Below is an example:

kadmin: addprinc -randkey ftp/<belgarath.lfs.org>
kadmin: ktadd ftp/<belgarath.lfs.org>

Exit the kadmin program (use quit or exit) and return back to the shell prompt. Start the KDC daemon manually, just to test out the installation:

/usr/sbin/krb5kdc &

Attempt to get a ticket with the following command:

kinit <loginname>

You will be prompted for the password you created. After you get your ticket, you can list it with the following command:

klist

Information about the ticket should be displayed on the screen.

To test the functionality of the keytab file, issue the following command:

ktutil
ktutil: rkt /etc/krb5.keytab
ktutil: l

This should dump a list of the host principal, along with the encryption methods used to access the principal.

At this point, if everything has been successful so far, you can feel fairly confident in the installation and configuration of the package.

Install the /etc/rc.d/init.d/kerberos init script included in the blfs-bootscripts package.

make install-kerberos

Using Kerberized Client Programs

To use the kerberized client programs (telnet, ftp, rsh, rcp, rlogin), you first must get an authentication ticket. Use the kinit program to get the ticket. After you've acquired the ticket, you can use the kerberized programs to connect to any kerberized server on the network. You will not be prompted for authentication until your ticket expires (default is one day), unless you specify a different user as a command line argument to the program.

The kerberized programs will connect to non kerberized daemons, warning you that authentication is not encrypted.

Using Kerberized Server Programs

Using kerberized server programs (telnetd, kpropd, klogind and kshd) requires two additional configuration steps. First the /etc/services file must be updated to include eklogin and krb5_prop. Second, the inetd.conf or xinetd.conf must be modified for each server that will be activated, usually replacing the server from Inetutils.

Additional Information

For additional information consult Documentation for krb-1.4.1 on which the above instructions are based.

Contents

Installed Programs: compile-et, ftp, ftpd, gss-client, gss-server, k5srvutil, kadmin, kadmin.local, kadmind, kadmind4, kdb5_util, kdestroy, kinit, klist, klogind, kpasswd, kprop, kpropd, krb5-send-pr, krb5-config, krb524d, krb524init, krb5kdc, kshd, ksu, ktutil, kvno, login.krb5, rcp, rlogin, rsh, sclient, sim_client, sim_server, sserver, telnet, telnetd, uuclient, uuserver, v5passwd, and v5passwdd
Installed Libraries: libcom_err.{so,a}, libdes425.{so,a}, libgssapi.{so,a}, libgssrpc.{so,a}, libkadm5clnt.{so,a}, libkadm5srv.{so,a}, libkdb5.{so,a}, libkrb5.{so,a}, and libkrb4.{so,a}
Installed Directory: /usr/include/kerberosIV and /var/lib/krb5kdc

Short Descriptions

compile_et converts the table listing error-code names into a C source file.
ftp is a kerberized FTP client.
ftpd is a kerberized FTP daemon.
k5srvutil is a host keytable manipulation utility.
kadmin is an utility used to make modifications to the Kerberos database.
kadmind is a server for administrative access to a Kerberos database.
kdb5_util is the KDC database utility.
kdestroy removes the current set of tickets.
kinit is used to authenticate to the Kerberos server as a principal and acquire a ticket granting ticket that can later be used to obtain tickets for other services.
klist reads and displays the current tickets in the credential cache.
klogind is the server that responds to rlogin requests.
kpasswd is a program for changing Kerberos 5 passwords.
kprop takes a principal database in a specified format and converts it into a stream of database records.
kpropd receives a database sent by kprop and writes it as a local database.
krb5-config gives information on how to link programs against libraries.
krb5kdc is a Kerberos 5 server.
kshd is the server that responds to rsh requests.
ksu is the super user program using Kerberos protocol. Requires a properly configured /etc/shells and ~/.k5login containing principals authorized to become super users.
ktutil is a program for managing Kerberos keytabs.
kvno prints keyversion numbers of Kerberos principals.
login.krb5 is a kerberized login program.
rcp is a kerberized rcp client program.
rlogin is a kerberized rlogin client program.
rsh is a kerberized rsh client program.
telnet is a kerberized telnet client program.
telnetd is a kerberized telnet server.
libcom_err.{so,a} implements the Kerberos library error code.
libgssapi.{so,a} contain the Generic Security Service Application Programming Interface (GSSAPI) functions which provides security services to callers in a generic fashion, supportable with a range of underlying mechanisms and technologies and hence allowing source-level portability of applications to different environments.
libkadm5clnt.{so,a} contains the administrative authentication and password checking functions required by Kerberos 5 client-side programs.
libkadm5srv.{so,a} contain the administrative authentication and password checking functions required by Kerberos 5 servers.
libkdb5.{so,a} is a Kerberos 5 authentication/authorization database access library.
libkrb5.{so,a} is an all-purpose Kerberos 5 library.