允许我插入AppArmor,这是一种简单的强制访问控制机制,可以使创建这些类型的沙箱变得简单。这里是一个配置文件我在的地方,限制我的xpdf
PDF查看器:
#include <tunables/global>
/usr/bin/xpdf {
#include <abstractions/base>
#include <abstractions/bash>
#include <abstractions/X>
#include <abstractions/fonts>
/dev/tty rw,
owner /dev/pts/* rw,
/etc/papersize r,
/etc/xpdf/* r,
/bin/bash ix,
/usr/bin/xpdf r,
/usr/bin/xpdf.bin rmix,
/usr/share/xpdf/** r,
/usr/share/icons/** r,
owner /**.pdf r,
owner /tmp/* rw,
}
你可以学习在半天左右围您所选择的应用程序的基础知识,并在另一半为你的服务器写入的配置文件天。 (xpdf
配置文件花了我大约四分钟的时间写下来,但我知道我在做什么。我们已经在一个下午的时间里将AppArmor部署到了领先的在线零售商的面向公众的服务器上,与其他部署的结果相似。)
AppArmor中也给出an easy interface for configuring run-time limits,诸如处理多少内存允许分配:
rlimit as <= 100M, # limit address space to 100 megabytes
AppArmor配置将是最容易在Ubuntu,openSUSE的,SLES,PLD,Mandriva的,Pardis,或Annvix分布使用,因为这些工具是预先安装的。但AppArmor的核心功能是有货的Linux内核2.6.36和更新版本,以及it is possible to install AppArmor on any Linux distribution。
其他类似工具包括SElinux,TOMOYO或SMACK。我认为SMACK是下一个最容易部署的,但其中任何一个都可以防止恶意代码破坏您的系统。
的可能重复的[分级计划 - 编译/内执行的C++代码C++](http://stackoverflow.com/questions/5131085/grading-program-compile-executing-c-code-within-c) – 2011-03-21 01:40:23
是否http://ideone.com/太简单了? – Johnsyweb 2011-03-21 01:42:28
查看[codepad.org](http://codepad.org/)的[关于页面](http://codepad.org/about)。即:“策略是在ptrace下运行所有的东西,许多系统调用都被禁止或忽略。编译器和最终的可执行文件都在chroot jail中执行,并且资源限制严格。” – 2011-03-21 01:56:56