This module enables different Virtual Hosts to run with different Unix User and Group IDs, and with different Solaris Privileges. In particular, it offers a solution to the problem of privilege separation between different Virtual Hosts, first promised by the abandoned perchild MPM. It also offers other security enhancements.
Unlike perchild,
The basic security concerns with mod_privileges are:
The
Before describing the modes, we should also introduce the target use cases: Benign vs Hostile. In a benign situation, you want to separate users for their convenience, and protect them and the server against the risks posed by honest mistakes, but you trust your users are not deliberately subverting system security. In a hostile situation - e.g. commercial hosting - you may have users deliberately attacking the system or each other.
You can select different
This directive trades off performance vs security against malicious, privileges-aware code. In SECURE mode, each request runs in a secure subprocess, incurring a substantial performance penalty. In FAST mode, the server is not protected against escalation of privileges as discussed above.
This directive differs slightly between a <Directory>
context (including equivalents such as Location/Files/If) and a
top-level or <VirtualHost>
.
At top-level, it sets a default that will be inherited by virtualhosts.
In a virtual host, FAST or SECURE mode acts on the entire
HTTP request, and any settings in a <Directory>
context will be ignored. A third pseudo-mode
SELECTIVE defers the choice of FAST vs SECURE to directives in a
<Directory>
context.
In a <Directory>
context, it is applicable only
where SELECTIVE mode was set for the VirtualHost. Only
FAST or SECURE can be set in this context (SELECTIVE would be
meaningless).
<Directory>
context applies to the request.
This might give an attacker opportunities to introduce
code through a <VirtualHost>
context
before privileges have been dropped and userid/gid set.
The
Unix-userid is one of:
#
followed by a user number.This directive cannot be used to run apache as root! Nevertheless, it opens potential security issues similar to those discussed in the suexec documentation.
The
Unix-group is one of:
#
followed by a group number.This directive cannot be used to run apache as root! Nevertheless, it opens potential security issues similar to those discussed in the suexec documentation.
Determines whether the virtual host processes requests with security enhanced by removal of Privileges that are rarely needed in a webserver, but which are available by default to a normal Unix user and may therefore be required by modules and applications. It is recommended that you retain the default (On) unless it prevents an application running. Since the setting applies to the process, this is not compatible with threaded MPMs.
If
Determines whether the virtual host is allowed to run fork and exec,
the privileges required to run subprocesses. If this is set to
Off the virtualhost is denied the privileges and will not
be able to run traditional CGI programs or scripts under the traditional
If set to On or Secure, the virtual host
is permitted to run external programs and scripts as above.
Setting
This server-wide directive determines whether Apache will run with the privileges required to run dtrace. Note that DTracePrivileges On will not in itself activate DTrace, but DTracePrivileges Off will prevent it working.
A privilege-name may optionally be prefixed by + or -, which will respectively allow or deny a privilege. If used with neither + nor -, all privileges otherwise assigned to the virtualhost will be denied. You can use this to override any of the default sets and construct your own privilege set.
This directive can open huge security holes in apache, up to and including running requests with root-level powers. Do not use it unless you fully understand what you are doing!
A privilege-name may optionally be prefixed by + or -, which will respectively allow or deny a privilege. If used with neither + nor -, all privileges otherwise assigned to the virtualhost will be denied. You can use this to override any of the default sets and construct your own privilege set.
This directive can open huge security holes in apache subprocesses, up to and including running them with root-level powers. Do not use it unless you fully understand what you are doing!