Skip to content

Commit 503b07a

Browse files
image-proxy: Use privileged user when pull from containers storage
We were defaulting to unprivileged user "nobody" when pulling an image, but pulling from containers-storage was failing as it requires extra privileges. Default to the current user, usually root, when pulling from containers-storage Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
1 parent 024e2ed commit 503b07a

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

crates/lib/src/bootc_composefs/status.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,12 +356,28 @@ pub(crate) fn list_bootloader_entries(storage: &Storage) -> Result<Vec<Bootloade
356356
pub(crate) async fn get_container_manifest_and_config(
357357
imgref: &String,
358358
) -> Result<ImgConfigManifest> {
359+
use containers_image_proxy::{ImageProxy, ImageReference, Transport};
360+
361+
let imgref = ImageReference::from_str(&imgref)
362+
.context("Failed to parse '{imgref}' into ImageReference")?;
363+
359364
let mut config = crate::deploy::new_proxy_config();
360-
ostree_ext::container::merge_default_container_proxy_opts(&mut config)?;
361-
let proxy = containers_image_proxy::ImageProxy::new_with_config(config).await?;
365+
366+
if imgref.transport == Transport::ContainerStorage {
367+
// Fetching from containers-storage, may require privileges to read files
368+
ostree_ext::container::merge_default_container_proxy_opts_with_isolation(
369+
&mut config,
370+
None,
371+
)?;
372+
} else {
373+
// Apply our defaults to the proxy config
374+
ostree_ext::container::merge_default_container_proxy_opts(&mut config)?;
375+
}
376+
377+
let proxy = ImageProxy::new_with_config(config).await?;
362378

363379
let img = proxy
364-
.open_image(&imgref)
380+
.open_image_ref(&imgref)
365381
.await
366382
.with_context(|| format!("Opening image {imgref}"))?;
367383

0 commit comments

Comments
 (0)