Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-115166

buildah: create parent directories of mount targets with mode 0755 - [RHEL-9.7] 0day

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: Generate New Ti...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Major Major
    • rhel-9.7.z
    • None
    • buildah
    • buildah-1.41.4-2.el9_7
    • No
    • Important
    • Customer Reported
    • 1
    • rhel-container-tools
    • 1
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • RUN 277
    • Bug Fix
    • Hide
      .Parent directories can be created now for the mount targets with mode 0755

      In this update, build failures were occurring due to modifications in the handling of `--mount` parameter permissions in `quay.io/buildah/stable:v1 v1.41.3`. Previously, specifying UID as an argument resulted in incorrect permissions for the secret. Consequently, users were unable to access build secrets due to incorrect permissions after the `buildah` update.

      With this release, Buildah has updated secret permissions for Buildah v1.41.3, using `secret-permissions` instead of `mount`. As a result, Buildah now sets the expected permissions for secrets correctly when using the UID argument in the `--mount` parameter, resolving mount failures.
      Show
      .Parent directories can be created now for the mount targets with mode 0755 In this update, build failures were occurring due to modifications in the handling of `--mount` parameter permissions in `quay.io/buildah/stable:v1 v1.41.3`. Previously, specifying UID as an argument resulted in incorrect permissions for the secret. Consequently, users were unable to access build secrets due to incorrect permissions after the `buildah` update. With this release, Buildah has updated secret permissions for Buildah v1.41.3, using `secret-permissions` instead of `mount`. As a result, Buildah now sets the expected permissions for secrets correctly when using the UID argument in the `--mount` parameter, resolving mount failures.
    • Done
    • Done
    • Done
    • Not Required
    • None

      Several of our builds that attempts to mount a build-secret have started failing after quay.io/buildah/stable:v1 was updated from v1.40.1 to v1.41.3.

      The issue seems to be that specifying the uid as an argument to the --mount parameter no longer results in the expected permissions for the secret.

      Steps to reproduce the issue

      With this Containerfile:
      FROM docker.io/library/alpine:latestRUN --mount=type=secret,id=test_secret \
      /bin/sh -c '\ ls -lh /run/secrets/test_secret \ && [ -e /run/secrets/test_secret ] \ && cat /run/secrets/test_secret \ && [ "$(cat /run/secrets/test_secret)" = "some-expected-secret-value" ]' \
      && echo "Test OK"USER nobodyRUN --mount=type=secret,uid=65534,id=test_secret_user \
      /bin/sh -c '\ ls -lh /run/secrets/test_secret_user \ && [ -e /run/secrets/test_secret_user ] \ && cat /run/secrets/test_secret_user \ && [ "$(cat /run/secrets/test_secret_user)" = "some-other-secret-value" ]' \
      && echo "Test OK"
       
      ... do this:
      export SECRET1=some-expected-secret-valueexport SECRET2=some-other-secret-value
      buildah build --secret id=test_secret,src=env,env=SECRET1 --secret id=test_secret_user,src=env,env=SECRET2 .
       

      Describe the results you received

      STEP 3/4: USER nobody
      --> Pushing cache []
      --> 58e995db39e6
      STEP 4/4: RUN --mount=type=secret,uid=65534,id=test_secret_user /bin/sh -c ' ls -lh /run/secrets/test_secret_user && [ -e /run/secrets/test_secret_user ] && cat /run/secrets/test_secret_user && [ "$(cat /run/secrets/test_secret_user)" = "some-other-secret-value" ]' && echo "Test OK"
      ls: /run/secrets/test_secret_user: Permission denied
      subprocess exited with status 1
      subprocess exited with status 1
      Error: building at STEP "RUN --mount=type=secret,uid=65534,id=test_secret_user /bin/sh -c ' ls -lh /run/secrets/test_secret_user && [ -e /run/secrets/test_secret_user ] && cat /run/secrets/test_secret_user && [ "$(cat /run/secrets/test_secret_user)" = "some-other-secret-value" ]' && echo "Test OK"": exit status 1

      Describe the results you expected

      --> Pushing cache []
      --> c794fe725496
      STEP 4/4: RUN --mount=type=secret,uid=65534,id=test_secret_user /bin/sh -c ' ls -lh /run/secrets/test_secret_user && [ -e /run/secrets/test_secret_user ] && cat /run/secrets/test_secret_user && [ "$(cat /run/secrets/test_secret_user)" = "some-other-secret-value" ]' && echo "Test OK"
      r------- 1 nobody root 23 Sep 1 12:40 /run/secrets/test_secret_user
      some-other-secret-valueTest OK

      buildah version output

      We're following the latest quay.io/buildah/stable:v1 image, which we update nightly. This image was recently updated from v1.40.1 to v1.41.3.
       

      buildah info output

      We're running the official image on kubernetes, with slight customizations:FROM quay.io/buildah/stable:v1RUN sed -i \'s/^.+secrets\/(etc-pki-entitlement|rhsm).+$/#&/' \/etc/containers/mounts.conf \&& sed -i -e 's/^mount_program/#mount_program/g' -e 's/^mountopt/#mountopt/g' \/etc/containers/storage.conf \&& dnf remove -y fuse-overlayfsCOPY registries.conf.d/* /etc/containers/registries.conf.d/
       

              rhn-support-jnovy Jindrich Novy
              ddarrah@redhat.com David Darrah
              Jindrich Novy, Nalin Dahyabhai, Tom Sweeney
              Nalin Dahyabhai Nalin Dahyabhai
              Yiqiao Pu Yiqiao Pu
              Mugdha Soni Mugdha Soni
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: