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. - Never use directly, use
acl_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. - Describes, 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.
- Structure describing a BTM launch item
- Error conditions for clearing the authorisation caches
- Opaque type that stores the endpoint security client state.
- Test file access
- Auto Unlock authentication data for type
ES_AUTHENTICATION_TYPE_TOKEN. - OpenDirectory authentication data for type
ES_AUTHENTICATION_TYPE_OD. - Notification that an authentication was performed.
- Token authentication data for type
ES_AUTHENTICATION_TYPE_TOKEN. - TouchID authentication data for type
ES_AUTHENTICATION_TYPE_TOUCHID. - Notification that a process had it’s right petition judged
- Notification that a process petitioned for certain authorization rights
- Notification 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.
- Notification 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.
- Changes directories
- Changes the root directory for a process
- Clone a file
- Close a file descriptor
- Copy a file using the copyfile syscall.
- Create a file system object.
- Code signing status for process was invalidated.
- Delete an extended attribute
- Duplicate 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
- File control
- Materialize a file via the
FileProviderframework - Update file contents via the
FileProviderframework - Fork a new process
- Retrieve file system path based on FSID.
- Get a process’s task inspect port.
- Get a process’s task name port.
- Get a process’s task read port.
- Get a process’s task control port.
- Retrieve file system attributes
- Retrieve 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
- List extended attributes of a file
- Notification for authenticated login event from
/usr/bin/login. - Notification for authenticated logout event from
/usr/bin/login. - Lookup a file system object.
- Notification that LoginWindow locked the screen of a session.
- Notification that LoginWindow has logged in a user.
- Notification that LoginWindow has logged out a user.
- Notification that LoginWindow unlocked the screen of a session.
- Memory map a file
- Mount a file system
- Control protection of pages
- Notification that an attribute is being set.
- Notification that an attribute value was added to a record.
- Notification that an attribute value was removed to a record.
- Notification that a group was created.
- Notification that a user account was created.
- Notification that a group was deleted.
- Notification that a user account was deleted.
- Notification that a user account was disabled.
- Notification that a user account was enabled.
- Notification that a member was added to a group.
- Notification that a member was removed to a group.
- Notification that a group had it’s members initialised or replaced.
- Notification that an account had its password modified.
- Open a file system object.
- Notification for OpenSSH login event.
- Notification for OpenSSH logout event.
- Access control check for retrieving process information
- Fired when one of pid_suspend, pid_resume or pid_shutdown_sockets is called on a process
- Notification for Profiles installed on the system.
- Notification for Profiles removed on the system.
- Fired when a pseudoterminal control device is closed
- Fired when a pseudoterminal control device is granted
- Read directory entries
- Resolve a symbolic link.
- Notification that a process has attempted to create a thread in another process by calling one of the
thread_createorthread_create_runningMIG routines - Remount a file system
- Rename a file system object.
- Notification that Screen Sharing has attached to a graphical session.
- Notification that Screen Sharing has detached from a graphical session.
- Access control check for searching a volume or a mounted file system
- Set a file ACL.
- Modify file system attributes
- Notification that a process has called
setegid() - Notification that a process has called
seteuid() - Set an extended attribute
- Modify file flags information.
- Notification that a process has called
setgid() - Modify file mode.
- Modify file owner information
- Notification that a process has called
setregid() - Notification that a process has called
setreuid() - Modify the system time
- Notification that a process has called
setuid() - Send a signal to a process.
- View stat information of a file
- Notification for a su policy decisions events.
- Notification for a sudo event.
- Fired when one process attempts to attach to another process
- Truncate to a file
- The valid event types recognized by Endpoint Security.
- Fired when a UNIX-domain socket is about to be bound to a path
- Fired when a UNIX-domain socket is about to be connected.
- Unlink a file system object.
- Unmount a file system
- Change file access and modification times (e.g. via
utimes(2)) - Write to a file
- Notification that XProtect detected malware.
- Notification that XProtect remediated malware.
- Notification for an XPC connection being established to a named service.
- An open file descriptor
- 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
- An array of group member identities.
- The 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).
- 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.
- Provides context about failures in
es_event_sudo_t. - Machine-specific thread state as used by
thread_create_runningand other Mach API functions. - Information related to a thread
- Structure buffer with size
- This enum describes the types of XPC service domains.
Enums
- Clearing authorisation caches failed.
- Type of muting for a specific
es_mute_inversion_type_t - Getting 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
- Pointer 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 - A 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
- gid_tNeither
target_os="espidf"nortarget_os="horizon"nortarget_os="vita"nortarget_os="nto" - uid_tNeither
target_os="espidf"nortarget_os="horizon"nortarget_os="vita"nortarget_os="nto"
Unions
- See
es_event_close_t. - See [
es_event_exec_t.anon_0] - See
es_event_su_t - Union of all possible events that can appear in an
es_message_t - See [
es_fd_t_anon_0.anon_0] - See
es_result_t