forked from pool/docker
8d13290266
- Update to Docker 20.10.21-ce. See upstream changelog online at <https://docs.docker.com/engine/release-notes/#201021>. bsc#1206065 - Rebase patches: * 0001-SECRETS-daemon-allow-directory-creation-in-run-secre.patch * 0002-SECRETS-SUSE-implement-SUSE-container-secrets.patch * 0003-PRIVATE-REGISTRY-add-private-registry-mirror-support.patch * 0004-bsc1073877-apparmor-clobber-docker-default-profile-o.patch * 0005-bsc1183855-btrfs-Do-not-disable-quota-on-cleanup.patch * 0006-bsc1193930-vendor-update-golang.org-x-crypto.patch * 0007-bsc1200022-fifo.Close-prevent-possible-panic-if-fifo.patch - The PRIVATE-REGISTRY patch will now output a warning if it is being used (in preparation for removing the feature). This feature was never meant to be used by users directly (and is only available in the -kubic/CaaSP version of the package anyway) and thus should not affect any users. OBS-URL: https://build.opensuse.org/request/show/1040668 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/docker?expand=0&rev=378
75 lines
2.7 KiB
Diff
75 lines
2.7 KiB
Diff
From 823bedd07fac6778a3d94b6f949ac16e6bd12638 Mon Sep 17 00:00:00 2001
|
|
From: Aleksa Sarai <asarai@suse.de>
|
|
Date: Wed, 8 Mar 2017 12:41:54 +1100
|
|
Subject: [PATCH 1/7] SECRETS: daemon: allow directory creation in /run/secrets
|
|
|
|
Since FileMode can have the directory bit set, allow a SecretStore
|
|
implementation to return secrets that are actually directories. This is
|
|
useful for creating directories and subdirectories of secrets.
|
|
|
|
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
|
|
Signed-off-by: Aleksa Sarai <asarai@suse.de>
|
|
---
|
|
daemon/container_operations_unix.go | 24 +++++++++++++++++++++---
|
|
1 file changed, 21 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/daemon/container_operations_unix.go b/daemon/container_operations_unix.go
|
|
index 75b4b09b8dc4..583db20aa459 100644
|
|
--- a/daemon/container_operations_unix.go
|
|
+++ b/daemon/container_operations_unix.go
|
|
@@ -4,6 +4,7 @@
|
|
package daemon // import "github.com/docker/docker/daemon"
|
|
|
|
import (
|
|
+ "bytes"
|
|
"fmt"
|
|
"io/ioutil"
|
|
"os"
|
|
@@ -13,6 +14,7 @@ import (
|
|
"github.com/docker/docker/container"
|
|
"github.com/docker/docker/daemon/links"
|
|
"github.com/docker/docker/errdefs"
|
|
+ "github.com/docker/docker/pkg/archive"
|
|
"github.com/docker/docker/pkg/idtools"
|
|
"github.com/docker/docker/pkg/stringid"
|
|
"github.com/docker/docker/pkg/system"
|
|
@@ -206,9 +208,6 @@ func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) {
|
|
if err != nil {
|
|
return errors.Wrap(err, "unable to get secret from secret store")
|
|
}
|
|
- if err := ioutil.WriteFile(fPath, secret.Spec.Data, s.File.Mode); err != nil {
|
|
- return errors.Wrap(err, "error injecting secret")
|
|
- }
|
|
|
|
uid, err := strconv.Atoi(s.File.UID)
|
|
if err != nil {
|
|
@@ -219,6 +218,25 @@ func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) {
|
|
return err
|
|
}
|
|
|
|
+ if s.File.Mode.IsDir() {
|
|
+ if err := os.Mkdir(fPath, s.File.Mode); err != nil {
|
|
+ return errors.Wrap(err, "error creating secretdir")
|
|
+ }
|
|
+ if secret.Spec.Data != nil {
|
|
+ // If the "file" is a directory, then s.File.Data is actually a tar
|
|
+ // archive of the directory. So we just do a tar extraction here.
|
|
+ if err := archive.UntarUncompressed(bytes.NewBuffer(secret.Spec.Data), fPath, &archive.TarOptions{
|
|
+ UIDMaps: daemon.idMapping.UIDs(),
|
|
+ GIDMaps: daemon.idMapping.GIDs(),
|
|
+ }); err != nil {
|
|
+ return errors.Wrap(err, "error injecting secretdir")
|
|
+ }
|
|
+ }
|
|
+ } else {
|
|
+ if err := ioutil.WriteFile(fPath, secret.Spec.Data, s.File.Mode); err != nil {
|
|
+ return errors.Wrap(err, "error injecting secret")
|
|
+ }
|
|
+ }
|
|
if err := os.Chown(fPath, rootIDs.UID+uid, rootIDs.GID+gid); err != nil {
|
|
return errors.Wrap(err, "error setting ownership for secret")
|
|
}
|
|
--
|
|
2.38.1
|
|
|