Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install: Explicitly label .ostree.cfs #577

Merged
merged 1 commit into from
Jun 4, 2024
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
9 changes: 9 additions & 0 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const BOOT: &str = "boot";
const RUN_BOOTC: &str = "/run/bootc";
/// This is an ext4 special directory we need to ignore.
const LOST_AND_FOUND: &str = "lost+found";
/// The filename of the composefs EROFS superblock; TODO move this into ostree
const OSTREE_COMPOSEFS_SUPER: &str = ".ostree.cfs";
/// The mount path for selinux
#[cfg(feature = "install")]
const SELINUXFS: &str = "/sys/fs/selinux";
Expand Down Expand Up @@ -684,6 +686,13 @@ async fn initialize_ostree_root_from_self(
)
.with_context(|| format!("Recursive SELinux relabeling of {d}"))?;
}

if let Some(cfs_super) = root.open_optional(OSTREE_COMPOSEFS_SUPER)? {
let label = crate::lsm::require_label(policy, "/usr".into(), 0o644)?;
crate::lsm::set_security_selinux(cfs_super.as_fd(), label.as_bytes())?;
} else {
tracing::warn!("Missing {OSTREE_COMPOSEFS_SUPER}; composefs is not enabled?");
}
}

// Write the entry for /boot to /etc/fstab. TODO: Encourage OSes to use the karg?
Expand Down
Loading