home *** CD-ROM | disk | FTP | other *** search
- sg</code> $BB0@-$GJQ99$9$k$3$H$,$G$-$^$9(B:</p>
- <div class="example"><p><code>
- <!--#config errmsg="[It appears that you don't know how to use SSI]" -->
- </code></p></div>
-
- <p>$B$*$=$i$/!"%(%s%I%f!<%6$O$3$N%a%C%;!<%8$r7h$7$F8+$k$3$H$O$"$j$^$;$s!#(B
- $B$J$<$J$i!"$=$N%5%$%H$,@8$-$?>uBV$K$J$kA0$K(B SSI $B%G%#%l%/%F%#%V$K4X$9$k(B
- $BA4$F$NLdBj$r2r7h$7$F$$$k$O$:$@$+$i$G$9!#(B($B$=$&$G$9$h$M(B?)</p>
-
- <p>$B$=$7$F!"(B<code>config</code> $B$K$*$$$F(B <code>sizefmt</code>
- $BB0@-$r;HMQ$9$k$3$H$G!"(B
- $BJV$5$l$k%U%!%$%k%5%$%:$N=q<0$r@_Dj$9$k$3$H$,$G$-$^$9!#(B
- $B%P%$%H?t$K$O(B <code>bytes</code> $B$r!"E,Ev$K(B Kb $B$d(B Mb
- $B$KC;=L$5$;$k$K$O(B <code>abbrev</code> $B$r;XDj$9$k$3$H$,$G$-$^$9!#(B</p>
- </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
- <div class="section">
- <h2><a name="exec" id="exec">$B%3%^%s%I$N<B9T(B</a></h2>
-
-
- <p>$B:#8e?t%v7n$N$&$A$K!">.$5$J(B CGI $B%W%m%0%i%`$H(B SSI
- $B$r;HMQ$9$k5-;v$r=P$7$?$$$H9M$($F$$$^$9!#$3$3$G$O$=$l$H$OJL$K!"(B
- <code>exec</code> $BMWAG$K$h$C$F9T$J$&$3$H$,$G$-$k$3$H$r<($7$^$9!#(B
- SSI $B$K%7%'%k(B ($B@53N$K$O(B <code>/bin/sh</code>$B!#(BWin32 $B$J$i$P(B DOS $B%7%'%k(B)
- $B$r;HMQ$7$F%3%^%s%I$r<B9T$5$;$k$3$H$,$G$-$^$9!#(B
- $B2<5-$N(B$BNc$G$O!"%G%#%l%/%H%j%j%9%H=PNO$r9T$J$$$^$9!#(B</p>
- <div class="example"><p><code>
- <pre><br />
- <!--#exec cmd="ls" --><br />
- </pre>
- </code></p></div>
-
- <p>Windows $B>e$G$O!"(B</p>
- <div class="example"><p><code>
- <pre><br />
- <!--#exec cmd="dir" --><br />
- </pre>
- </code></p></div>
-
- <p>Windows $B>e$G$O!"$3$N%G%#%l%/%F%#%V$K$h$C$F$$$/$D$+$N4qL/$J(B
- $B=q<0$K5$$E$/$G$7$g$&!#$J$<$J$i(B <code>dir</code> $B$N=PNO$,J8;zNs(B
- ``<<code>dir</code>>'' $B$r4^$_!"%V%i%&%6$r:.Mp$5$;$k$+$i$G$9!#(B</p>
-
- <p>$B$3$N5!G=$OHs>o$K4m81$G$"$j!"$I$s$J%3!<%I$G$b(B <code>exec</code>
- $B%?%0$KKd$a9~$^$l$F$7$^$($P<B9T$9$k$3$H$KCm0U$7$F$/$@$5$$!#Nc$($P(B
- `` $B%2%9%H%V%C%/(B '' $B$N$h$&$K!"$b$7!"(B
- $B%f!<%6$,%Z!<%8$NFbMF$rJT=8$G$-$k>u67$K$"$k$J$i$P!"(B
- $B$3$N5!G=$r3N<B$KM^@)$7$F$/$@$5$$!#(B<code>Options</code>
- $B%G%#%l%/%F%#%V$N(B <code>IncludesNOEXEC</code> $B0z?t$r;XDj$9$k$3$H$G!"(B
- SSI $B$O5v2D$9$k$1$l$I(B <code>exec</code>
- $B5!G=$O5v2D$7$J$$$h$&$K$9$k$3$H$,$G$-$^$9!#(B</p>
- </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
- <div class="section">
- <h2><a name="advanced" id="advanced">$B9bEY$J(B SSI $B%F%/%K%C%/(B</a></h2>
-
-
- <p>$B%3%s%F%s%D$r=PNO$9$k$3$H$K2C$(!"(BApache SSI $B$OJQ?t$r@_Dj$7!"(B
- $B$=$7$FHf3S$H>r7oJ,4t$K$=$NJQ?t$r;HMQ$G$-$k5!G=$rDs6!$7$F$$$^$9!#(B
- </p>
-
- <h3><a name="caveat" id="caveat">$B7Y9p(B</a></h3>
-
- <p>$B$3$N5-;v$G=R$Y$?BgItJ,$N5!G=$O!"(BApache 1.2
- $B0J9_$r;HMQ$7$F$$$k>l9g$N$_MxMQ2DG=$G$9!#$b$A$m$s!"$b$7(B Apache 1.2
- $B0J9_$r;HMQ$7$F$J$$>l9g!"D>$A$K%"%C%W%0%l!<%I$9$kI,MW$,$"$j$^$9!#(B
- $B$5$!!":#$=$l$r9T$J$$$J$5$$!#$=$l$^$GBT$C$F$$$^$9!#(B</p>
-
-
- <h3><a name="variables" id="variables">$BJQ?t$r@_Dj$9$k(B</a></h3>
-
- <p><code>set</code> $B%G%#%l%/%F%#%V$r;HMQ$7$F!"(B
- $B8e$G;HMQ$9$k$?$a$KJQ?t$r@_Dj$9$k$3$H$,$G$-$^$9!#(B
- $B$3$l$O8e$N@bL@$GI,MW$K$J$k$N$G!"$3$3$G$=$l$K$D$$$F=R$Y$F$$$^$9!#(B
- $BJ8K!$O0J2<$N$H$*$j$G$9(B:</p>
- <div class="example"><p><code>
- <!--#set var="name" value="Rich" -->
- </code></p></div>
-
- <p>$B$3$N$h$&$KC1=c$KJ8;z$I$*$j$K@_Dj$9$k$3$H$K2C$(!"(B
- $BNc$($P4D6-JQ?t$dA0$N5-;v$G=R$Y$?JQ?t(B
- ($BNc$($P(B <code>LAST_MODIFIED</code> $B$N$h$&$J(B)
- $B$r4^$`B>$N$"$i$f$kJQ(B$B?t$rCM$r@_Dj$9$k$N$K;HMQ$9$k$3$H$,$G$-$^$9!#(B
- $BJQ?tL>$NA0$K%I%k5-9f(B ($) $B$r;HMQ$9$k$3$H$G!"(B
- $B$=$l$,%j%F%i%kJ8;zNs$G$O$J$/$FJQ?t$G$"$k$3$H$r<($7$^$9!#(B</p>
- <div class="example"><p><code>
- <!--#set var="modified" value="$LAST_MODIFIED" -->
- </code></p></div>
-
- <p>$B%I%k5-9f(B ($) $B$rJ8;z$H$7$FJQ?t$NCM$KF~$l$k$K$O!"(B
- $B%P%C%/%9%i%C%7%e$K$h$C$F%I%k5-9f$r%(%9%1!<%W$9$kI,MW$,$"$j$^$9!#(B</p>
- <div class="example"><p><code>
- <!--#set var="cost" value="\$100" -->
- </code></p></div>
-
- <p>$B:G8e$K$J$j$^$9$,!"D9$$J8;zNs$NCf$KJQ?t$rCV$-$?$$>l9g$G!"(B
- $BJQ?tL>$,B>$NJ8;z$H$V$D$+$k2DG=@-$,$"$j!"(B
- $B$=$l$i$NJ8;z$K$D$$$F:.Mp$7$F$7$^$&>l9g!"$3$N:.Mp$r<h$j=|$/$?$a!"(B
- $BJQ?tL>$rCf3g8L$G0O$`$3$H$,$G$-$^$9(B
- ($B$3$l$K$D$$$F$NNI$$Nc$r<($9$N$OFq$7$$$N$G$9$,!"(B
- $B$*$=$i$/J,$+$C$F$$$?$@$1$k$G$7$g$&(B)$B!#(B
- </p>
- <div class="example"><p><code>
- <!--#set var="date" value="${DATE_LOCAL}_${DATE_GMT}" -->
- </code></p></div>
-
-
- <h3><a name="conditional" id="conditional">$B>r7o<0(B</a></h3>
-
-
- <p>$B$5$F!"JQ?t$r;}$C$F$$$F!"(B
- $B$=$l$i$NCM$r@_Dj$7$FHf3S$9$k$3$H$,$G$-$k$N$G$9$+$i!"(B
- $B>r7o$rI=$9$?$a$K$=$l$i$r;HMQ$9$k$3$H$,$G$-$^$9!#$3$l$K$h$j(B
- SSI $B$O$"$k<o$N>.$5$J%W%m%0%i%_%s%08@8l$K$J$C$F$$$^$9!#(B
- <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> $B$O>r7o$rI=8=$9$k$?$a$K(B <code>if</code>,
- <code>elif</code>, <code>else</code>, <code>endif</code>
- $B9=B$$rDs6!$7$F$$$^$9!#$3$l$K$h$C$F!"(B
- $B0l$D$N<B:]$N%Z!<%8$+$iJ#?t$NO@M}%Z!<%8$r8z2LE*$K@8@.$9$k$3$H$,$G$-$^$9!#(B</p>
-
- <p>$B>r7o9=B$$O0J2<$N$H$*$j$G$9(B:</p>
- <div class="example"><p><code>
- <!--#if expr="test_condition" --><br />
- <!--#elif expr="test_condition" --><br />
- <!--#else --><br />
- <!--#endif -->
- </code></p></div>
-
- <p><em>test_condition</em>
- $B$O$"$i$f$k<oN`$NO@M}E*Hf3S$r$9$k$3$H$,$G$-$^$9!#(B
- $BCM$rHf3S$7$?$j!"$=$NCM$,(B ``$B??(B'' $B$+$I$&$+$rI>2A$7$^$9(B
- ($B6u$G$J$$$J$iM?$($i$l$?J8;zNs$O??$G$9(B)$B!#(B
- $BMxMQ2DG=$JHf3S1i;;;R$NA4$F$N%j%9%H$K$D$$$F$O!"(B
- <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> $B%I%-%e%a%s%F!<%7%g%s$r;2>H$7$F$/$@$5$$!#(B
- $B$3$3$G$O!"$3$N9=B$$r$I$&;HMQ$9$k$+$NNc$r$$$/$D$+<($7$^$9!#(B</p>
-
- <p>$B@_Dj%U%!%$%k$G<!$N9T$r5-=R$7$^$9(B:</p>
- <div class="example"><p><code>
- BrowserMatchNoCase macintosh Mac<br />
- BrowserMatchNoCase MSIE InternetExplorer
- </code></p></div>
-
- <p>$B$3$l$O%/%i%$%"%s%H$,(B Macintosh
- $B>e$G%$%s%?!<%M%C%H%(%/%9%W%m!<%i$,F0$$$F$$$k>l9g!"4D6-JQ?t(B
- ``Mac'' $B$H(B ``InternetExplorer'' $B$r??$H@_Dj$7$^$9!#(B</p>
-
- <p>$B<!$K!"(BSSI $B$,2DG=$K$J$C$?%I%-%e%a%s%H$G0J2<$r9T$J$$$^$9(B:
- </p>
- <div class="example"><p><code>
- <!--#if expr="${Mac} && ${InternetExplorer}" --><br />
- Apologetic text goes here<br />
- <!--#else --><br />
- Cool JavaScript code goes here<br />
- <!--#endif -->
- </code></p></div>
-
- <p>Mac $B>e$N(B IE $B$KBP$7$F2?$+;W$&$H$3$m$,$"$k$o$1$G$"$j$^$;$s!#(B
- $BB>$G$O<B9T$G$-$F$$$k$$$/$D$+$N(B JavaScript $B$r(B Mac $B>e$N(B IE
- $B$G<B9T$5$;$k$N$K!"@h=5?t;~4V6lO+$7$?$H$$$&$@$1$N$3$H$G$9!#(B
- $B>e$NNc$O$=$N;CDjE*$JBP=hJ}K!$G$9!#(B</p>
-
- <p>$BB>$N$I$s$JJQ?t(B ($B$"$J$?$,Dj5A$9$k$b$N!"(B
- $B$^$?$OIaDL$N4D6-JQ?t$N$$$:$l$+(B) $B$b!">r7oJ8$K;HMQ$9$k$3$H$,$G$-$^$9!#(B
- Apache $B$O(B <code>SetEnvIf</code> $B%G%#%l%/%F%#%V$dB>$N4XO"(B
- $B%G%#%l%/%F%#%V$r;HMQ$7$F4D6-JQ?t$r@_Dj$9$k$3$H$,$G$-$^$9!#(B
- $B$3$N5!G=$K$h$j!"(BCGI
- $B$KMj$k$3$H$J$/$+$J$jJ#;($JF0E*$J$3$H$r$5$;$k$3$H$,$G$-$^$9!#(B</p>
-
- </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
- <div class="section">
- <h2><a name="conclusion" id="conclusion">$B=*$o$j$K(B</a></h2>
-
- <p>SSI $B$O3N$+$K(B CGI
- $B$dF0E*$J%&%'%V%Z!<%8$r@8@.$9$kB>$N5;=Q$KBe$o$k$b$N$G$O$"$j$^$;$s!#(B
- $B$7$+$7!"$?$/$5$s$NM>J,$J:n6H$r$;$:$K!"(B
- $B>/NL$NF0E*$J%3%s%F%s%D$r2C$($k$K$O$9$0$l$?J}K!$G$9!#(B</p>
- </div></div>
- <div class="bottomlang">
- <p><span>Available Languages: </span><a href="../en/howto/ssi.html" hreflang="en" rel="alternate" title="English"> en </a> |
- <a href="../ja/howto/ssi.html" title="Japanese"> ja </a></p>
- </div><div id="footer">
- <p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p>
- <p class="menu"><a href="../mod/">$B%b%8%e!<%k(B</a> | <a href="../mod/directives.html">$B%G%#%l%/%F%#%V(B</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">$BMQ8l(B</a> | <a href="../sitemap.html">$B%5%$%H%^%C%W(B</a></p></div>
- </body></html><?xml version='1.0' encoding='UTF-8' ?>
- <!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
- <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
-
- <manualpage metafile="auth.xml.meta">
- <parentdocument href="./">How-To / Tutorials</parentdocument>
-
- <title>Authentication, Authorization and Access Control</title>
-
- <summary>
- <p>Authentication is any process by which you verify that
- someone is who they claim they are. Authorization is any
- process by which someone is allowed to be where they want to
- go, or to have information that they want to have.</p>
- </summary>
-
- <section id="related"><title>Related Modules and Directives</title>
- <related>
- <modulelist>
- <module>mod_auth</module>
- <module>mod_access</module>
- </modulelist>
-
- <directivelist>
- <directive module="mod_access">Allow</directive>
- <directive module="mod_auth">AuthGroupFile</directive>
- <directive module="core">AuthName</directive>
- <directive module="core">AuthType</directive>
- <directive module="mod_auth">AuthUserFile</directive>
- <directive module="mod_access">Deny</directive>
- <directive module="core">Options</directive>
- <directive module="core">Require</directive>
- </directivelist>
- </related>
- </section>
-
- <section id="introduction"><title>Introduction</title>
- <p>If you have information on your web site that is sensitive
- or intended for only a small group of people, the techniques in
- this article will help you make sure that the people that see
- those pages are the people that you wanted to see them.</p>
-
- <p>This article covers the "standard" way of protecting parts
- of your web site that most of you are going to use.</p>
- </section>
-
- <section id="theprerequisites"><title>The Prerequisites</title>
- <p>The directives discussed in this article will need to go
- either in your main server configuration file (typically in a
- <directive module="core" type="section">Directory</directive> section), or
- in per-directory configuration files (<code>.htaccess</code> files).</p>
-
- <p>If you plan to use <code>.htaccess</code> files, you will
- need to have a server configuration that permits putting
- authentication directives in these files. This is done with the
- <directive module="core">AllowOverride</directive> directive, which
- specifies which directives, if any, may be put in per-directory
- configuration files.</p>
-
- <p>Since we're talking here about authentication, you will need
- an <directive module="core">AllowOverride</directive> directive like the
- following:</p>
-
- <example>
- AllowOverride AuthConfig
- </example>
-
- <p>Or, if you are just going to put the directives directly in
- your main server configuration file, you will of course need to
- have write permission to that file.</p>
-
- <p>And you'll need to know a little bit about the directory
- structure of your server, in order to know where some files are
- kept. This should not be terribly difficult, and I'll try to
- make this clear when we come to that point.</p>
- </section>
-
- <section id="gettingitworking"><title>Getting it working</title>
- <p>Here's the basics of password protecting a directory on your
- server.</p>
-
- <p>You'll need to create a password file. This file should be
- placed somewhere not accessible from the web. This is so that
- folks cannot download the password file. For example, if your
- documents are served out of <code>/usr/local/apache/htdocs</code> you
- might want to put the password file(s) in
- <code>/usr/local/apache/passwd</code>.</p>
-
- <p>To create the file, use the <a
- href="../programs/htpasswd.html">htpasswd</a> utility that came
- with Apache. This be located in the <code>bin</code> directory
- of wherever you installed Apache. To create the file, type:</p>
-
- <example>
- htpasswd -c /usr/local/apache/passwd/passwords rbowen
- </example>
-
- <p><code>htpasswd</code> will ask you for the password, and
- then ask you to type it again to confirm it:</p>
-
- <example>
- # htpasswd -c /usr/local/apache/passwd/passwords rbowen<br />
- New password: mypassword<br />
- Re-type new password: mypassword<br />
- Adding password for user rbowen
- </example>
-
- <p>If <code>htpasswd</code> is not in your path, of course
- you'll have to type the full path to the file to get it to run.
- On my server, it's located at
- <code>/usr/local/apache/bin/htpasswd</code></p>
-
- <p>Next, you'll need to configure the server to request a
- password and tell the server which users are allowed access.
- You can do this either by editing the <code>httpd.conf</code>
- file or using an <code>.htaccess</code> file. For example, if
- you wish to protect the directory
- <code>/usr/local/apache/htdocs/secret</code>, you can use the
- following directives, either placed in the file
- <code>/usr/local/apache/htdocs/secret/.htaccess</code>, or
- placed in <code>httpd.conf</code> inside a <Directory
- /usr/local/apache/apache/htdocs/secret> section.</p>
-
- <example>
- AuthType Basic<br />
- AuthName "Restricted Files"<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
- Require user rbowen
- </example>
-
- <p>Let's examine each of those directives individually. The <directive
- module="core">AuthType</directive> directive selects
- that method that is used to authenticate the user. The most
- common method is <code>Basic</code>, and this is the method
- implemented by <module>mod_auth</module>. It is important to be aware,
- however, that Basic authentication sends the password from the client to
- the browser unencrypted. This method should therefore not be used for
- highly sensitive data. Apache supports one other authentication method:
- <code>AuthType Digest</code>. This method is implemented by <module
- >mod_auth_digest</module> and is much more secure. Only the most recent
- versions of clients are known to support Digest authentication.</p>
-
- <p>The <directive module="core">AuthName</directive> directive sets
- the <dfn>Realm</dfn> to be used in the authentication. The realm serves
- two major functions. First, the client often presents this information to
- the user as part of the password dialog box. Second, it is used by the
- client to determine what password to send for a given authenticated
- area.</p>
-
- <p>So, for example, once a client has authenticated in the
- <code>"Restricted Files"</code> area, it will automatically
- retry the same password for any area on the same server that is
- marked with the <code>"Restricted Files"</code> Realm.
- Therefore, you can prevent a user from being prompted more than
- once for a password by letting multiple restricted areas share
- the same realm. Of course, for security reasons, the client
- will always need to ask again for the password whenever the
- hostname of the server changes.</p>
-
- <p>The <directive module="mod_auth">AuthUserFile</directive>
- directive sets the path to the password file that we just
- created with <code>htpasswd</code>. If you have a large number
- of users, it can be quite slow to search through a plain text
- file to authenticate the user on each request. Apache also has
- the ability to store user information in fast database files.
- The <module>mod_auth_dbm</module> module provides the <directive
- module="mod_auth_dbm">AuthDBMUserFile</directive> directive. These
- files can be created and manipulated with the <a
- href="../programs/dbmmanage.html">dbmmanage</a> program. Many
- other types of authentication options are available from third
- party modules in the <a
- href="http://modules.apache.org/">Apache Modules
- Database</a>.</p>
-
- <p>Finally, the <directive module="core">Require</directive>
- directive provides the authorization part of the process by
- setting the user that is allowed to access this region of the
- server. In the next section, we discuss various ways to use the
- <directive module="core">Require</directive> directive.</p>
- </section>
-
- <section id="lettingmorethanonepersonin"><title>Letting more than one
- person in</title>
- <p>The directives above only let one person (specifically
- someone with a username of <code>rbowen</code>) into the
- directory. In most cases, you'll want to let more than one
- person in. This is where the <directive module="mod_auth"
- >AuthGroupFile</directive> comes in.</p>
-
- <p>If you want to let more than one person in, you'll need to
- create a group file that associates group names with a list of
- users in that group. The format of this file is pretty simple,
- and you can create it with your favorite editor. The contents
- of the file will look like this:</p>
-
- <example>
- GroupName: rbowen dpitts sungo rshersey
- </example>
-
- <p>That's just a list of the members of the group in a long
- line separated by spaces.</p>
-
- <p>To add a user to your already existing password file,
- type:</p>
-
- <example>
- htpasswd /usr/local/apache/passwd/password dpitts
- </example>
-
- <p>You'll get the same response as before, but it will be
- appended to the existing file, rather than creating a new file.
- (It's the <code>-c</code> that makes it create a new password
- file).</p>
-
- <p>Now, you need to modify your <code>.htaccess</code> file to
- look like the following:</p>
-
- <example>
- AuthType Basic<br />
- AuthName "By Invitation Only"<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
- AuthGroupFile /usr/local/apache/passwd/groups<br />
- Require group GroupName
- </example>
-
- <p>Now, anyone that is listed in the group <code>GroupName</code>,
- and has an entry in the <code>password</code> file, will be let in, if
- they type the correct password.</p>
-
- <p>There's another way to let multiple users in that is less
- specific. Rather than creating a group file, you can just use
- the following directive:</p>
-
- <example>
- Require valid-user
- </example>
-
- <p>Using that rather than the <code>Require user rbowen</code>
- line will allow anyone in that is listed in the password file,
- and who correctly enters their password. You can even emulate
- the group behavior here, by just keeping a separate password
- file for each group. The advantage of this approach is that
- Apache only has to check one file, rather than two. The
- disadvantage is that you have to maintain a bunch of password
- files, and remember to reference the right one in the
- <directive module="mod_auth">AuthUserFile</directive> directive.</p>
- </