Commit graph

11 commits

Author SHA1 Message Date
Giuseppe Scrivano b8514ca6f3
namespaces: by default create cgroupns on cgroups v2
change the default on cgroups v2 and create a new cgroup namespace.

When a cgroup namespace is used, processes inside the namespace are
only able to see cgroup paths relative to the cgroup namespace root
and not have full visibility on all the cgroups present on the
system.

The previous behaviour is maintained on a cgroups v1 host, where a
cgroup namespace is not created by default.

Closes: https://github.com/containers/libpod/issues/4363

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-11-05 17:29:01 +01:00
Peter Hunt dc750df802 namespaces: fix Container() call
If we call Container(), we expect the namespace to be prefixed with "container:".
Add this check, and refactor to use named const strings instead of string literals

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-08-07 13:11:08 -04:00
Giuseppe Scrivano 1d72f651e4
podman: support --userns=ns|container
allow to join the user namespace of another container.

Closes: https://github.com/containers/libpod/issues/3629

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-07-25 23:04:55 +02:00
Giuseppe Scrivano 0b57e77d7c
libpod: support for cgroup namespace
allow a container to run in a new cgroup namespace.

When running in a new cgroup namespace, the current cgroup appears to
be the root, so that there is no way for the container to access
cgroups outside of its own subtree.

By default it uses --cgroup=host to keep the previous behavior.

To create a new namespace, --cgroup=private must be provided.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-07-18 10:32:25 +02:00
Giuseppe Scrivano f09370c68b
userns: add new option --userns=keep-id
it creates a namespace where the current UID:GID on the host is mapped
to the same UID:GID in the container.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-24 17:34:12 +02:00
Matthew Heon e25924f31c Fix lint
Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-03-28 18:01:36 -04:00
Matthew Heon beb263554e Ensure that we make a netns for CNI non-default nets
We accidentally patched this out trying to enable ns:/path/to/ns

This should restore the ability to configure nondefault CNI
networks with Podman, by ensuring that they request creation of a
network namespace.

Completely remove the WithNetNS() call when we do use an explicit
namespace from a path. We use that call to indicate that a netns
is going to be created - there should not be any question about
whether it actually does.

Fixes #2795

Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-03-28 17:39:56 -04:00
Daniel J Walsh 4d13262405
Change all 'can not' to 'cannot' for proper usage
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-12-21 10:27:54 -05:00
Giuseppe Scrivano 4203df69ac
rootless: add new netmode "slirp4netns"
so that inspect reports the correct network configuration.

Closes: https://github.com/containers/libpod/issues/1453

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-11-27 21:10:16 +01:00
Giuseppe Scrivano 8b9b493b53 spec: refactor ns modes to a common interface
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1507
Approved by: rhatdan
2018-09-21 10:13:39 +00:00
Daniel J Walsh 87f90ce14a Fix pod sharing for utsmode
We should be sharing cgroups namespace by default in pods
uts namespace sharing was broken in pods.

Create a new libpod/pkg/namespaces for handling of namespace fields
in containers

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1418
Approved by: mheon
2018-09-07 18:18:54 +00:00