diff --git a/README.md b/README.md index a66e38e..ecc925f 100644 --- a/README.md +++ b/README.md @@ -146,14 +146,14 @@ Our project has been manually tested on (tests in may 2023): In june 2024, we performed automated `capable` tests with Vagrant on the following distributions: -* ❌ Centos 7 → Kernel too old (3.1) -* ✅ Centos 8 * ❌ Debian 10 → Dev dependencies unavailable, it should work once compiled * ✅ Debian 11 * ✅ Fedora 37 * ✅ RedHat 9 * ✅ Ubuntu 22.04 * ✅ ArchLinux +* ✅ Almalinux 8 +* ✅ RockyLinux 8 This doesn't mean that earlier versions of these distributions are incompatible; it simply indicates they haven't been tested yet. However, if you encounter issues during the compilation process, they are likely due to dependency problems. In theory, the RootAsRole project should work on any Linux distribution with a kernel version of 4.1 or higher. However, since BTF (BPF Type Format) is becoming a mandatory requirement, [the kernel must be compiled with many features enabled](https://github.com/iovisor/bcc/blob/master/INSTALL.md#kernel-configuration). diff --git a/capable b/capable index b594535..d866161 160000 --- a/capable +++ b/capable @@ -1 +1 @@ -Subproject commit b594535b19d4641cbb7a1ec74d7c60c67eb6969b +Subproject commit d866161abbd71c83ed893576dd6fb6b3ae72a722 diff --git a/xtask/src/ebpf/mod.rs b/xtask/src/ebpf/mod.rs index a4c84e3..4f91436 100644 --- a/xtask/src/ebpf/mod.rs +++ b/xtask/src/ebpf/mod.rs @@ -8,6 +8,12 @@ pub mod build; pub mod run; +fn clone() -> Result<(), anyhow::Error> { + let status = std::process::Command::new("git") + .args(&["clone", "", "capable"]).status().context("context")?; + Ok(()) +} + pub fn build_all(opts: &BuildOptions) -> Result<(), anyhow::Error> { build_ebpf(&opts.ebpf.unwrap_or(EbpfArchitecture::default()), &opts.profile).context("Error while building eBPF program")?; diff --git a/xtask/src/install/configure.rs b/xtask/src/install/configure.rs index e032a57..9b88481 100644 --- a/xtask/src/install/configure.rs +++ b/xtask/src/install/configure.rs @@ -233,7 +233,7 @@ fn retrieve_real_user() -> Result, anyhow::Error> { pub fn default_pam_path(os: &OsTarget) -> &'static str { match os { OsTarget::Debian | OsTarget::Ubuntu => "resources/debian/deb_sr_pam.conf", - OsTarget::RedHat | OsTarget::CentOS | OsTarget::Fedora => "resources/redhat/rh_sr_pam.conf", + OsTarget::RedHat | OsTarget::AlmaLinux | OsTarget::RockyLinux | OsTarget::Fedora => "resources/rh/rh_sr_pam.conf", OsTarget::ArchLinux => "resources/arch/arch_sr_pam.conf", } } diff --git a/xtask/src/install/dependencies.rs b/xtask/src/install/dependencies.rs index d419544..33a9fab 100644 --- a/xtask/src/install/dependencies.rs +++ b/xtask/src/install/dependencies.rs @@ -13,7 +13,7 @@ fn update_package_manager() -> Result<(), anyhow::Error> { .arg("update") .status()?; }, - OsTarget::RedHat | OsTarget::Fedora | OsTarget::CentOS => { + OsTarget::RedHat | OsTarget::Fedora | OsTarget::AlmaLinux | OsTarget::RockyLinux => { let _ = std::process::Command::new("yum") .arg("update") .arg("-y") @@ -25,19 +25,28 @@ fn update_package_manager() -> Result<(), anyhow::Error> { Ok(()) } -fn required_dependencies(os: &OsTarget) -> Vec<&str> { +fn required_dependencies(os: &OsTarget) -> &'static [&'static str] { match os { - OsTarget::Debian | OsTarget::Ubuntu => vec!["libpam0g", "libpcre2-8-0"], - OsTarget::RedHat => vec!["pcre2"], - OsTarget::ArchLinux | OsTarget::Fedora | OsTarget::CentOS => vec!["pam", "pcre2"], + OsTarget::Debian | OsTarget::Ubuntu => &["libpam0g", "libpcre2-8-0"], + OsTarget::RedHat | OsTarget::AlmaLinux | OsTarget::RockyLinux => &["pcre2"], + OsTarget::ArchLinux | OsTarget::Fedora => &["pam", "pcre2"], } } -fn development_dependencies(os: &OsTarget) -> Vec<&str> { +fn development_dependencies(os: &OsTarget) -> &'static [&'static str] { match os { - OsTarget::Debian | OsTarget::Ubuntu => vec!["libpam0g-dev", "libpcre2-dev"], - OsTarget::RedHat => vec!["pcre2-devel"], - OsTarget::ArchLinux | OsTarget::Fedora | OsTarget::CentOS => vec!["pam-devel", "pcre2-devel"], + OsTarget::Debian | OsTarget::Ubuntu => &["libpam0g-dev", "libpcre2-dev"], + OsTarget::RedHat | OsTarget::AlmaLinux | OsTarget::RockyLinux => &["pcre2-devel", "clang-devel", "openssl-devel", "pam-devel"], + OsTarget::Fedora => &["pam-devel", "pcre2-devel", "clang", "openssl-devel"], + OsTarget::ArchLinux => &["pam-devel", "pcre2-devel", "clang", "libssl", "pkg-config"], + } +} + +fn get_dependencies(os: &OsTarget, dev: &bool) -> &'static [&'static str] { + if *dev { + development_dependencies(os) + } else { + required_dependencies(os) } } @@ -61,39 +70,28 @@ pub fn install(opts: InstallDependenciesOptions) -> Result<(), anyhow::Error> { let _ = std::process::Command::new("apt-get") .arg("install") .arg("-y") - .arg("libpam0g") - .arg("libpcre2-8-0") - .status()?; - }, - OsTarget::RedHat => { - let _ = std::process::Command::new("yum") - .arg("install") - .arg("-y") - .arg("pcre2") + .args(get_dependencies(&os, &opts.dev)) .status()?; }, - OsTarget::CentOS => { + OsTarget::RedHat | OsTarget::AlmaLinux | OsTarget::RockyLinux => { let _ = std::process::Command::new("yum") .arg("install") .arg("-y") - .arg("pam") - .arg("pcre2") + .args(get_dependencies(&os, &opts.dev)) .status()?; }, OsTarget::Fedora => { let _ = std::process::Command::new("dnf") .arg("install") .arg("-y") - .arg("pam") - .arg("pcre2") + .args(get_dependencies(&os, &opts.dev)) .status()?; } OsTarget::ArchLinux => { let _ = std::process::Command::new("pacman") .arg("-Sy") .arg("--noconfirm") - .arg("pam") - .arg("pcre2") + .args(get_dependencies(&os, &opts.dev)) .status()?; }, } diff --git a/xtask/src/install/mod.rs b/xtask/src/install/mod.rs index 5a79d40..2f62a80 100644 --- a/xtask/src/install/mod.rs +++ b/xtask/src/install/mod.rs @@ -120,8 +120,10 @@ pub enum OsTarget { RedHat, #[clap(alias = "fed")] Fedora, - #[clap(alias = "cen")] - CentOS, + #[clap(alias = "alma")] + AlmaLinux, + #[clap(alias = "rocky")] + RockyLinux, #[clap(alias = "arch")] ArchLinux, } @@ -139,8 +141,10 @@ impl OsTarget { return Ok(OsTarget::RedHat); } else if os.contains("fedora") { return Ok(OsTarget::Fedora); - } else if os.contains("centos") { - return Ok(OsTarget::CentOS); + } else if os.contains("almalinux") { + return Ok(OsTarget::AlmaLinux); + } else if os.contains("rocky") { + return Ok(OsTarget::RockyLinux); } else if os.contains("arch") { return Ok(OsTarget::ArchLinux); }