LDAP + Kerberos

LDAP and Kerberos together make for a great combination. Kerberos is used to manage credentials securely (authentication) while LDAP is used for determining criteria about the accounts, such as what they're allowed access to (authorization) and other account metadata. Most other LDAP setups involve in storing passwords in the LDAP directory itself using the userPassword attribute. While this is ok for a basic setup, one can do much better with just a little effort.

Overview

this is a work in progress, obv.

This guide is intended as a Debian-focused update to excellent guides, such as http://aput.net/~jheiss/krbldap/howto.html . Many of the workarounds have been fixed in recent releases of Debian, however there are still a few places one can easily get snagged.

The goal of this document is to create a Single Sign-On (SSO) system without using NIS. This includes a client setup which can successfully use Kerberos for authentication and LDAP for authorization. A number of common clients are shown, such as a standard shell login and Apache2 integration.

This document was originally written based on experience with Debian/etch and Debian/lenny. Please update accordingly.

Kerberos server

There are plenty of guides for setting up a Kerberos server on Debian. Once you have a KDC set up with a test principal, come back to this document.

Kerberos client

Install the following packages:

The Kerberos client setup is pretty straight forward using the krb5-config package's config. For libpam-krb5, you will have to modify your /etc/pam.d/common-* files according to /usr/share/doc/libpam-krb5/README.Debian.

If you're having trouble, check the following:

LDAP Server

  1. PAM / NSS

Apache2

Basic authentication over SSL

Basic + SSL is a quick way to set up restricted access to websites. It's not the best, usability wise (this is usually the fault of most browsers for not exposing identity management at all), but it works well enough for most internal-use cases.

Other options are to use libapache2-mod-auth-kerb or libapache2-mod-authn-sasl, but neither of those provide group information from LDAP. It might be possible to pull that in using the authnz_ldap that comes with Apache2, but that module seems quite intent on performing the authentication phase, which is in our case is supposed to be handled by Kerberos, not LDAP.