diff --git a/diskimage_builder/elements/manifests/cleanup.d/01-copy-manifests-dir b/diskimage_builder/elements/manifests/cleanup.d/01-copy-manifests-dir index 3ac192568..4e65fa5ba 100755 --- a/diskimage_builder/elements/manifests/cleanup.d/01-copy-manifests-dir +++ b/diskimage_builder/elements/manifests/cleanup.d/01-copy-manifests-dir @@ -34,10 +34,11 @@ echo "$DIB_ARGS" | sudo dd of=${MANIFEST_IMAGE_PATH}/dib_arguments # dib-lint: # Save the manifests locally to the save dir mkdir -p ${DIB_MANIFEST_SAVE_DIR} -cp --no-preserve=ownership -rv ${MANIFEST_IMAGE_PATH} ${DIB_MANIFEST_SAVE_DIR} +sudo cp --no-preserve=ownership -rv ${MANIFEST_IMAGE_PATH} ${DIB_MANIFEST_SAVE_DIR} # dib-lint: safe_sudo +sudo chown -R $(whoami): ${DIB_MANIFEST_SAVE_DIR} # dib-lint: safe_sudo # Lock down permissions on the manifest files inside the image to # root. We don't want regular users being able to see what might # contain a password, etc. -find ${MANIFEST_IMAGE_PATH} -type f | xargs sudo chown root:root # dib-lint: safe_sudo -find ${MANIFEST_IMAGE_PATH} -type f | xargs sudo chmod 600 # dib-lint: safe_sudo +sudo find ${MANIFEST_IMAGE_PATH} -type f | xargs sudo chown root:root # dib-lint: safe_sudo +sudo find ${MANIFEST_IMAGE_PATH} -type f | xargs sudo chmod 600 # dib-lint: safe_sudo diff --git a/releasenotes/notes/fix-2069956-396eb9f5fb928e2d.yaml b/releasenotes/notes/fix-2069956-396eb9f5fb928e2d.yaml new file mode 100644 index 000000000..f50b984c5 --- /dev/null +++ b/releasenotes/notes/fix-2069956-396eb9f5fb928e2d.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes an issue where an image using the ``manifest`` element could fail to + build when using a non-root user. See `bug 2069956 + `__.