Crate endpoint_sec_sys
source ·Expand description
Raw manual bindings for the Endpoint Security Framework for Apple targets (macOS) (referred to as ES in the following documentation).
Everything that was not present in the original release is feature gated to the macOS version
that saw it released, so you can ensure you don’t use any newer functions and types. Additional
checks are done at runtime to return None or an Err when using something not yet available,
in the endpoint-sec crate. This crate does not perform the checks since it contains the
raw types and extern "C" declaration. This is done because 1) the performance hit of a version
check is negligible in my experience and 2) even if compiled for a newer version where
information A is available, your program will still be able to handle older versions since A
will be returned in an Option.
§Debug implementations (and PartialEq, Eq, Hash)
Several types do not have a Debug implementation because it depends on the es_message_t
version field. In this case, use the endpoint-sec crate, which bundle the version with
the data (for example with es_event_exec_t), allowing to implement Debug, PartialEq,
Eq and Hash correctly.
For lots of other types, it’s because the implementation would be useless because they contain
pointers like es_string_token_t: implementing Debug for it in a useful way needs unsafe
code that we don’t want to hide in a Debug impl. See the endpoint-sec crate, with its
higher level types for useful Debug impls (and PartialEq, Eq, Hash).
Re-exports§
pub use block2;
Structs§
- A wrapper type around
*mut Tto communicate a pointer should not be null without introducing undefined behaviour. - _acl
macos_10_15_1Never use directly, useacl_tinstead - The audit token is an opaque token which identifies Mach tasks and senders of Mach messages as subjects to the BSM audit system. Only the appropriate BSM library routines should be used to interpret the contents of the audit token as the representation of the subject identity within the token may change over time.
- Type of action to take after receiving a message
- Type of a network address.
- Valid authorization values to be used when responding to a
es_message_tauth event - This enum describes the types of authentications that
ES_EVENT_TYPE_NOTIFY_AUTHENTICATIONcan describe. - es_
authorization_ result_ t macos_14_0_0Describes, for a single right, the class of that right and if it was granted - The class of rules used to evaluate the petition for a specific authorization right
- Type of launch item.
- es_
btm_ launch_ item_ t macos_13_0_0Structure describing a BTM launch item - Error conditions for clearing the authorisation caches
- Opaque type that stores the endpoint security client state.
- es_
event_ access_ t macos_10_15_1Test file access - es_
event_ authentication_ auto_ unlock_ t macos_13_0_0Auto Unlock authentication data for typeES_AUTHENTICATION_TYPE_TOKEN. - es_
event_ authentication_ od_ t macos_13_0_0OpenDirectory authentication data for typeES_AUTHENTICATION_TYPE_OD. - es_
event_ authentication_ t macos_13_0_0Notification that an authentication was performed. - es_
event_ authentication_ token_ t macos_13_0_0Token authentication data for typeES_AUTHENTICATION_TYPE_TOKEN. - es_
event_ authentication_ touchid_ t macos_13_0_0TouchID authentication data for typeES_AUTHENTICATION_TYPE_TOUCHID. - es_
event_ authorization_ judgement_ t macos_14_0_0Notification that a process had it’s right petition judged - es_
event_ authorization_ petition_ t macos_14_0_0Notification that a process petitioned for certain authorization rights - es_
event_ btm_ launch_ item_ add_ t macos_13_0_0Notification for launch item being made known to background task management. This includes launch agents and daemons as well as login items added by the user, via MDM or by an app. - es_
event_ btm_ launch_ item_ remove_ t macos_13_0_0Notification for launch item being removed from background task management. This includes launch agents and daemons as well as login items added by the user, via MDM or by an app. - es_
event_ chdir_ t macos_10_15_1Changes directories - es_
event_ chroot_ t macos_10_15_1Changes the root directory for a process - es_
event_ clone_ t macos_10_15_1Clone a file - Close a file descriptor
- es_
event_ copyfile_ t macos_12_0_0Copy a file using the copyfile syscall. - Create a file system object.
- es_
event_ create_ t_ anon_ 1_ anon_ 0 macos_10_15_1 - es_
event_ cs_ invalidated_ t macos_11_0_0Code signing status for process was invalidated. - es_
event_ deleteextattr_ t macos_10_15_1Delete an extended attribute - es_
event_ dup_ t macos_10_15_1Duplicate a file descriptor - Exchange data atomically between two files
- Execute a new process
- See [
es_event_exec_t_anon_0.anon_0] - Terminate a process
- es_
event_ fcntl_ t macos_10_15_1File control - Materialize a file via the
FileProviderframework - Update file contents via the
FileProviderframework - Fork a new process
- es_
event_ fsgetpath_ t macos_10_15_1Retrieve file system path based on FSID. - es_
event_ get_ task_ inspect_ t macos_11_3_0Get a process’s task inspect port. - es_
event_ get_ task_ name_ t macos_11_0_0Get a process’s task name port. - es_
event_ get_ task_ read_ t macos_11_3_0Get a process’s task read port. - Get a process’s task control port.
- es_
event_ getattrlist_ t macos_10_15_1Retrieve file system attributes - es_
event_ getextattr_ t macos_10_15_1Retrieve an extended attribute - Unique ID for an event
- Open a connection to an I/O Kit IOService.
- Load a kernel extension
- Unload a kernel extension
- Link to a file
- es_
event_ listextattr_ t macos_10_15_1List extended attributes of a file - es_
event_ login_ login_ t macos_13_0_0Notification for authenticated login event from/usr/bin/login. - es_
event_ login_ logout_ t macos_13_0_0Notification for authenticated logout event from/usr/bin/login. - Lookup a file system object.
- es_
event_ lw_ session_ lock_ t macos_13_0_0Notification that LoginWindow locked the screen of a session. - es_
event_ lw_ session_ login_ t macos_13_0_0Notification that LoginWindow has logged in a user. - es_
event_ lw_ session_ logout_ t macos_13_0_0Notification that LoginWindow has logged out a user. - es_
event_ lw_ session_ unlock_ t macos_13_0_0Notification that LoginWindow unlocked the screen of a session. - Memory map a file
- Mount a file system
- Control protection of pages
- es_
event_ od_ attribute_ set_ t macos_14_0_0Notification that an attribute is being set. - es_
event_ od_ attribute_ value_ add_ t macos_14_0_0Notification that an attribute value was added to a record. - es_
event_ od_ attribute_ value_ remove_ t macos_14_0_0Notification that an attribute value was removed to a record. - es_
event_ od_ create_ group_ t macos_14_0_0Notification that a group was created. - es_
event_ od_ create_ user_ t macos_14_0_0Notification that a user account was created. - es_
event_ od_ delete_ group_ t macos_14_0_0Notification that a group was deleted. - es_
event_ od_ delete_ user_ t macos_14_0_0Notification that a user account was deleted. - es_
event_ od_ disable_ user_ t macos_14_0_0Notification that a user account was disabled. - es_
event_ od_ enable_ user_ t macos_14_0_0Notification that a user account was enabled. - es_
event_ od_ group_ add_ t macos_14_0_0Notification that a member was added to a group. - es_
event_ od_ group_ remove_ t macos_14_0_0Notification that a member was removed to a group. - es_
event_ od_ group_ set_ t macos_14_0_0Notification that a group had it’s members initialised or replaced. - es_
event_ od_ modify_ password_ t macos_14_0_0Notification that an account had its password modified. - Open a file system object.
- es_
event_ openssh_ login_ t macos_13_0_0Notification for OpenSSH login event. - es_
event_ openssh_ logout_ t macos_13_0_0Notification for OpenSSH logout event. - es_
event_ proc_ check_ t macos_10_15_4Access control check for retrieving process information - es_
event_ proc_ suspend_ resume_ t macos_11_0_0Fired when one of pid_suspend, pid_resume or pid_shutdown_sockets is called on a process - es_
event_ profile_ add_ t macos_14_0_0Notification for Profiles installed on the system. - es_
event_ profile_ remove_ t macos_14_0_0Notification for Profiles removed on the system. - es_
event_ pty_ close_ t macos_10_15_4Fired when a pseudoterminal control device is closed - es_
event_ pty_ grant_ t macos_10_15_4Fired when a pseudoterminal control device is granted - es_
event_ readdir_ t macos_10_15_1Read directory entries - Resolve a symbolic link.
- es_
event_ remote_ thread_ create_ t macos_11_0_0Notification that a process has attempted to create a thread in another process by calling one of thethread_createorthread_create_runningMIG routines - es_
event_ remount_ t macos_10_15_1Remount a file system - Rename a file system object.
- es_
event_ screensharing_ attach_ t macos_13_0_0Notification that Screen Sharing has attached to a graphical session. - es_
event_ screensharing_ detach_ t macos_13_0_0Notification that Screen Sharing has detached from a graphical session. - es_
event_ searchfs_ t macos_11_0_0Access control check for searching a volume or a mounted file system - es_
event_ setacl_ t macos_10_15_1Set a file ACL. - Modify file system attributes
- es_
event_ setegid_ t macos_12_0_0Notification that a process has calledsetegid() - es_
event_ seteuid_ t macos_12_0_0Notification that a process has calledseteuid() - Set an extended attribute
- Modify file flags information.
- es_
event_ setgid_ t macos_12_0_0Notification that a process has calledsetgid() - Modify file mode.
- Modify file owner information
- es_
event_ setregid_ t macos_12_0_0Notification that a process has calledsetregid() - es_
event_ setreuid_ t macos_12_0_0Notification that a process has calledsetreuid() - es_
event_ settime_ t macos_10_15_1Modify the system time - es_
event_ setuid_ t macos_12_0_0Notification that a process has calledsetuid() - Send a signal to a process.
- es_
event_ stat_ t macos_10_15_1View stat information of a file - es_
event_ su_ t macos_14_0_0Notification for a su policy decisions events. - es_
event_ sudo_ t macos_14_0_0Notification for a sudo event. - es_
event_ trace_ t macos_11_0_0Fired when one process attempts to attach to another process - Truncate to a file
- The valid event types recognized by Endpoint Security.
- es_
event_ uipc_ bind_ t macos_10_15_1Fired when a UNIX-domain socket is about to be bound to a path - es_
event_ uipc_ connect_ t macos_10_15_1Fired when a UNIX-domain socket is about to be connected. - Unlink a file system object.
- Unmount a file system
- es_
event_ utimes_ t macos_10_15_1Change file access and modification times (e.g. viautimes(2)) - Write to a file
- es_
event_ xp_ malware_ detected_ t macos_13_0_0Notification that XProtect detected malware. - es_
event_ xp_ malware_ remediated_ t macos_13_0_0Notification that XProtect remediated malware. - es_
event_ xpc_ connect_ t macos_14_0_0Notification for an XPC connection being established to a named service. - es_fd_t
macos_11_0_0An open file descriptor - es_
fd_ t_ anon_ 0_ pipe macos_11_0_0 - Provides the
statinformation and path to a file that relates to a security event. The path may be truncated, which is indicated by thepath_truncatedflag. - This is the top level datatype that encodes information sent from the ES subsystem to its clients. Each security event being processed by the ES subsystem will be encoded in an
es_message_t. A message can be an authorization request or a notification of an event that has already taken place. - Return type for mute inversion
- Values that will be paired with path strings to describe the type of the path
- Structure to describe attributes of a muted path
- Structure for a set of muted paths
- Structure to describe attributes of a muted process
- Structure for a set of muted processes
- Error conditions for creating a new client
- Type of an account, used in OpenDirectory (od) events
- es_
od_ member_ id_ array_ t macos_14_0_0An array of group member identities. - es_
od_ member_ id_ t macos_14_0_0The identity of a group member - Type of a group member, used in OpenDirectory (od) events
- Type of a record, used in OpenDirectory (od) events
- This enum describes the type of
es_event_proc_check_tevents that are currently used. - This enum describes the type of suspend/resume operations that are currently used
- Information related to a process. This is used both for describing processes that performed an action (e.g. in the case of the [
es_message_t.process] field, or are targets of an action (e.g. for exec events this describes the new process being executed, for signal events this describes the process that will receive the signal). - Source of profile installation (MDM/Manual Install).
- es_
profile_ t macos_14_0_0 - Error conditions for responding to a message
- Indicates the result of the ES subsystem authorization process
- Valid authorization values to be used when responding to a
es_message_tauth event - Return value for functions that can only fail in one way
- Whether an ACL is being set or cleared
- Structure for handling strings
- Describes the type of plugin types in sudo.
- es_
sudo_ reject_ info_ t macos_14_0_0Provides context about failures ines_event_sudo_t. - es_
thread_ state_ t macos_11_0_0Machine-specific thread state as used bythread_create_runningand other Mach API functions. - es_
thread_ t macos_11_0_0Information related to a thread - Structure buffer with size
- This enum describes the types of XPC service domains.
Enums§
- Clearing authorisation caches failed.
- Mute
Inverted Type macos_13_0_0Type of muting for a specifices_mute_inversion_type_t - Mute
Type Error macos_13_0_0Getting the mute type failed. - Creating a new client failed.
- OpenSSH login failed.
- Responding to a message failed.
- Basic error without additional informations.
- Equivalent to C’s
voidtype when used as a pointer.
Functions§
- Extract the audit session ID from an
audit_token_t, used to identify Mach tasks and senders of Mach messages as subjects of the audit system. - Extract information from an
audit_token_t, used to identify Mach tasks and senders of Mach messages as subjects to the audit system.audit_tokent_to_au32()is the only method that should be used to parse anaudit_token_t, since its internal representation may change over time. A pointer parameter may beNULLif that information is not needed.audit_token_to_au32()has been deprecated because the terminal ID information is no longer saved in this token. The last parameter is actually the process ID version. The API callsaudit_token_to_auid(),audit_token_to_euid(),audit_token_to_ruid(),audit_token_to_rgid(),audit_token_to_pid(),audit_token_to_asid(), and/oraudit_token_to_pidversion()should be used instead. - Extract the audit user ID from an
audit_token_t, used to identify Mach tasks and senders of Mach messages as subjects of the audit system. - Extract the effective group ID from an
audit_token_t, used to identify Mach tasks and senders of Mach messages as subjects of the audit system. - Extract the effective user ID from an
audit_token_t, used to identify Mach tasks and senders of Mach messages as subjects of the audit system. - Extract the process ID from an
audit_token_t, used to identify Mach tasks and senders of Mach messages as subjects of the audit system. - Extract the process ID version from an
audit_token_t, used to identify Mach tasks and senders of Mach messages as subjects of the audit system. - Extract the real group ID from an
audit_token_t, used to identify Mach tasks and senders of Mach messages as subjects of the audit system. - Extract the real user ID from an
audit_token_t, used to identify Mach tasks and senders of Mach messages as subjects of the audit system. - Clear all cached results for all clients.
- Retains an
es_message_t, returning a non-const pointer to the givenes_message_tfor compatibility with existing code. - Destroy an
es_client_t, freeing resources and disconnecting from the ES subsystem - Get the argument at the specified position in the message containing an
es_event_exec_t - Get the number of arguments in a message containing an
es_event_exec_t - Get the environment variable at the specified position in the message containing an
es_event_exec_t - Get the number of environment variables in a message containing an
es_event_exec_t - es_
exec_ ⚠fd macos_11_0_0Get the file descriptor at the specified position in the message containing anes_event_exec_t - es_
exec_ ⚠fd_ count macos_11_0_0Get the number of file descriptors in a message containing anes_event_exec_t - Releases the memory associated with the given
es_message_tthat was retained viaes_copy_message() - es_
invert_ ⚠muting macos_13_0_0Invert the mute state of a given mute dimension - Calculate the size of an
es_message_t. - es_
mute_ ⚠path macos_12_0_0Suppress all events matching a path. - es_
mute_ ⚠path_ events macos_12_0_0Suppress a subset of events matching a path. - Suppress events matching a path literal
- Suppress events matching a path prefix
- Suppress all events from the process described by the given
audit_token - es_
mute_ ⚠process_ events macos_12_0_0Suppress a subset of events from the process described by the givenaudit_token - es_
muted_ ⚠paths_ events macos_12_0_0Retrieve a list of all muted paths. - List muted processes
- es_
muted_ ⚠processes_ events macos_12_0_0Retrieve a list of all muted processes. - es_
muting_ ⚠inverted macos_13_0_0Query mute inversion state - Initialise a new
es_client_tand connect to the ES subsystem - es_
release_ ⚠message macos_11_0_0Releases the givenes_message_tthat was previously retained withes_retain_message() - es_
release_ ⚠muted_ paths macos_12_0_0Delete a set of muted paths obtained fromes_muted_paths_events, freeing resources. - es_
release_ ⚠muted_ processes macos_12_0_0Delete a set of muted processes obtained fromes_muted_processes_events, freeing resources. - Respond to an auth event that requires an
es_auth_result_tresponse - Respond to an auth event that requires an
u32flags response - es_
retain_ ⚠message macos_11_0_0Retains the givenes_message_t, extending its lifetime until released withes_release_message(). - Subscribe to some set of events
- List subscriptions
- Unmute all paths
- es_
unmute_ ⚠all_ target_ paths macos_13_0_0Unmute all target paths - es_
unmute_ ⚠path macos_12_0_0Unmute a path for all event types. - es_
unmute_ ⚠path_ events macos_12_0_0Unmute a path for a subset of event types. - Unmute a process for all event types
- es_
unmute_ ⚠process_ events macos_12_0_0Unmute a process for a subset of event types. - Unsubscribe from some set of events
- Unsubscribe from all events
- stat⚠
Type Aliases§
- acl_t
macos_10_15_1Pointer to opaque type for Endpoint Security ACL. - Equivalent to C’s
signed int(int) type. - Equivalent to C’s
unsigned inttype. - Equivalent to C’s
unsigned shorttype. - cpu_
subtype_ t macos_13_0_0 - cpu_
type_ t macos_13_0_0 - es_
graphical_ session_ id_ t macos_13_0_0A session identifier identifying a on-console or off-console graphical session. - The type of block that will be invoked to handled messages from the ES subsystem
Unions§
- es_
event_ authentication_ t_ anon0 macos_13_0_0 - es_
event_ authentication_ touchid_ t_ anon0 macos_13_0_0 - See
es_event_close_t. - See [
es_event_exec_t.anon_0] - es_
event_ login_ login_ t_ anon0 macos_13_0_0 - es_
event_ openssh_ login_ t_ anon0 macos_13_0_0 - es_
event_ setacl_ t_ anon_ 0 macos_10_15_1 - es_
event_ su_ t_ anon0 macos_14_0_0Seees_event_su_t - es_
event_ sudo_ t_ anon0 macos_14_0_0 - Union of all possible events that can appear in an
es_message_t - es_
fd_ t_ anon_ 0 macos_11_0_0See [es_fd_t_anon_0.anon_0] - es_
od_ member_ id_ array_ t_ anon0 macos_14_0_0 - es_
od_ member_ id_ t_ anon0 macos_14_0_0 - See
es_result_t