mod_auth.html revision 39f9a4276c8e03639d26c1be99e966468e30b774
97a9a944b5887e91042b019776c41d5dd74557aferikabele<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
97a9a944b5887e91042b019776c41d5dd74557aferikabele<HTML>
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<HEAD>
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<TITLE>Apache module mod_auth</TITLE>
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd</HEAD>
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki<BODY
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd BGCOLOR="#FFFFFF"
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc TEXT="#000000"
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd LINK="#0000FF"
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd VLINK="#000080"
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen ALINK="#FF0000"
2e545ce2450a9953665f701bb05350f0d3f26275nd>
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<!--#include virtual="header.html" -->
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<H1 ALIGN="CENTER">Module mod_auth</h1>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4ndThis module is contained in the <code>mod_auth.c</code> file, and
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowenis compiled in by default. It provides for user authentication using
3f08db06526d6901aa08c110b5bc7dde6bc39905ndtextual files.
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<menu>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<li><A HREF="#authgroupfile">AuthGroupFile</A>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<li><A HREF="#authuserfile">AuthUserFile</A>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<li><A HREF="#authauthoritative">AuthAuthoritative</A>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd</menu>
7dc5a2d4a0c77f5bf5a95de92d68e43de7d8117anilgun<hr>
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<A name="authgroupfile"><h2>AuthGroupFile</h2></A>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<!--%plaintext &lt;?INDEX {\tt AuthGroupFile} directive&gt; -->
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<strong>Syntax:</strong> AuthGroupFile <em>filename</em><br>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<Strong>Context:</strong> directory, .htaccess<br>
cea021a7fc2657b091df4d3b031c4254ec371dd7rbowen<Strong>Override:</strong> AuthConfig<br>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<strong>Status:</strong> Base<br>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<strong>Module:</strong> mod_auth<p>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf
f19fa851b976a05691dea05be46586aa5aadeba2rbowenThe AuthGroupFile directive sets the name of a textual file containing the list
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsfof user groups for user authentication. <em>Filename</em> is the path
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirinto the group file. If it is not absolute (<EM>i.e.</EM>, if it
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirindoesn't begin with a slash), it is treated as relative to the ServerRoot.
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf<P>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsfEach line of the group file contains a groupname followed by a colon, followed
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirinby the member usernames separated by spaces. Example:
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf<blockquote><code>mygroup: bob joe anne</code></blockquote>
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirinNote that searching large text files is <em>very</em> inefficient;
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin<A HREF="mod_auth_dbm.html#authdbmgroupfile">AuthDBMGroupFile</A> should
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsfbe used instead.<p>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsfSecurity: make sure that the AuthGroupFile is stored outside the
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsfdocument tree of the web-server; do <em>not</em> put it in the directory that
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirinit protects. Otherwise, clients will be able to download the AuthGroupFile.<p>
06ba4a61654b3763ad65f52283832ebf058fdf1cslive
f0a393c5c2d7de58f447855369ad2fbfa254e544rbowenSee also <A HREF="core.html#authname">AuthName</A>,
f0a393c5c2d7de58f447855369ad2fbfa254e544rbowen<A HREF="core.html#authtype">AuthType</A> and
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<A HREF="#authuserfile">AuthUserFile</A>.<p><hr>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri<A name="authuserfile"><h2>AuthUserFile</h2></A>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri<!--%plaintext &lt;?INDEX {\tt AuthUserFile} directive&gt; -->
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri<strong>Syntax:</strong> AuthUserFile <em>filename</em><br>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<Strong>Context:</strong> directory, .htaccess<br>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd<Strong>Override:</strong> AuthConfig<br>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<strong>Status:</strong> Base<br>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<strong>Module:</strong> mod_auth<p>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd
117c1f888a14e73cdd821dc6c23eb0411144a41cndThe AuthUserFile directive sets the name of a textual file containing
117c1f888a14e73cdd821dc6c23eb0411144a41cndthe list of users and passwords for user
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4ndauthentication. <em>Filename</em> is the path to the user
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggerifile. If it is not absolute (<EM>i.e.</EM>, if it doesn't begin with a
b41a0dbe6310c576e96b7ea6910051fd84fb06f5sfslash), it is treated as relative to the ServerRoot.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<p> Each line of the user file file contains a username followed
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarby a colon, followed by the crypt() encrypted password. The behavior
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarof multiple occurrences of the same user is undefined.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<p> Note that
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarsearching large text files is <EM>very</EM> inefficient;
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<A HREF="mod_auth_dbm.html#authdbmuserfile">AuthDBMUserFile</A> should be
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarused instead.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarSecurity: make sure that the AuthUserFile is stored outside the
1f1b6bf13313fdd14a45e52e553d3ff28689b717coardocument tree of the web-server; do <em>not</em> put it in the directory that
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarit protects. Otherwise, clients will be able to download the AuthUserFile.<p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarSee also <A HREF="core.html#authname">AuthName</A>,
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<A HREF="core.html#authtype">AuthType</A> and
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<A HREF="#authgroupfile">AuthGroupFile</A>.<p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<hr>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<A name="authauthoritative"><h2>AuthAuthoritative</h2></A>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<!--%plaintext &lt;?INDEX {\tt AuthAuthoritative} directive&gt; -->
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<strong>Syntax:</strong> AuthAuthoritative &lt; <strong> on</strong>(default) | off &gt; <br>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<Strong>Context:</strong> directory, .htaccess<br>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<Strong>Override:</strong> AuthConfig<br>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<strong>Status:</strong> Base<br>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<strong>Module:</strong> mod_auth<p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarSetting the AuthAuthoritative directive explicitly to <b>'off'</b>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarallows for both authentication and authorization to be passed on to
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarlower level modules (as defined in the <code>Configuration</code> and
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<code>modules.c</code> files) if there is <b>no userID</b> or
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<b>rule</b> matching the supplied userID. If there is a userID and/or
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarrule specified; the usual password and access checks will be applied
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarand a failure will give an Authorization Required reply.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarSo if a userID appears in the database of more than one module; or if
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nda valid require directive applies to more than one module; then the
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4ndfirst module will verify the credentials; and no access is passed on;
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4ndregardless of the AuthAuthoritative setting.
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirin<p>
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4nd
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4ndA common use for this is in conjunction with one of the database
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4ndmodules; such as <a
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4ndhref="mod_auth_db.html"><code>mod_auth_db.c</code></a>, <a
0c4abc32c00611fe1d52c9661f5cc79a3f74c6d4ndhref="mod_auth_dbm.html"><code>mod_auth_dbm.c</code></a>,
06f0540592b1d6fc148e1ec9afc95ce48162db18covener<code>mod_auth_msql.c</code>, and <a
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coarhref="mod_auth_anon.html"><code>mod_auth_anon.c</code></a>. These modules
06f0540592b1d6fc148e1ec9afc95ce48162db18covenersupply the bulk of the user credential checking; but a few
06f0540592b1d6fc148e1ec9afc95ce48162db18covener(administrator) related accesses fall through to a lower level with a
06f0540592b1d6fc148e1ec9afc95ce48162db18covenerwell protected AuthUserFile.
06f0540592b1d6fc148e1ec9afc95ce48162db18covener
b9bf3918f6eaf7747bcbfbd02792bcbe4a052784nilgun<p>
06f0540592b1d6fc148e1ec9afc95ce48162db18covener
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coar<b>Default:</b> By default; control is not passed on; and an unknown
06f0540592b1d6fc148e1ec9afc95ce48162db18coveneruserID or rule will result in an Authorization Required reply. Not
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coarsetting it thus keeps the system secure; and forces an NSCA compliant
06f0540592b1d6fc148e1ec9afc95ce48162db18covenerbehaviour.
06f0540592b1d6fc148e1ec9afc95ce48162db18covener
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coar<p>
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coar
06f0540592b1d6fc148e1ec9afc95ce48162db18covenerSecurity: Do consider the implications of allowing a user to allow
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coarfall-through in his .htaccess file; and verify that this is really
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coarwhat you want; Generally it is easier to just secure a single
172025a566937b5a0492a7060e4ba52f121047f4covener.htpasswd file, than it is to secure a database such as mSQL. Make
172025a566937b5a0492a7060e4ba52f121047f4covenersure that the AuthUserFile is stored outside the document tree of the
06f0540592b1d6fc148e1ec9afc95ce48162db18covenerweb-server; do <em>not</em> put it in the directory that it
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirinprotects. Otherwise, clients will be able to download the
06f0540592b1d6fc148e1ec9afc95ce48162db18covenerAuthUserFile.
06f0540592b1d6fc148e1ec9afc95ce48162db18covener
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coar<p>
06f0540592b1d6fc148e1ec9afc95ce48162db18covenerSee also <A HREF="core.html#authname">AuthName</A>,
06f0540592b1d6fc148e1ec9afc95ce48162db18covener<A HREF="core.html#authtype">AuthType</A> and
c3c937a1510d6ff9cfa28ef3713e787f0e1a39c9coar<A HREF="#authgroupfile">AuthGroupFile</A>.<p>
b475917ddf898282aa51ce31b3275c2c4783ce98coar
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<!--#include virtual="footer.html" -->
17ade6df5ec233536985eb1c130a906c725dd614humbedooh</BODY>
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coar</HTML>
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coar
4aa603e6448b99f9371397d439795c91a93637eand