2006-06-11 05:18:19 +00:00
|
|
|
<?php
|
2006-06-13 20:27:35 +00:00
|
|
|
require_once("docutil.php");
|
|
|
|
page_head("Sandbox design");
|
|
|
|
|
|
|
|
echo "
|
2009-10-31 09:25:52 +00:00
|
|
|
This document describes the permissions structure for
|
2010-01-28 10:33:21 +00:00
|
|
|
BOINC on the Macintosh. It has been updated for BOINC versions 6.8.20 and 6.10.30 and later.
|
2009-10-31 09:25:52 +00:00
|
|
|
The purpose of this scheme is to 'sandbox' BOINC applications,
|
2006-06-13 20:27:35 +00:00
|
|
|
i.e. to limit the amount of damage that a malicious
|
|
|
|
or malfunctioning application can cause.
|
|
|
|
<p>
|
|
|
|
In our design, BOINC applications run under a specially-created account
|
|
|
|
having a minimal set of privileges.
|
2009-10-31 09:25:52 +00:00
|
|
|
In early versions of BOINC, the applications typically ran as the user who installed BOINC,
|
2006-06-13 20:27:35 +00:00
|
|
|
and had the full privileges of that account.
|
|
|
|
";
|
2006-06-11 05:18:19 +00:00
|
|
|
|
|
|
|
function prot($user, $group, $perm) {
|
|
|
|
return "
|
|
|
|
<br>
|
|
|
|
user: $user
|
|
|
|
<br>
|
|
|
|
group: $group
|
|
|
|
<br>
|
|
|
|
protection: $perm";
|
|
|
|
}
|
|
|
|
|
2008-01-18 02:08:25 +00:00
|
|
|
$pp06610771 = prot('boinc_project', 'boinc_project', '0661 or 0771');
|
2006-07-25 10:57:24 +00:00
|
|
|
$pp06640775 = prot('boinc_project', 'boinc_project', '0664 or 0775');
|
2006-07-03 22:04:12 +00:00
|
|
|
$mp2500 = prot('boinc_master', 'boinc_project', '0500+setgid');
|
2007-10-12 05:11:04 +00:00
|
|
|
$rm4050 = prot('root', 'boinc_master', '0050+setuid');
|
2008-01-16 11:31:59 +00:00
|
|
|
$rm4555 = prot('root', 'boinc_master', '0555+setuid');
|
2006-07-01 05:32:02 +00:00
|
|
|
$mm0550 = prot('boinc_master', 'boinc_master', '0550');
|
2009-10-31 09:25:52 +00:00
|
|
|
$mm0555 = prot('boinc_master', 'boinc_master', '0555');
|
|
|
|
$mm0444 = prot('boinc_master', 'boinc_master', '0444');
|
2006-07-25 10:57:24 +00:00
|
|
|
$mm0660 = prot('boinc_master', 'boinc_master', '0660');
|
2009-04-02 10:57:53 +00:00
|
|
|
$mm0664 = prot('boinc_master', 'boinc_master', '0664');
|
2008-01-16 11:31:59 +00:00
|
|
|
$mm0771 = prot('boinc_master', 'boinc_master', '0771');
|
2010-01-27 08:57:37 +00:00
|
|
|
$mp0770 = prot('boinc_master', 'boinc_project', '0770');
|
2006-07-01 05:32:02 +00:00
|
|
|
$mp0775 = prot('boinc_master', 'boinc_project', '0775');
|
2008-01-18 02:08:25 +00:00
|
|
|
$mp06610771 = prot('boinc_master', 'boinc_project', '0661 or 0771');
|
2006-07-25 10:57:24 +00:00
|
|
|
$mp06640775 = prot('boinc_master', 'boinc_project', '0664 or 0775');
|
2009-10-31 09:25:52 +00:00
|
|
|
$mm2555 = prot('boinc_master', 'boinc_master', '0555');
|
2006-06-13 01:50:48 +00:00
|
|
|
$mm6555 = prot('boinc_master', 'boinc_master', '0555+setuid+setgid');
|
2006-07-01 05:55:53 +00:00
|
|
|
$ua0555 = prot('(installing user)', 'admin', '0555');
|
2006-06-11 05:18:19 +00:00
|
|
|
|
2006-06-13 20:27:35 +00:00
|
|
|
$colors = array('ddddff', 'ccccff', 'bbbbff');
|
|
|
|
|
|
|
|
function show_dir($level, $name, $prot, $contents) {
|
|
|
|
global $colors;
|
|
|
|
$color = $colors[$level];
|
2006-06-11 05:18:19 +00:00
|
|
|
$x = "
|
2006-06-13 20:27:35 +00:00
|
|
|
<table bgcolor=$color cellpadding=6 cellspacing=0 border=1 width=100%>
|
2006-06-11 05:18:19 +00:00
|
|
|
<tr>
|
2006-06-13 20:27:35 +00:00
|
|
|
<td valign=top><b>$name</b> <font size=-1>$prot</font></td><td valign=top>
|
2006-06-11 05:18:19 +00:00
|
|
|
";
|
2006-06-12 06:43:37 +00:00
|
|
|
for ($i=0; $i<sizeof($contents); $i++) {
|
|
|
|
if ($i) $x .= '<br>';
|
|
|
|
$c = $contents[$i];
|
2006-06-11 05:18:19 +00:00
|
|
|
$x .= $c;
|
|
|
|
}
|
|
|
|
$x .= "
|
|
|
|
</td></tr>
|
|
|
|
</table>
|
|
|
|
";
|
|
|
|
return $x;
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_file($name, $prot) {
|
|
|
|
return "
|
2006-06-13 20:27:35 +00:00
|
|
|
$name <font size=-1>$prot</font><br>
|
2006-06-11 05:18:19 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2006-06-13 01:50:48 +00:00
|
|
|
echo "
|
|
|
|
|
2006-06-13 20:27:35 +00:00
|
|
|
<p>
|
|
|
|
Our design uses two users and two groups,
|
|
|
|
both specially created for use by BOINC.
|
|
|
|
These users and groups are created by the installation process.
|
2006-06-13 01:50:48 +00:00
|
|
|
<ul>
|
|
|
|
<li>Group: <b>boinc_master</b>
|
|
|
|
<li>Group: <b>boinc_project</b>
|
|
|
|
<li>User: <b>boinc_master</b>
|
|
|
|
<ul>
|
2006-06-13 20:27:35 +00:00
|
|
|
<li>Primary group: <b>boinc_master</b>
|
2008-01-18 02:08:25 +00:00
|
|
|
<li>Supplementary groups: none
|
2006-06-13 01:50:48 +00:00
|
|
|
</ul>
|
|
|
|
<li>User: <b>boinc_project</b>
|
|
|
|
<ul>
|
2006-06-13 20:27:35 +00:00
|
|
|
<li>Primary group: <b>boinc_project</b>
|
|
|
|
<li>Supplementary groups: none
|
2006-06-13 01:50:48 +00:00
|
|
|
</ul>
|
|
|
|
</ul>
|
2006-06-13 20:27:35 +00:00
|
|
|
On Mac OS X, <b>boinc_project</b> and <b>boinc_master</b>
|
|
|
|
are added to the Supplementary Groups Lists of those other users
|
|
|
|
who are members of group <b>admin</b>.
|
|
|
|
This gives admin users full access to all BOINC and project files.
|
|
|
|
<p>
|
|
|
|
The following diagram shows user, group and permissions
|
|
|
|
for the BOINC file and directory tree:
|
|
|
|
<p>
|
2006-06-13 01:50:48 +00:00
|
|
|
";
|
|
|
|
|
|
|
|
echo
|
2008-01-16 11:31:59 +00:00
|
|
|
show_dir(0, 'BOINC data', $mm0771, array(
|
2010-01-27 08:57:37 +00:00
|
|
|
show_dir(1, 'projects', $mp0770, array(
|
2006-07-01 05:32:02 +00:00
|
|
|
show_dir(2, 'setiathome.berkeley.edu', $mp0775, array(
|
2008-01-18 02:08:25 +00:00
|
|
|
show_file('files created by BOINC Client', $mp06610771),
|
2011-12-01 07:22:28 +00:00
|
|
|
show_file('files created by project apps', $pp06610771),
|
|
|
|
show_file('running BOINC installer changes all files to', $mp06610771)
|
2006-06-11 05:18:19 +00:00
|
|
|
))
|
|
|
|
)),
|
2010-01-27 08:57:37 +00:00
|
|
|
show_dir(1, 'slots', $mp0770, array(
|
2006-07-01 05:32:02 +00:00
|
|
|
show_dir(2, '0', $mp0775, array(
|
2008-01-18 02:08:25 +00:00
|
|
|
show_file('files created by BOINC Client', $mp06610771),
|
2011-12-01 07:22:28 +00:00
|
|
|
show_file('files created by project apps', $pp06610771),
|
|
|
|
show_file('running BOINC installer changes all files to', $mp06610771)
|
2006-06-11 05:18:19 +00:00
|
|
|
))
|
|
|
|
)),
|
2006-07-01 05:32:02 +00:00
|
|
|
show_dir(1, 'switcher (directory)', $mm0550, array(
|
2007-10-12 05:11:04 +00:00
|
|
|
show_file('switcher (executable)', $rm4050),
|
2006-07-03 22:04:12 +00:00
|
|
|
show_file('setprojectgrp (executable)', $mp2500)
|
2006-06-12 02:02:49 +00:00
|
|
|
)),
|
2009-10-31 09:25:52 +00:00
|
|
|
show_dir(1, 'locale', $mm0555, array(
|
|
|
|
show_dir(2, 'de', $mm0555, array(
|
|
|
|
show_file('BOINC Manager.mo', $mm0444),
|
|
|
|
show_file('wxstd.mo', $mm0444)
|
2006-06-13 01:50:48 +00:00
|
|
|
))
|
2006-06-11 05:18:19 +00:00
|
|
|
)),
|
2008-01-16 11:31:59 +00:00
|
|
|
show_file('account_*.xml', $mm0660),
|
|
|
|
show_file('acct_mgr_login.xml', $mm0660),
|
|
|
|
show_file('client_state.xml', $mm0660),
|
2006-07-25 10:57:24 +00:00
|
|
|
show_file('gui_rpc_auth.cfg', $mm0660),
|
2008-01-16 11:31:59 +00:00
|
|
|
show_file('sched_reply*', $mm0660),
|
2009-04-02 10:57:53 +00:00
|
|
|
show_file('sched_request*', $mm0660),
|
|
|
|
show_file('ss_config.xml', $mm0664)
|
2006-06-11 05:18:19 +00:00
|
|
|
));
|
|
|
|
|
2006-06-12 02:02:49 +00:00
|
|
|
echo "<br><br>";
|
|
|
|
|
2006-06-11 05:18:19 +00:00
|
|
|
echo
|
2006-07-01 05:55:53 +00:00
|
|
|
show_dir(0, 'BOINC executables', $ua0555, array(
|
2006-06-13 01:50:48 +00:00
|
|
|
show_file('BOINC Manager', $mm2555),
|
2007-10-12 05:11:04 +00:00
|
|
|
show_file('BOINC Client', $mm6555),
|
|
|
|
show_dir(1, 'screensaver (directory)', $ua0555, array(
|
2008-01-16 11:31:59 +00:00
|
|
|
show_file('gfx_switcher (executable)', $rm4555)
|
2007-10-12 05:11:04 +00:00
|
|
|
)),
|
2006-06-11 05:18:19 +00:00
|
|
|
));
|
2006-06-13 01:50:48 +00:00
|
|
|
|
|
|
|
echo "
|
|
|
|
|
|
|
|
<p>Implementation notes:
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>BOINC Client runs setuid and setgid to <b>boinc_master:boinc_master</b>.
|
2006-07-01 05:32:02 +00:00
|
|
|
<li>BOINC Client uses the helper application <i>setprojectgrp</i> to
|
|
|
|
set project and slot files and directories to group <b>boinc_project</b>.
|
2006-06-13 20:27:35 +00:00
|
|
|
<li>BOINC Client does not directly execute project applications.
|
|
|
|
It runs the helper application <i>switcher</i>,
|
|
|
|
passing the request in the argument list.
|
2007-10-12 05:11:04 +00:00
|
|
|
<i>switcher</i> runs setuid <b>root</b> and immediately changes its real and
|
|
|
|
effective user ID and group ID to <b>boinc_project</b>,
|
2006-06-13 20:27:35 +00:00
|
|
|
so all project applications inherit user and group <b>boinc_project</b>.
|
2006-06-13 01:50:48 +00:00
|
|
|
This blocks project applications from accessing unauthorized files.
|
2007-10-12 05:11:04 +00:00
|
|
|
<li>In most cases, it is best to avoid running setuid <b>root</b> because
|
|
|
|
it can present a security risk. In this case, however, this is necessary to
|
|
|
|
<i>reduce</i> the risk because only the superuser can change the <i>real</i>
|
|
|
|
user and group of a process. This prevents a malicious or malfunctioning
|
|
|
|
application from reverting to the user and group who launched BOINC, since any
|
|
|
|
process can change its user and group back to the <i>real</i> user and
|
|
|
|
group IDs.
|
|
|
|
<li>BOINC's use of setuid <b>root</b> for the <i>switcher</i> application is
|
|
|
|
safe because:
|
|
|
|
<ul>
|
|
|
|
<li>The <i>switcher</i> application is inside the <i>switcher</i> directory.
|
|
|
|
This directory is accessible only by user and group <b>boinc_master</b>,
|
|
|
|
so that project applications cannot modify the <i>switcher</i>
|
|
|
|
application's permissions or code. This also prevents unauthorized users
|
|
|
|
from using <i>switcher</i> to damage or manipulate project files.
|
|
|
|
<li>The <i>switcher</i> application is readable and executable only by
|
|
|
|
group <b>boinc_master</b>; all other access is forbidden.
|
|
|
|
<li>When it is run, the <i>switcher</i> application immediately changes
|
|
|
|
its real and effective user ID and group ID to <b>boinc_project</b>, disabling
|
|
|
|
its superuser privileges.
|
|
|
|
</ul>
|
2009-10-31 09:25:52 +00:00
|
|
|
<li>As of BOINC Version 6.10.5, BOINC Manager no longer runs setgid to group
|
|
|
|
<b>boinc_master</b>, because Mac OS 10.6 does not allow it. So it can be run
|
|
|
|
only by users who are members of group <b>boinc_master</b>. By default, the
|
|
|
|
BOINC installer automatically adds all users who are members of group
|
|
|
|
<b>admin</b> to group <b>boinc_master</b>, and optionally adds non-admin
|
|
|
|
users to group <b>boinc_master</b>. The Manager runs as the user who
|
|
|
|
launched it, which is necessary for a number of GUI features to work correctly.
|
|
|
|
Although this means that BOINC Manager cannot modify files created by project
|
|
|
|
applications, there is no need for it to do so.
|
2007-10-12 05:11:04 +00:00
|
|
|
<li>Starting with BOINC version 6.0, project science applications use a
|
|
|
|
separate companion application to display graphics. These graphics
|
|
|
|
applications are launched by the BOINC Manager when the user clicks on
|
|
|
|
the <i>Show Graphics</i> button. Running the graphics application
|
|
|
|
with the BOINC Manager's user and group would be a security risk, so
|
|
|
|
BOINC Manager uses the <i>switcher</i> application to launch them as
|
|
|
|
user and group <b>boinc_project</b>.
|
|
|
|
<li>The screensaver also can run the graphics applications. The Macintosh
|
|
|
|
screensaver is launched by the operating system, so it runs as the
|
|
|
|
currently logged in user and group. Since running the science projects' graphics applications
|
|
|
|
with this user and group would be a security risk, the screensaver has
|
|
|
|
its own embedded helper application <i>gfx_switcher</i> which it uses to
|
2009-04-02 10:57:53 +00:00
|
|
|
launch and kill the graphics applications.
|
2007-10-12 05:11:04 +00:00
|
|
|
Like the <i>switcher</i> application, <i>gfx_switcher</i> runs setuid
|
|
|
|
<b>root</b> and immediately changes its real and effective user ID and
|
2009-04-15 08:55:30 +00:00
|
|
|
group ID to <b>boinc_project</b>.
|
2009-04-02 10:57:53 +00:00
|
|
|
<li>Starting with BOINC version 6.7, a default screenaver graphics application
|
|
|
|
is provided with BOINC. The screensaver (now more properly called the
|
|
|
|
<b>screensaver coordinator</b>) runs the default graphics alternating with science
|
2010-01-27 08:57:37 +00:00
|
|
|
graphics applications according to a schedule set by the data file ss_config.xml.
|
2009-04-02 10:57:53 +00:00
|
|
|
The default graphics are run also when no science graphics are available, such as
|
|
|
|
when BOINC is suspended. The default graphics executable is run as user and group
|
2009-04-15 08:55:30 +00:00
|
|
|
<b>boinc_project</b>.
|
2007-10-12 05:11:04 +00:00
|
|
|
<li>The BOINC screensaver's use of setuid <b>root</b> for the
|
|
|
|
<i>gfx_switcher</i> application is safe because:
|
|
|
|
<ul>
|
|
|
|
<li>When it is run, the <i>gfx_switcher</i> application immediately changes
|
2009-04-15 08:55:30 +00:00
|
|
|
its real and effective user ID and group ID to <b>boinc_project</b>, disabling
|
|
|
|
its superuser privileges.
|
2007-10-12 05:11:04 +00:00
|
|
|
<li>The <i>gfx_switcher</i> application has very limited functionality. It
|
2009-04-15 08:55:30 +00:00
|
|
|
accepts only three commands as its first argument:
|
2007-10-12 05:11:04 +00:00
|
|
|
<ul>
|
|
|
|
<li><i>launch_gfx</i>: the second argument is the slot number. It looks for
|
|
|
|
a soft-link named <b>graphics_app</b> in the specified slot directory and launches
|
2009-04-02 10:57:53 +00:00
|
|
|
the referenced graphics application as user and group <b>boinc_project</b>.
|
2009-04-15 08:55:30 +00:00
|
|
|
<li><i>default_gfx</i>: launches the default graphics application <i>boincscr</i>
|
|
|
|
in the BOINC data directory as user and group <b>boinc_project</b>.
|
2007-10-12 05:11:04 +00:00
|
|
|
<li><i>kill_gfx</i>: the second argument is the process ID. It kills the
|
|
|
|
application with the process ID; since it is running as user and group
|
2009-04-02 10:57:53 +00:00
|
|
|
<b>boinc_project</b>, it can affect only processes belonging to that user.
|
2009-04-15 08:55:30 +00:00
|
|
|
This is used to exit all screensaver graphics applications.</ul>
|
2007-10-12 05:11:04 +00:00
|
|
|
</ul>
|
2010-01-27 08:57:37 +00:00
|
|
|
<li>To hide account keys from unauthorized users, BOINC Client sets its umask
|
2010-01-28 10:33:21 +00:00
|
|
|
to 006 and (as of versions 6.8.20 and 6.10.30) makes all *.xml files at the top level
|
2010-01-27 08:57:37 +00:00
|
|
|
directory not world-readable (except ss_config.xml, which must be read by the
|
|
|
|
screensaver coordinator). This means that third-party add-ons cannot read BOINC
|
|
|
|
data files; they must use GUI RPCs to access BOINC Data.
|
2008-01-18 02:08:25 +00:00
|
|
|
<li>BOINC sets the umask for project applications to 002; the default permissions
|
|
|
|
for all files and directories they create prevent modification outside the
|
2010-01-27 08:57:37 +00:00
|
|
|
<b>boinc_project</b> user and group.
|
|
|
|
<li>Files written by projects are world-readable so that the BOINC Client can read
|
2010-01-28 10:33:21 +00:00
|
|
|
them. But, starting with BOINC versions 6.8.20 and 6.10.30, the slots directory and the projects
|
2010-01-27 08:57:37 +00:00
|
|
|
directory are executable (traversable) only by user boinc_master and group
|
|
|
|
boinc_projects, to prevent unauthorized users from reading account keys from the
|
|
|
|
init_data.xml files.
|
|
|
|
<li>Unauthorized users cannot modify BOINC or project files.
|
2006-06-13 20:27:35 +00:00
|
|
|
<li>Users with admin access are members of groups <b>boinc_master</b>
|
|
|
|
and <b>boinc_project</b> so that they do have
|
|
|
|
direct access to all BOINC and project files
|
|
|
|
to simplify maintenance and administration.
|
|
|
|
<li>The RPC password file <i>gui_rpc_auth.cfg</i>
|
|
|
|
is accessible only by user and group <b>boinc_master</b>.
|
2010-01-27 08:57:37 +00:00
|
|
|
In other words, only BOINC Manager, BOINC Client and authorized
|
|
|
|
users can read or modify it, restricting access to those BOINC RPC functions
|
|
|
|
which modify BOINC's operation.
|
2007-10-12 05:11:04 +00:00
|
|
|
<li>On Macintosh computers, the actual directory structures
|
|
|
|
of the BOINC Manager application bundle and the screensaver bundle are
|
|
|
|
more complex than implied by the box <i>BOINC executables</i> in the
|
|
|
|
BOINC tree diagram shown above.
|
2010-01-27 08:57:37 +00:00
|
|
|
<li>Some Macintosh system administrators may wish to further limit which users
|
2006-06-13 20:27:35 +00:00
|
|
|
can perform BOINC Manager functions (Activity Menu, etc.).
|
|
|
|
This can be done by moving BOINC Manager out of the
|
|
|
|
<b>/Applications</b> directory into a directory with restricted access.
|
2011-12-01 07:22:28 +00:00
|
|
|
<li><b>Important information for project developers:</b> The BOINC
|
|
|
|
installer traverses the BOINC Data directory and sets the users, groups and
|
|
|
|
permissions of all files as shown in the above table. This allows it to
|
|
|
|
repair corrupted permissions. <b>Note</b> that the BOINC installer will
|
2012-02-09 09:55:14 +00:00
|
|
|
<b>change all files and subdirectories</b> in the projects directory, the slots directory, and
|
2011-12-01 07:37:04 +00:00
|
|
|
all their subdirectories to <b>user boinc_master</b> and
|
2012-02-09 09:47:23 +00:00
|
|
|
<b>group boinc_project</b>. This means that:
|
|
|
|
<ul>
|
|
|
|
<li>If a project file needs to be
|
2011-12-01 07:37:04 +00:00
|
|
|
executable by another project file, its executable-by-group permission bit
|
|
|
|
<b>must</b> be set. The BOINC installer will <i>not</i> alter the
|
|
|
|
executable-by-user and executable-by-group permission bits of files in these
|
|
|
|
directories (though it will set these bits for the directories themselves.)
|
2012-02-09 09:47:23 +00:00
|
|
|
<li>It is <b>critical</b> that all files and subdirectories under the projects
|
|
|
|
and slots directories have both their read-by-owner <b>and</b> read-by-group
|
|
|
|
permission bits set, and that all subdirectories have both their
|
|
|
|
executable-by-owner and executable-by-group permission bits set.
|
|
|
|
</ul>
|
2006-06-13 01:50:48 +00:00
|
|
|
</ul>
|
|
|
|
</p>
|
|
|
|
";
|
|
|
|
|
2006-06-13 20:27:35 +00:00
|
|
|
page_tail();
|
2006-06-11 05:18:19 +00:00
|
|
|
?>
|