summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-06-22 22:20:59 +0200
committerHelmut Grohne <helmut@subdivi.de>2024-06-22 22:20:59 +0200
commit97eada134e410a83cd024a490721dec27f45d097 (patch)
tree3918605d2b547c19a5209ad853823fcdaa2342a7
parenta3566049dc64f0016bc4e1f1e0484e37fb92d373 (diff)
downloadpython-linuxnamespaces-97eada134e410a83cd024a490721dec27f45d097.tar.gz
unschroot: only provide /dev/net/tun when the network namespace is unshared
-rwxr-xr-xexamples/unschroot.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/unschroot.py b/examples/unschroot.py
index cbabcc4..59c0ce4 100755
--- a/examples/unschroot.py
+++ b/examples/unschroot.py
@@ -245,7 +245,9 @@ def do_run_session(args: argparse.Namespace) -> None:
os.chdir("/mnt")
linuxnamespaces.populate_sys("/", ".")
linuxnamespaces.populate_proc("/", ".", ns)
- linuxnamespaces.populate_dev("/", ".")
+ linuxnamespaces.populate_dev(
+ "/", ".", tun=bool(ns & linuxnamespaces.CloneFlags.NEWNET)
+ )
linuxnamespaces.pivot_root(".", ".")
linuxnamespaces.umount(".", linuxnamespaces.UmountFlags.DETACH)
os.chdir("/")