]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_auth_digest.xml
627c66e48e4f26da2c57bd82220eb36b8f4751cb
[apache] / docs / manual / mod / mod_auth_digest.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Copyright 2002-2006 The Apache Software Foundation or its licensors, as
8  applicable.
9
10  Licensed under the Apache License, Version 2.0 (the "License");
11  you may not use this file except in compliance with the License.
12  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <modulesynopsis metafile="mod_auth_digest.xml.meta">
24
25 <name>mod_auth_digest</name>
26 <description>User authentication using MD5
27     Digest Authentication.</description>
28 <status>Experimental</status>
29 <sourcefile>mod_auth_digest.c</sourcefile>
30 <identifier>auth_digest_module</identifier>
31
32 <summary>
33     <p>This module implements HTTP Digest Authentication. However, it
34     has not been extensively tested and is therefore marked
35     experimental.</p>
36 </summary>
37
38 <seealso><directive module="core">AuthName</directive></seealso>
39 <seealso><directive module="core">AuthType</directive></seealso>
40 <seealso><directive module="core">Require</directive></seealso>
41 <seealso><a href="../howto/auth.html">Authentication howto</a></seealso>
42
43 <section id="using"><title>Using Digest Authentication</title>
44
45     <p>Using MD5 Digest authentication is very simple. Simply set
46     up authentication normally, using <code>AuthType Digest</code> and
47     <directive module="mod_auth_digest">AuthDigestProvider</directive>
48     instead of the normal <code>AuthType Basic</code> and
49     <directive module="mod_auth_basic">AuthBasicProvider</directive>.
50     Then add a <directive module="mod_auth_digest"
51     >AuthDigestDomain</directive> directive containing at least the root
52     URI(s) for this protection space.</p>
53
54     <p>Appropriate user (text) files can be created using the
55     <program>htdigest</program> tool.</p>
56
57     <example><title>Example:</title>
58       &lt;Location /private/&gt;<br />
59       <indent>
60         AuthType Digest<br />
61         AuthName "private area"<br />
62         AuthDigestDomain /private/ http://mirror.my.dom/private2/<br />
63         <br />
64         AuthDigestProvider file<br />
65         AuthUserFile /web/auth/.digest_pw<br />
66         Require valid-user<br />
67       </indent>
68       &lt;/Location&gt;
69     </example>
70
71     <note><title>Note</title> 
72     <p>Digest authentication is more secure than Basic authentication,
73     but only works with supporting browsers. As of September 2004, major
74     browsers that support digest authentication include <a
75     href="http://www.w3.org/Amaya/">Amaya</a>, <a
76     href="http://konqueror.kde.org/">Konqueror</a>, <a
77     href="http://www.microsoft.com/windows/ie/">MS Internet Explorer</a>
78     for Mac OS X and Windows (although the Windows version fails when
79     used with a query string -- see "<a href="#msie" >Working with MS
80     Internet Explorer</a>" below for a workaround), <a
81     href="http://www.mozilla.org">Mozilla</a>, <a
82     href="http://channels.netscape.com/ns/browsers/download.jsp">
83     Netscape</a> 7, <a href="http://www.opera.com/">Opera</a>, and <a
84     href="http://www.apple.com/safari/">Safari</a>. <a
85     href="http://lynx.isc.org/">lynx</a> does <strong>not</strong>
86     support digest authentication. Since digest authentication is not as
87     widely implemented as basic authentication, you should use it only
88     in environments where all users will have supporting browsers.</p>
89     </note>
90 </section>
91
92 <section id="msie"><title>Working with MS Internet Explorer</title>
93     <p>The Digest authentication implementation in current Internet
94     Explorer for Windows implementations has known issues, namely that
95     <code>GET</code> requests with a query string are not RFC compliant.
96     There are a few ways to work around this issue.</p>
97
98     <p>
99     The first way is to use <code>POST</code> requests instead of
100     <code>GET</code> requests to pass data to your program.  This method
101     is the simplest approach if your application can work with this
102     limitation.
103     </p>
104
105     <p>Since version 2.0.51 Apache also provides a workaround in the
106     <code>AuthDigestEnableQueryStringHack</code> environment variable.
107     If <code>AuthDigestEnableQueryStringHack</code> is set for the
108     request, Apache will take steps to work around the MSIE bug and
109     remove the request URI from the digest comparison.  Using this
110     method would look similar to the following.</p>
111
112     <example><title>Using Digest Authentication with MSIE:</title>
113     BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
114     </example>
115
116     <p>See the <directive module="mod_setenvif">BrowserMatch</directive>
117     directive for more details on conditionally setting environment
118     variables</p>
119 </section>
120
121
122 <directivesynopsis>
123 <name>AuthDigestProvider</name>
124 <description>Sets the authentication provider(s) for this location</description>
125 <syntax>AuthDigestProvider <var>provider-name</var>
126 [<var>provider-name</var>] ...</syntax>
127 <default>AuthDigestProvider file</default>
128 <contextlist><context>directory</context><context>.htaccess</context>
129 </contextlist>
130 <override>AuthConfig</override>
131
132 <usage>
133     <p>The <directive>AuthDigestProvider</directive> directive sets 
134     which provider is used to authenticate the users for this location.
135     The default <code>file</code> provider is implemented
136     by the <module>mod_authn_file</module> module.  Make sure
137     that the chosen provider module is present in the server.</p>
138
139     <p>See <module>mod_authn_dbm</module>, <module>mod_authn_file</module>, 
140     and <module>mod_authn_dbd</module> for providers.</p>
141 </usage>
142 </directivesynopsis>
143
144 <directivesynopsis>
145 <name>AuthDigestQop</name>
146 <description>Determines the quality-of-protection to use in digest
147 authentication</description>
148 <syntax>AuthDigestQop none|auth|auth-int [auth|auth-int]</syntax>
149 <default>AuthDigestQop auth</default>
150 <contextlist><context>directory</context><context>.htaccess</context>
151 </contextlist>
152 <override>AuthConfig</override>
153
154 <usage>
155     <p>The <directive>AuthDigestQop</directive> directive determines
156     the <dfn>quality-of-protection</dfn> to use. <code>auth</code> will
157     only do authentication (username/password); <code>auth-int</code> is
158     authentication plus integrity checking (an MD5 hash of the entity
159     is also computed and checked); <code>none</code> will cause the module
160     to use the old RFC-2069 digest algorithm (which does not include
161     integrity checking). Both <code>auth</code> and <code>auth-int</code> may
162     be specified, in which the case the browser will choose which of
163     these to use. <code>none</code> should only be used if the browser for
164     some reason does not like the challenge it receives otherwise.</p>
165
166     <note>
167       <code>auth-int</code> is not implemented yet.
168     </note>
169 </usage>
170 </directivesynopsis>
171
172 <directivesynopsis>
173 <name>AuthDigestNonceLifetime</name>
174 <description>How long the server nonce is valid</description>
175 <syntax>AuthDigestNonceLifetime <var>seconds</var></syntax>
176 <default>AuthDigestNonceLifetime 300</default>
177 <contextlist><context>directory</context><context>.htaccess</context>
178 </contextlist>
179 <override>AuthConfig</override>
180
181 <usage>
182     <p>The <directive>AuthDigestNonceLifetime</directive> directive
183     controls how long the server nonce is valid. When the client
184     contacts the server using an expired nonce the server will send
185     back a 401 with <code>stale=true</code>. If <var>seconds</var> is
186     greater than 0 then it specifies the amount of time for which the
187     nonce is valid; this should probably never be set to less than 10
188     seconds. If <var>seconds</var> is less than 0 then the nonce never
189     expires. <!-- Not implemented yet: If <var>seconds</var> is 0 then
190     the nonce may be used exactly once by the client. Note that while
191     one-time-nonces provide higher security against replay attacks,
192     they also have significant performance implications, as the
193     browser cannot pipeline or multiple connections for the
194     requests. Because browsers cannot easily detect that
195     one-time-nonces are being used, this may lead to browsers trying
196     to pipeline requests and receiving 401 responses for all but the
197     first request, requiring the browser to resend the requests. Note
198     also that the protection against reply attacks only makes sense
199     for dynamically generated content and things like POST requests;
200     for static content the attacker may already have the complete
201     response, so one-time-nonces do not make sense here.  -->
202     </p>
203 </usage>
204 </directivesynopsis>
205
206 <directivesynopsis>
207 <name>AuthDigestNonceFormat</name>
208 <description>Determines how the nonce is generated</description>
209 <syntax>AuthDigestNonceFormat <var>format</var></syntax>
210 <contextlist><context>directory</context><context>.htaccess</context>
211 </contextlist>
212 <override>AuthConfig</override>
213
214 <usage>
215     <note>Not implemented yet.</note>
216     <!-- The AuthDigestNonceFormat directive determines how the nonce is
217     generated. -->
218 </usage>
219 </directivesynopsis>
220
221 <directivesynopsis>
222 <name>AuthDigestNcCheck</name>
223 <description>Enables or disables checking of the nonce-count sent by the
224 server</description>
225 <syntax>AuthDigestNcCheck On|Off</syntax>
226 <default>AuthDigestNcCheck Off</default>
227 <contextlist><context>server config</context></contextlist>
228
229 <usage>
230     <note>
231       Not implemented yet.
232     </note>
233     <!--
234     <p>The AuthDigestNcCheck directive enables or disables the checking of the
235     nonce-count sent by the server.</p>
236
237     <p>While recommended from a security standpoint, turning this directive
238     On has one important performance implication. To check the nonce-count
239     *all* requests (which have an Authorization header, irrespective of
240     whether they require digest authentication) must be serialized through
241     a critical section. If the server is handling a large number of
242     requests which contain the Authorization header then this may noticeably
243     impact performance.</p>
244      -->
245 </usage>
246 </directivesynopsis>
247
248 <directivesynopsis>
249 <name>AuthDigestAlgorithm</name>
250 <description>Selects the algorithm used to calculate the challenge and
251 response hashes in digest authentication</description>
252 <syntax>AuthDigestAlgorithm MD5|MD5-sess</syntax>
253 <default>AuthDigestAlgorithm MD5</default>
254 <contextlist><context>directory</context><context>.htaccess</context>
255 </contextlist>
256 <override>AuthConfig</override>
257
258 <usage>
259     <p>The <directive>AuthDigestAlgorithm</directive> directive
260     selects the algorithm used to calculate the challenge and response
261     hashes.</p>
262
263     <note>
264       <code>MD5-sess</code> is not correctly implemented yet.
265     </note>
266     <!--
267     <p>To use <code>MD5-sess</code> you must first code up the
268     <code>get_userpw_hash()</code> function in
269     <code>mod_auth_digest.c</code>.</p>
270     -->
271 </usage>
272 </directivesynopsis>
273
274 <directivesynopsis>
275 <name>AuthDigestDomain</name>
276 <description>URIs that are in the same protection space for digest
277 authentication</description>
278 <syntax>AuthDigestDomain <var>URI</var> [<var>URI</var>] ...</syntax>
279 <contextlist><context>directory</context><context>.htaccess</context>
280 </contextlist>
281 <override>AuthConfig</override>
282
283 <usage>
284     <p>The <directive>AuthDigestDomain</directive> directive allows
285     you to specify one or more URIs which are in the same protection
286     space (<em>i.e.</em> use the same realm and username/password info).
287     The specified URIs are prefixes; the client will assume
288     that all URIs "below" these are also protected by the same
289     username/password. The URIs may be either absolute URIs (<em>i.e.</em>
290     including a scheme, host, port, etc.) or relative URIs.</p>
291
292     <p>This directive <em>should</em> always be specified and
293     contain at least the (set of) root URI(s) for this space.
294     Omitting to do so will cause the client to send the
295     Authorization header for <em>every request</em> sent to this
296     server. Apart from increasing the size of the request, it may
297     also have a detrimental effect on performance if <directive
298     module="mod_auth_digest">AuthDigestNcCheck</directive> is on.</p>
299
300     <p>The URIs specified can also point to different servers, in
301     which case clients (which understand this) will then share
302     username/password info across multiple servers without
303     prompting the user each time. </p>
304 </usage>
305 </directivesynopsis>
306
307 <directivesynopsis>
308 <name>AuthDigestShmemSize</name>
309 <description>The amount of shared memory to allocate for keeping track
310 of clients</description>
311 <syntax>AuthDigestShmemSize <var>size</var></syntax>
312 <default>AuthDigestShmemSize 1000</default>
313 <contextlist><context>server config</context></contextlist>
314
315 <usage>
316     <p>The <directive>AuthDigestShmemSize</directive> directive defines
317     the amount of shared memory, that will be allocated at the server
318     startup for keeping track of clients. Note that the shared memory
319     segment cannot be set less than the space that is necessary for
320     tracking at least <em>one</em> client. This value is dependant on your
321     system. If you want to find out the exact value, you may simply
322     set <directive>AuthDigestShmemSize</directive> to the value of
323     <code>0</code> and read the error message after trying to start the
324     server.</p>
325
326     <p>The <var>size</var> is normally expressed in Bytes, but you
327     may let the number follow a <code>K</code> or an <code>M</code> to
328     express your value as KBytes or MBytes. For example, the following
329     directives are all equivalent:</p>
330
331     <example>
332       AuthDigestShmemSize 1048576<br />
333       AuthDigestShmemSize 1024K<br />
334       AuthDigestShmemSize 1M
335     </example>
336 </usage>
337 </directivesynopsis>
338
339 </modulesynopsis>