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§
- Should
NotBe Null - A wrapper type around
*mut Tto communicate a pointer should not be null without introducing undefined behaviour. - _acl
macos_10_15_1 - Never use directly, use
acl_tinstead - attrlist
- au_
tid_ t - audit_
token_ t - 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.
- es_
action_ type_ t - Type of action to take after receiving a message
- es_
address_ type_ t - Type of a network address.
- es_
auth_ result_ t - Valid authorization values to be used when responding to a
es_message_tauth event - es_
authentication_ type_ t - This enum describes the types of authentications that
ES_EVENT_TYPE_NOTIFY_AUTHENTICATIONcan describe. - es_
authorization_ result_ t macos_14_0_0 - Describes, for a single right, the class of that right and if it was granted
- es_
authorization_ rule_ class_ t - The class of rules used to evaluate the petition for a specific authorization right
- es_
auto_ unlock_ type_ t - See
es_event_authentication_auto_unlock_t. - es_
btm_ item_ type_ t - Type of launch item.
- es_
btm_ launch_ item_ t macos_13_0_0 - Structure describing a BTM launch item
- es_
clear_ cache_ result_ t - Error conditions for clearing the authorisation caches
- es_
client_ t - Opaque type that stores the endpoint security client state.
- es_
destination_ type_ t - es_
event_ access_ t macos_10_15_1 - Test file access
- es_
event_ authentication_ auto_ unlock_ t macos_13_0_0 - Auto Unlock authentication data for type
ES_AUTHENTICATION_TYPE_TOKEN. - es_
event_ authentication_ od_ t macos_13_0_0 - OpenDirectory authentication data for type
ES_AUTHENTICATION_TYPE_OD. - es_
event_ authentication_ t macos_13_0_0 - Notification that an authentication was performed.
- es_
event_ authentication_ token_ t macos_13_0_0 - Token authentication data for type
ES_AUTHENTICATION_TYPE_TOKEN. - es_
event_ authentication_ touchid_ t macos_13_0_0 - TouchID authentication data for type
ES_AUTHENTICATION_TYPE_TOUCHID. - es_
event_ authorization_ judgement_ t macos_14_0_0 - Notification that a process had it’s right petition judged
- es_
event_ authorization_ petition_ t macos_14_0_0 - Notification that a process petitioned for certain authorization rights
- es_
event_ btm_ launch_ item_ add_ t macos_13_0_0 - 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.
- es_
event_ btm_ launch_ item_ remove_ t macos_13_0_0 - 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.
- es_
event_ chdir_ t macos_10_15_1 - Changes directories
- es_
event_ chroot_ t macos_10_15_1 - Changes the root directory for a process
- es_
event_ clone_ t macos_10_15_1 - Clone a file
- es_
event_ close_ t - Close a file descriptor
- es_
event_ copyfile_ t macos_12_0_0 - Copy a file using the copyfile syscall.
- es_
event_ create_ t - Create a file system object.
- es_
event_ create_ t_ anon_ 0_ anon_ 0 - See
es_event_create_t_anon_0 - es_
event_ create_ t_ anon_ 1_ anon_ 0 macos_10_15_1 - See
es_event_create_t_anon_1 - es_
event_ cs_ invalidated_ t macos_11_0_0 - Code signing status for process was invalidated.
- es_
event_ deleteextattr_ t macos_10_15_1 - Delete an extended attribute
- es_
event_ dup_ t macos_10_15_1 - Duplicate a file descriptor
- es_
event_ exchangedata_ t - Exchange data atomically between two files
- es_
event_ exec_ t - Execute a new process
- es_
event_ exec_ t_ anon_ 0_ anon_ 0 - See [
es_event_exec_t_anon_0.anon_0] - es_
event_ exit_ t - Terminate a process
- es_
event_ fcntl_ t macos_10_15_1 - File control
- es_
event_ file_ provider_ materialize_ t - Materialize a file via the
FileProviderframework - es_
event_ file_ provider_ update_ t - Update file contents via the
FileProviderframework - es_
event_ fork_ t - Fork a new process
- es_
event_ fsgetpath_ t macos_10_15_1 - Retrieve file system path based on FSID.
- es_
event_ get_ task_ inspect_ t macos_11_3_0 - Get a process’s task inspect port.
- es_
event_ get_ task_ name_ t macos_11_0_0 - Get a process’s task name port.
- es_
event_ get_ task_ read_ t macos_11_3_0 - Get a process’s task read port.
- es_
event_ get_ task_ t - Get a process’s task control port.
- es_
event_ getattrlist_ t macos_10_15_1 - Retrieve file system attributes
- es_
event_ getextattr_ t macos_10_15_1 - Retrieve an extended attribute
- es_
event_ id_ t - Unique ID for an event
- es_
event_ iokit_ open_ t - Open a connection to an I/O Kit IOService.
- es_
event_ kextload_ t - Load a kernel extension
- es_
event_ kextunload_ t - Unload a kernel extension
- es_
event_ link_ t - Link to a file
- es_
event_ listextattr_ t macos_10_15_1 - List extended attributes of a file
- es_
event_ login_ login_ t macos_13_0_0 - Notification for authenticated login event from
/usr/bin/login. - es_
event_ login_ logout_ t macos_13_0_0 - Notification for authenticated logout event from
/usr/bin/login. - es_
event_ lookup_ t - Lookup a file system object.
- es_
event_ lw_ session_ lock_ t macos_13_0_0 - Notification that LoginWindow locked the screen of a session.
- es_
event_ lw_ session_ login_ t macos_13_0_0 - Notification that LoginWindow has logged in a user.
- es_
event_ lw_ session_ logout_ t macos_13_0_0 - Notification that LoginWindow has logged out a user.
- es_
event_ lw_ session_ unlock_ t macos_13_0_0 - Notification that LoginWindow unlocked the screen of a session.
- es_
event_ mmap_ t - Memory map a file
- es_
event_ mount_ t - Mount a file system
- es_
event_ mprotect_ t - Control protection of pages
- es_
event_ od_ attribute_ set_ t macos_14_0_0 - Notification that an attribute is being set.
- es_
event_ od_ attribute_ value_ add_ t macos_14_0_0 - Notification that an attribute value was added to a record.
- es_
event_ od_ attribute_ value_ remove_ t macos_14_0_0 - Notification that an attribute value was removed to a record.
- es_
event_ od_ create_ group_ t macos_14_0_0 - Notification that a group was created.
- es_
event_ od_ create_ user_ t macos_14_0_0 - Notification that a user account was created.
- es_
event_ od_ delete_ group_ t macos_14_0_0 - Notification that a group was deleted.
- es_
event_ od_ delete_ user_ t macos_14_0_0 - Notification that a user account was deleted.
- es_
event_ od_ disable_ user_ t macos_14_0_0 - Notification that a user account was disabled.
- es_
event_ od_ enable_ user_ t macos_14_0_0 - Notification that a user account was enabled.
- es_
event_ od_ group_ add_ t macos_14_0_0 - Notification that a member was added to a group.
- es_
event_ od_ group_ remove_ t macos_14_0_0 - Notification that a member was removed to a group.
- es_
event_ od_ group_ set_ t macos_14_0_0 - Notification that a group had it’s members initialised or replaced.
- es_
event_ od_ modify_ password_ t macos_14_0_0 - Notification that an account had its password modified.
- es_
event_ open_ t - Open a file system object.
- es_
event_ openssh_ login_ t macos_13_0_0 - Notification for OpenSSH login event.
- es_
event_ openssh_ logout_ t macos_13_0_0 - Notification for OpenSSH logout event.
- es_
event_ proc_ check_ t macos_10_15_4 - Access control check for retrieving process information
- es_
event_ proc_ suspend_ resume_ t macos_11_0_0 - Fired when one of pid_suspend, pid_resume or pid_shutdown_sockets is called on a process
- es_
event_ profile_ add_ t macos_14_0_0 - Notification for Profiles installed on the system.
- es_
event_ profile_ remove_ t macos_14_0_0 - Notification for Profiles removed on the system.
- es_
event_ pty_ close_ t macos_10_15_4 - Fired when a pseudoterminal control device is closed
- es_
event_ pty_ grant_ t macos_10_15_4 - Fired when a pseudoterminal control device is granted
- es_
event_ readdir_ t macos_10_15_1 - Read directory entries
- es_
event_ readlink_ t - Resolve a symbolic link.
- es_
event_ remote_ thread_ create_ t macos_11_0_0 - Notification that a process has attempted to create a thread in another process by calling one
of the
thread_createorthread_create_runningMIG routines - es_
event_ remount_ t macos_10_15_1 - Remount a file system
- es_
event_ rename_ t - Rename a file system object.
- es_
event_ rename_ t_ anon_ 0_ anon_ 0 - See
es_event_rename_t_anon_0 - es_
event_ screensharing_ attach_ t macos_13_0_0 - Notification that Screen Sharing has attached to a graphical session.
- es_
event_ screensharing_ detach_ t macos_13_0_0 - Notification that Screen Sharing has detached from a graphical session.
- es_
event_ searchfs_ t macos_11_0_0 - Access control check for searching a volume or a mounted file system
- es_
event_ setacl_ t macos_10_15_1 - Set a file ACL.
- es_
event_ setattrlist_ t - Modify file system attributes
- es_
event_ setegid_ t macos_12_0_0 - Notification that a process has called
setegid() - es_
event_ seteuid_ t macos_12_0_0 - Notification that a process has called
seteuid() - es_
event_ setextattr_ t - Set an extended attribute
- es_
event_ setflags_ t - Modify file flags information.
- es_
event_ setgid_ t macos_12_0_0 - Notification that a process has called
setgid() - es_
event_ setmode_ t - Modify file mode.
- es_
event_ setowner_ t - Modify file owner information
- es_
event_ setregid_ t macos_12_0_0 - Notification that a process has called
setregid() - es_
event_ setreuid_ t macos_12_0_0 - Notification that a process has called
setreuid() - es_
event_ settime_ t macos_10_15_1 - Modify the system time
- es_
event_ setuid_ t macos_12_0_0 - Notification that a process has called
setuid() - es_
event_ signal_ t - Send a signal to a process.
- es_
event_ stat_ t macos_10_15_1 - View stat information of a file
- es_
event_ su_ t macos_14_0_0 - Notification for a su policy decisions events.
- es_
event_ sudo_ t macos_14_0_0 - Notification for a sudo event.
- es_
event_ trace_ t macos_11_0_0 - Fired when one process attempts to attach to another process
- es_
event_ truncate_ t - Truncate to a file
- es_
event_ type_ t - The valid event types recognized by Endpoint Security.
- es_
event_ uipc_ bind_ t macos_10_15_1 - Fired when a UNIX-domain socket is about to be bound to a path
- es_
event_ uipc_ connect_ t macos_10_15_1 - Fired when a UNIX-domain socket is about to be connected.
- es_
event_ unlink_ t - Unlink a file system object.
- es_
event_ unmount_ t - Unmount a file system
- es_
event_ utimes_ t macos_10_15_1 - Change file access and modification times (e.g. via
utimes(2)) - es_
event_ write_ t - Write to a file
- es_
event_ xp_ malware_ detected_ t macos_13_0_0 - Notification that XProtect detected malware.
- es_
event_ xp_ malware_ remediated_ t macos_13_0_0 - Notification that XProtect remediated malware.
- es_
event_ xpc_ connect_ t macos_14_0_0 - Notification for an XPC connection being established to a named service.
- es_fd_t
macos_11_0_0 - An open file descriptor
- es_
fd_ t_ anon_ 0_ pipe macos_11_0_0 - Pipe information available in
es_fd_tif thefdtypefield isPROX_FDTYPE_PIPE - es_
file_ t - 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. - es_
get_ task_ type_ t - es_
message_ t - 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. - es_
mute_ inversion_ type_ t - es_
mute_ inverted_ return_ t - Return type for mute inversion
- es_
mute_ path_ type_ t - Values that will be paired with path strings to describe the type of the path
- es_
muted_ path_ t - Structure to describe attributes of a muted path
- es_
muted_ paths_ t - Structure for a set of muted paths
- es_
muted_ process_ t - Structure to describe attributes of a muted process
- es_
muted_ processes_ t - Structure for a set of muted processes
- es_
new_ client_ result_ t - Error conditions for creating a new client
- es_
od_ account_ type_ t - Type of an account, used in OpenDirectory (od) events
- es_
od_ member_ id_ array_ t macos_14_0_0 - An array of group member identities.
- es_
od_ member_ id_ t macos_14_0_0 - The identity of a group member
- es_
od_ member_ type_ t - Type of a group member, used in OpenDirectory (od) events
- es_
od_ record_ type_ t - Type of a record, used in OpenDirectory (od) events
- es_
openssh_ login_ result_ type_ t - See
es_event_openssh_login_t - es_
proc_ check_ type_ t - This enum describes the type of
es_event_proc_check_tevents that are currently used. - es_
proc_ suspend_ resume_ type_ t - This enum describes the type of suspend/resume operations that are currently used
- es_
process_ t - 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). - es_
profile_ source_ t - Source of profile installation (MDM/Manual Install).
- es_
profile_ t macos_14_0_0 - es_
respond_ result_ t - Error conditions for responding to a message
- es_
result_ t - Indicates the result of the ES subsystem authorization process
- es_
result_ type_ t - Valid authorization values to be used when responding to a
es_message_tauth event - es_
return_ t - Return value for functions that can only fail in one way
- es_
set_ or_ clear_ t - Whether an ACL is being set or cleared
- es_
string_ token_ t - Structure for handling strings
- es_
sudo_ plugin_ type_ t - Describes the type of plugin types in sudo.
- es_
sudo_ reject_ info_ t macos_14_0_0 - Provides context about failures in
es_event_sudo_t. - es_
thread_ state_ t macos_11_0_0 - Machine-specific thread state as used by
thread_create_runningand other Mach API functions. - es_
thread_ t macos_11_0_0 - Information related to a thread
- es_
token_ t - Structure buffer with size
- es_
touchid_ mode_ t - See
es_event_authentication_touchid_t - es_
xpc_ domain_ type_ t - This enum describes the types of XPC service domains.
- stat
- statfs
- timespec
- timeval
Enums§
- Clear
Cache Error - Clearing authorisation caches failed.
- Mute
Inverted Type macos_13_0_0 - Type of muting for a specific
es_mute_inversion_type_t - Mute
Type Error macos_13_0_0 - Getting the mute type failed.
- NewClient
Error - Creating a new client failed.
- Openssh
Login Error - OpenSSH login failed.
- Respond
Error - Responding to a message failed.
- Return
Error - Basic error without additional informations.
- c_void
- Equivalent to C’s
voidtype when used as a pointer.
Functions§
- audit_
token_ ⚠to_ asid - 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. - audit_
token_ ⚠to_ au32 - 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. - audit_
token_ ⚠to_ auid - 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. - audit_
token_ ⚠to_ egid - 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. - audit_
token_ ⚠to_ euid - 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. - audit_
token_ ⚠to_ pid - 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. - audit_
token_ ⚠to_ pidversion - 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. - audit_
token_ ⚠to_ rgid - 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. - audit_
token_ ⚠to_ ruid - 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. - es_
clear_ ⚠cache - Clear all cached results for all clients.
- es_
copy_ ⚠message - Retains an
es_message_t, returning a non-const pointer to the givenes_message_tfor compatibility with existing code. - es_
delete_ ⚠client - Destroy an
es_client_t, freeing resources and disconnecting from the ES subsystem - es_
exec_ ⚠arg - Get the argument at the specified position in the message containing an
es_event_exec_t - es_
exec_ ⚠arg_ count - Get the number of arguments in a message containing an
es_event_exec_t - es_
exec_ ⚠env - Get the environment variable at the specified position in the message containing an
es_event_exec_t - es_
exec_ ⚠env_ count - Get the number of environment variables in a message containing an
es_event_exec_t - es_
exec_ ⚠fd macos_11_0_0 - Get the file descriptor at the specified position in the message containing an
es_event_exec_t - es_
exec_ ⚠fd_ count macos_11_0_0 - Get the number of file descriptors in a message containing an
es_event_exec_t - es_
free_ ⚠message - Releases the memory associated with the given
es_message_tthat was retained viaes_copy_message() - es_
invert_ ⚠muting macos_13_0_0 - Invert the mute state of a given mute dimension
- es_
message_ ⚠size - Calculate the size of an
es_message_t. - es_
mute_ ⚠path macos_12_0_0 - Suppress all events matching a path.
- es_
mute_ ⚠path_ events macos_12_0_0 - Suppress a subset of events matching a path.
- es_
mute_ ⚠path_ literal - Suppress events matching a path literal
- es_
mute_ ⚠path_ prefix - Suppress events matching a path prefix
- es_
mute_ ⚠process - Suppress all events from the process described by the given
audit_token - es_
mute_ ⚠process_ events macos_12_0_0 - Suppress a subset of events from the process described by the given
audit_token - es_
muted_ ⚠paths_ events macos_12_0_0 - Retrieve a list of all muted paths.
- es_
muted_ ⚠processes - List muted processes
- es_
muted_ ⚠processes_ events macos_12_0_0 - Retrieve a list of all muted processes.
- es_
muting_ ⚠inverted macos_13_0_0 - Query mute inversion state
- es_
new_ ⚠client - Initialise a new
es_client_tand connect to the ES subsystem - es_
release_ ⚠message macos_11_0_0 - Releases the given
es_message_tthat was previously retained withes_retain_message() - es_
release_ ⚠muted_ paths macos_12_0_0 - Delete a set of muted paths obtained from
es_muted_paths_events, freeing resources. - es_
release_ ⚠muted_ processes macos_12_0_0 - Delete a set of muted processes obtained from
es_muted_processes_events, freeing resources. - es_
respond_ ⚠auth_ result - Respond to an auth event that requires an
es_auth_result_tresponse - es_
respond_ ⚠flags_ result - Respond to an auth event that requires an
u32flags response - es_
retain_ ⚠message macos_11_0_0 - Retains the given
es_message_t, extending its lifetime until released withes_release_message(). - es_
subscribe ⚠ - Subscribe to some set of events
- es_
subscriptions ⚠ - List subscriptions
- es_
unmute_ ⚠all_ paths - Unmute all paths
- es_
unmute_ ⚠all_ target_ paths macos_13_0_0 - Unmute all target paths
- es_
unmute_ ⚠path macos_12_0_0 - Unmute a path for all event types.
- es_
unmute_ ⚠path_ events macos_12_0_0 - Unmute a path for a subset of event types.
- es_
unmute_ ⚠process - Unmute a process for all event types
- es_
unmute_ ⚠process_ events macos_12_0_0 - Unmute a process for a subset of event types.
- es_
unsubscribe ⚠ - Unsubscribe from some set of events
- es_
unsubscribe_ ⚠all - Unsubscribe from all events
- stat⚠
- statfs⚠
Type Aliases§
- acl_t
macos_10_15_1 - Pointer to opaque type for Endpoint Security ACL.
- attrgroup_
t - au_
asid_ t - c_char
- c_int
- Equivalent to C’s
signed int(int) type. - c_uint
- Equivalent to C’s
unsigned inttype. - c_
ushort - Equivalent to C’s
unsigned shorttype. - cpu_
subtype_ t macos_13_0_0 - cpu_
type_ t macos_13_0_0 - dev_t
- es_
graphical_ session_ id_ t macos_13_0_0 - A session identifier identifying a on-console or off-console graphical session.
- es_
handler_ block_ t - The type of block that will be invoked to handled messages from the ES subsystem
- gid_t
- mode_t
- pid_t
- size_t
- uid_t
- user_
addr_ t - user_
size_ t
Unions§
- es_
event_ authentication_ t_ anon0 macos_13_0_0 - See
es_event_authentication_t - es_
event_ authentication_ touchid_ t_ anon0 macos_13_0_0 - See
es_event_authentication_touchid_t - es_
event_ close_ t_ anon_ 0 - See
es_event_close_t. - es_
event_ create_ t_ anon_ 0 - See
es_event_create_t - es_
event_ create_ t_ anon_ 1 - See
es_event_create_t - es_
event_ exec_ t_ anon_ 0 - See [
es_event_exec_t.anon_0] - es_
event_ login_ login_ t_ anon0 macos_13_0_0 - See
es_event_login_login_t - es_
event_ openssh_ login_ t_ anon0 macos_13_0_0 - See
es_event_openssh_login_t - es_
event_ rename_ t_ anon_ 0 - See
es_event_rename_t - es_
event_ setacl_ t_ anon_ 0 macos_10_15_1 - See
es_event_setacl_t - es_
event_ su_ t_ anon0 macos_14_0_0 - See
es_event_su_t - es_
event_ sudo_ t_ anon0 macos_14_0_0 es_event_sudo_t- es_
events_ t - Union of all possible events that can appear in an
es_message_t - es_
fd_ t_ anon_ 0 macos_11_0_0 - See [
es_fd_t_anon_0.anon_0] - es_
message_ t_ anon_ 0 - es_
od_ member_ id_ array_ t_ anon0 macos_14_0_0 - See
es_od_member_id_array_t - es_
od_ member_ id_ t_ anon0 macos_14_0_0 - See
es_od_member_id_t - es_
result_ t_ anon_ 0 - See
es_result_t