1 AUTHOR: Randy McMurchy <LFS-User_at_mcmurchy_dot_com>
5 LICENSE: Creative Commons Attribution-NonCommercial-ShareAlike License
6 http://creativecommons.org/licenses/by-nc-sa/1.0/
8 SYNOPSIS: How to deploy Heimdal Kerberos 5 on your network
12 This hint provides detailed instructions for deploying Heimdal Kerberos 5 on
13 your network. You'll find instructions for creating the master KDC server,
14 how to configure kerberized daemon servers, how to configure client machines
15 and a brief section on how to use Kerberos. The hint will be updated soon to
16 include a section on creating and deploying slave KDC servers.
20 http://www.linuxfromscratch.org/patches/downloads/heimdal/heimdal-0.6.2-fhs-compliance-1.patch
21 http://www.linuxfromscratch.org/patches/downloads/heimdal/heimdal-0.6.2-cracklib-1.patch
25 This hint requires you have root access to every machine you'll be installing
26 and/or configuring Heimdal on. A basic understanding of Linux based
27 authentication is desireable as well having knowledge about your system's
28 (x)inetd configurations.
37 2. Package Dependencies
42 3. Package Installation
50 Stripping the binaries
51 Installation modifications
52 Update /etc/ld.so.cache
53 4. Master KDC Server Configuration
54 Creating the /etc/heimdal directory
55 Creating /etc/heimdal/krb5.conf
56 Creating /var/lib/heimdal/m-key
57 Creating the KDC database
58 Starting the KDC daemon
59 Getting and listing a TGT
60 Creating /etc/heimdal/krb5.keytab
61 Testing the keytab file
62 Notes about the keytab file
63 Creating the admin access control list (ACL)
64 Remote access to the master KDC server
65 Notes about the kpasswdd daemon
66 Creating the KDC server init script
67 5. Kerberized Daemon Server Configuration
69 Creating /etc/heimdal/krb5.keytab
70 Notes about the keytab file
71 Configuring the kxd daemon
72 6. Using Kerberized Client Programs
73 7. Installing the pam_krb5 PAM Module Package
82 Configuring /etc/heimdal/krb5.conf
83 8. Issues, Gotchas and Other Sundry Items
91 These instructions should allow you to build, configure and deploy a working
92 Heimdal Kerberos 5 installation for your network. I've tested everything
93 documented below and everything works for me. YMMV.
95 First off, please be sure you want a kerberos installation. This is not a
96 package to install "just for the fun of it". A kerberos installation will
97 make changes to the authentication mechanisms on your network and will
98 overwrite several GNU inetutil and shadow package programs and daemons. You
99 could modify the configure script to not overwrite these programs and
100 daemons, but I'll leave it up to you to figure out how. (I'll outline a
101 method to place the daemon programs in their own directory, preserving your
102 existing daemon programs, but it's not recommended.)
104 ========================
105 2. PACKAGE DEPENDENCIES:
106 ========================
112 OpenSSL-0.9.7d, Berkeley DB-4.1.25
118 Linux-PAM-0.77, pam_krb5-1.3-rc7, cracklib-2.7
124 tcpwrappers-7.6, readline-4.3, xinetd-2.3.13, NTP-4.2.0,
125 X.org-6.7.0 or XFree86-4.4.0
127 Additionally, an optional dependency of Heimdal is OpenLDAP-2.1.30, however,
128 there's a caveat I should explain. There's a circular dependency with the
129 Heimdal package and the OpenLDAP package. Each package is an optional
130 dependency of each other. If you plan on integrating Heimdal with OpenLDAP,
131 you need to decide the order of installation.
133 I finished an installation integrating PAM/SASL/Heimdal/LDAP and I decided
134 the best method is to first install Heimdal without LDAP. Then install
135 Cyrus-SASL and then LDAP (with LDAP configured to use the GSSAPI
136 functionality of Cyrus/SASL-Heimdal). After LDAP is installed, go back and
137 install Heimdal again with the following additional options to ./configure:
139 --with-openldap=/usr/bin \
140 --with-openldap-lib=/usr/lib \
141 --with-openldap-include=/usr/include
143 I never did put the Heimdal database into LDAP as I don't feel comfortable
144 enough with my knowledge of LDAP to trust my LDAP ACL security setup with
145 something as critical as a Heimdal Kerberos database.
147 ----------------------
148 Notes on Dependencies:
149 ----------------------
151 Linux-PAM is not a compile time dependency. However, you'll need it if you
152 want to use Kerberos authentication for non-native Kerberos applications such
153 as the xdm, gdm and kdm X display managers. If you decide to install
154 Linux-PAM, you should also reinstall the Shadow package. See the Shadow
155 section in the BLFS book for details.
157 The pam_krb5-1.3-rc7 module is used with Linux-PAM to provide authentication
158 for non-native Kerberos applications. Additionally, the pam_krb5 module once
159 installed and properly configured almost eliminates the need for a user to
160 manually acquire a Kerberos TGT (ticket-granting-ticket).
162 To utilize the cracklib library for strong password checking, you'll need to
163 have installed the cracklib library following the BLFS instructions. The BLFS
164 cracklib installation instructions allows you to install a special version of
165 the cracklib library to work with Heimdal.
167 The tcpwrappers package can be installed before or after Heimdal. Heimdal
168 does not compile against the package.
170 The readline package must be installed before Heimdal should you wish to
171 utilize this library.
173 The xinetd package may be installed before or after Heimdal. There is no
174 compile time dependency. If you have plans on using xinetd, you should
175 install it first however, as the you'll be modifying the (x)inetd
176 configuration file during these instructions.
178 NTP is listed as a dependency, though there is no compile-time dependency.
179 Heimdal requires time-syncronization between the KDC server and clients.
180 NTP is perfect for this.
182 The X package should be installed before Heimdal if you wish to use the
183 Heimdal kxd programs.
185 ========================
186 3. PACKAGE INSTALLATION:
187 ========================
189 ---------------------
190 Download the Package:
191 ---------------------
193 The current stable package is heimdal-0.6.2 and can be downloaded from the
194 Heimdal FTP site at ftp://ftp.pdc.kth.se/pub/heimdal/src/. The complete URL
195 to download the source tarball is:
197 ftp://ftp.pdc.kth.se/pub/heimdal/src/heimdal-0.6.2.tar.gz
199 ---------------------
200 Download the Patches:
201 ---------------------
203 There are two patches for the package.
205 heimdal-0.6.2-fhs-compliance-1.patch
206 heimdal-0.6.2-cracklib-1.patch
208 Download the patches from:
209 http://www.linuxfromscratch.org/patches/downloads/heimdal/
215 After you unpack the tarball and change to the heimdal-0.6.2 directory, you
216 must make a change to a library header file, the configure script and
217 several documentation files so that the installation does not look for some
218 files in a /var/heimdal directory. To make the installation FHS compliant
219 and use /var/lib/heimdal instead, you can use a sed script or a patch. I've
222 To make the required changes using sed, here's the command:
224 sed -i -e "s@var/heimdal@var/lib/heimdal@g" configure.in configure \
225 doc/setup.texi doc/heimdal.info-1 kadmin/kadmind.8 kdc/kdc.8 \
226 lib/hdb/hdb.h lib/krb5/krb5.conf.5 lib/krb5/krb5.conf.cat5
228 To make the required changes using a patch, here's the command:
230 patch -Np1 -i ../heimdal-0.6.2-fhs-compliance-1.patch
232 To have the Heimdal package link against the cracklib library, you must apply
233 a patch. Install the patch with the following command:
235 patch -Np1 -i ../heimdal-0.6.2-cracklib-1.patch
241 Next run the configure script. I used many options to the script, some of
242 which may not have been necessary. Omit any as you see fit.
244 ./configure --prefix=/usr \
245 --sysconfdir=/etc/heimdal \
246 --datadir=/var/lib/heimdal \
247 --libexecdir=/usr/sbin \
248 --sharedstatedir=/usr/share \
249 --localstatedir=/var/lib/heimdal \
251 --with-openssl=/usr \
252 --with-readline-lib=/usr/lib \
253 --with-readline-include=/usr/include/readline
257 --prefix=/usr will install the libraries in /usr/lib and the programs in
260 --sysconfdir=/etc/heimdal insures that the krb5.conf and the keytab file will
261 be looked for in /etc/heimdal. We use /etc/heimdal so that all the Heimdal
262 configuration files are located in one directory.
264 --datadir=/var/lib/heimdal is there as a "just in case" thing. I'm not even
265 sure there's anything Heimdal uses requiring the "datadir".
267 --libexecdir=/usr/sbin installs the daemon programs into /usr/sbin.
268 *****NOTE***** If you want to preserve all your existing inetutil package
269 daemons, install the Heimdal daemons into /usr/sbin/heimdal (or whatever you
270 want). Since these programs will be called from (x)inetd or rc scripts, it
271 really doesn't matter where they live, as long as they are correctly
272 specified in the /etc/(x)inetd.conf file and rc scripts. If you choose
273 something other than /usr/sbin, you may want to move some of the user
274 programs (such as kadmin) to /usr/sbin manually.
276 --sharedstatedir=/usr/share is there as a "just in case" thing.
278 --localstatedir=/var/lib/heimdal is there as a "just in case" thing.
280 --enable-shared builds the shared libraries.
282 --with-openssl=/usr allows configure to find the Open-SSL package.
284 --with-readline-lib (and include) Configure won't find readline without them.
286 Towards the end of configure's output, there's a line that says:
288 "checking which authentication modules should be built... none"
290 This confused me at first. I thought it had something to do with it not
291 finding OpenSSL, but apparently it's normal.
297 Simply running the "make" command will build the package.
303 Issuing "make check" will run an extensive test suite on the build. My
304 experience is negative however, as way deep into the tests, it sometimes
305 would fail during the "xnlock" test. The "xnlock" program is a stupid little
306 locking screen saver (secure, though, when it transmits the unlocking
307 password) and it works just fine after installation.
309 You may try "make -k check" and see if it will run through. I did this and
310 it skipped the rest of the "appl" directory after the error on the "xnlock"
311 program. Be sure to log your output if you want to view the results (unless
312 you have an extraordinary amount of scroll buffer on your terminal).
314 After installing cracklib, and linking with the cracklib library, the "make
315 check" tests never failed on me again. I'm not sure what's up with that.
321 Before installing the package, I found I needed to preserve the ftp program
322 from the inetutil package. If you're using NcFTP or something else that
323 isn't called /usr/bin/ftp, then you can omit the next step. But, if you're
324 using /usr/bin/ftp, you should move this to another name before starting
329 My experience using the Heimdal ftp program to connect to non kerberized
330 ftp servers was not good. It will allow you to connect (letting you know
331 that transmission of the password is clear text) but will have problems
332 doing puts and gets. Mget will work but get won't. Go figure. A get will
333 actually segfault. So, I move my /usr/bin/ftp to /usr/bin/ftpn (the "n" is
334 for "normal") before overwriting it with the kerberized version. This way,
335 a "normal" ftp program is available when I need it.
337 <editorial>I'm not sure if this problem is enough to sway someone from using
338 the Heimdal package in favor of the MIT package, but I thought I'd let you
339 know! I'll mention that I think the Heimdal package is very good and this
340 problem is not enough to make me think the package is faulty.</editorial>
342 ****************************************************************************
344 ***** The remainder of this hint must be performed by the root user *****
346 ****************************************************************************
348 So, if you want to preserve your old /usr/bin/ftp program, do this:
350 mv /usr/bin/ftp /usr/bin/ftpn
352 Then simply issue a "make install" command to install the package.
354 -----------------------
355 Stripping the Binaries:
356 -----------------------
358 Heimdal doesn't strip the binaries during the build phase and uses -g as a
359 build option. So, the binaries are quite large. If desired, strip the
360 unnecessary symbols by issuing the following commands:
364 strip --strip-all ipropd-slave ipropd-master dump_log truncate_log \
365 replay_log hprop ktutil kstash kdc hpropd kpasswdd kadmind kadmin \
366 ftpd rshd push popper telnetd kxd kfd
369 strip --strip-all kinit klist kdestroy kgetcred string2key kpasswd afslog \
370 pagsh ftp login otp otpprint rsh rcp su xnlock telnet kx kf mk_cmds \
374 strip --strip-debug libroken.so.16.0.3 libroken.a libss.so.0.1.4 libss.a \
375 libsl.so.0.1.2 libsl.a libeditline.a libasn1.so.6.0.2 libasn1.a \
376 libkrb5.so.17.3.0 libkrb5.a libkafs.so.0.4.0 libkafs.a libhdb.so.7.0.7 \
377 libhdb.a libkadm5srv.so.7.0.6 libkadm5srv.a libkadm5clnt.so.4.2.4 \
378 libkadm5clnt.a libotp.so.0.1.4 libotp.a libgssapi.so.1.4.0 libgssapi.a
381 ---------------------------
382 Installation Modifications:
383 ---------------------------
385 The /usr/bin/login and /usr/bin/su programs installed by Heimdal belong in
386 /bin, so I preserve the originals and move/copy the new ones into /bin. The
387 login program is copied because Heimdal is expecting to find it in /usr/bin.
388 You could get away with simply renaming (mv) the old /bin/login file and
389 letting the system fall back to /usr/bin, but /usr might not be mounted at
390 some point when the login program is required. Hence, I copy it to /bin.
392 mv /bin/login /bin/login.SAVE
393 mv /bin/su /bin/su.SAVE
394 cp /usr/bin/login /bin
397 Because the login and su programs have been moved to /bin, the libraries
398 linked to these programs should be moved to /lib in order to satisfy FHS
399 doctrines. Use the following commands to accomplish this:
401 mv /usr/lib/lib{otp.so.0,otp.so.0.1.4,kafs.so.0,kafs.so.0.4.0} /lib
402 mv /usr/lib/lib{krb5.so.17,krb5.so.17.3.0,asn1.so.6,asn1.so.6.0.2} /lib
403 mv /usr/lib/lib{roken.so.16,roken.so.16.0.3,crypto.so.0.9.7} /lib
404 mv /usr/lib/lib{com_err.so.2,com_err.so.2.1,db-4.1.so} /lib
405 ln -sf /lib/lib{otp.so.0,otp.so.0.1.4,kafs.so.0,kafs.so.0.4.0} /usr/lib
406 ln -sf /lib/lib{krb5.so.17,krb5.so.17.3.0,asn1.so.6,asn1.so.6.0.2} /usr/lib
407 ln -sf /lib/lib{roken.so.16,roken.so.16.0.3,crypto.so.0.9.7} /usr/lib
408 ln -sf /lib/lib{com_err.so.2,com_err.so.2.1,db-4.1.so} /usr/lib
410 ------------------------
411 Update /etc/ld.so.cache:
412 ------------------------
414 Update the linker's library cache file by issuing the "ldconfig" command:
418 ===================================
419 4. MASTER KDC SERVER CONFIGURATION:
420 ===================================
422 ------------------------------------
423 Creating the /etc/heimdal Directory:
424 ------------------------------------
426 Create the /etc/heimdal configuration directory with the following command:
428 install -d -m 755 /etc/heimdal
430 --------------------------------
431 Creating /etc/heimdal/krb5.conf:
432 --------------------------------
434 Create the kerberos configuration file with the following command:
436 cat > /etc/heimdal/krb5.conf << "EOF"
438 default_realm = LFS.ORG
443 kdc = belgarath.lfs.org
444 admin_server = belgarath.lfs.org
445 kpasswd_server = belgarath.lfs.org
452 kdc = FILE:/var/log/kdc.log
453 admin_server = FILE:/var/log/kadmin.log
454 default = FILE:/var/log/krb.log
458 You will need to substitute your domain and proper hostname for the
459 occurances of the belgarath and lfs.org names. Here's an explanation of the
460 krb5.conf parameters.
462 default_realm should be the name of your domain changed to ALL CAPS. This
463 isn't required, but both Heimdal and MIT recommend it. Should you desire a
464 name other than capitalized domainname, well, YOYO.
466 encrypt = true provides encryption of all traffic between kerberized clients
467 and servers. It's not necessary and can be left off. If you leave it off, you
468 can encrypt all traffic from the client to the server using a switch on the
469 client program instead. You decide how you want it.
471 The [realms] parameters tell the client programs where to look for the KDC
472 authentication services.
474 The [domain_realm] section maps a domain to a realm.
476 The [logging] section is optional. I'm a log freak, so I want it in there.
478 --------------------------------
479 Creating /var/lib/heimdal/m-key:
480 --------------------------------
482 Store the master password in a key file using the following commands:
484 install -d -m 755 /var/lib/heimdal
487 You'll be prompted to enter, then verify the password. The key file should
488 be created and have 600 (root read/write only) permissions.
490 --------------------------
491 Creating the KDC database:
492 --------------------------
494 Create the KDC database by "connecting" to the as-yet-not-created database
495 in "local" mode. What I mean by this is, we are going to run the kadmin
496 program, which "connects" to the KDC database and allows administrative
497 updates and modifications. But there's no database yet! Running kadmin with
498 a "-l" switch allows us to "connect" to the database (from the local host
499 only), even if the database doesn't exist. Run the following commands, and
500 choose the defaults for now. You can go in later and change the defaults,
501 should you feel the need.
505 At the "kadmin>" prompt, issue the following statement:
509 Of course, substitute the realm name you identified in the "default_realm"
510 parameter of the [libdefaults] section of the krb5.conf file you created
513 After accepting the defaults about the realm ticket life, you will be back
514 at the "kadmin>" prompt. You've now created the database. You can open up
515 another terminal and look in the /var/lib/heimdal directory to confirm this.
517 Now we need to populate the database with principles (users). You should
518 create at least one for now. Use your regular login name or "root". You need
519 to decide what you want to use as an admin user for the day-to-day admin
520 duties of the KDC. It's not important now, just something to think about for
521 when the time comes to create the ACL's. For now, just use your regular
522 login name or root. (you should still be at the "kadmin>" prompt)
526 Of course, substitute some valid login name. Just press enter to choose the
527 default choices during the add user routine (or, if you're bold and know
528 what you're doing, modify the defaults). Choose a password carefully, this
529 will be the password you'll use to authenticate to the KDC. You can always
530 change your password later, however.
532 There's enough done now to test the installation. So, exit the kadmin
533 program (use quit or exit) and return back to the unix prompt.
535 ------------------------
536 Starting the KDC Daemon:
537 ------------------------
539 We'll start the KDC daemon manually right now, just to test out the
540 installation. After you're convinced you want to use kerberos, you can
541 install and use the init script provided later in the instructions. Start
542 the daemon with the following command:
546 A "ps -ef | grep kdc" listing should show the daemon running.
548 --------------------------
549 Getting and Listing a TGT:
550 --------------------------
552 Attempt to get a TGT (ticket-granting-ticket) with the following command:
556 Of course, use the login name you used when you added it into the database.
557 You will be prompted for the password you created. After you get your ticket,
558 you can list it with the following command:
562 Information about the ticket should be displayed on the screen.
564 ----------------------------------
565 Creating /etc/heimdal/krb5.keytab:
566 ----------------------------------
568 The KDC server and any machine running kerberized server daemons must have a
569 host key installed. To create the host key (keytab file), issue the following
574 This connects to the database again in "local" mode. At the "kadmin>" prompt:
576 add --random-key host/belgarath.lfs.org
578 Of course, substitute the proper hostname and domainname. *Do* leave the
579 word "host" as it is. Only substitute the "belgarath.lfs.org". Again, choose
580 the defaults when prompted. You will return back to the "kadmin>" prompt. To
581 actually export the data to a keytab file, type the following at the
584 ext host/belgarath.lfs.org
586 Of course, make the appropriate substitutions. This should have created two
587 files in /etc/heimdal; krb5.keytab (kerberos 5) and srvtab (kerberos 4). BOTH
588 FILES SHOULD HAVE 600 (root rw only) PERMISSIONS. Keeping the keytab files
589 from public access is crucial to the overall security of the kerberos
592 ------------------------
593 Testing the keytab file:
594 ------------------------
596 To test the functionality of the keytab file, issue the following command
597 from the unix prompt:
601 This should dump a list of the host principal, along with the encryption
602 methods used to access the principal.
604 At this point, if everything has been successful so far, you can feel fairly
605 confident in the installation and configuration of the package.
607 There's still plenty more to do to complete the overall network installation,
608 though it's downhill from here.
610 ----------------------------
611 Notes about the keytab file:
612 ----------------------------
614 Eventually, you'll want to add server daemon principles to the database and
615 extract them to the keytab file. You do this in the same way you created the
616 host principles. Below is an example (after you connect to the database using
619 add --random-key ftp/belgarath.lfs.org
621 (choose the defaults)
623 ext ftp/belgarath.lfs.org
625 Of course, make the appropriate substitutions for the hostname and
628 ---------------------------------------------
629 Creating the Admin Access Control List (ACL):
630 ---------------------------------------------
632 This step isn't necessary if you have no plans on remotely administering the
633 KDC server. If all you'll ever do is connect to the KDC database locally
634 using the "kadmin -l" command, you don't need to create an ACL file. Though
635 you should keep one thing in mind.
637 Any machine acting as a kerberos server (not just the KDC server, but any
638 server running kerberized daemons) must have a keytab file installed. We've
639 already created a basic keytab file for the KDC server, but no others. You
640 can create a keytab file for another machine locally using "kadmin -l", but
641 you must transmit it to the other machine using some sort of encrypted
642 method (or floppy disk, tape, CD or other media). If a keytab file is
643 transmitted from the KDC server to another server without encryption, the
644 keytab file can be compromised, leading to an entirely compromised kerberos
647 Now, in a home network environment, this isn't too big a deal. But if you
648 are installing kerberos in a production environment where security is
649 important (it must be, why else install kerberos?), then anyone with a
650 packet sniffer can compromise your keytab file during transit if it's not
653 The solution is to remotely connect to the KDC database and extract a keytab
654 file for the remote server, or use scp, ssh or something along those lines.
658 Anywho, back to an ACL file.
660 Create a basic Access Control List (ACL) file with the following command:
662 cat > /etc/heimdal/krb5.acl << "EOF"
663 loginname@LFS.ORG all
667 Of course, substitute a valid principal and realm name. You may name the ACL
668 file anything you wish. It doesn't have to be krb5.acl. Heimdal, however, is
669 specific in the filename it uses as an ACL file. We put the ACL file in the
670 /etc/heimdal configuration directory, as this is more FHSish. To satisfy
671 Heimdal, we need to create a symbolic link with the following command:
673 ln -s /etc/heimdal/krb5.acl /var/lib/heimdal/kadmind.acl
675 Insure that whatever name you used for the acl file in /etc/heimdal is the
676 name of the file in the symlink. Note /var/lib/heimdal/kadmind.acl is not
679 This is the most very basic ACL as possible. As you create user principals,
680 you may provide different access levels to each. For now, the principle you
681 identified above will have full remote administrative access to the KDC
682 database. You'll probably want to create "admin" principals. Read the man
683 pages and do some googleing on kerberos administration to find out more about
684 ACL's and the "admin" principles.
686 -----------------------------------------
687 Remote Access to the Master KDC Database:
688 -----------------------------------------
690 Remote access to the KDC database is provided by the kadmin program. The
691 kadmin program requires the kadmind daemon to be functional on the KDC
692 server. The kadmind daemon is spawned on the KDC server by (x)inetd. I use
693 the following configuration in my /etc/xinetd.conf file (note - I use
698 flags = REUSE NAMEINARGS
702 instances = UNLIMITED
703 server = /usr/sbin/tcpd
704 server_args = /usr/sbin/kadmind
707 The kerberos-adm service port is identified in a standard LFS /etc/services
710 You can remotely connect to the master KDC database by the principle you have
711 already created (and provided access via the ACL) with the following command:
715 (this assumes Heimdal is installed, and /etc/heimdal/krb5.conf exists on the
718 After you create "admin" principles, you can remotely connect and administer
719 the database by simply using the "kadmin" command without a -p option.
721 --------------------------------
722 Notes about the kpasswdd Daemon:
723 --------------------------------
725 Heimdal provides a front end program (kpasswd) to the KDC database which
726 allows end users (principals) to change their kerberos password. This program
727 relies on the kpasswdd daemon to be running on the KDC server. The init
728 script below will automatically start the kpasswdd daemon. The kpasswdd
729 daemon should not be run from (x)inetd.
731 ------------------------------------
732 Creating the KDC Server Init Script:
733 ------------------------------------
735 To create an init script, issue the following command:
737 cat > /etc/rc.d/init.d/heimdal << "EOF"
739 # Begin $rc_base/init.d/heimdal
741 # Based on sysklogd script from LFS-3.1 and earlier.
742 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
743 # Heimdal bootscript submitted by Randy McMurchy <LFS-User at mcmurchy.com>
750 echo "Starting KDC Server Daemon..."
753 echo "Starting KDC kpasswdd Daemon..."
759 echo "Stopping KDC kpasswdd Daemon..."
760 killproc /usr/sbin/kpasswdd
761 echo "Stopping KDC Server Daemon..."
762 killproc /usr/sbin/kdc
772 statusproc /usr/sbin/kdc
773 statusproc /usr/sbin/kpasswdd
777 echo "Usage: $0 {start|stop|restart|status}"
782 # End $rc_base/init.d/heimdal
786 Change the permissions of the init script so that it is executable using the
789 chmod 754 /etc/rc.d/init.d/heimdal
791 I don't use the canned LFS bootscripts. I've created my own with a slightly
792 different directory structure and number ordering scheme. So I'm not really
793 in a position to create the necessary symlinks. Simply copy the format of
794 your existing symlinks and substitute the number of your choice for startup
797 You may also install the init script *and* associated symlinks by using the
798 instructions in the BLFS book. You'll find this in the heimdal-0.6.2 section.
800 This wraps up the installation and configuration of the master KDC server. If
801 the KDC server will also be used to run kerberized daemons, some of the
802 following instructions will apply.
804 ==========================================
805 5. KERBERIZED DAEMON SERVER CONFIGURATION:
806 ==========================================
808 These instructions are for creating a server which will run kerberized
809 daemons. A kerberized daemon is a Heimdal installed daemon which will
810 authenticate using a KDC server on the network. The kerberized daemons
811 installed by Heimdal include telnetd, rshd, ftpd and kxd. There are others,
812 but those aren't really used for general network connectivity.
814 First off, a warning. Installing Heimdal using these instructions will
815 overwrite several of the inetutil package daemon programs. You may specify
816 --libexecdir=/usr/sbin/heimdal, or some other location, but this is not
817 recommended. Additionally, Heimdal will overwrite several of the inetutil
818 package programs installed in /usr/bin. But you already know this if you've
819 read all the instructions up to this point.
827 First, decide if the server you are going to install Heimdal on will ever
828 become a slave KDC server. If not, you don't need to install Berkeley DB or
829 cracklib. You can specify --disable-berkeley-db as an option to ./configure
830 and Heimdal will be okay with this. Open-SSL is a requirement. All the other
831 optional dependencies listed above in the main installation section apply.
833 Install Heimdal according to the instructions above. Here's the abbreviated
836 sed -i -e "s@var/heimdal@var/lib/heimdal@g" configure.in configure \
837 doc/setup.texi doc/heimdal.info-1 kadmin/kadmind.8 kdc/kdc.8 \
838 lib/hdb/hdb.h lib/krb5/krb5.conf.5 lib/krb5/krb5.conf.cat5
842 patch -Np1 -i ../heimdal-0.6.2-fhs-compliance-1.patch
844 patch -Np1 -1 ../heimdal-0.6.2-cracklib-1.patch (only if a slave KDC server)
846 ./configure --prefix=/usr \
847 --sysconfdir=/etc/heimdal \
848 --datadir=/var/lib/heimdal \
849 --libexecdir=/usr/sbin \
850 --sharedstatedir=/usr/share \
851 --localstatedir=/var/lib/heimdal \
853 --with-openssl=/usr \
854 --with-readline-lib=/usr/lib \
855 --with-readline-include=/usr/include/readline
861 mv /usr/bin/ftp /usr/bin/ftpn
867 strip --strip-all ipropd-slave ipropd-master dump_log truncate_log \
868 replay_log hprop ktutil kstash kdc hpropd kpasswdd kadmind kadmin \
869 ftpd rshd push popper telnetd kxd kfd
872 strip --strip-all kinit klist kdestroy kgetcred string2key kpasswd afslog \
873 pagsh ftp login otp otpprint rsh rcp su xnlock telnet kx kf mk_cmds \
877 strip --strip-debug libroken.so.16.0.3 libroken.a libss.so.0.1.4 libss.a \
878 libsl.so.0.1.2 libsl.a libeditline.a libasn1.so.6.0.2 libasn1.a \
879 libkrb5.so.17.3.0 libkrb5.a libkafs.so.0.4.0 libkafs.a libhdb.so.7.0.7 \
880 libhdb.a libkadm5srv.so.7.0.6 libkadm5srv.a libkadm5clnt.so.4.2.4 \
881 libkadm5clnt.a libotp.so.0.1.4 libotp.a libgssapi.so.1.4.0 libgssapi.a
884 mv /bin/login /bin/login.SAVE
885 mv /bin/su /bin/su.SAVE
886 cp /usr/bin/login /bin
888 mv /usr/lib/lib{otp.so.0,otp.so.0.1.4,kafs.so.0,kafs.so.0.4.0} /lib
889 mv /usr/lib/lib{krb5.so.17,krb5.so.17.3.0,asn1.so.6,asn1.so.6.0.2} /lib
890 mv /usr/lib/lib{roken.so.16,roken.so.16.0.3,crypto.so.0.9.7} /lib
891 mv /usr/lib/lib{com_err.so.2,com_err.so.2.1,db-4.1.so} /lib
892 ln -sf /lib/lib{otp.so.0,otp.so.0.1.4,kafs.so.0,kafs.so.0.4.0} /usr/lib
893 ln -sf /lib/lib{krb5.so.17,krb5.so.17.3.0,asn1.so.6,asn1.so.6.0.2} /usr/lib
894 ln -sf /lib/lib{roken.so.16,roken.so.16.0.3,crypto.so.0.9.7} /usr/lib
895 ln -sf /lib/lib{com_err.so.2,com_err.so.2.1,db-4.1.so} /usr/lib
899 cat > /etc/heimdal/krb5.conf << "EOF"
901 default_realm = LFS.ORG
906 kdc = belgarath.lfs.org
907 admin_server = belgarath.lfs.org
908 kpasswd_server = belgarath.lfs.org
915 kdc = FILE:/var/log/kdc.log
916 admin_server = FILE:/var/log/kadmin.log
917 default = FILE:/var/log/krb.log
921 (you may remove the [logging] section if you know the server will never
922 become a slave KDC server)
924 ----------------------------------
925 Creating /etc/heimdal/krb5.keytab:
926 ----------------------------------
928 If you followed the instructions during the KDC server installation to create
929 an ACL, this step should be simple. First, as the root user (we're going to
930 create a file in /etc/heimdal and hopefully only the root user has write
931 access), connect to the KDC server using the kadmin program.
935 Use the login name you created earlier in the KDC server installation and
936 gave access via the ACL. (If you didn't create an ACL, you'll need to connect
937 to the database locally using the kadmin -l command. The steps are the same,
938 but you'll need to transfer the keytab file from the KDC server to the remote
939 server.) At the "kadmin>" prompt, issue the following command:
941 add --random-key host/remoteserver.lfs.org
943 Of course, substitute a valid hostname and domainname. Leave the word "host"
944 as is. Accept the default values when prompted. When you're back at the
945 "kadmin>" prompt, issue the following command:
947 ext host/remoteserver.lfs.org
949 Of course, substitute .......
951 This should create a keytab and srvtab file in /etc/heimdal. Insure the
954 ----------------------------
955 Notes about the keytab file:
956 ----------------------------
958 Eventually, you'll want to add server daemon principles to the database and
959 extract them to the keytab file. You do this in the same way you created the
960 host principles. Below is an example (after you connect to the database using
963 add --random-key ftp/remoteserver.lfs.org
965 (choose the defaults)
967 ext ftp/remoteserver.lfs.org
969 Of course, substitute .......
971 Heimdal should now be installed and ready for use as a kerberized server.
972 There's really not much to do to get the kerberized daemons running. Telnetd,
973 rshd and ftpd should not need anything in order for them to work if they were
974 previously running. Simply send a SIGHUP to the (x)inetd process (kill -1 pid)
975 so it will reread the configuration file. This isn't really necessary, but it
976 will complain if something is amiss.
978 If you haven't previously configured the telnetd, rshd, and ftpd daemons on
979 the machine, do so now by making the appropriate entries in (x)inetd.conf and
980 starting/signalling (x)inetd.
982 ---------------------------
983 Configuring the kxd Daemon:
984 ---------------------------
986 To me, one of the coolest things with the Heimdal kerberos package is its
987 ability to securely forward X requests. The Heimdal rxterm and rxtelnet
988 programs are really cool. Using them, you can securely request an X session
989 by any user on any host. Logged in as user A on host A, you can request an X
990 session started by user B on host B to be displayed on user A's display.
991 These programs rely on the Heimdal kxd daemon.
993 The kxd daemon needs some configuration. First, there's no service port
994 assigned to the kx service in the /etc/services file. The port used in most
995 of the stuff I found while googleing about kerberos kxd is spoken for by the
996 IANA database information. So, you'll have to pick one. I used 1001. Whatever
997 port you choose, make the appropriate entry in the /etc/services file.
999 Next, edit the (x)inetd.conf file to include an entry for the kx service. I
1000 have the following entry and it works just fine (I use tcp-wrappers).
1004 flags = REUSE NAMEINARGS
1005 socket_type = stream
1008 instances = UNLIMITED
1009 server = /usr/sbin/tcpd
1010 server_args = /usr/sbin/kxd
1013 Send a SIGHUP to (x)inetd and things should be good. This completes a basic
1016 ====================================
1017 6. USING KERBERIZED CLIENT PROGRAMS:
1018 ====================================
1020 To use the kerberized client programs (telnet, ftp, rsh, rxterm, rxtelnet,
1021 rcp, xnlock) they must be installed on the client machine. You can probably
1022 copy the programs and libraries from a machine that has had a Heimdal install
1023 if the architecture is similar. Maybe someone will try it out. To me, it's
1024 easier to just do an install of the package. Slow cpu machines
1025 notwithstanding. The make alone on my production KDC server, an ancient AMD
1026 P5-133mhz machine that Linux thinks is an i486 took over 3 1/2 hours! I
1027 didn't cross-compile as I wasn't pressed for time and felt the workout was a
1028 good test of the machine.
1030 Ah hell, just do an install on the machine if you haven't already.
1032 You can omit installing Berkeley-DB and cracklib and then use the
1033 --disable-berkeley-db switch to ./configure if the machine will never be a
1034 kerberos slave server.
1036 After the programs are installed you need an /etc/heimdal/krb5.conf file. The
1037 instructions for creating the file earlier in the hint are valid again. You
1038 can omit the logging section, if applicable (not a slave server).
1040 That's all there is to it.
1042 To run a kerberized program, you must first get a TGT. Use the "kinit"
1043 program to get the ticket. After you've acquired the ticket, you can use the
1044 kerberized programs to connect to any kerberized server on the network. You
1045 will not be prompted for authentication until your ticket expires (default
1046 is one day), unless you specify a different user as a command line argument
1047 to the program. You may get tickets for several principals (users), if you
1048 know the passwords, and bop along the network running program after program,
1049 never having to provide authentication.
1051 The kerberized programs will connect to non kerberized daemons, warning you
1052 that authentication is not encrypted. As mentioned earlier, only the ftp
1053 program gave any trouble connecting to non kerberized daemons.
1055 =============================================
1056 7. INSTALLING THE pam_krb5 PAM MODULE PACKAGE
1057 =============================================
1063 There's a Linux-PAM module available that works with the Heimdal Kerberos 5
1064 package. This module is used to provide secure authentication using PAM in
1065 conjunction with Kerberos 5. This authentication method is handy for
1066 authenticating non-native Kerberos applications such as the xdm, gdm and kdm
1067 X display managers. The following information is my understanding of the xdm
1068 login process. I could be wrong. Please research this topic further if it is
1069 of great importance to you.
1071 The xdm X display manager uses the Athena xlogin widget to perform login
1072 authentication. This method does not use Kerberos for authentication. It uses
1073 a straight read of the /etc/passwd and /etc/shadow files to perform
1074 authentication. This is undesireable in a Kerberos environment. To get around
1075 this, you can use Linux-PAM to assist in authentication.
1077 PAM, by default, does not include a module to support Kerberos. In fact, the
1078 BLFS book does not mention anything in the PAM, Shadow or X sections about
1079 using PAM for X display manager authentication. I won't discuss the use of
1080 the gdm or kdm display managers here. I don't use them. Though I use Gnome
1081 and KDE, I use xdm as my X display manager. I found I can create an xdm file
1082 in my /etc/pam.d directory to allow xdm login.
1084 Using the default BLFS setup (other defined very strict), you cannot log into
1085 your system using xdm without adding an xdm section to your PAM
1086 configuration. Even with PAM, authentication is clear text using /etc/passwd
1087 /etc/shadow. To get around this, use the pam_krb5 module.
1089 Lastly, I cannot vouch that the pam_krb5 module is a totally secure method
1090 of authenticating remote XDMCP requests. I have not checked with a packet
1091 analyzer to see what happens during the remote authentication process. If
1092 anyone has solid, verifyable information about this, please send me an email
1093 as I would like to include that information here.
1095 ---------------------
1096 Download the Package:
1097 ---------------------
1099 The most recent pam_krb5 PAM module package I found available is
1100 pam_krb5-1.3-rc7 and can be downloaded from:
1102 http://prdownloads.sourceforge.net/pam-krb5/pam_krb5-1.3-rc7.tar.gz?download
1104 --------------------
1105 Configure the Build:
1106 --------------------
1108 ./configure --prefix=/usr
1110 --prefix=/usr installs the documentation into /usr/man. The actual module is
1111 installed in /lib/security as the configure script looks for the location of
1118 Simply run the "make" command to build the package.
1124 There are no "check" or "test" targets to check the build. Omit this step.
1126 --------------------
1127 Install the Package:
1128 --------------------
1130 Simply run the "make install" command to install the package.
1136 Issue the following command to strip the debugging symbols from the binary:
1138 strip --strip-debug /lib/security/pam_krb5.so
1144 There are many examples of PAM configuration files in the pam.d subdirectory
1145 of the source tree. Additionally, the README file in the source tree is full
1146 of good information. Please review this information for configuring your PAM
1147 installation for use with Kerberos.
1149 Correctly configured, the pam_krb5 module will almost eliminate the need to
1150 manually acquire a TGT.
1152 ----------------------------------
1153 Configuring /etc/heimdal/krb5.conf
1154 ----------------------------------
1156 To fully utilize the pam_krb5 module you should add a section the Heimdal
1157 configuration file, /etc/heimdal/krb5.conf. Insert the following lines:
1161 keytab = /etc/heimdal/krb5.keytab
1163 ticket_lifetime = 36000
1164 renew_lifetime = 36000
1167 afs_cells = FQDN_of_KDC_server
1168 hosts = FQDN_of_additional_hosts
1174 You should modify or remove any lines appropriate to your installation.
1175 Insure you modify the lines containing FQDN.
1177 ==========================================
1178 8. ISSUES, GOTCHAS AND OTHER SUNDRY ITEMS:
1179 ==========================================
1181 As mentioned earlier, there's a glitch in the ftp program. Another thing I
1182 noticed is that the Heimdal programs don't process the backslashed special
1183 characters in the /etc/issue file correctly. Additionally, as mentioned in
1184 the previous section, Heimdal does not have any native way to authenticate
1185 the xdm, gdm and kdm display manager logins.
1187 There's probably some other small issues I noticed, too small to write down
1188 when it happened or remember now, but as I find/remember any, I'll update the
1195 1. Create instructions for creating/propogating a slave KDC server.
1201 When I realized I was going to integrate Heimdal into a project I was working
1202 on, Heimdal was not included in the BLFS book. I created this hint from my
1203 testing and research. Since that time, and my release of this hint as a
1204 "draft", Heimdal has been added to the BLFS book. I've tried to go back and
1205 make sure this hint and the BLFS book instructions contain the same
1208 If you discover errors and/or omissions in this hint, please let me know. I
1209 was mainly interested in providing the instructions for a clean build and
1210 configuration. I hope I've succeeded. Enjoy!
1215 DJ Lucas <dj_at_lucusit_dot_com> for assistance with the cracklib integration
1221 * Modified package dependency list to include pam_krb5
1222 * Added a section describing the pam_krb5 dependency
1223 * Modified pam_krb5 installation instructions
1224 * Minor wording changes
1227 * Updated package software version number due to package upgrade
1228 * Changed reference to libcom_err library moves and symlinks
1231 * Added a note about the Linux-PAM dependency
1234 * Changed Synopsis to more properly reflect the scope of the document
1235 * Reformatted the layout IAW the LFS hint submission guideline
1236 * Minor wording changes
1239 * Added pam_krb5 PAM Module section
1240 * Changed cracklib patch filename references
1241 * Minor wording changes
1244 * Slight modification to cracklib integration instructions
1247 * Added cracklib integration
1248 * Added notes about dependencies
1249 * Moved sysconfdir to /etc/heimdal
1250 * Simplified --with-openssl switches
1251 * Modified the "make check" explanation
1252 * Moved some libraries to /lib to stay FHS compliant
1253 * Modified the krb5.conf file
1254 * Removed instructions to create kdc.conf
1255 * Moved ACL file and created symlink to original location
1256 * Minor wording changes