suexec.html revision 091caae3b2ebdb760c98575d0d5e349cd686f913
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen BGCOLOR="#FFFFFF"
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen TEXT="#000000"
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen LINK="#0000FF"
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen VLINK="#000080"
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen ALINK="#FF0000"
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen<!--#include virtual="header.html" -->
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><BIG><STRONG>CONTENTS</STRONG></BIG></LI>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><A HREF="#before">Before we begin.</A></LI>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><A HREF="#model">suEXEC Security Model.</A></LI>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><A HREF="#install">Configuring & Installing suEXEC</A></LI>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><A HREF="#enable">Enabling & Disabling suEXEC</A></LI>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><A HREF="#debug">Debugging suEXEC</A></LI>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><A HREF="#jabberwock">Beware the Jabberwock: Warnings &
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenThe <STRONG>suEXEC</STRONG> feature -- introduced in Apache 1.2 -- provides
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenApache users the ability to run <STRONG>CGI</STRONG> and <STRONG>SSI</STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenprograms under user IDs different from the user ID of the calling web-server.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenNormally, when a CGI or SSI program executes, it runs as the same user who is
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenrunning the web server.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenUsed properly, this feature can reduce considerably the security risks involved
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenwith allowing users to develop and run private CGI or SSI programs. However,
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenif suEXEC is improperly configured, it can cause any number of problems and
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenpossibly create new holes in your computer's security. If you aren't familiar
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenwith managing setuid root programs and the security issues they present, we
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenhighly recommend that you not consider using suEXEC.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen<STRONG><A HREF="suexec.html">BACK TO CONTENTS</A></STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen<H3><A NAME="before">Before we begin.</A></H3>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenBefore jumping head-first into this document, you should be aware of the
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenassumptions made on the part of the Apache Group and this document.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenFirst, it is assumed that you are using a UNIX derivate operating system that
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenis capable of <STRONG>setuid</STRONG> and <STRONG>setgid</STRONG> operations.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenAll command examples are given in this regard. Other platforms, if they are
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersencapable of supporting suEXEC, may differ in their configuration.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenSecond, it is assumed you are familiar with some basic concepts of your
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersencomputer's security and its administration. This involves an understanding
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenof <STRONG>setuid/setgid</STRONG> operations and the various effects they
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenmay have on your system and its level of security.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenThird, it is assumed that you are using an <STRONG>unmodified</STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenversion of suEXEC code. All code for suEXEC has been carefully scrutinized and
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersentested by the developers as well as numerous beta testers. Every precaution
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenhas been taken to ensure a simple yet solidly safe base of code. Altering this
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersencode can cause unexpected problems and new security risks. It is
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen<STRONG>highly</STRONG> recommended you not alter the suEXEC code unless you
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenare well versed in the particulars of security programming and are willing to
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenshare your work with the Apache Group for consideration.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenFourth, and last, it has been the decision of the Apache Group to
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen<STRONG>NOT</STRONG> make suEXEC part of the default installation of Apache.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenTo this end, suEXEC configuration requires of the administrator careful
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenattention to details. After due consideration has been given to the various
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersensettings for suEXEC, the administrator may install suEXEC through normal
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Anderseninstallation methods. The values for these settings need to be carefully
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersendetermined and specified by the administrator to properly maintain system
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersensecurity during the use of suEXEC functionality. It is through this detailed
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenprocess that the Apache Group hopes to limit suEXEC installation only to those
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenwho are careful and determined enough to use it.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenStill with us? Yes? Good. Let's move on!
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen<STRONG><A HREF="suexec.html">BACK TO CONTENTS</A></STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen<H3><A NAME="model">suEXEC Security Model</A></H3>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenBefore we begin configuring and installing suEXEC, we will first discuss
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenthe security model you are about to implement. By doing so, you may
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenbetter understand what exactly is going on inside suEXEC and what precautions
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenare taken to ensure your system's security.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen<STRONG>suEXEC</STRONG> is based on a setuid "wrapper" program that is
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersencalled by the main Apache web server. This wrapper is called when an HTTP
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenrequest is made for a CGI or SSI program that the administrator has designated
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersento run as a userid other than that of the main server. When such a request
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenis made, Apache provides the suEXEC wrapper with the program's name and the
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenuser and group IDs under which the program is to execute.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho AndersenThe wrapper then employs the following process to determine success or
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenfailure -- if any one of these conditions fail, the program logs the failure
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersenand exits with an error, otherwise it will continue:
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><STRONG>Was the wrapper called with the proper number of
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen arguments?</STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen The wrapper will only execute if it is given the proper number of arguments.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen The proper argument format is known to the Apache web server. If the
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen is not receiving the proper number of arguments, it is either being hacked,
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen there is something wrong with the suEXEC portion of your Apache binary.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen </BLOCKQUOTE>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><STRONG>Is the user executing this wrapper a valid user of this
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen system?</STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen This is to ensure that the user executing the wrapper is truly a user of the
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen </BLOCKQUOTE>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><STRONG>Is this valid user allowed to run the wrapper?</STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen Is this user the user allowed to run this wrapper? Only one user (the
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen Apache user) is allowed to execute this program.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen </BLOCKQUOTE>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><STRONG>Does the target program have an unsafe hierarchical
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen reference?</STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen Does the target program contain a leading '/' or have a '..' backreference?
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen These are not allowed; the target program must reside within the Apache
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen </BLOCKQUOTE>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><STRONG>Is the target user name valid?</STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen Does the target user exist?
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen </BLOCKQUOTE>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><STRONG>Is the target group name valid?</STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen Does the target group exist?
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen </BLOCKQUOTE>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><STRONG>Is the target user <EM>NOT</EM> superuser?</STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen Presently, suEXEC does not allow 'root' to execute CGI/SSI programs.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen </BLOCKQUOTE>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><STRONG>Is the target userid <EM>ABOVE</EM> the minimum ID
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen number?</STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen The minimum user ID number is specified during configuration. This allows
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen to set the lowest possible userid that will be allowed to execute CGI/SSI
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen programs. This is useful to block out "system" accounts.
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen </BLOCKQUOTE>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><STRONG>Is the target group <EM>NOT</EM> the superuser group?</STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen Presently, suEXEC does not allow the 'root' group to execute CGI/SSI
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen </BLOCKQUOTE>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen <LI><STRONG>Is the target groupid <EM>ABOVE</EM> the minimum ID
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen number?</STRONG>
735f2c6e504a541cbb2592a3f94858bf337a24ffTycho Andersen The minimum group ID number is specified during configuration. This allows
<!--#include virtual="footer.html" -->