From f66184d5bdc8e8ddf2eea5b7eea3af8595bca64c Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 07 2020 09:18:40 +0000 Subject: import podman-1.6.4-4.module+el8.1.1+5885+44006e55 --- diff --git a/SOURCES/podman-1784950.patch b/SOURCES/podman-1784950.patch new file mode 100644 index 0000000..7cf3d81 --- /dev/null +++ b/SOURCES/podman-1784950.patch @@ -0,0 +1,145 @@ +From fb7d2b6bd6a16ffdbe4a69428e3ba5b487719e78 Mon Sep 17 00:00:00 2001 +From: Daniel J Walsh +Date: Tue, 17 Dec 2019 15:24:29 -0500 +Subject: [PATCH] Add support for FIPS-Mode backends + +If host is running in fips mode, then RHEL8.2 and beyond container images +will come with a directory /usr/share/crypto-policies/back-ends/FIPS. +This directory needs to be bind mounted over /etc/crypto-policies/back-ends in +order to make all tools in the container follow the FIPS Mode rules. + +Signed-off-by: Daniel J Walsh +--- + pkg/secrets/secrets.go | 48 +++++++++++++++++++++++++++++++++--------- + run_linux.go | 2 +- + 2 files changed, 39 insertions(+), 11 deletions(-) + +diff -up ./libpod-5cc92849f7fc9dd734ca2fd8f3ae8830b9a7eb26/vendor/github.com/containers/buildah/pkg/secrets/secrets.go.1784950 ./libpod-5cc92849f7fc9dd734ca2fd8f3ae8830b9a7eb26/vendor/github.com/containers/buildah/pkg/secrets/secrets.go +--- libpod-5cc92849f7fc9dd734ca2fd8f3ae8830b9a7eb26/vendor/github.com/containers/buildah/pkg/secrets/secrets.go.1784950 2020-02-19 16:12:04.940778585 +0100 ++++ libpod-5cc92849f7fc9dd734ca2fd8f3ae8830b9a7eb26/vendor/github.com/containers/buildah/pkg/secrets/secrets.go 2020-02-19 16:12:04.942778613 +0100 +@@ -148,12 +148,21 @@ func getMountsMap(path string) (string, + } + + // SecretMounts copies, adds, and mounts the secrets to the container root filesystem ++// Deprecated, Please use SecretMountWithUIDGID + func SecretMounts(mountLabel, containerWorkingDir, mountFile string, rootless, disableFips bool) []rspec.Mount { + return SecretMountsWithUIDGID(mountLabel, containerWorkingDir, mountFile, containerWorkingDir, 0, 0, rootless, disableFips) + } + +-// SecretMountsWithUIDGID specifies the uid/gid of the owner +-func SecretMountsWithUIDGID(mountLabel, containerWorkingDir, mountFile, mountPrefix string, uid, gid int, rootless, disableFips bool) []rspec.Mount { ++// SecretMountsWithUIDGID copies, adds, and mounts the secrets to the container root filesystem ++// mountLabel: MAC/SELinux label for container content ++// containerWorkingDir: Private data for storing secrets on the host mounted in container. ++// mountFile: Additional mount points required for the container. ++// mountPoint: Container image mountpoint ++// uid: to assign to content created for secrets ++// gid: to assign to content created for secrets ++// rootless: indicates whether container is running in rootless mode ++// disableFips: indicates whether system should ignore fips mode ++func SecretMountsWithUIDGID(mountLabel, containerWorkingDir, mountFile, mountPoint string, uid, gid int, rootless, disableFips bool) []rspec.Mount { + var ( + secretMounts []rspec.Mount + mountFiles []string +@@ -171,7 +180,7 @@ func SecretMountsWithUIDGID(mountLabel, + } + for _, file := range mountFiles { + if _, err := os.Stat(file); err == nil { +- mounts, err := addSecretsFromMountsFile(file, mountLabel, containerWorkingDir, mountPrefix, uid, gid) ++ mounts, err := addSecretsFromMountsFile(file, mountLabel, containerWorkingDir, uid, gid) + if err != nil { + logrus.Warnf("error mounting secrets, skipping entry in %s: %v", file, err) + } +@@ -187,7 +196,7 @@ func SecretMountsWithUIDGID(mountLabel, + // Add FIPS mode secret if /etc/system-fips exists on the host + _, err := os.Stat("/etc/system-fips") + if err == nil { +- if err := addFIPSModeSecret(&secretMounts, containerWorkingDir, mountPrefix, mountLabel, uid, gid); err != nil { ++ if err := addFIPSModeSecret(&secretMounts, containerWorkingDir, mountPoint, mountLabel, uid, gid); err != nil { + logrus.Errorf("error adding FIPS mode secret to container: %v", err) + } + } else if os.IsNotExist(err) { +@@ -206,7 +215,7 @@ func rchown(chowndir string, uid, gid in + + // addSecretsFromMountsFile copies the contents of host directory to container directory + // and returns a list of mounts +-func addSecretsFromMountsFile(filePath, mountLabel, containerWorkingDir, mountPrefix string, uid, gid int) ([]rspec.Mount, error) { ++func addSecretsFromMountsFile(filePath, mountLabel, containerWorkingDir string, uid, gid int) ([]rspec.Mount, error) { + var mounts []rspec.Mount + defaultMountsPaths := getMounts(filePath) + for _, path := range defaultMountsPaths { +@@ -285,7 +294,7 @@ func addSecretsFromMountsFile(filePath, + } + + m := rspec.Mount{ +- Source: filepath.Join(mountPrefix, ctrDirOrFile), ++ Source: ctrDirOrFileOnHost, + Destination: ctrDirOrFile, + Type: "bind", + Options: []string{"bind", "rprivate"}, +@@ -300,15 +309,15 @@ func addSecretsFromMountsFile(filePath, + // root filesystem if /etc/system-fips exists on hosts. + // This enables the container to be FIPS compliant and run openssl in + // FIPS mode as the host is also in FIPS mode. +-func addFIPSModeSecret(mounts *[]rspec.Mount, containerWorkingDir, mountPrefix, mountLabel string, uid, gid int) error { ++func addFIPSModeSecret(mounts *[]rspec.Mount, containerWorkingDir, mountPoint, mountLabel string, uid, gid int) error { + secretsDir := "/run/secrets" + ctrDirOnHost := filepath.Join(containerWorkingDir, secretsDir) + if _, err := os.Stat(ctrDirOnHost); os.IsNotExist(err) { + if err = idtools.MkdirAllAs(ctrDirOnHost, 0755, uid, gid); err != nil { +- return errors.Wrapf(err, "making container directory on host failed") ++ return errors.Wrapf(err, "making container directory %q on host failed", ctrDirOnHost) + } + if err = label.Relabel(ctrDirOnHost, mountLabel, false); err != nil { +- return errors.Wrap(err, "error applying correct labels") ++ return errors.Wrapf(err, "error applying correct labels on %q", ctrDirOnHost) + } + } + fipsFile := filepath.Join(ctrDirOnHost, "system-fips") +@@ -323,7 +332,7 @@ func addFIPSModeSecret(mounts *[]rspec.M + + if !mountExists(*mounts, secretsDir) { + m := rspec.Mount{ +- Source: filepath.Join(mountPrefix, secretsDir), ++ Source: ctrDirOnHost, + Destination: secretsDir, + Type: "bind", + Options: []string{"bind", "rprivate"}, +@@ -331,6 +340,25 @@ func addFIPSModeSecret(mounts *[]rspec.M + *mounts = append(*mounts, m) + } + ++ srcBackendDir := "/usr/share/crypto-policies/back-ends/FIPS" ++ destDir := "/etc/crypto-policies/back-ends" ++ srcOnHost := filepath.Join(mountPoint, srcBackendDir) ++ if _, err := os.Stat(srcOnHost); err != nil { ++ if os.IsNotExist(err) { ++ return nil ++ } ++ return errors.Wrapf(err, "failed to stat FIPS Backend directory %q", ctrDirOnHost) ++ } ++ ++ if !mountExists(*mounts, destDir) { ++ m := rspec.Mount{ ++ Source: srcOnHost, ++ Destination: destDir, ++ Type: "bind", ++ Options: []string{"bind", "rprivate"}, ++ } ++ *mounts = append(*mounts, m) ++ } + return nil + } + +diff -up ./libpod-5cc92849f7fc9dd734ca2fd8f3ae8830b9a7eb26/vendor/github.com/containers/buildah/run_linux.go.1784950 ./libpod-5cc92849f7fc9dd734ca2fd8f3ae8830b9a7eb26/vendor/github.com/containers/buildah/run_linux.go +--- libpod-5cc92849f7fc9dd734ca2fd8f3ae8830b9a7eb26/vendor/github.com/containers/buildah/run_linux.go.1784950 2020-02-19 16:12:04.914778223 +0100 ++++ libpod-5cc92849f7fc9dd734ca2fd8f3ae8830b9a7eb26/vendor/github.com/containers/buildah/run_linux.go 2020-02-19 16:12:04.916778251 +0100 +@@ -460,7 +460,7 @@ func (b *Builder) setupMounts(mountPoint + } + + // Get the list of secrets mounts. +- secretMounts := secrets.SecretMountsWithUIDGID(b.MountLabel, cdir, b.DefaultMountsFilePath, cdir, int(rootUID), int(rootGID), unshare.IsRootless(), false) ++ secretMounts := secrets.SecretMountsWithUIDGID(b.MountLabel, cdir, b.DefaultMountsFilePath, mountPoint, int(rootUID), int(rootGID), unshare.IsRootless(), false) + + // Add temporary copies of the contents of volume locations at the + // volume locations, unless we already have something there. diff --git a/SOURCES/podman-1805212.patch b/SOURCES/podman-1805212.patch new file mode 100644 index 0000000..f92dac5 --- /dev/null +++ b/SOURCES/podman-1805212.patch @@ -0,0 +1,72 @@ +diff -up libpod-5cc92849f7fc9dd734ca2fd8f3ae8830b9a7eb26/cni/87-podman-bridge.conflist.1805212 libpod-5cc92849f7fc9dd734ca2fd8f3ae8830b9a7eb26/cni/87-podman-bridge.conflist +--- libpod-5cc92849f7fc9dd734ca2fd8f3ae8830b9a7eb26/cni/87-podman-bridge.conflist.1805212 2020-02-25 10:38:58.802723918 +0100 ++++ libpod-5cc92849f7fc9dd734ca2fd8f3ae8830b9a7eb26/cni/87-podman-bridge.conflist 2020-02-25 10:39:30.358147422 +0100 +@@ -1,38 +1,33 @@ + { +- "cniVersion": "0.4.0", +- "name": "podman", +- "plugins": [ +- { +- "type": "bridge", +- "bridge": "cni-podman0", +- "isGateway": true, +- "ipMasq": true, +- "ipam": { +- "type": "host-local", +- "routes": [ +- { +- "dst": "0.0.0.0/0" +- } +- ], +- "ranges": [ +- [ +- { +- "subnet": "10.88.0.0/16", +- "gateway": "10.88.0.1" +- } +- ] +- ] ++ "cniVersion": "0.4.0", ++ "name": "podman", ++ "plugins": [ ++ { ++ "type": "bridge", ++ "bridge": "cni-podman0", ++ "isGateway": true, ++ "ipMasq": true, ++ "ipam": { ++ "type": "host-local", ++ "routes": [{ "dst": "0.0.0.0/0" }], ++ "ranges": [ ++ [ ++ { ++ "subnet": "10.88.0.0/16", ++ "gateway": "10.88.0.1" + } +- }, +- { +- "type": "portmap", +- "capabilities": { +- "portMappings": true +- } +- }, +- { +- "type": "firewall", +- "backend": "iptables" +- } +- ] ++ ] ++ ] ++ } ++ }, ++ { ++ "type": "portmap", ++ "capabilities": { ++ "portMappings": true ++ } ++ }, ++ { ++ "type": "tuning" ++ } ++ ] + } diff --git a/SPECS/podman.spec b/SPECS/podman.spec index 611c2e0..556413f 100644 --- a/SPECS/podman.spec +++ b/SPECS/podman.spec @@ -29,12 +29,18 @@ go build -buildmode pie -compiler gc -tags="rpm_crashtraceback libtrust_openssl Name: podman Version: 1.6.4 -Release: 2%{?dist} +Release: 4%{?dist} Summary: Manage Pods, Containers and Container Images License: ASL 2.0 URL: https://%{name}.io/ Source0: %{git0}/archive/%{commit0}/%{repo}-%{shortcommit0}.tar.gz Patch0: https://patch-diff.githubusercontent.com/raw/containers/storage/pull/497.patch +# related bug: https://bugzilla.redhat.com/show_bug.cgi?id=1784950 +# backported: https://patch-diff.githubusercontent.com/raw/containers/buildah/pull/2031.patch +Patch1: podman-1784950.patch +# related bug: https://bugzilla.redhat.com/show_bug.cgi?id=1805212 +# backported: https://raw.githubusercontent.com/containers/libpod/master/cni/87-podman-bridge.conflist +Patch2: podman-1805212.patch BuildRequires: golang >= 1.12.12-4 BuildRequires: glib2-devel BuildRequires: glibc-devel @@ -339,6 +345,14 @@ exit 0 %{_datadir}/%{name}/test %changelog +* Thu Feb 27 2020 Jindrich Novy - 1.6.4-4 +- fix "podman (1.6.4) rhel 8.1 no route to host from inside container" +- Resolves: #1806900 + +* Wed Feb 19 2020 Jindrich Novy - 1.6.4-3 +- fix "Podman support for FIPS Mode requires a bind mount inside the container" +- Resolves: #1804194 + * Fri Jan 03 2020 Jindrich Novy - 1.6.4-2 - apply fix for bug 1757845 - Related: RHELPLAN-25138