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