pub struct Landlock {
pub read_paths: Vec<PathBuf>,
pub write_paths: Vec<PathBuf>,
pub execute_paths: Vec<PathBuf>,
}Expand description
Landlock filesystem and network access control configuration.
Landlock is a Linux security module (LSM) that provides fine-grained filesystem and network access control for unprivileged processes.
§Example
ⓘ
use evalbox_sandbox::Landlock;
let landlock = Landlock::default()
.allow_read("/etc")
.allow_read_write("/tmp/output")
.allow_execute("/usr/bin");Fields§
§read_paths: Vec<PathBuf>Paths with read access.
write_paths: Vec<PathBuf>Paths with read-write access.
execute_paths: Vec<PathBuf>Paths with execute access.
Implementations§
Source§impl Landlock
impl Landlock
Sourcepub fn allow_read(self, path: impl Into<PathBuf>) -> Self
pub fn allow_read(self, path: impl Into<PathBuf>) -> Self
Allow read access to a path.
Sourcepub fn allow_read_write(self, path: impl Into<PathBuf>) -> Self
pub fn allow_read_write(self, path: impl Into<PathBuf>) -> Self
Allow read-write access to a path.
Sourcepub fn allow_execute(self, path: impl Into<PathBuf>) -> Self
pub fn allow_execute(self, path: impl Into<PathBuf>) -> Self
Allow execute access to a path.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Landlock
impl RefUnwindSafe for Landlock
impl Send for Landlock
impl Sync for Landlock
impl Unpin for Landlock
impl UnsafeUnpin for Landlock
impl UnwindSafe for Landlock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more