Introduction to Heimdal

Heimdal is a free implementation of Kerberos 5, that aims to be compatible with MIT krb5 and is backwards compatible with krb4. Kerberos is a network authentication protocol. Basically it preserves the integrity of passwords in any untrusted network (like the Internet). Kerberized applications work hand-in-hand with sites that support Kerberos to ensure that passwords cannot be stolen. A Kerberos installation will make changes to the authentication mechanisms on your network and will overwrite several programs and daemons from the Coreutils, Inetutils, Qpopper and Shadow packages.

Package information

Heimdal dependencies


readline-4.3, Linux-PAM-0.77, OpenLDAP-2.1.30, X (X.org-6.7.0 or XFree86-4.4.0), cracklib-2.7 and krb4



Some sort of time synchronization facility on your system (like NTP-4.2.0) is required since Kerberos won't authenticate if the time differential between a kerberized client and the KDC server is more than 5 minutes.

Installation of Heimdal

Before installing the package, you may want to preserve the ftp program from the Inetutils package. This is because using the Heimdal ftp program to connect to non kerberized ftp servers may not work properly. It will allow you to connect (letting you know that transmission of the password is clear text) but will have problems doing puts and gets.

mv /usr/bin/ftp /usr/bin/ftpn

If you wish the Heimdal package to link against the cracklib library, you must apply a patch:

patch -Np1 -i ../heimdal-0.6.2-cracklib-1.patch

Install Heimdal by running the following commands:

patch -Np1 -i ../heimdal-0.6.2-fhs-compliance-1.patch &&
./configure --prefix=/usr --sysconfdir=/etc/heimdal \
    --datadir=/var/lib/heimdal --libexecdir=/usr/sbin \
    --sharedstatedir=/usr/share --localstatedir=/var/lib/heimdal \
    --enable-shared --with-openssl=/usr &&
make &&
make install &&
mv /bin/login /bin/login.shadow &&
mv /bin/su /bin/su.coreutils &&
mv /usr/bin/{login,su} /bin &&
ln -sf ../../bin/login /usr/bin &&
mv /usr/lib/lib{otp.so.0,otp.so.0.1.4,kafs.so.0,kafs.so.0.4.0} /lib &&
mv /usr/lib/lib{krb5.so.17,krb5.so.17.3.0,asn1.so.6,asn1.so.6.0.2} /lib &&
mv /usr/lib/lib{roken.so.16,roken.so.16.0.3,crypto.so.0.9.7} /lib &&
mv /usr/lib/lib{com_err.so.2,com_err.so.2.1,db-4.1.so} /lib &&
ln -sf ../../lib/lib{otp.so.0,otp.so.0.1.4,kafs.so.0,kafs.so.0.4.0} /usr/lib &&
ln -sf ../../lib/lib{krb5.so.17,krb5.so.17.3.0,asn1.so.6,asn1.so.6.0.2} /usr/lib &&
ln -sf ../../lib/lib{roken.so.16,roken.so.16.0.3,crypto.so.0.9.7} /usr/lib &&
ln -sf ../../lib/lib{com_err.so.2,com_err.so.2.1,db-4.1.so} /usr/lib &&

Command explanations

--libexecdir=/usr/sbin: This switch puts the daemon programs into /usr/sbin.



If you want to preserve all your existing Inetutils package daemons, install the Heimdal daemons into /usr/sbin/heimdal (or wherever you want). Since these programs will be called from (x)inetd or rc scripts, it really doesn't matter where they live, as long as they are correctly specified in the /etc/(x)inetd.conf file and rc scripts. If you choose something other than /usr/sbin, you may want to move some of the user programs (such as kadmin) to /usr/sbin manually.

mv /bin/login /bin/login.shadow
mv /bin/su /bin/su.coreutils
mv /usr/bin/{login,su} /bin
ln -sf ../../bin/login /usr/bin

The login and su programs installed by Heimdal belong in the /bin directory. The login program is symlinked because Heimdal is expecting to find it in /usr/bin. We preserve the old executables before the move to keep things sane should breaks occur.

mv /usr/lib/lib{otp.so.0,otp.so.0.1.4,kafs.so.0,kafs.so.0.4.0} /lib
mv /usr/lib/lib{krb5.so.17,krb5.so.17.3.0,asn1.so.6,asn1.so.6.0.2} /lib
mv /usr/lib/lib{roken.so.16,roken.so.16.0.3,crypto.so.0.9.7} /lib
mv /usr/lib/lib{com_err.so.2,com_err.so.2.1,db-4.1.so} /lib
ln -sf ../../lib/lib{otp.so.0,otp.so.0.1.4,kafs.so.0,kafs.so.0.4.0} /usr/lib
ln -sf ../../lib/lib{krb5.so.17,krb5.so.17.3.0,asn1.so.6,asn1.so.6.0.2} /usr/lib
ln -sf ../../lib/lib{roken.so.16,roken.so.16.0.3,crypto.so.0.9.7} /usr/lib
ln -sf ../../lib/lib{com_err.so.2,com_err.so.2.1,db-4.1.so} /usr/lib

The login and su programs installed by Heimdal link against Heimdal libraries as well as crypto and db libraries. We move these libraries to /lib to be FHS compliant and in case when /usr is located on a separate partition which may not always be mounted.

Configuring Heimdal

Config files


Configuration Information

Master KDC Server Configuration

Create the Kerberos configuration file with the following command:

install -d /etc/heimdal &&
cat > /etc/heimdal/krb5.conf << "EOF"
# Begin /etc/heimdal/krb5.conf
    default_realm = [LFS.ORG]
    encrypt = true

    [LFS.ORG] = {
        kdc = [belgarath.lfs.org]
        admin_server = [belgarath.lfs.org]
        kpasswd_server = [belgarath.lfs.org]

    .[lfs.org] = [LFS.ORG]

    kdc = FILE:/var/log/kdc.log
    admin_server = FILE:/var/log/kadmin.log
    default = FILE:/var/log/krb.log

# End /etc/heimdal/krb5.conf

You will need to substitute your domain and proper hostname for the occurances 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.

Store the master password in a key file using the following commands:

install -d -m 755 /var/lib/heimdal &&

Create the KDC database:

kadmin -l

Choose the defaults for now. You can go in later and change the defaults, should you feel the need. At the kadmin> prompt, issue the following statement:

init [LFS.ORG]

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

add [loginname]

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

add --random-key host/[belgarath.lfs.org]

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

ext host/[belgarath.lfs.org]

This should have created two files in /etc/heimdal; krb5.keytab (Kerberos 5) and srvtab (Kerberos 4). Both files 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:

add --random-key ftp/[belgarath.lfs.org]

(choose the defaults)

ext 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/kdc &

Attempt to get a TGT (ticket granting ticket) with the following command:

kinit [loginname]

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


Information about the ticket should be displayed on the screen.

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

ktutil list

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

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

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

make install-heimdal
Using Kerberized Client Programs

To use the kerberized client programs (telnet, ftp, rsh, rxterm, rxtelnet, rcp, xnlock), you first must get a TGT. 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. As mentioned earlier, only the ftp program gives any trouble connecting to non kerberized daemons.

For additional information consult the Heimdal hint on which the above instructions are based.


The Heimdal package contains afslog, dump_log, ftp, ftpd, hprop, hpropd, ipropd-master, ipropd-slave, kadmin, kadmind, kauth, kdc, kdestroy, kf, kfd, kgetcred, kinit, klist, kpasswd, kpasswdd, krb5-config, kstash, ktutil, kx, kxd, login, mk_cmds, otp, otpprint, pagsh, pfrom, popper, push, rcp, replay_log, rsh, rshd, rxtelnet, rxterm, string2key, su, telnet, telnetd, tenletxr, truncate_log, verify_krb5_conf, xnlock, libasn1, libeditline, libgssapi, libhdb, libkadm5clnt, libkadm5srv, libkafs, libkrb5, libotp, libroken, libsl and libss.



afslog obtains AFS tokens for a number of cells.


hprop takes a principal database in a specified format and converts it into a stream of Heimdal database records.


hpropd receives a database sent by hprop and writes it as a local database.


kadmin is an utility used to make modifications to the Kerberos database.


kadmind is a server for administrative access to Kerberos database.

kauth, kinit

kauth and kinit are used to authenticate to the Kerberos server as principal and acquire a ticket granting ticket that can later be used to obtain tickets for other services.


kdc is a Kerberos 5 server.


kdestroy removes the current set of tickets.


kf is a program which forwards tickets to a remote host through an authenticated and encrypted stream.


kfd receives forwarded tickets.


kgetcred obtains a ticket for a service.


klist reads and displays the current tickets in the credential cache.


kpasswd is a program for changing Kerberos 5 passwords.


kpasswdd is a Kerberos 5 password changing server.


krb5-config gives information on how to link programs against Heimdal libraries.


kstash stores the KDC master password in a file.


ktutil is a program for managing Kerberos keytabs.


kx is a program which securely forwards X connections.


kxd is the daemon for kx.


otp manages one-time passwords.


otpprint prints lists of one-time passwords.


rxtelnet program starts an xterm window with a telnet to given host and forwards X connections.


rxterm starts a secure remote xterm.


string2key maps a password into a key.


tenletxr forwards X connections backwards.


verify_krb5_conf checks krb5.conf file for obvious errors.


xnlock is a program that acts as a secure screen saver for workstations running X.