Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,27 @@ impl Storage {
let sepolicy = if self.sysroot.booted_deployment().is_none() {
// fallback to policy from container root
// this should only happen during cleanup of a broken install
tracing::trace!("falling back to container root's selinux policy");
let container_root = Dir::open_ambient_dir("/", cap_std::ambient_authority())?;
&ostree::SePolicy::new_at(container_root.as_raw_fd(), gio::Cancellable::NONE)?
} else {
// load the sepolicy from the booted ostree deployment so the imgstorage can be
// properly labeled with /var/lib/container/storage labels
tracing::trace!("loading sepolicy from booted ostree deployment");
let dep = self.sysroot.booted_deployment().unwrap();
let dep_fs = deployment_fd(&self.sysroot, &dep)?;
&ostree::SePolicy::new_at(dep_fs.as_raw_fd(), gio::Cancellable::NONE)?
};

let imgstore = crate::imgstorage::Storage::create(&sysroot_dir, &self.run, Some(sepolicy))?;
let sepolicy = if sepolicy.csum().is_none() {
None
} else {
Some(sepolicy)
};
Comment on lines +107 to +111
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also let sepolicy = sepolicy.filter(|policy| policy.csum.is_some()); too


tracing::trace!("sepolicy in get_ensure_imgstore: {sepolicy:?}");

let imgstore = crate::imgstorage::Storage::create(&sysroot_dir, &self.run, sepolicy)?;
Ok(self.imgstore.get_or_init(|| imgstore))
}

Expand Down