Struct secmem_proc::config::Config

source ·
pub struct Config { /* private fields */ }
Expand description

Configuration for the hardening procedure. The configuration allows to enable or disable certain features, such as filesystem access (e.g. for procfs), anti-tracing methods and to use a custom DACL on windows.

Implementations§

source§

impl Config

source

pub const DEFAULT: Self = _

Default configuration.

source

pub const fn new_with_anti_tracing(anti_tracing: bool) -> Self

Create new default configuration, with anti-tracing set to anti_tracing.

source

pub fn set_anti_tracing(&mut self, b: bool)

Set anti-tracing to b (true means enabled).

source

pub fn set_fs(&mut self, b: bool)

Set filesystem access to b (true means enabled).

source

pub fn fs_mut(&mut self) -> &mut Fs

Get mutable reference to filesystem access configuration, allowing to modify it.

source

pub fn set_fs_procfs(&mut self, b: bool)

Set procfs access to b (true means enabled).

source

pub fn set_unstable(&mut self, b: bool)

Set unstable hardening methods to b (true means enabled).

Default is disabled (false). Note that the unstable crate feature is required for this configuration to have any effect. Without that crate feature, the value of this configuration is silently ignored, and unstable hardening is not performed.

source

pub fn unstable_mut(&mut self) -> &mut Unstable

Get mutable reference to unstable hardening configuration, allowing to modify it.

source

pub fn set_unstable_win_ntapi(&mut self, b: bool)

Set use of unstable windows native API to b (true means enabled).

Default is disabled (false). Note that the unstable crate feature is required for this configuration to have any effect. Without that crate feature, the value of this configuration is silently ignored, and unstable hardening is not performed.

source

pub fn set_unstable_win_kernelmem(&mut self, b: bool)

Set use of unstable windows hardening relying on shared kernel memory to b (true means enabled).

Default is disabled (false). Note that the unstable crate feature is required for this configuration to have any effect. Without that crate feature, the value of this configuration is silently ignored, and unstable hardening is not performed.

source

pub fn set_win_dacl(&mut self, dacl: WinDacl)

Configure a custom windows DACL dacl (for the process).

source

pub fn set_win_dacl_default(&mut self)

Configure the windows DAC (for the process)L as the default.

source

pub fn set_win_dacl_empty(&mut self)

Configure the windows DACL (for the process) as an empty DACL. This means giving no access to any user at all. This is extremely strict. Use with caution.

source

pub fn set_win_dacl_custom_user_perm(&mut self, access: WinDaclProcessAccess)

Configure the windows DACL (for the process) as a DACL which gives precisely the accesses specified by access to the current user, and no access to any other user.

source

pub fn set_win_dacl_custom_fn(&mut self, fnptr: fn() -> Result)

Configure to, instead of setting a DACL (for the process) on windows, call the function fnptr. This callback function fnptr can then be used to set a custom DACL yourself, using the API in crate::win_acl.

source

pub fn harden_process(self) -> Result

Use the configuration self to harden the current process.

Trait Implementations§

source§

impl Default for Config

source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.