Skip to content

Commit a581429

Browse files
authored
Merge pull request #79 from cgwalters/takeover-prep0
takeover installs: prep0
2 parents bc1c6ba + bf0b043 commit a581429

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rust-version = "1.63.0"
1111
[dependencies]
1212
anyhow = "1.0"
1313
camino = { version = "1.0.4", features = ["serde1"] }
14-
ostree-ext = "0.10.5"
14+
ostree-ext = "0.10.6"
1515
clap = { version= "3.2", features = ["derive"] }
1616
clap_mangen = { version = "0.1", optional = true }
1717
cap-std-ext = "1.0.1"

lib/src/install.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,19 +312,19 @@ impl SourceInfo {
312312
}
313313
}
314314

315-
mod config {
315+
pub(crate) mod config {
316316
use super::*;
317317

318318
/// The toplevel config entry for installation configs stored
319319
/// in bootc/install (e.g. /etc/bootc/install/05-custom.toml)
320-
#[derive(Debug, Deserialize, Default)]
320+
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
321321
#[serde(deny_unknown_fields)]
322322
pub(crate) struct InstallConfigurationToplevel {
323323
pub(crate) install: Option<InstallConfiguration>,
324324
}
325325

326326
/// The serialized [install] section
327-
#[derive(Debug, Deserialize, Default)]
327+
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
328328
#[serde(rename = "install", rename_all = "kebab-case", deny_unknown_fields)]
329329
pub(crate) struct InstallConfiguration {
330330
pub(crate) root_fs_type: Option<super::baseline::Filesystem>,

lib/src/lsm.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::fs::File;
2+
use std::io::Write;
13
use std::os::unix::process::CommandExt;
24
use std::path::Path;
35
use std::process::Command;
@@ -79,6 +81,20 @@ pub(crate) fn container_setup_selinux() -> Result<()> {
7981
Ok(())
8082
}
8183

84+
#[context("Setting SELinux permissive mode")]
85+
#[allow(dead_code)]
86+
#[cfg(feature = "install")]
87+
pub(crate) fn selinux_set_permissive() -> Result<()> {
88+
let enforce_path = &Utf8Path::new(SELINUXFS).join("enforce");
89+
if !enforce_path.exists() {
90+
return Ok(());
91+
}
92+
let mut f = File::open(enforce_path)?;
93+
f.write_all(b"0")?;
94+
tracing::debug!("Set SELinux permissive mode");
95+
Ok(())
96+
}
97+
8298
fn selinux_label_for_path(target: &str) -> Result<String> {
8399
// TODO: detect case where SELinux isn't enabled
84100
let o = Command::new("matchpathcon").args(["-n", target]).output()?;

0 commit comments

Comments
 (0)