Use cannonical DNS name when constructing the principal for passwd verification ...
[mod_auth_kerb.git] / INSTALL
1 1. Prerequisites
2 ----------------
3  - Development enviroment for Kerberos5 and/or Kerberos4 (i.e. libraries and
4    header files).  The module works with the MIT Kerberos implementation
5    (supporting both krb4 and krb5), the kth-krb Kerberos4 implementation,
6    and the Heimdal Kerberos5 implementation. Kerberos libraries come with
7    most Linux distributions but they may not be installed by default. 
8  - Apache server installed with SSL support.
9    Both 1.x and 2.x series of Apache are supported, provided they are
10    compiled to support DSO. SSL support (provided by either mod_ssl or
11    apache-ssl) is necessary for the module to work in a secure way. Most
12    Linux distributions contain suitable Apache packages. 
13  - The latest source of the module available from the main project site
14    (http://sourceforge.net/project/showfiles.php?group_id=51775). 
15  - Working C compiler, GNU make.
16
17 2. Building and installing the module
18 -------------------------------------
19 Unpack the distribution tarball and run the configure script to set up the
20 build enviroment. The script will try to find krb5 and/or krb4 libraries and
21 headers and an Apache installation directory. You can use following flags to
22 specify locations of these files:
23
24    --with-krb4=<dir>
25    --with-krb5=<dir>
26       these options are used to specify locations of the installation
27       directories for krb4 and krb5, respectively. If you don't want to
28       compile support for one of the method, use no as the appropriate
29       parameter or specify --without-krb5 or --without-krb4.
30    --with-apache=<dir>
31       use this parameter to specify location where the Apache installation
32       resides. 
33
34 After the configuration script finishes run make followed by make install.
35 In order to install the module you will have to have writing permission for
36 the apache directory.
37
38 An example of the building stage follows:
39    ./configure --with-krb5=/software/krb5-1.3.1         \
40                --with-krb4=no                           \
41                --with-apache=/software/apache-2.0.47
42    make
43    su
44    make install
45
46 3. Create the Kerberos principal for the server
47 -----------------------------------------------
48 A service principal for the web server must be registered with the KDC in
49 order to let the module verify users properly. In general the principals for
50 web servers have names with format HTTP/servername@REALM, where servername
51 is the fully-qualified domain name of the server and REALM is your Kerberos
52 realm.  If you have multiple virtual servers requiring authentication
53 service principals have to be generated for each virtual servername.  After
54 creating the service principal, corresponding Kerberos keys must be
55 extracted to a keytab file stored on the server host.  Steps to create the
56 principal and extracting the keys vary depending on the KDC server type
57 used.
58
59 Heimdal or MIT KDC
60 ------------------
61 From the www machine start the kadmin command, connect to the KDC and create
62 principal HTTP/servername@REALM with a random key(s).  Then extract the keys
63 into a local keytab and change ownership and permissions  for the keytab
64 file so that only the apache user can access it. Example using kadmin from
65 Heimdal:
66   kadmin -p admin@REALM -r REALM ank -r HTTP/servername@REALM
67   kadmin -p admin@REALM -r REALM ext -k /etc/httpd/keytab HTTP/servername@REALM
68   chown nobody /etc/httpd/keytab
69   chmod 600 /etc/httpd/keytab
70   
71 Windows 2000 Domain Controler
72 -----------------------------
73 The Kerberos realm in Active Directory is the same as the DNS domain
74 name of the AD domain. For example, a Kerberos principal for host
75 server.example.com might be "HTTP/server.example.com@EXAMPLE.COM".
76
77 To install the principal in AD you first need to create a user account in the
78 domain for the server. It makes sense to call this account something
79 meaningful, maybe "httpd_servername" so that it is obvious what this account is
80 used for. To create the account you can use standard AD tools.  Make sure that
81 the user account has "Password never expires" set and write down the password
82 you set for the account (you will need it later).
83
84 If you want to kerberize additional hosts you need to create one user account
85 per each kerberized host.
86
87 The Kerberos principal is associated with a user account with the ktpass.exe
88 tool that is part of the Microsoft Support Tools package. This tools needs to
89 be run on a domain controller. To associate a Kerberos principal with a user
90 account just run ktpass.exe in a command prompt with appropriate parameters to
91 create a keytab file. Full description of the ktpass.exe command can be found
92 at http://support.microsoft.com/default.aspx?scid=kb;en-us;324144.
93
94 ktpass -out c:\apache.ktab -princ HTTP/server.name@REALM.NAME 
95        -pass account_password -mapuser httpd_servername
96
97 In the above the c:\apache.ktab is the name of the created keytab file,
98 account_passwored is the password you set for the user account and
99 httpd_servername is the name of the user account.
100
101 You need to copy the keytab file to your web server in a secure way to avoid
102 revealing the server key(s). Make sure that the keytab file is owned by the
103 apache user and only readable to this user (i.e. the permissions are 600).
104 After copying the keytab verify the content using the ktutil tool.
105
106 4. Verifying krb5 on the server host
107 ------------------------------------
108 Before starting configuring the module make sure your Kerberos enviroment on
109 the web host is properly configured. The easiest way to check is using the
110 kinit command to get a ticket from the KDC.
111
112 5. Configuring mod_auth_kerb
113 ----------------------------
114 First make sure that Apache works as expected.
115
116 You need to load the mod_auth_kerb module. To do this, add a LoadModule
117 statement into the appropriate section of httpd.conf file.
118
119 LoadModule auth_kerb_module modules/mod_auth_kerb.so
120
121 The configuration of mod_auth_kerb can be done per directory. The
122 configuration directives can be stored in either a <Directory> section of
123 httpd.conf or in a .htaccess file in the coresponding directory. Example of a
124 Directory section from httpd.conf:
125
126   <Directory /var/www/private>
127      AuthType Kerberos
128      AuthName "Kerberos Login"
129      Krb5Keytab  /etc/apache/apache.keytab
130      KrbAuthRealms EXAMPLE.COM
131      Require valid-user
132   </Directory>
133
134 The Krb5Keytab file is the one created as described above in section 3.
135
136 Summary of all configuration directives supported by the module can be found in
137 README.
138
139 6. Configuring the browsers
140 ---------------------------
141 For password based authentication any browser supporting the Basic HTTP
142 authentication method can be used without any changes. In order to use
143 ticket based authentication (Negotiate) you will need either MS Internet
144 Explorer 5.0+ running on Win2000 SP2 (or greater) or Mozilla with the
145 Negotiateauth extension (available in 1.7rc2 and greater).
146
147 Internet Explorer
148 -----------------
149 To make the Negotiate authentication work the web server hostname  must be
150 in Internet Explorer "Local Intranet" security zone and the "Windows
151 Integrated Authentication" must be enabled in the IE advanced options.
152
153 Mozilla
154 -------
155 TBD
156 (First make sure your Mozilla distribution contains the Negotiateauth component
157 check libnegotiate.so
158 debugging
159 Using with heimdal)
160
161 6. Access control
162 -----------------
163 If you want only particular users to be able to access the secured area, you
164 can list their principal names in the appropriate Require directive. They must
165 be full Kerberos names, including the REALM part. For example:
166   Require kouril@REALM.COM kouril REALM.CZ
167
168 The user's name is put by Apache in the REMOTE_USER environment variable so
169 that it could be used by cgi-bin scripts.
170
171 $Id$