8
jailBase = '/home/infomatics/jails/'
9
siteBase = '/home/informatics/www/'
13
passwdfile = open('/etc/passwd')
14
for line in passwdfile.readlines():
15
rec = re.split(':',line)
18
raise Exception, (login + " not found!")
24
limits = [(resource.RLIMIT_CORE, (0,0)), \
25
(resource.RLIMIT_CPU, (1,2)), \
26
(resource.RLIMIT_FSIZE, (5 * Mb, 5 * Mb)), \
27
(resource.RLIMIT_DATA, (20 * Mb, 24 * Mb)), \
28
(resource.RLIMIT_STACK, (8 * Mb, 9 * Mb)), \
29
(resource.RLIMIT_NPROC, (10, 10)), \
30
(resource.RLIMIT_NOFILE, (10, 12))]
33
resource.setrlimit(r,l)
35
def runit(login, script):
36
user = findUser(login)
38
os.chdir(jailBase + login)
39
os.chroot(jailBase + login)
42
os.execlp("/usr/bin/python", "python", script)
44
os.environ['DOCUMENT_ROOT'] = '/'
45
os.environ['SCRIPT_FILENAME'] = re.sub(siteBase, '/home/',
46
os.environ['SCRIPT_FILENAME'])
48
m = re.match('^/([^/]*)/', os.environ['SCRIPT_NAME'])
53
runit(login, os.environ['SCRIPT_FILENAME'])