os.close(tmp_fd)
with open(tmp_filename, 'w+') as fd:
- fd.write('import prctl ; prctl.set_seccomp(True)\n')
fd.write(code)
read_pipe, write_pipe = os.pipe()
# if fork() -> share environment & everything
# execve while limiting reads to anything not in /etc, blocking
# anything else.
- cmd = "/usr/bin/python"
+ cmd = "seccompctl"
os.dup2(write_pipe, sys.stdout.fileno())
- # os.execv(cmd, [cmd, tmp_filename])
+ os.execv(cmd, [cmd, "python", tmp_filename])
else:
os.close(write_pipe)
os.waitpid(pid, 0)
if __name__ == "__main__":
- app.run()
+ app.run(host= '0.0.0.0')