From: Erik Abele
Before we begin
suEXEC Security Model+ This is to ensure that the user executing the wrapper is + truly a user of the system. +
+- This is to ensure that the user executing the wrapper is - truly a user of the system. -
-
- Presently, suEXEC does not allow 'root' to execute
- CGI/SSI programs.
+ Presently, suEXEC does not allow root
+ to execute CGI/SSI programs.
- Presently, suEXEC does not allow the 'root' group to
- execute CGI/SSI programs.
+ Presently, suEXEC does not allow the root
+ group to execute CGI/SSI programs.
- If it doesn't exist, it can't very well contain files. + 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.
--with-suexec-xxxxx option has to be provided
+ together with the --enable-suexec option to let
+ APACI accept your request for using the suEXEC feature.
--with-suexec-bin=PATHsuexec binary must be hard-coded
+ in the server for security reasons. Use this option to override
the default path. e.g.
--with-suexec-bin=/usr/sbin/suexec--datadir
+ value with the suffix "/htdocs", e.g. if you configure
with "--datadir=/home/apache" the directory
"/home/apache/htdocs" is used as document root for the suEXEC
wrapper.--logfiledir).
--with-suexec-safepath=PATHChecking your suEXEC
setup
Before you compile and install the suEXEC wrapper you can
- check the configuration with the --layout option.
+ check the configuration with the --layout option.
Example output:
Compiling and installing the suEXEC
wrapper Setting paranoid permissions If for example, your web-server is configured to run as: and This will ensure that only the group Apache runs as can even
+ execute the suEXEC wrapper.
suEXEC setup:
- suexec binary: /usr/local/apache/sbin/suexec
- document root: /usr/local/apache/share/htdocs
+ suexec binary: /usr/local/apache2/sbin/suexec
+ document root: /usr/local/apache2/share/htdocs
userdir suffix: public_html
- logfile: /usr/local/apache/var/log/suexec_log
+ logfile: /usr/local/apache2/var/log/suexec_log
safe path: /usr/local/bin:/usr/bin:/bin
caller ID: www
minimum user ID: 100
@@ -456,33 +457,63 @@
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".
+ --enable-suexec option the suexec binary
+ (together with Apache itself) is automatically built if you execute
+ the make command.
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".
+ command make install to install them. The binary image
+ suexec is installed in the directory defined by the
+ --sbindir option. The default location is
+ "/usr/local/apache2/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.
+ Although the suEXEC wrapper will check to ensure that its
+ caller is the correct user as specified with the
+ --with-suexec-caller configure option, there is
+ always the possibility that a system or library call suEXEC uses
+ before this check may be exploitable on your system. To counter
+ this, and because it is best-practise in general, you should use
+ filesystem permissions to ensure that only the group Apache
+ runs as may execute suEXEC.
+ User www
+ Group webgroup
+suexec is installed at
+ "/usr/local/apache2/sbin/suexec", you should run:
+ chgrp webgroup /usr/local/apache2/bin/suexec
+ chmod 4750 /usr/local/apache2/bin/suexec
+
Upon startup of Apache, it looks for the file
- "suexec" in the "sbin" directory (default is
+ suexec in the directory defined by the
+ --sbindir option (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:
[notice] suEXEC mechanism enabled (wrapper: /path/to/suexec)
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.
@@ -492,7 +523,7 @@ 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.
+ Apache after you have removed thesuexec file.
The suEXEC wrapper will write log information - to the file defined with the --with-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.
+ to the file defined with the--with-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.
- For security and efficiency reasons, all suexec requests + For security and efficiency reasons, all suEXEC requests must remain within either a top-level document root for virtual host requests, or one top-level personal document root for userdir requests. For example, if you have four diff --git a/docs/manual/suexec.xml b/docs/manual/suexec.xml index 8c3b6cdbd9f..653f2fa67fb 100644 --- a/docs/manual/suexec.xml +++ b/docs/manual/suexec.xml @@ -19,9 +19,9 @@ 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 setuid root programs and the - security issues they present, we highly recommend that you not - consider using suEXEC.
+ you aren't familiar with managing setuid root programs + and the security issues they present, we highly recommend that + you not consider using suEXEC.+ This is to ensure that the user executing the wrapper is + truly a user of the system. +
+- This is to ensure that the user executing the wrapper is - truly a user of the system. -
-
- Presently, suEXEC does not allow 'root' to execute
- CGI/SSI programs.
+ Presently, suEXEC does not allow root
+ to execute CGI/SSI programs.
- Presently, suEXEC does not allow the 'root' group to
- execute CGI/SSI programs.
+ Presently, suEXEC does not allow the root
+ group to execute CGI/SSI programs.
- If it doesn't exist, it can't very well contain files. + 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.
--with-suexec-xxxxx option has to be provided
+ together with the --enable-suexec option to let
+ APACI accept your request for using the suEXEC feature.
--with-suexec-bin=PATHsuexec binary must be hard-coded
+ in the server for security reasons. Use this option to override
the default path. e.g.
--with-suexec-bin=/usr/sbin/suexec--datadir
+ value with the suffix "/htdocs", e.g. if you configure
with "--datadir=/home/apache" the directory
"/home/apache/htdocs" is used as document root for the suEXEC
wrapper.--logfiledir).
--with-suexec-safepath=PATHChecking your suEXEC
setup
Before you compile and install the suEXEC wrapper you can
- check the configuration with the --layout option.
+ check the configuration with the --layout option.
Example output:
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".
+ --enable-suexec option the suexec binary
+ (together with Apache itself) is automatically built if you execute
+ the make command.
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".
+ command make install to install them. The binary image
+ suexec is installed in the directory defined by the
+ --sbindir option. The default location is
+ "/usr/local/apache2/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.
Setting paranoid permissions
+ Although the suEXEC wrapper will check to ensure that its
+ caller is the correct user as specified with the
+ --with-suexec-caller configure option, there is
+ always the possibility that a system or library call suEXEC uses
+ before this check may be exploitable on your system. To counter
+ this, and because it is best-practise in general, you should use
+ filesystem permissions to ensure that only the group Apache
+ runs as may execute suEXEC.
If for example, your web-server is configured to run as:
+ +and suexec is installed at
+ "/usr/local/apache2/sbin/suexec", you should run:
This will ensure that only the group Apache runs as can even + execute the suEXEC wrapper.
Upon startup of Apache, it looks for the file
- "suexec" in the "sbin" directory (default is
+ suexec in the directory defined by the
+ --sbindir option (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:
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.
@@ -465,7 +496,7 @@ 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.
+ Apache after you have removed thesuexec file.
The suEXEC wrapper will write log information - to the file defined with the --with-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.
+ to the file defined with the--with-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.
- For security and efficiency reasons, all suexec requests + For security and efficiency reasons, all suEXEC requests must remain within either a top-level document root for virtual host requests, or one top-level personal document root for userdir requests. For example, if you have four