diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-05-23 11:57:51 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-05-25 13:47:57 +0200 |
commit | ee11f3bce960cf2eeff0bf9b410c752bbc6af89f (patch) | |
tree | 98368dba61a2526f9af2a1e54d64e3b585af44d5 /pkg/rootless/rootless_unsupported.go | |
parent | ce26aa701f5d49b3aaac08b34b1fbc1492067f46 (diff) | |
download | podman-ee11f3bce960cf2eeff0bf9b410c752bbc6af89f.tar.gz podman-ee11f3bce960cf2eeff0bf9b410c752bbc6af89f.tar.bz2 podman-ee11f3bce960cf2eeff0bf9b410c752bbc6af89f.zip |
rootless: new function to join existing conmon processes
move the logic for joining existing namespaces down to the rootless
package. In main_local we still retrieve the list of conmon pid files
and use it from the rootless package.
In addition, create a temporary user namespace for reading these
files, as the unprivileged user might not have enough privileges for
reading the conmon pid file, for example when running with a different
uidmap and root in the container is different than the rootless user.
Closes: https://github.com/containers/libpod/issues/3187
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg/rootless/rootless_unsupported.go')
-rw-r--r-- | pkg/rootless/rootless_unsupported.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/rootless/rootless_unsupported.go b/pkg/rootless/rootless_unsupported.go index 221baff97..06781e6ce 100644 --- a/pkg/rootless/rootless_unsupported.go +++ b/pkg/rootless/rootless_unsupported.go @@ -36,3 +36,15 @@ func GetRootlessGID() int { func JoinUserAndMountNS(pid uint, pausePid string) (bool, int, error) { return false, -1, errors.New("this function is not supported on this os") } + +// TryJoinFromFilePaths attempts to join the namespaces of the pid files in paths. +// This is useful when there are already running containers and we +// don't have a pause process yet. We can use the paths to the conmon +// processes to attempt joining their namespaces. +// If needNewNamespace is set, the file is read from a temporary user +// namespace, this is useful for containers that are running with a +// different uidmap and the unprivileged user has no way to read the +// file owned by the root in the container. +func TryJoinFromFilePaths(pausePidPath string, needNewNamespace bool, paths []string) (bool, int, error) { + return false, -1, errors.New("this function is not supported on this os") +} |