blob: 4563a31af0ad5f19baafb51e098df653c32e5542 [file] [log] [blame] [view]
andybonsad92aa32015-08-31 02:27:441# Linux SUID Sandbox Development
2
3For context see [LinuxSUIDSandbox](linux_suid_sandbox.md)
andybons3322f762015-08-24 21:37:094
5We need a SUID helper binary to turn on the sandbox on Linux.
6
andybonsad92aa32015-08-31 02:27:447In most cases, you can run `build/update-linux-sandbox.sh` and it'll install
8the proper sandbox for you in `/usr/local/sbin` and tell you to update your
9`.bashrc` if needed.
andybons3322f762015-08-24 21:37:0910
andybonsad92aa32015-08-31 02:27:4411## Installation instructions for developers
andybons3322f762015-08-24 21:37:0912
andybonsad92aa32015-08-31 02:27:4413* If you have no setuid sandbox at all, you will see a message such as:
14
15 ```
16 Running without the SUID sandbox!
17 ```
18
19* If your setuid binary is out of date, you will get messages such as:
20
21 ```
22 The setuid sandbox provides API version X, but you need Y
23 You are using a wrong version of the setuid binary!
24 ```
andybons3322f762015-08-24 21:37:0925
26Run the script mentioned above, or do something such as:
27
andybonsad92aa32015-08-31 02:27:4428* Build `chrome_sandbox` whenever you build chrome
29 (`ninja -C xxx chrome chrome_sandbox` instead of `ninja -C xxx chrome`)
30* After building, run something similar to (or use the provided
31 `update-linux-sandbox.sh`):
andybons3322f762015-08-24 21:37:0932
andybonsad92aa32015-08-31 02:27:4433 ```shell
34 # needed if you build on NFS!
35 sudo cp out/Debug/chrome_sandbox /usr/local/sbin/chrome-devel-sandbox
36 sudo chown root:root /usr/local/sbin/chrome-devel-sandbox
37 sudo chmod 4755 /usr/local/sbin/chrome-devel-sandbox
38 ```
andybons3322f762015-08-24 21:37:0939
andybonsad92aa32015-08-31 02:27:4440* Put this line in your `~/.bashrc` (or `.zshenv` etc):
andybons3322f762015-08-24 21:37:0941
andybonsad92aa32015-08-31 02:27:4442 ```
43 export CHROME_DEVEL_SANDBOX=/usr/local/sbin/chrome-devel-sandbox
44 ```
andybons3322f762015-08-24 21:37:0945
andybonsad92aa32015-08-31 02:27:4446## Try bots and waterfall
andybons3322f762015-08-24 21:37:0947
andybonsad92aa32015-08-31 02:27:4448If you're installing a new bot, always install the setuid sandbox (the
49instructions are different than for developers, contact the Chrome troopers). If
50something does need to run without the setuid sandbox, use the
51`--disable-setuid-sandbox` command line flag.
andybons3322f762015-08-24 21:37:0952
andybonsad92aa32015-08-31 02:27:4453The `SUID` sandbox must be enabled on the try bots and the waterfall. If you
54don't use it locally, things might appear to work for you, but break on the
55bots.
andybons3322f762015-08-24 21:37:0956
andybonsad92aa32015-08-31 02:27:4457(Note: as a temporary, stop gap measure, setting `CHROME_DEVEL_SANDBOX` to an
58empty string is equivalent to `--disable-setuid-sandbox`)
andybons3322f762015-08-24 21:37:0959
andybonsad92aa32015-08-31 02:27:4460## Disabling the sandbox
61
62If you are certain that you don't want the setuid sandbox, use
63`--disable-setuid-sandbox`. There should be very few cases like this. So if
64you're not absolutely sure, run with the setuid sandbox.
65
66## Installation instructions for "[Raw builds of Chromium](https://commondatastorage.googleapis.com/chromium-browser-continuous/index.html)"
andybons3322f762015-08-24 21:37:0967
68If you're using a "raw" build of Chromium, do the following:
andybons3322f762015-08-24 21:37:0969
andybonsad92aa32015-08-31 02:27:4470 sudo chown root:root chrome_sandbox && sudo chmod 4755 chrome_sandbox && \
71 export CHROME_DEVEL_SANDBOX="$PWD/chrome_sandbox"
72 ./chrome
andybons3322f762015-08-24 21:37:0973
andybonsad92aa32015-08-31 02:27:4474You can also make such an installation more permanent by following the
75[steps above](#Installation-Instructions-for-developers) and installing
76`chrome_sandbox` to a more permanent location.
andybons3322f762015-08-24 21:37:0977
andybonsad92aa32015-08-31 02:27:4478## System-wide installations of Chromium
79
80The `CHROME_DEVEL_SANDBOX` variable is intended for developers and won't work
81for a system-wide installation of Chromium. Package maintainers should make sure
82the `setuid` binary is installed and defined in GYP as `linux_sandbox_path`.