Skip to content

Tags: AkihiroSuda/runc

Tags

rootless-systemd.202004012050

Toggle rootless-systemd.202004012050's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
[DNM] cgroup v2: attempt to support rootless systemd

This patch does NOT work because godbus doesn't support userns:
https://github.com/godbus/dbus/blob/v5.0.3/auth.go#L56

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>

fix-subgid.20180829

Toggle fix-subgid.20180829's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
libcontainer: CurrentGroupSubGIDs -> CurrentUserSubGIDs

subgid is defined per user, not group (see subgid(5))

This commit also adds support for specifying subuid owner with a numeric UID.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>

bind-sys-2.20180817-1

Toggle bind-sys-2.20180817-1's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
rootless: make /sys/fs/cgroup/* read-only

The default rootless spec bind-mounts /sys with "rbind,ro" (because mounting sysfs
requires netns to be unshared), however, it does not make subfilesystems mounted
under /sys read-only.

So, files under /sys/fs/cgroup were unexpectedly writable when they are chmod/chowned
via privileged helpers such as pam_cgfs.

This patch fixes the issue by mounting /sys/fs/cgroup/* as read-only explicitly.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>

bind-sys-2.20180817-0

Toggle bind-sys-2.20180817-0's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
rootless: make /sys/fs/cgroup/* read-only

The default rootless spec bind-mounts /sys with "rbind,ro" (because mounting sysfs
requires netns to be unshared), however, it does not make subfilesystems mounted
under /sys read-only.

So, files under /sys/fs/cgroup were unexpectedly writable when they are chmod/chowned
via privileged helpers such as pam_cgfs.

This patch fixes the issue by mounting /sys/fs/cgroup/* as read-only explicitly.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>

bind-sys-2.20180816

Toggle bind-sys-2.20180816's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
rootless: make /sys/fs/cgroup/* read-only

The default rootless spec bind-mounts /sys with "rbind,ro" (because mounting sysfs
requires netns to be unshared), however, it does not make subfilesystems mounted
under /sys read-only.

So, files under /sys/fs/cgroup were unexpectedly writable when they are chmod/chowned
via privileged helpers such as pam_cgfs.

This patch fixes the issue by mounting /sys/fs/cgroup/* as read-only explicitly.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>

bind-sys-2-20180814

Toggle bind-sys-2-20180814's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
rootless: make /sys/fs/cgroup/* read-only

The default rootless spec bind-mounts /sys with "rbind,ro" (because mounting sysfs
requires netns to be unshared), however, it does not make subfilesystems mounted
under /sys read-only.

So, files under /sys/fs/cgroup were unexpectedly writable when they are chmod/chowned
via privileged helpers such as pam_cgfs.

This patch fixes the issue by mounting /sys/fs/cgroup/* as read-only explicitly.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>

decompose-rootless-pr.201808102144

Toggle decompose-rootless-pr.201808102144's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Disable rootless mode except RootlessCgMgr when executed as the root …

…in userns

This PR decomposes `libcontainer/configs.Config.Rootless bool` into `RootlessEUID bool` and
`RootlessCgroups bool`, so as to make "runc-in-userns" to be more compatible with "rootful" runc.

`RootlessEUID` denotes that runc is being executed as a non-root user (euid != 0) in
the current user namespace. `RootlessEUID` is almost identical to the former `Rootless`
except cgroups stuff.

`RootlessCgroups` denotes that runc is unlikely to have the full access to cgroups.
`RootlessCgroups` is set to false if runc is executed as the root (euid == 0) in the initial namespace.
Otherwise `RootlessCgroups` is set to true.
(Hint: if `RootlessEUID` is true, `RootlessCgroups` becomes true as well)

When runc is executed as the root (euid == 0) in an user namespace (e.g. by Docker-in-LXD, Podman, Usernetes),
`RootlessEUID` is set to false but `RootlessCgroups` is set to true.
So, "runc-in-userns" behaves almost same as "rootful" runc except that cgroups errors are ignored.

This PR does not have any impact on CLI flags and `state.json`.

Note about CLI:
* Now `runc --rootless=(auto|true|false)` CLI flag is only used for setting `RootlessCgroups`.
* Now `runc spec --rootless` is only required when `RootlessEUID` is set to true.
  For runc-in-userns, `runc spec`  without `--rootless` should work, when sufficient numbers of
  UID/GID are mapped.

Note about `$XDG_RUNTIME_DIR` (e.g. `/run/user/1000`):
* `$XDG_RUNTIME_DIR` is ignored if runc is being executed as the root (euid == 0) in the initial namespace, for backward compatibility.
  (`/run/runc` is used)
* If runc is executed as the root (euid == 0) in an user namespace, `$XDG_RUNTIME_DIR` is honored if `$USER != "" && $USER != "root"`.
  This allows unprivileged users to allow execute runc as the root in userns, without mounting writable `/run/runc`.

Note about `state.json`:
* `rootless` is set to true when `RootlessEUID == true && RootlessCgroups == true`.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>

decompose-rootless-pr.201808101604

Toggle decompose-rootless-pr.201808101604's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Disable rootless mode except RootlessCgMgr when executed as the root …

…in userns

This PR `libcontainer/configs.Config.Rootless bool` decomposes into `RootlessEUID bool` and
`RootlessCgroups bool`, so as to make "runc-in-userns" to be more compatible with "rootful" runc.

`RootlessEUID` denotes that runc is being executed as a non-root user (euid != 0) in
the current user namespace. `RootlessEUID` is almost identical to the former `Rootless`
except cgroups stuff.

`RootlessCgroups` denotes that runc is unlikely to have the full access to cgroups.
`RootlessCgroups` is set to false if runc is executed as the root (euid == 0) in the initial namespace.
Otherwise `RootlessCgroups` is set to true.
(Hint: if `RootlessEUID` is true, `RootlessCgroups` becomes true as well)

When runc is executed as the root (euid == 0) in an user namespace (e.g. by Docker-in-LXD, Podman, Usernetes),
`RootlessEUID` is set to false but `RootlessCgroups` is set to true.
So, "runc-in-userns" behaves almost same as "rootful" runc except that cgroups errors are ignored.

This PR does not have any impact on CLI flags and `state.json`.

Note about CLI:
* Now `runc --rootless=(auto|true|false)` CLI flag is only used for setting `RootlessCgroups`.
* Now `runc spec --rootless` is only required when `RootlessEUID` is set to true.
  For runc-in-userns, `runc spec`  without `--rootless` should work, when sufficient numbers of
  UID/GID are mapped.

Note about `$XDG_RUNTIME_DIR` (e.g. `/run/user/1000`):
* `$XDG_RUNTIME_DIR` is ignored if runc is being executed as the root (euid == 0) in the initial namespace, for backward compatibility.
  (`/run/runc` is used)
* If runc is executed as the root (euid == 0) in an user namespace, `$XDG_RUNTIME_DIR` is honored if `$USER != "" && $USER != "root"`.
  This allows unprivileged users to allow execute runc as the root in userns, without mounting writable `/run/runc`.

Note about `state.json`:
* `rootless` is set to true when `RootlessEUID == true && RootlessCgroups == true`.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>

decompose-rootless-pr.201808101537

Toggle decompose-rootless-pr.201808101537's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
don't enable rootless mode except RootlessCgMgr when root in userns

Cgroups (including ps, pause, resume):
* Now `runc --rootless=(auto|true|false)` CLI flag is only used for whether we should
 use RootlessCgroupManager, which attempts cgroups operations but ignores permission errors.
* When `runc --rootless` is set to auto, if we are the root (euid=0) in the initial namespace,
 we disable RootlessCgroupManager and use the strict cgroup manager. Otherwise we use RootlessCgroupManager.

$XDG_RUNTIME_DIR:
* Ignored if we are the root (euid=0) in the initial namespace for backward compatibility.
* If we have euid=0 but in a user namespace, $XDG_RUNTIME_DIR is honored
  if $USER != "" && $USER != "root".

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>

decompose-rootless.20180705

Toggle decompose-rootless.20180705's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
rootless: don't enable rootless mode except "lenient cgroup" when in …

…euid=0 in userns

Cgroups (including ps, pause, resume):
* Now `runc --rootless=(auto|true|false)` CLI flag is only used for whether we should
 use "lenient cgroup manager" which ignores permission errors.
* When `--rootless` is set to auto, if we are the root (euid=0) in the initial namespace,
 we disable "lenient cgroup manager" and use the strict one. Otherwise we use the lenient one.

$XDG_RUNTIME_DIR:
* Ignored if we are the root (euid=0) in the initial namespace
* If we have euid=0 but in a user namespace, $XDG_RUNTIME_DIR is honored
  if $USER != "" && $USER != "root".

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>