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

Switch seccomp filter to whitelist #37

Merged
merged 4 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions src/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use landlock::{
};

use crate::error::{Error, Result};
use crate::linux::seccomp::Filter;
use crate::linux::seccomp::NetworkFilter;
use crate::{Exception, Sandbox};

mod seccomp;
Expand Down Expand Up @@ -70,11 +70,9 @@ impl Sandbox for LinuxSandbox {
}

// Create and apply seccomp filter.
let mut seccomp = Filter::new();
if !self.allow_networking {
seccomp.deny_networking()?;
NetworkFilter::apply()?;
}
seccomp.apply()?;

// Apply landlock rules.
let status = self.landlock.restrict_self()?;
Expand Down
Loading
Loading