87
90
To each user, it appears that they have their own private Unix filesystem
88
91
containing software, libraries and a home directory to do with what they
89
please. This is mainly done by the setuid root program ``trampoline`` (See
90
:file:`bin/trampoline/trampoline.c`) which mounts the users home directory,
91
sets up the users environment, jumps into the user's jail using the
92
:manpage:`chroot(2)` system call and finally drops privileges to the desired
92
please. This is mainly done by the setuid root program ``trampoline`` which
93
mounts the users home directory, sets up the users environment, jumps into the
94
user's jail using the :manpage:`chroot(2)` system call and finally drops
95
privileges to the desired user and group.
95
97
To prevent abuse, ``trampoline`` can only be used by root or one of the uids
96
98
specified when trampoline is built by ``setup.py build`` (defaults to UID 33,
97
99
www-data on Debian systems). Since it's one of two C programs involved in IVLE
98
and runs setuid root it is rather secuity sensative.
100
and runs setuid root it is rather security sensitive.
102
.. seealso:: Source code :file:`bin/trampoline/trampoline.c`
100
105
Base Image Generation
101
106
---------------------
131
136
directories to be accessible from another location in the file system. By
132
137
carefully bind-mounting the jail image as read-only and then bind-mounting the
133
138
user's :file:`/home` and :file:`/tmp` directory data over the top, we create a
134
jail with only three bind mounts and at virtually no filesystem overhead.
139
jail with only three bind mounts and at virtually no file system overhead.
137
142
IVLE has historically used numerous solutions to this problem, which are
204
215
* Creating group Subversion repositories.
205
216
* Rebuilding Subversion authorization files.
207
Communication with the Server is done using the `Chat Protocol`_. To prevent
208
unauthorized use, communication with the User Management Server requires that
209
a *shared secret* be used to communicate with the server. This secret is
210
stored in the `magic` variable in the `[usrmgt]` section of
218
Communication with the Server is done using the `Chat Protocol <ref-chat>`_.
219
To prevent unauthorized use, communication with the User Management Server
220
requires that a *shared secret* be used to communicate with the server. This
221
secret is stored in the `magic` variable in the `[usrmgt]` section of
211
222
:file:`/etc/ivle/ivle.conf`.
213
224
The User Management Server is called almost exclusively from the
214
225
:mod:`ivle.webapp.userservice` module.
216
See :file:`services/usrmgt-server` for details.
227
.. seealso:: Source code :file:`services/usrmgt-server`
221
234
**Chat** is our JSON_-based client/server communication protocol used in
222
communicating to `Python Console`_ processes and `User Management Server`_.
223
Since it is JSON-based it can be called from either Python or JavaScript.
235
communicating to `Python Console <ref-python-console>`_ processes and `User
236
Management Server <ref-usrmgt-server>`_. Since it is JSON-based it can be
237
called from either Python or JavaScript.
256
270
exception and :const:`TRACEBACK` is a string of the traceback generated by the
257
271
server's exception handler.
259
See :file:`ivle/chat.py` for details.
273
.. seealso:: Source code :file:`ivle/chat.py`
279
Along with traditional file system access, IVLE allows users to version their
280
files using Subversion_. Much like how Subversion workspaces are used on a
281
standard desktop, workspaces are checked out into users home directories where
282
they can be manipulated through a series of AJAX requests to the
285
Like all other user file system actions, version control actions need to be
286
executed inside the user's :ref:`jail <ref-jail>`. Requests are made to the
287
``fileservice`` app in :mod:`ivle.webapp.fileservice` which then calls the
288
``fileservice`` CGI script using ``trampoline``. This script is simply a
289
wrapper around :mod:`ivle.fileservice_lib` which actually contains the code to
290
handle each of the actions.
292
Manipulation of the Subversion workspaces is done using the pysvn_ library.
294
.. _Subversion: http://subversion.tigris.org/
295
.. _pysvn: http://pysvn.tigris.org/
301
Each user is allocated a Subversion repository when their :ref:`Jail
302
<ref-jail>` is created by the :ref:`User Management Server
303
<ref-usermgt-server>`. Repository are stored in the location specified by
304
``[paths] [[svn]] repo_path`` in :file:`/etc/ivle/ivle.conf` (by default
305
:file:`/var/lib/ivle/svn/repositories/`). User repositories are stored in the
306
:samp:`users/{USERNAME}/` subdirectory and group repositories in
307
:samp:`groups/{SUBJECT}_{YEAR}_{SEMESTER}_{GROUP}`.
311
While it would be possible to give users direct access to their repository
312
using Subversion's file backend, this would allow users to potentially
313
modify the history of any repository that they had access to. To ensure
314
repository integrity, all Subversion interaction must be done remotely.
320
These repositories are served by Apache using ``mod_dav_svn`` allowing access
321
over Subversion's WebDAV HTTP or HTTPS backends. Users are authenticated using
322
a randomly generated key which is stored in the database and is made available
323
to each user inside their Jail (``svn_pass`` property inside
324
:file:`/home/.ivle.conf`). This key is automatically provided when doing
325
Subversion actions, but can be manually entered when accessing a users
326
repository from an external Subversion client such as with :samp:`svn checkout
327
{svn_addr}/users/{USERNAME}/ workspace`.
329
Repository permissions for ``AuthzSVNAccessFILE`` are automatically generated
330
and placed in the file located at ``[paths] [[svn]] conf`` for user
331
repositories and ``[paths] [[svn]] group_conf`` for group repositories. User
332
authentication keys for ``AuthUserFile`` are stored in the file located at
333
``[path] [[svn]] auth_ivle``. These will be regenerated each time user or
334
group repository settings change.