help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disabling dangerous commands


From: David Bateman
Subject: Re: Disabling dangerous commands
Date: Sat, 29 May 2010 21:17:21 +0200
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706)

Søren Hauberg wrote:
lør, 29 05 2010 kl. 21:51 +1000, skrev Thomas Karpiniec:
I'm trying to come up with a way of disabling commands such as
system(), fopen(), plot(), dlmwrite(), etc., which can spawn
subprocesses or interact with the rest of the system.

The reason I want to do this is that I have written an octave IRC bot
for GNU/Linux which allows you to do maths in-channel by forwarding
the input to an octave process and reading results back out to the
channel. Obviously I need to somehow lock it down so that users can't
wreak havoc on my system via octave. :)

I'm open to broader suggestions but my current feeling is that a list
of restricted commands within octave would provide the best
protection. I've searched online and through the manual and I haven't
been able to find a way to do that.

I could always patch octave, of course. Does anyone know if there is
a neater way?

There was a thread on something similar a while back (related to
creating a web interface to Octave); you might want to find that.

In general, if you disable system commands than many other functions
will stop working (example: if you disable the 'system' function, then
you wont be able to start gnuplot, i.e. no plotting). So, I really think
you need to follow Sergei's advice and go with the virtual machine.

Søren


You should also think about using PAM to limit the number of processes that can be spawned by octave as anything in octave that can be used to spawn an external process or thread can be used as a fork bomb... For example "i=0; while(true); figure(++i); plot(1:10); endwhile" will fork a new gnuplot process for each figure.

Running an octave command that will take an extremely long time might also be used to deny the use of your octave process to someone else (or do you have different process for each user), and you might not even be able to limit this with the ulimit command. For example "while (true), sleep(1000); endwhile" won't use much processor time but will lockup the octave process doing nothing useful..

D.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]