From email@example.com Thu Nov 12 20:10:57 1998
-Here's where we begin the fun. The configuration and installation of suEXEC is -a four step process: edit the suEXEC header file, compile suEXEC, place the -suEXEC binary in its proper location, and configure Apache for use with suEXEC. -- -
-EDITING THE SUEXEC HEADER FILE
-- From the top-level of the Apache source tree, type: -
cd support [ENTER]
suexec.h file and change the following macros to
-match your local Apache installation.
+Here's where we begin the fun. If you use Apache 1.2 or prefer to configure
+Apache 1.3 with the "
src/Configure" script you have to edit
+the suEXEC header file and install the binary in its proper location
+manually. This procedure is described in an
+The following sections describe the configuration and installation
+for Apache 1.3 with the AutoConf-style interface (APACI).
+APACI's suEXEC configuration options
--datadir=/home/apache" the directory + "/home/apache/htdocs" is used as document root for + the suEXEC wrapper. +
+Checking your suEXEC setup
+Before you compile and install the suEXEC wrapper you can check +the configuration with the --layout option. +
- /* - * HTTPD_USER -- Define as the username under which Apache normally - * runs. This is the only user allowed to execute - * this program. - */ - #define HTTPD_USER "www" - - /* - * UID_MIN -- Define this as the lowest UID allowed to be a target user - * for suEXEC. For most systems, 500 or 100 is common. - */ - #define UID_MIN 100 - - /* - * GID_MIN -- Define this as the lowest GID allowed to be a target group - * for suEXEC. For most systems, 100 is common. - */ - #define GID_MIN 100 - - /* - * USERDIR_SUFFIX -- Define to be the subdirectory under users' - * home directories where suEXEC access should - * be allowed. All executables under this directory - * will be executable by suEXEC as the user so - * they should be "safe" programs. If you are - * using a "simple" UserDir directive (ie. one - * without a "*" in it) this should be set to - * the same value. suEXEC will not work properly - * in cases where the UserDir directive points to - * a location that is not the same as the user's - * home directory as referenced in the passwd file. - * - * If you have VirtualHosts with a different - * UserDir for each, you will need to define them to - * all reside in one parent directory; then name that - * parent directory here. IF THIS IS NOT DEFINED - * PROPERLY, ~USERDIR CGI REQUESTS WILL NOT WORK! - * See the suEXEC documentation for more detailed - * information. - */ - #define USERDIR_SUFFIX "public_html" - - /* - * LOG_EXEC -- Define this as a filename if you want all suEXEC - * transactions and errors logged for auditing and - * debugging purposes. - */ - #define LOG_EXEC "/usr/local/apache/logs/cgi.log" /* Need me? */ - - /* - * DOC_ROOT -- Define as the DocumentRoot set for Apache. This - * will be the only hierarchy (aside from UserDirs) - * that can be used for suEXEC behavior. - */ - #define DOC_ROOT "/usr/local/apache/htdocs" - - /* - * SAFE_PATH -- Define a safe PATH environment to pass to CGI executables. - * - */ - #define SAFE_PATH "/usr/local/bin:/usr/bin:/bin" + suEXEC setup: + suexec binary: /usr/local/apache/sbin/suexec + document root: /usr/local/apache/share/htdocs + userdir suffix: public_html + logfile: /usr/local/apache/var/log/suexec_log + safe path: /usr/local/bin:/usr/bin:/bin + caller ID: www + minimum user ID: 100 + minimum group ID: 100
-COMPILING THE SUEXEC WRAPPER
-You now need to compile the suEXEC wrapper. At the shell command prompt, -after compiling Apache, -type:
-This should create the suexec wrapper executable.
+Compiling and installing the suEXEC wrapper
+If you have enabled the suEXEC feature with the --enable-suexec option +the suexec binary (together with Apache itself) is automatically built +if you execute the command "make". +
+After all components have been built you can execute the command +"make install" to install them. +The binary image "suexec" is installed in the directory defined by +the --sbindir option. Default location is "/usr/local/apache/sbin/suexec". +
+Please note that you need root privileges for +the installation step. In order for the wrapper to set the user ID, it +must be installed as owner
root and must have the
+setuserid execution bit set for file modes.
-COMPILING APACHE FOR USE WITH SUEXEC
-By default, Apache is compiled to look for the suEXEC wrapper in the following -location. +
+BACK TO CONTENTS+
-From src/include/httpd.h +Upon startup of Apache, it looks for the file "suexec" in the "sbin" +directory (default is "/usr/local/apache/sbin/suexec"). +If Apache finds a properly configured suEXEC wrapper, it will print +the following message to the error log:
- /* The path to the suExec wrapper, can be overridden in Configuration */ - #ifndef SUEXEC_BIN - #define SUEXEC_BIN HTTPD_ROOT "/sbin/suexec" - #endif + [notice] suEXEC mechanism enabled (wrapper: /path/to/suexec)- - -
-If your installation requires location of the wrapper program in a different
-directory, either add
-to your CFLAGS (or edit src/include/httpd.h) and recompile your Apache server.
-See Compiling and Installing Apache
-(and the INSTALL file in the source distribution)
-for more info on this process.
-COPYING THE SUEXEC BINARY TO ITS PROPER LOCATION
-Copy the suexec executable created in the -exercise above to the defined location for SUEXEC_BIN. -
cp suexec /usr/local/apache/sbin/suexec [ENTER]
-In order for the wrapper to set the user ID, it must me installed as owner -root and must have the setuserid execution bit -set for file modes. If you are not running a root -user shell, do so now and execute the following commands. -- -
chown root /usr/local/apache/sbin/suexec [ENTER]
+If you don't see this message at server startup, the server is most
+likely not finding the wrapper program where it expects it, or the
+executable is not installed setuid root.
chmod 4711 /usr/local/apache/sbin/suexec [ENTER]
+If you want to enable the suEXEC mechanism for the first time
+and an Apache server is already running you must kill and restart Apache.
+Restarting it with a simple HUP or USR1 signal will not be enough.
+If you want to disable suEXEC you should kill and restart Apache after +you have removed the "suexec" file.
BACK TO CONTENTS-
-After properly installing the suexec wrapper
-executable, you must kill and restart the Apache server. A simple
kill -1 `cat httpd.pid` will not be enough.
-Upon startup of the web-server, if Apache finds a properly configured
-suexec wrapper, it will print the following message to
Configuring Apache for use with suexec wrapper.
-If you don't see this message at server startup, the server is most -likely not finding the wrapper program where it expects it, or the -executable is not installed setuid root. Check -your installation and try again. -- -
-One way to use suEXEC is through the
-Group directives in
+One way to use the suEXEC wrapper is through the +User and +Group directives in +VirtualHost definitions. By setting these directives to values different from the main server user ID, all requests for CGI resources will be executed as -the User and Group defined for that -<VirtualHost>. If only one or +the User and Group defined for that +
<VirtualHost>. If only one or
neither of these directives are specified for a
-<VirtualHost> then the main
-server userid is assumed.
-suEXEC can also be used to to execute CGI programs as
<VirtualHost> then the main
+server userid is assumed.
+The suEXEC wrapper can also be used to execute CGI programs as the user to which the request is being directed. This is accomplished by -using the ~ character prefixing the user ID for whom -execution is desired. +using the "
~" character prefixing the user
+ID for whom execution is desired.
The only requirement needed for this feature to work is for CGI
execution to be enabled for the user and that the script must meet the
scrutiny of the security checks above.
@@ -483,8 +455,8 @@
-The suEXEC wrapper will write log information to the location defined in
suexec.h as indicated above. If you feel you have
+The suEXEC wrapper will write log information to the file defined
+with the --suexec-logfile option as indicated above. If you feel you have
configured and installed the wrapper properly, have a look at this log
and the error_log for the server to see where you may have gone astray.