Skip to content

Commit 4d70d55

Browse files
committed
Further lock down of Singularity
as inspired by https://www.sylabs.io/2018/04/1098/
1 parent e02861e commit 4d70d55

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cwltool/singularity.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ def create_runtime(self, env, rm_container=True, record_container_id=False, cidf
164164
cidfile_prefix="", **kwargs):
165165
# type: (MutableMapping[Text, Text], bool, bool, Text, Text, **Any) -> List
166166

167-
runtime = [u"singularity", u"--quiet", u"exec", u"--contain"]
167+
runtime = [u"singularity", u"--quiet", u"exec", u"--contain", u"--pid",
168+
u"--ipc", u"--userns"]
168169
runtime.append(u"--bind")
169170
runtime.append(u"{}:{}:rw".format(
170171
docker_windows_path_adjust(os.path.realpath(self.outdir)),
@@ -182,7 +183,9 @@ def create_runtime(self, env, rm_container=True, record_container_id=False, cidf
182183

183184
if kwargs.get("custom_net", None) is not None:
184185
raise UnsupportedRequirement(
185-
"Singularity implementation does not support networking")
186+
"Singularity implementation does not support custom networking")
187+
elif kwargs.get("disable_net", None):
188+
runtime.append(u"--net")
186189

187190
env["SINGULARITYENV_TMPDIR"] = "/tmp"
188191
env["SINGULARITYENV_HOME"] = self.builder.outdir

0 commit comments

Comments
 (0)