Configuring Heimdal Config files /etc/heimdal/* 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 [libdefaults] default_realm = [LFS.ORG] encrypt = true [realms] [LFS.ORG] = { kdc = [belgarath.lfs.org] admin_server = [belgarath.lfs.org] kpasswd_server = [belgarath.lfs.org] } [domain_realm] .[lfs.org] = [LFS.ORG] [logging] kdc = FILE:/var/log/kdc.log admin_server = FILE:/var/log/kadmin.log default = FILE:/var/log/krb.log # End /etc/heimdal/krb5.conf EOF 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 && kstash 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: klist 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. To automate the running of Kerberos server and kpasswdd daemon, use the following command to create the init.d script: cat >etc/rc.d/init.d/heimdal << "EOF" #!/bin/sh # Begin $rc_base/init.d/heimdal # Based on sysklogd script from LFS-3.1 and earlier. # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org # Heimdal bootscript submitted by Randy McMurchy <LFS-User_at_mcmurchy_dot_com> . /etc/sysconfig/rc . $rc_functions case "$1" in start) echo "Starting KDC Server Daemon..." if test -f "/var/run/kdc.pid" then print_status warning running else /usr/sbin/kdc & sleep 1 if test -f "/var/run/kdc.pid" then print_status success else print_status failure fi fi echo "Starting KDC kpasswdd Daemon..." if test -f "/var/run/kpasswdd.pid" then print_status warning running else /usr/sbin/kpasswdd & sleep 1 if test -f "/var/run/kpasswdd.pid" then print_status success else print_status failure fi fi ;; stop) echo "Stopping KDC kpasswdd Daemon..." killproc /usr/sbin/kpasswdd echo "Stopping KDC Server Daemon..." killproc /usr/sbin/kdc ;; restart) $0 stop sleep 1 $0 start ;; status) statusproc /usr/sbin/kdc statusproc /usr/sbin/kpasswdd ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 ;; esac # End $rc_base/init.d/heimdal EOF chmod 754 /etc/rc.d/init.d/heimdal Create the symbolic links to this file in the relevant rc.d directory with the following commands: cd /etc/rc.d/init.d && ln -sf ../init.d/heimdal ../rc0.d/K42heimdal && ln -sf ../init.d/heimdal ../rc1.d/K42heimdal && ln -sf ../init.d/heimdal ../rc2.d/K42heimdal && ln -sf ../init.d/heimdal ../rc3.d/S28heimdal && ln -sf ../init.d/heimdal ../rc4.d/S28heimdal && ln -sf ../init.d/heimdal ../rc5.d/S28heimdal && ln -sf ../init.d/heimdal ../rc6.d/K42heimdal 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.