Skip to content

Commit

Permalink
Merge pull request containers#405 from cgwalters/drop-getname
Browse files Browse the repository at this point in the history
lsm/install: Use csum(), not name() from SELinux policy
  • Loading branch information
cgwalters authored Mar 19, 2024
2 parents 6a96d81 + b6ef8d9 commit 4222b38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,10 @@ impl State {
// We always use the physical container root to bootstrap policy
let rootfs = &Dir::open_ambient_dir("/", cap_std::ambient_authority())?;
let r = ostree::SePolicy::new_at(rootfs.as_raw_fd(), gio::Cancellable::NONE)?;
tracing::debug!("Loaded SELinux policy: {}", r.name());
let csum = r
.csum()
.ok_or_else(|| anyhow::anyhow!("SELinux enabled, but no policy found in root"))?;
tracing::debug!("Loaded SELinux policy: {csum}");
Ok(Some(r))
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/lsm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ pub(crate) fn require_label(
.label(destname.as_str(), mode, ostree::gio::Cancellable::NONE)?
.ok_or_else(|| {
anyhow::anyhow!(
"No label found in policy '{}' for {destname})",
policy.name()
"No label found in policy '{:?}' for {destname})",
policy.csum()
)
})
}
Expand Down

0 comments on commit 4222b38

Please sign in to comment.