Rainbow/Current Situation: Difference between revisions
mNo edit summary |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Rainbow page}} |
{{Rainbow page}} |
||
=== Features === |
|||
The main features implemented by the current design are: |
|||
* process isolation |
|||
* filesystem isolation |
|||
* optional primitive video/audio hardware isolation |
|||
* optional experimental X11 isolation |
|||
=== Design === |
=== Design === |
||
Line 27: | Line 36: | ||
=== Implementation === |
=== Implementation === |
||
Here are some key ideas underlying the current implementation: |
|||
# "Owners" are the accounts on behalf of which we are isolating a program. They need access to data produced by that program and to space ("topic dirs" and "data groups") through which to share information with it. |
# "Owners" are the accounts on behalf of which we are isolating a program. They need access to data produced by that program and to space ("topic dirs" and "data groups") through which to share information with it. |
||
# Some times, people will want to re-use a container. Other times, they'll want a fresh one. Containers, being accounts, are identified by uid. |
# Some times, people will want to re-use a container. Other times, they'll want a fresh one. Containers, being accounts, are identified by uid. |
||
# Control flow is linear within controlling functions like <tt>main()</tt> and <tt>inject()</tt>. |
|||
#* Exceptions are used to terminate control flow and to record information about the program's situation when it terminates. |
|||
#* Input validation is performed by functions named <tt>check_'''foo'''()</tt> |
|||
# State is maintained in a simple filesystem-embedded microformat. |
# State is maintained in a simple filesystem-embedded microformat. |
||
#* Reservations are recorded in <tt>'''foo'''_pool</tt> |
#* Reservations are recorded in <tt>'''foo'''_pool</tt> |
Latest revision as of 21:45, 12 June 2009
Rainbow :: git :: sources :: rainbow-0.8.6.tar.bz2 :: announcement
Features
The main features implemented by the current design are:
- process isolation
- filesystem isolation
- optional primitive video/audio hardware isolation
- optional experimental X11 isolation
Design
Rainbow has been implemented according to three designs to date.
The present design, implemented in the "rainbow-0.8.*" series, works to isolate processes by confining them to accounts with access control credentials which limit the confined programs' ability to commit side-effects like filesystem I/O.
Structurally, the design consists of:
- a "UI" layer, containing:
- the rainbow-run "exec-wrapper" and
- some higher-level tools based on that program such as the rainbow-easy convenience wrapper.
- an injection library, which contains Rainbow's isolation logic
- an NSS module.
These components have the following responsibilities:
- The UI is responsible for figuring out what to do and for handing that information to a separate injection library.
- The injection is responsible for:
- acting on isolation requests by manipulating persistent state held in a filesystem spool,
- dropping privilege, and
- handing control to the program being isolated.
- Finally, the rainbow NSS module lets other programs read the rainbow spool through the usual POSIX APIs for reading system databases.
This structure was chosen to so that rainbow can be used from freedesktop.org .desktop launcher files, from the command-line, and from custom graphical shells like Sugar with equal ease and so that changes to rainbow can operate without munging important system files like /etc/passwd and /etc/group.
Implementation
Here are some key ideas underlying the current implementation:
- "Owners" are the accounts on behalf of which we are isolating a program. They need access to data produced by that program and to space ("topic dirs" and "data groups") through which to share information with it.
- Some times, people will want to re-use a container. Other times, they'll want a fresh one. Containers, being accounts, are identified by uid.
- Control flow is linear within controlling functions like main() and inject().
- Exceptions are used to terminate control flow and to record information about the program's situation when it terminates.
- Input validation is performed by functions named check_foo()
- State is maintained in a simple filesystem-embedded microformat.
- Reservations are recorded in foo_pool
- Maps are named foo_to_bar
- Key-value pairs are entries are symlinks from key->value.
- SQLite would probably have worked just as well, except that its algorithms are not lock-free.
- We provide isolation by generating low-privilege accounts through the NSS module, then by calling things like
- chown()
- chmod()
- setrlimit()
- setgroups()
- setgid()
- setuid()
- Task-specific "assistant" program like rainbow-xify or rainbow-sugarize provide isolated software with access to task-specific shared resources like:
- D-Bus sockets,
- D-Bus cookies,
- X sockets,
- X cookies, and
- temporary filesystems
- Mounting filesystems needs to be done as root and is presently done in a new filesystem namespace (see CLONE_NEWNS) in order to reduce resource leakage.
Other Notes
See User:Mstone/Tricks for more detail on some of the idioms used rainbow.