Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Providing Active Directory authentication via Kerberos protocol in Apache

View products that this article applies to.

More information

Before Getting Started

You will need to have hands-on experiences with UNIX, Apache, and Kerberos before continuing on this article.

In this example, I will be using Tao Linux 1.0 as the Linux distribution base.� Tao Linux is one of several projects to build a free Linux distribution from the source used in the Red Hat Enterprise product line.� For more information about Tao Linux, please visit their web site at

Tao Linux ships with Apache 2 and Kerberos 5.� Please check with the User Guide for package installation.

Download the latest version of mod_auth_kerb from� We will be using this module to provide Kerberos protocol support in Apache.

Step 1

Uncompress mod_auth_krb and�follow the README file to install the module to your Apache's modules directory.

# zcat mod_auth_kerb-5.0-rc4.tar.gz | tar xvf -
# cd mod_auth_kerb-5.0-rc4.tar.gz
# ./configure --with-krb4=no --with-krb5=/usr/kerberos
# make
# make install

Step 2

Append this line�to the�Apache configuration file.� The default location for the configuration file�is�/etc/httpd/conf/httpd.conf.

LoadModule auth_kerb_module modules/

Step 3

Create a Kerberos keytab file and make it readable by all.� This will be the key entry for the module that you installed in step 1.��The format of the file is�HTTP/replace_your_web_server_full_hostname_here@ACTIVE_DIRECTORY_FULL_DOMAIN_NAME

# echo HTTP/ > /path/auth_kerb.keytab
# chmod ugo+r /path/auth_kerb.keytab

Step 4

Configure the Kerberos configuration file.� The default location for the configuration file�is /etc/krb5.conf.� Please see template below.� Replace EXAMPLE.COM with your Active Directory domain's FQDN and dc-01/ with your domain controllers' FQDN.

�ticket_lifetime = 24000
�default_realm = EXAMPLE.COM
�dns_lookup_realm = false
�dns_lookup_kdc = false

� kdc =
� kdc =


�pam = {
�� debug = false
�� ticket_lifetime = 36000
�� renew_lifetime = 36000
�� forwardable = true
�� krb4_convert = false

Step 5

Create an .htaccess file�and set up a basic authentication.� Please see template below.� Replace /path/auth_kerb.keytab with the location of the keytab file and�EXAMPLE.COM with your Active Directory domain's FQDN.

AuthName "Kerberos Login"
AuthType Kerberos
Krb5Keytab /path/auth_kerb.keytab
KrbMethodNegotiate off
KrbSaveCredentials off
KrbVerifyKDC off
Require valid-user

Step 6

Restart Apache daemon.

# service httpd restart


It is recommended that you tunnel basic password authentication via SSL in Apache using mod_ssl so the password will not be exposed in plain text format.

Questions and Answers

1) How do I test the Kerberos configuration file that I set up in step 4?

A: Execute "kinit valid_AD_account_username" and "klist" (without quotes). �For example:

# kinit jdoe
Password for jdoe@EXAMPLE.COM: XXXXXXXX

# Klist
Ticket cache: FILE/tmp/krb5cc_999
Default principal: jdoe@EXAMPLE.COM

Valid starting���� Expires����������� Service principal
04/15/04 18:00:00� 04/16/04 18:00:00� krbtgt/EXAMPLE.COM@EXAMPLE.COM

Kerberos 4 ticket cache: /tmp/tkt999
Klist: You have no tickets cached

Don't forget to execute "kdestroy" (without quotes) to clear out�the ticket file.

↑ Back to the top

Community solutions content disclaimer

Microsoft corporation and/or its respective suppliers make no representations about the suitability, reliability, or accuracy of the information and related graphics contained herein. All such information and related graphics are provided "as is" without warranty of any kind. Microsoft and/or its respective suppliers hereby disclaim all warranties and conditions with regard to this information and related graphics, including all implied warranties and conditions of merchantability, fitness for a particular purpose, workmanlike effort, title and non-infringement. You specifically agree that in no event shall Microsoft and/or its suppliers be liable for any direct, indirect, punitive, incidental, special, consequential damages or any damages whatsoever including, without limitation, damages for loss of use, data or profits, arising out of or in any way connected with the use of or inability to use the information and related graphics contained herein, whether based on contract, tort, negligence, strict liability or otherwise, even if Microsoft or any of its suppliers has been advised of the possibility of damages.

↑ Back to the top

Keywords: KB555092, kbhowto, kbpubmvp, kbpubtypecca

↑ Back to the top

Article Info
Article ID : 555092
Revision : 1
Created on : 4/21/2004
Published on : 4/21/2004
Exists online : False
Views : 390