Skip to content

Commit

Permalink
Merge pull request #790 from cgwalters/drop-selinux-warning
Browse files Browse the repository at this point in the history
install: Drop SELinux-disabled warning
  • Loading branch information
cgwalters committed Sep 18, 2024
2 parents 7856ce0 + 413e68e commit c173970
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,7 @@ impl RootSetup {
}
}

#[derive(Debug)]
pub(crate) enum SELinuxFinalState {
/// Host and target both have SELinux, but user forced it off for target
ForceTargetDisabled,
Expand Down Expand Up @@ -952,15 +953,10 @@ pub(crate) fn reexecute_self_for_selinux_if_needed(
let g = crate::lsm::selinux_ensure_install_or_setenforce()?;
SELinuxFinalState::Enabled(g)
} else {
// This used to be a hard error, but is now a mild warning
crate::utils::medium_visibility_warning(
"Host kernel does not have SELinux support, but target enables it by default; this is less well tested. See https://github.com/containers/bootc/issues/419",
);
SELinuxFinalState::HostDisabled
};
Ok(r)
} else {
tracing::debug!("Target does not enable SELinux");
Ok(SELinuxFinalState::Disabled)
}
}
Expand Down Expand Up @@ -1227,6 +1223,7 @@ async fn prepare_install(

// Now, deal with SELinux state.
let selinux_state = reexecute_self_for_selinux_if_needed(&source, config_opts.disable_selinux)?;
tracing::debug!("SELinux state: {selinux_state:?}");

println!("Installing image: {:#}", &target_imgref);
if let Some(digest) = source.digest.as_deref() {
Expand Down
1 change: 1 addition & 0 deletions lib/src/lsm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ pub(crate) fn selinux_ensure_install() -> Result<bool> {
/// gain the `mac_admin` permission (install_t).
#[cfg(feature = "install")]
#[must_use]
#[derive(Debug)]
pub(crate) struct SetEnforceGuard(Option<()>);

#[cfg(feature = "install")]
Expand Down

0 comments on commit c173970

Please sign in to comment.