Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, you can use some general security system to ensure safe code execution like <a href="http://wiki.apparmor.net/index.php/Main_Page" rel="nofollow">AppArmor</a> or <a href="http://en.wikipedia.org/wiki/Security-Enhanced_Linux" rel="nofollow">SELinux</a>. It works not only for java, python, etc. applications, but also for bash-scripts, binary executables and so on. Haven't worked at all with SELinux, but this is a simple example of AppArmor security profile which does everything you mentioned except "running more than X seconds" - this can be done by timeout mechanism (I'm a new user, so cannon post a second link here O_o..)</p> <pre><code>#include &lt;tunables/global&gt; /path/to/executable { #include &lt;abstractions/base&gt; # http://linux.die.net/man/2/setrlimit # limit memory (address space) set rlimit as &lt;= 150M, # limit core dump file http://linux.die.net/man/5/core set rlimit core &lt;= 2M, # allow to create files only this size at max set rlimit fsize &lt;= 1M, # limits number of threads (fork bomb won't go! :)) set rlimit nproc &lt;= 10, # program will have access to stuff defined in abstractions/base and # to the file defined below. Nothing else. /path/to/file.txt rw, } </code></pre> <p>What about putting each script in a sandbox - you can create several identical profiles for script1, script2 etc. This is also the way if you want different permissions for different excercises people will solve on your site.</p> <p>And this is an example of using timeout:</p> <pre><code>$sudo apt-get install timeout $timeout 3 ./binary #limits execution of ./binary to 3 seconds </code></pre> <p>I also want to recommend you limit compilation time for compiled proramming languages if you have any. For example, in C++ someone can write a tricky template or </p> <pre><code>#include &lt;/dev/urandom&gt; </code></pre> <p>That will cause cpu-intensive work at compile-time.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload