spiegel_podman/pkg
Martin Roukala (né Peres) 70057c8b47
Make rootless privileged containers share the same tty devices as rootfull ones
Until Podman v4.3, privileged rootfull containers would expose all the
host devices to the container while rootless ones would exclude
`/dev/ptmx` and `/dev/tty*`.

When 5a2405ae1b ("Don't mount /dev/tty* inside privileged containers
running systemd") landed, rootfull containers started excluding all the
`/dev/tty*` devices when the container would be running in systemd
mode, reducing the disparity between rootless and rootfull containers
when running in this mode.

However, this commit regressed some legitimate use cases: exposing
non-virtual-terminal tty devices (modems, arduinos, serial
consoles, ...) to the container, and the regression was addressed in
f4c81b0aa5 ("Only prevent VTs to be mounted inside privileged
systemd containers").

This now calls into question why all tty devices were historically
prevented from being shared to the rootless non-privileged containers.
A look at the podman git history reveals that the code was introduced
as part of ba430bfe5e ("podman v2 remove bloat v2"), and obviously
was copy-pasted from some other code I couldn't find.

In any case, we can easily guess that this check was put for the same
reason 5a2405ae1b was introduced: to prevent breaking the host
environment's consoles. This also means that excluding *all* tty
devices is overbearing, and should instead be limited to just virtual
terminals like we do on the rootfull path.

This is what this commit does, thus making the rootless codepath behave
like the rootfull one when in systemd mode.

This leaves `/dev/ptmx` as the main difference between the two
codepath. Based on the blog post from the then-runC maintainer[1] and
this Red Hat bug[2], I believe that this is intentional and a needed
difference for the rootless path.

Closes: #16925
Suggested-by: Fabian Holler <mail@fholler.de>
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>

[1]: https://www.cyphar.com/blog/post/20160627-rootless-containers-with-runc
[2]: https://bugzilla.redhat.com/show_bug.cgi?id=501718
2023-01-16 16:23:53 +02:00
..
annotations fix a number of godot issues 2022-03-22 13:04:35 +01:00
api Merge pull request #16732 from flouthoc/network-update 2023-01-12 12:18:14 -05:00
auth [CI:DOCS] Fix spelling and typos 2022-11-19 16:26:00 +01:00
autoupdate bump golangci-lint to v1.49.0 2022-10-17 09:19:41 +02:00
bindings Use containers/storage/pkg/regexp in place of regexp 2023-01-12 18:33:38 -05:00
channel bump golangci-lint to v1.50.1 2022-12-15 13:39:56 +01:00
checkpoint checkpoint restore: fix --ignore-static-ip/mac 2022-12-12 18:34:49 +01:00
copy pkg: switch to golang native error wrapping 2022-07-08 08:54:47 +02:00
criu deps: bump go-criu to v6 2022-11-01 13:57:24 +05:30
ctime Replace deprecated ioutil 2022-09-20 15:34:27 -04:00
domain Merge pull request #17107 from vrothberg/fix-17016 2023-01-14 11:19:07 -05:00
env [CI:DOCS] Fix spelling and typos 2022-11-19 16:26:00 +01:00
errorhandling libpod/runtime: switch to golang native error wrapping 2022-07-04 15:39:00 +02:00
inspect pkg/inspect: remove unused ImageResult type 2022-05-24 16:07:39 +02:00
k8s.io Merge pull request #16560 from eriksjolund/fix_typo_a_an 2022-11-20 17:04:36 -05:00
lookup bump golangci-lint to v1.50.1 2022-12-15 13:39:56 +01:00
machine Updated options for QEMU on Windows hosts 2023-01-09 23:58:47 +02:00
namespaces libpod: Add pasta networking mode 2022-11-08 00:16:35 +01:00
parallel Fix stutters 2022-09-10 07:52:00 -04:00
ps Fix stutters 2022-09-10 07:52:00 -04:00
rctl pkg/rctl: Remove unused cgo dependency 2022-10-31 15:13:48 +00:00
rootless rootless: always create userns with euid != 0 2022-12-20 13:33:23 +01:00
rootlessport go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
seccomp pkg: switch to golang native error wrapping 2022-07-08 08:54:47 +02:00
selinux Fix SELinux functions names to not be repetitive 2020-04-23 15:57:34 -04:00
servicereaper go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
signal Run codespell on code 2022-11-04 10:57:41 -04:00
specgen Updated error message for supported VolumeSource types 2023-01-10 20:18:59 -06:00
specgenutil Add containers.conf read-only flag support 2022-12-22 11:57:28 -05:00
systemd Use containers/storage/pkg/regexp in place of regexp 2023-01-12 18:33:38 -05:00
terminal podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
timetype bump golangci-lint to v1.49.0 2022-10-17 09:19:41 +02:00
trust pkg/trust: Take the default policy path from c/common/pkg/config 2022-11-25 10:14:15 +00:00
util Make rootless privileged containers share the same tty devices as rootfull ones 2023-01-16 16:23:53 +02:00