Secure way to run other people code (sandbox) on my server?

后端 未结 9 1477
一个人的身影
一个人的身影 2020-12-01 06:37

I want to make a web service that run other people code locally... Naturally, I want to limit their code access to certain \"sandbox\" directory, and that they wont be able

相关标签:
9条回答
  • 2020-12-01 07:10

    Use Ideone API - the simplest way.

    0 讨论(0)
  • 2020-12-01 07:11

    Check out ulimit and friends for ways of limiting the underprivileged user's ability to DOS the machine.

    0 讨论(0)
  • 2020-12-01 07:14

    chroot, jail, container, VServer/OpenVZ/etc., are generally more secure than running as an unprivileged user, but lighter-weight than full OS virtualization.

    Also, for Java, you might trust the JVM's built-in sandboxing, and for compiling C++, NaCl claims to be able to sandbox x86 code.

    But as Checkers' answer states, it's been proven possible to cause malicious damage from almost any "sandbox" in the past, and I would expect more holes to be continually found (and hopefully fixed) in the future. Do you really want to be running untrusted code?

    0 讨论(0)
  • 2020-12-01 07:17

    try using lxc as a container for your apache server

    0 讨论(0)
  • 2020-12-01 07:20
    1. Running under unprivileged user still allows a local attacker to exploit vulnerabilities to elevate privileges.
    2. Allowing to execute code in a VM can be insecure as well; the attacker can gain access to host system, as recent VMWare vulnerability report has shown.

    In my opinion, allowing running native code on your system in the first place is not a good idea from security point of view. Maybe you should reconsider allowing them to run native code, this will certainly reduce the risk.

    0 讨论(0)
  • 2020-12-01 07:23

    Not sure about how much effort you want to put into this thing but could you run Xen like the VPS web hosts out there?

    http://www.xen.org/

    This would allow full root access on their little piece of the server without compromising the other users or the base system.

    0 讨论(0)
提交回复
热议问题