📄 suexec.html.en
字号:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX This file is generated from xml source: DO NOT EDIT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --><title>suEXEC Support - Apache HTTP Server</title><link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /><link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /><link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link href="./images/favicon.ico" rel="shortcut icon" /></head><body id="manual-page"><div id="page-header"><p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p><p class="apache">Apache HTTP Server Version 2.0</p><img alt="" src="./images/feather.gif" /></div><div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div><div id="path"><a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="./">Version 2.0</a></div><div id="page-content"><div id="preamble"><h1>suEXEC Support</h1><div class="toplang"><p><span>Available Languages: </span><a href="./en/suexec.html" title="English"> en </a> |<a href="./ja/suexec.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |<a href="./ko/suexec.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p></div> <p>The <strong>suEXEC</strong> feature provides Apache users the ability to run <strong>CGI</strong> and <strong>SSI</strong> programs under user IDs different from the user ID of the calling web-server. Normally, when a CGI or SSI program executes, it runs as the same user who is running the web server.</p> <p>Used properly, this feature can reduce considerably the security risks involved with allowing users to develop and run private CGI or SSI programs. However, if suEXEC is improperly configured, it can cause any number of problems and possibly create new holes in your computer's security. If you aren't familiar with managing <em>setuid root</em> programs and the security issues they present, we highly recommend that you not consider using suEXEC.</p> </div><div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#before">Before we begin</a></li><li><img alt="" src="./images/down.gif" /> <a href="#model">suEXEC Security Model</a></li><li><img alt="" src="./images/down.gif" /> <a href="#install">Configuring & Installing suEXEC</a></li><li><img alt="" src="./images/down.gif" /> <a href="#enable">Enabling & Disabling suEXEC</a></li><li><img alt="" src="./images/down.gif" /> <a href="#usage">Using suEXEC</a></li><li><img alt="" src="./images/down.gif" /> <a href="#debug">Debugging suEXEC</a></li><li><img alt="" src="./images/down.gif" /> <a href="#jabberwock">Beware the Jabberwock: Warnings & Examples</a></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div><div class="section"><h2><a name="before" id="before">Before we begin</a></h2> <p>Before jumping head-first into this document, you should be aware of the assumptions made on the part of the Apache Group and this document.</p> <p>First, it is assumed that you are using a UNIX derivative operating system that is capable of <strong>setuid</strong> and <strong>setgid</strong> operations. All command examples are given in this regard. Other platforms, if they are capable of supporting suEXEC, may differ in their configuration.</p> <p>Second, it is assumed you are familiar with some basic concepts of your computer's security and its administration. This involves an understanding of <strong>setuid/setgid</strong> operations and the various effects they may have on your system and its level of security.</p> <p>Third, it is assumed that you are using an <strong>unmodified</strong> version of suEXEC code. All code for suEXEC has been carefully scrutinized and tested by the developers as well as numerous beta testers. Every precaution has been taken to ensure a simple yet solidly safe base of code. Altering this code can cause unexpected problems and new security risks. It is <strong>highly</strong> recommended you not alter the suEXEC code unless you are well versed in the particulars of security programming and are willing to share your work with the Apache Group for consideration.</p> <p>Fourth, and last, it has been the decision of the Apache Group to <strong>NOT</strong> make suEXEC part of the default installation of Apache. To this end, suEXEC configuration requires of the administrator careful attention to details. After due consideration has been given to the various settings for suEXEC, the administrator may install suEXEC through normal installation methods. The values for these settings need to be carefully determined and specified by the administrator to properly maintain system security during the use of suEXEC functionality. It is through this detailed process that the Apache Group hopes to limit suEXEC installation only to those who are careful and determined enough to use it.</p> <p>Still with us? Yes? Good. Let's move on!</p></div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div><div class="section"><h2><a name="model" id="model">suEXEC Security Model</a></h2> <p>Before we begin configuring and installing suEXEC, we will first discuss the security model you are about to implement. By doing so, you may better understand what exactly is going on inside suEXEC and what precautions are taken to ensure your system's security.</p> <p><strong>suEXEC</strong> is based on a setuid "wrapper" program that is called by the main Apache web server. This wrapper is called when an HTTP request is made for a CGI or SSI program that the administrator has designated to run as a userid other than that of the main server. When such a request is made, Apache provides the suEXEC wrapper with the program's name and the user and group IDs under which the program is to execute.</p> <p>The wrapper then employs the following process to determine success or failure -- if any one of these conditions fail, the program logs the failure and exits with an error, otherwise it will continue:</p> <ol> <li> <strong>Is the user executing this wrapper a valid user of this system?</strong> <p class="indent"> This is to ensure that the user executing the wrapper is truly a user of the system. </p> </li> <li> <strong>Was the wrapper called with the proper number of arguments?</strong> <p class="indent"> The wrapper will only execute if it is given the proper number of arguments. The proper argument format is known to the Apache web server. If the wrapper is not receiving the proper number of arguments, it is either being hacked, or there is something wrong with the suEXEC portion of your Apache binary. </p> </li> <li> <strong>Is this valid user allowed to run the wrapper?</strong> <p class="indent"> Is this user the user allowed to run this wrapper? Only one user (the Apache user) is allowed to execute this program. </p> </li> <li> <strong>Does the target CGI or SSI program have an unsafe hierarchical reference?</strong> <p class="indent"> Does the target CGI or SSI program's path contain a leading '/' or have a '..' backreference? These are not allowed; the target CGI/SSI program must reside within suEXEC's document root (see <code>--with-suexec-docroot=<em>DIR</em></code> below). </p> </li> <li> <strong>Is the target user name valid?</strong> <p class="indent"> Does the target user exist? </p> </li> <li> <strong>Is the target group name valid?</strong> <p class="indent"> Does the target group exist? </p> </li> <li> <strong>Is the target user <em>NOT</em> superuser?</strong> <p class="indent"> Presently, suEXEC does not allow <code><em>root</em></code> to execute CGI/SSI programs. </p> </li> <li> <strong>Is the target userid <em>ABOVE</em> the minimum ID number?</strong> <p class="indent"> The minimum user ID number is specified during configuration. This allows you to set the lowest possible userid that will be allowed to execute CGI/SSI programs. This is useful to block out "system" accounts. </p> </li> <li> <strong>Is the target group <em>NOT</em> the superuser group?</strong> <p class="indent"> Presently, suEXEC does not allow the <code><em>root</em></code> group to execute CGI/SSI programs. </p> </li> <li> <strong>Is the target groupid <em>ABOVE</em> the minimum ID number?</strong> <p class="indent"> The minimum group ID number is specified during configuration. This allows you to set the lowest possible groupid that will be allowed to execute CGI/SSI programs. This is useful to block out "system" groups. </p> </li> <li> <strong>Can the wrapper successfully become the target user and group?</strong> <p class="indent"> Here is where the program becomes the target user and group via setuid and setgid calls. The group access list is also initialized with all of the groups of which the user is a member. </p> </li> <li> <strong>Can we change directory to the one in which the target CGI/SSI program resides?</strong> <p class="indent"> If it doesn't exist, it can't very well contain files. If we can't change directory to it, it might aswell not exist. </p> </li> <li> <strong>Is the directory within the Apache webspace?</strong> <p class="indent"> If the request is for a regular portion of the server, is the requested directory within suEXEC's document root? If the request is for a UserDir, is the requested directory within the directory configured as suEXEC's userdir (see <a href="#install">suEXEC's configuration options</a>)? </p> </li> <li> <strong>Is the directory <em>NOT</em> writable by anyone else?</strong> <p class="indent"> We don't want to open up the directory to others; only the owner user may be able to alter this directories contents. </p> </li> <li> <strong>Does the target CGI/SSI program exist?</strong> <p class="indent"> If it doesn't exists, it can't very well be executed. </p> </li> <li> <strong>Is the target CGI/SSI program <em>NOT</em> writable by anyone else?</strong> <p class="indent"> We don't want to give anyone other than the owner the ability to change the CGI/SSI program. </p> </li> <li> <strong>Is the target CGI/SSI program <em>NOT</em> setuid or setgid?</strong> <p class="indent"> We do not want to execute programs that will then change our UID/GID again.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -