3459469efb3e247026a48ed5085a70da6457fc55
[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 400 /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 -crypto DES-CBC-MD5
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. The DES-CBC-MD5 encryption
100 is needed to get Heimdal to work with Microsoft KDC, MIT Kerberos does not
101 seem to need it but it does not hurt either. In fact, RFC1510 discourages
102 using DES-CBC-CRC (default in Win2k ktpass.exe) so it's probably better to
103 use DES-CBC-MD5 in all cases.
104
105 You need to copy the keytab file to your web server in a secure way to avoid
106 revealing the server key(s). Note that the copy needs to be done in binary
107 mode to avoid corrupting the file. Make sure that the keytab file is owned by
108 the apache user and only readable to this user (i.e. the permissions are 400).
109 After copying the keytab verify the content using the ktutil tool.
110
111 See http://www.grolmsnet.de/kerbtut for more information about using
112 mod_auth_kerb with Windows KDC.
113
114 4. Verifying krb5 on the server host
115 ------------------------------------
116 Before starting configuring the module make sure your Kerberos enviroment on
117 the web host is properly configured. The easiest way to check is using the
118 kinit command to get a ticket from the KDC.
119
120 5. Configuring mod_auth_kerb
121 ----------------------------
122 First make sure that Apache works as expected.
123
124 You need to load the mod_auth_kerb module. To do this, add a LoadModule
125 statement into the appropriate section of httpd.conf file.
126
127 LoadModule auth_kerb_module modules/mod_auth_kerb.so
128
129 The configuration of mod_auth_kerb can be done per directory. The
130 configuration directives can be stored in either a <Directory> section of
131 httpd.conf or in a .htaccess file in the coresponding directory. Example of a
132 Directory section from httpd.conf:
133
134   <Directory /var/www/private>
135      AuthType Kerberos
136      AuthName "Kerberos Login"
137      Krb5Keytab  /etc/apache/apache.keytab
138      KrbAuthRealms EXAMPLE.COM
139      Require valid-user
140   </Directory>
141
142 The Krb5Keytab file is the one created as described above in section 3.
143
144 Summary of all configuration directives supported by the module can be found in
145 README.
146
147 6. Configuring the browsers
148 ---------------------------
149 For password based authentication any browser supporting the Basic HTTP
150 authentication method can be used without any changes. In order to use
151 ticket based authentication (Negotiate) you will need either MS Internet
152 Explorer 5.0+ running on Win2000 SP2 (or later) or Mozilla with the
153 Negotiateauth extension (available in 1.7beta and later).
154
155 Internet Explorer
156 -----------------
157 To make the Negotiate authentication work the web server hostname  must be
158 in Internet Explorer "Local Intranet" security zone and the "Windows
159 Integrated Authentication" must be enabled in the IE advanced options.
160
161 See also a guide from Microsoft describing how to configure Windows Machine to
162 use Unix KDC available at
163 http://www.microsoft.com/windows2000/techinfo/planning/security/kerbsteps.asp
164
165 Mozilla
166 -------
167 First make sure your Mozilla distribution contains the Negotiateauth component
168 (libnegotiateauth.so on Unix, negotiateauth.dll on Windows). Generally this is
169 included in versions 1.7beta and later on Unix platforms including Mac OSX,
170 maybe 1.8 and later on Windows.)
171
172 If you want to find out what happens in the Negotiateauth component use
173 following environment variables:
174   NSPR_LOG_MODULES=negotiateauth:5
175   NSPR_LOG_FILE=/tmp/negotiateauth.log
176 before starting Mozilla. You will see debugging messages logged in the file
177 specified by NSPR_LOG_FILE (/tmp/negotiateauth.log)
178
179 6. Access control
180 -----------------
181 If you want only particular users to be able to access the secured area, you
182 can list their principal names in the appropriate Require directive. They must
183 be full Kerberos names, including the REALM part. For example:
184   Require kouril@REALM.COM kouril REALM.CZ
185
186 The user's name is put by Apache in the REMOTE_USER environment variable so
187 that it could be used by cgi-bin scripts.
188
189 $Id$