pub struct Monitor { /* private fields */ }Expand description
Shared host monitor coordinating audit logging, remembered rules, pending approval gates, and optional whole-VM freeze-on-ask.
Implementations§
Source§impl Monitor
impl Monitor
pub fn new(cfg: MonitorConfig, pause: Arc<PauseController>) -> Arc<Self> ⓘ
pub fn attach_vmi(&self, vmi: Arc<VmiTracker>)
pub fn p9_proc(&self) -> Option<ProcInfo>
pub fn net_proc(&self) -> Option<ProcInfo>
pub fn is_active(&self) -> bool
pub fn ask_net(&self) -> bool
pub fn ask_fs_write(&self) -> bool
pub fn ask_sensitive_read(&self) -> bool
pub fn pause_controller(&self) -> &Arc<PauseController> ⓘ
pub fn emit(&self, ev: AuditEvent)
Sourcepub fn pause_vm(&self, reason: impl Into<String>) -> bool
pub fn pause_vm(&self, reason: impl Into<String>) -> bool
Pause the VM explicitly and emit vm.paused.
Sourcepub fn request_approval(
&self,
kind: ApprovalKind,
remember_key: &str,
target: String,
detail: Option<String>,
) -> ApprovalDecision
pub fn request_approval( &self, kind: ApprovalKind, remember_key: &str, target: String, detail: Option<String>, ) -> ApprovalDecision
Request an external decision for an intercepted operation.
Checks cached AllowAlways / DenyAlways rules first; if unknown, holds the calling
host driver thread (and optionally freezes the entire guest VM if freeze_on_ask) until
resolved via approval_callback or Self::resolve_approval.
Sourcepub fn resolve_approval(
&self,
approval_id: u64,
decision: ApprovalDecision,
) -> bool
pub fn resolve_approval( &self, approval_id: u64, decision: ApprovalDecision, ) -> bool
Resolve a pending approval by approval_id (returns false if not found).
Sourcepub fn pending_approvals(&self) -> Vec<ApprovalRequest>
pub fn pending_approvals(&self) -> Vec<ApprovalRequest>
Snapshot currently pending approval requests.
Auto Trait Implementations§
impl !Freeze for Monitor
impl !RefUnwindSafe for Monitor
impl !UnwindSafe for Monitor
impl Forget for Monitor
impl Move for Monitor
impl Send for Monitorwhere
Arc<dyn Fn(AuditEvent) + Send + Sync>: Send,
Arc<Mutex<File>>: Send,
Arc<dyn Fn(&ApprovalRequest) -> ApprovalDecision + Send + Sync>: Send,
Arc<PauseController>: Send,
OnceLock<Arc<VmiTracker>>: Send,
Atomic<u64>: Send,
Atomic<bool>: Send,
Mutex<PolicyCache>: Send,
Mutex<HashMap<u64, PendingApproval>>: Send,
impl Sync for Monitorwhere
Arc<dyn Fn(AuditEvent) + Send + Sync>: Sync,
Arc<Mutex<File>>: Sync,
Arc<dyn Fn(&ApprovalRequest) -> ApprovalDecision + Send + Sync>: Sync,
Arc<PauseController>: Sync,
OnceLock<Arc<VmiTracker>>: Sync,
Atomic<u64>: Sync,
Atomic<bool>: Sync,
Mutex<PolicyCache>: Sync,
Mutex<HashMap<u64, PendingApproval>>: Sync,
impl Unpin for Monitorwhere
Arc<dyn Fn(AuditEvent) + Send + Sync>: Unpin,
Arc<Mutex<File>>: Unpin,
Arc<dyn Fn(&ApprovalRequest) -> ApprovalDecision + Send + Sync>: Unpin,
Arc<PauseController>: Unpin,
Align4<u32>: Unpin,
Arc<VmiTracker>: Unpin,
Align8<u64>: Unpin,
Align1<u8>: Unpin,
*const u8 is !null: Unpin,
*mut Counter<Channel<ApprovalDecision>>: Unpin,
*mut Counter<Channel<ApprovalDecision>>: Unpin,
*mut Counter<Channel<ApprovalDecision>>: Unpin,
impl UnsafeUnpin for Monitorwhere
*const ArcInner<dyn Fn(AuditEvent) + Send + Sync> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(AuditEvent) + Send + Sync>>: UnsafeUnpin,
*const ArcInner<Mutex<File>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<File>>>: UnsafeUnpin,
*const ArcInner<dyn Fn(&ApprovalRequest) -> ApprovalDecision + Send + Sync> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(&ApprovalRequest) -> ApprovalDecision + Send + Sync>>: UnsafeUnpin,
*const ArcInner<PauseController> is !null: UnsafeUnpin,
PhantomData<ArcInner<PauseController>>: UnsafeUnpin,
Align4<u32>: UnsafeUnpin,
*const ArcInner<VmiTracker> is !null: UnsafeUnpin,
PhantomData<ArcInner<VmiTracker>>: UnsafeUnpin,
PhantomData<Arc<VmiTracker>>: UnsafeUnpin,
Align8<u64>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<((ApprovalKind, String), ())>: UnsafeUnpin,
PhantomData<(u64, PendingApproval)>: UnsafeUnpin,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more