summaryrefslogtreecommitdiff
path: root/linuxnamespaces
AgeCommit message (Collapse)Author
2024-11-16systemd: improve dbus type guessingHEADmainHelmut Grohne
The PIDs property receives integers. Since the guessing code did not handle integers, it would fail immediately.
2024-10-26add a method IDMapping.identity for convenienceHelmut Grohne
2024-06-22populate_sys: allow device accessHelmut Grohne
The systemd test suite does not like having no access to /sys/dev and other trees related to devices. Optionally provide them. Properly virtualizing them likely requires lxcfs or similar.
2024-06-22populate_sys: refactorHelmut Grohne
We now compute the actual bind mounts first and deduce the directories in need of creation from that. This makes populate_sys easier to extend.
2024-06-22populate_dev: fix /dev/net/tunHelmut Grohne
Fixes: 8b98dc846e7b ("populate_dev: remove assumption that newdev does not shadow origdev")
2024-06-22add function enable_loopback_ifHelmut Grohne
It can be used in a new network namespace to enable the loopback network interface and thus provide easy network isolation.
2024-06-16populate_dev: also provide /dev/shmHelmut Grohne
This is needed e.g. for Python's multiprocessing.SemLock.
2024-06-16populate_dev: install /dev/fdHelmut Grohne
This symlink turns out to be important for execveat. Its NOTES section details that /dev/fd needs to work in order for execveat to work. We better provide this symlink.
2024-06-11fix formatting and spelling errorsHelmut Grohne
No functional changes.
2024-06-11improve typingHelmut Grohne
linuxnamespaces/__init__.py: * linuxnamespaces.filedescriptor only exports FileDescriptor. By importing *, we re-export it implicitly. linuxnamespaces/atlocation.py: * PathLike should be parameterized and we no longer allow bytes there. linuxnamespaces/tarutils.py: * Resolve dict vs Mapping. tests/test_simple.py: * Establish expected type to mypy. examples/unschroot.py: * pidfd is first an int and later a FileDescriptor, but we always use it as int. * Also tell mypy that we cannot get NULL from waitid.
2024-05-28support sendfile in async_copyfdHelmut Grohne
2024-05-27add IDAllocation.reserve methodHelmut Grohne
Allow reserving a particular range instead of allocating a suitable large range of an IDAllocation. This is useful when a directory hierarchy defines the allocation and we merely want to verify it to be assigned.
2024-05-25add a FileDescriptor typeHelmut Grohne
It serves two main purposes. For one thing, it allows telling bare integers and file descriptors apart on a typing level similar to a NewType. For another it adds common methods to a file descriptor and enables closing it via a context manager.
2024-05-20add an asyncio waitid(P_PIDFD, ...) helperHelmut Grohne
2024-05-20add function async_copyfdHelmut Grohne
It is a bit like an async version of shutil.copyfileobj but for bare file descriptors and has an optimized version for pipes.
2024-05-20Revert "add a splice syscall wrapper"Helmut Grohne
os.splice from Python >= 3.10 is good enough. This reverts commit 056c1f964f55adedc17f8d7bddef1f48c73852c7.
2024-05-20syscalls: use >= 3.10 support for eventfds in os moduleHelmut Grohne
2024-05-17add a splice syscall wrapperHelmut Grohne
2024-05-17add prctl_set_child_subreaperHelmut Grohne
2024-05-17populate_dev: also create std{in,out,err} symlinksHelmut Grohne
When booting systemd, it'll create these symlinks, but when doing an application container, nothing does this and we risk creating regular files there.
2024-05-09add linuxnamespaces.tarinfo.XAttrTarFileHelmut Grohne
This is a mixin subclass for TarFile that enables it to restore and apply linux extended attributes as PAX headers in the SCHILY.xattr.* format. As a consequence, this enables us to process tar archives containing file system capabilities.
2024-05-09add linuxnamespaces.tarutilsHelmut Grohne
Move the generic tar utilities from the chroottar.py example into a linuxnamespaces module as dealing with tar archives is a fairly common thing when dealing with namespaces.
2024-05-07mount: allow data argument to be a listHelmut Grohne
2024-05-06syscalls: allow logging of syscallsHelmut Grohne
2024-04-23lift the dbus functionality from the cgroup exampleHelmut Grohne
2024-04-04avoid hard coding the soname of the libcHelmut Grohne
Passing None as name also yields libc functions.
2024-04-04add method AtLocation.as_emptypath for cloning a locationHelmut Grohne
2024-04-04add syscall wrapper for prctl(PR_SET_PDEATHSIG, ...)Helmut Grohne
2024-04-04add function populate_procHelmut Grohne
2024-04-04document security implications of populate_* functionsHelmut Grohne
2024-04-03AtLocation.walk: add support for AT_EMPTY_PATHHelmut Grohne
2024-04-03AtLocation.walk: emit nofllow flag when follow_symlinks=FalseHelmut Grohne
2024-04-03AtLocation.readlink: require AT_SYMLINK_NOFOLLOWHelmut Grohne
It does not make sense to read a link after having followed it.
2024-04-02improve AtLocation.join semanticsHelmut Grohne
Also allow joining an AtLocation. When doing that note that any kind of absolute location object (absolute path without fd and any location with an fd) results in just that latter location just like os.path.join returns the latter path when it is absolute. Fixes: 034f732a1af4 ("initial checkin")
2024-04-02a few formatting and typo fixesHelmut Grohne
2024-04-02add documentation regarding resource management of AtLocationsHelmut Grohne
2024-04-02fix logic error in AtLocation.statHelmut Grohne
Fixes: 1c265b6e11c3 ("add os.stat wrapper AtLocation.stat")
2024-03-24AtLocation.mkdir: support optional arguments from pathlibHelmut Grohne
2024-03-22add convenience functions for stat to AtLocationLikeHelmut Grohne
These are the is_* family and exists all from pathlib.Path.
2024-03-22add os.stat wrapper AtLocation.statHelmut Grohne
2024-03-16add an asyncio variant of run_in_forkHelmut Grohne
2024-03-14rename AtLocation.symlink to symlink_toHelmut Grohne
This mirrors what was done for pathlib.Path to avoid confusion about argument order.
2024-03-12work around mypy misdetection on bookwormHelmut Grohne
2024-03-11add method AtLocation.is_absoluteHelmut Grohne
This is similar to pathlib.Path.is_absolute.
2024-03-07add AtLocation.rename method wrapping os.renameHelmut Grohne
2024-03-07add AtLocation.link method wrapping os.linkHelmut Grohne
2024-03-03add function for prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, ...)Helmut Grohne
2024-03-03implement repr for AtLocationHelmut Grohne
2024-03-02fix typosJakub Wilk
2024-03-01add rudimentary prctl syscall wrapperHelmut Grohne