Run the program in the container under a timeout

Another level of defense against DDOS.
This commit is contained in:
Nicolas Setton
2018-07-16 10:26:33 -04:00
parent 10160040cd
commit b5f5e60ec3

View File

@@ -42,7 +42,8 @@ def safe_run(main):
# Run it, printint output to stdout as we go along
subprocess.call(["lxc", "exec", CONT, "--",
"su", "ubuntu", "-c",
os.path.join(tmpdir, os.path.basename(main))],
"timeout 20s {}".format(
os.path.join(tmpdir, os.path.basename(main)))],
stdout=sys.stdout)
except E:
print sys.exc_info()