Skip to main content

Plan

Struct Plan 

Source
pub struct Plan {
Show 13 fields pub cant: String, pub program: PathBuf, pub entrypoint: PathBuf, pub argv0: OsString, pub args: Vec<OsString>, pub env: Vec<(OsString, OsString)>, pub policy: Policy, pub effective: Policy, pub nested: bool, pub missing_libs: Vec<String>, pub netns_proxy: Option<u16>, pub readonly: Vec<PathBuf>, pub readonly_lock: bool,
}
Expand description

Everything needed to start a cant.

Fields§

§cant: String

Cant name, for messages.

§program: PathBuf

Canonical path of the executable.

§entrypoint: PathBuf

The program the cant is about: program itself, except for a can, where program is the can’s bundled loader and this is the program it starts.

§argv0: OsString

argv[0] (the program’s name as found, e.g. vim for /usr/bin/vim.basic).

§args: Vec<OsString>

Arguments after argv[0]: the manifest’s fixed arguments, then the user’s.

§env: Vec<(OsString, OsString)>

The complete environment of the program.

§policy: Policy

The policy to enforce (this cant’s own layer).

§effective: Policy

The policy in effect after attenuation by an enclosing cant (equal to policy when cant is not itself running inside a cant).

§nested: bool

Whether an enclosing cant’s policy was found.

§missing_libs: Vec<String>

Shared libraries that could not be found (the loader will report them if needed).

§netns_proxy: Option<u16>

The loopback port of the proxy, when the cant runs in its own network namespace with an allow list (see Plan::use_proxy).

§readonly: Vec<PathBuf>

Package-manager trees to mount read-only (readonly::shared_trees); empty for a nested cant, which stays in its enclosing cant’s mounts.

§readonly_lock: bool

Whether to mount them: set by the caller once it knows a user + mount namespace works here (or the cant is already in its own user namespace). Otherwise the launch warns that they stay writable.

Implementations§

Source§

impl Plan

Source

pub fn use_proxy(&mut self, port: u16)

Runs the program behind the proxy listening on port inside its network namespace: sets proxy_environment (replacing the user’s values; loopback through the proxy when the user added a loopback host), and Landlock will allow TCP connects to that port only.

Trait Implementations§

Source§

impl Clone for Plan

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Plan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.