154
154
# Verify that nothing in the jail is world-writable.
155
155
# We don't want students to write into places that others can see.
156
for path, dirs, files in os.walk(build_path):
158
d = os.path.join(path, dname)
159
if os.path.islink(d):
161
if os.stat(d).st_mode & stat.S_IWOTH:
165
f = os.path.join(path, fname)
166
if os.path.islink(f):
168
if os.stat(f).st_mode & stat.S_IWOTH:
169
if (os.path.dirname(f) == os.path.join(build_path, 'dev') and
170
os.path.basename(f) in ('ptmx', 'null', 'tty', 'full', 'zero',
157
for path, dirs, files in os.walk(build_path):
159
d = os.path.join(path, dname)
160
if os.path.islink(d):
162
if os.stat(d).st_mode & stat.S_IWOTH:
166
f = os.path.join(path, fname)
167
if os.path.islink(f):
169
if os.stat(f).st_mode & stat.S_IWOTH:
170
if (os.path.dirname(f) == os.path.join(build_path, 'dev') and
171
os.path.basename(f) in ('ptmx', 'null', 'tty', 'full', 'zero',
176
except UnsafeJail, e:
177
print >> sys.stderr,"""Error: Jail contains world writable path: '%s'.
178
This is a security vulnerability as jail template contents are shared between
179
users. Please either make this path world unwriteable or remove it from the
177
183
# Copy jail template build to actual jail template
178
184
template_path = conf['paths']['jails']['template']