New meson option enable_endpoint_security (auto, macOS only) links EndpointSecurity and bsm and builds three ES backends behind the existing interfaces. Helpers are in src/platform/es_support.hpp. - ProcessMonitor: NOTIFY_EXEC events (pid, parent, path, dev:ino, argv, start time) plus NOTIFY_TRACE and NOTIFY_KEXTLOAD for the behavior rules. Events go to a bounded queue (4096, overflow counted in events_dropped) drained on the monitor thread, so callbacks stay on one thread. Without an ES client the monitor polls libproc (backend "libproc"). backend_name() reports "endpoint_security". - ExecGuard: AUTH_EXEC with the fanotify guard's rules. It fails open at min(timeout, ES deadline - 500 ms) and on a full queue, and on macOS 27+ ES_DEADLINE_MISS_MODE_FAIL_OPEN makes the kernel allow a missed deadline too. Platform binaries and SIP paths are never denied, and our own execs are muted. ES does not cache verdicts, so rule changes apply on the next exec. Our own cache keys on dev:ino:size:mtime:generation. The image is opened by path and its dev:ino checked against the event; a swapped file counts as unscanned. - FileWatcher: NOTIFY_CREATE/RENAME/CLOSE(modified) with inverted target-path muting: named entries selected literally, whole directories by prefix. macos_watch_specs() covers launchd agents/daemons, periodic jobs, cron tabs, sudo drop-ins, shell rc files, authorized_keys, Downloads and the temp directories. match_watch_spec() (direct children, as with fanotify directory marks) is portable and tested. Home dirs come from the directory service (local_home_dirs). Every ES handler is noexcept and records swallowed exceptions. Client errors name the missing requirement (root, entitlement, Full Disk Access), and the daemon keeps running detection-only. macos_es_live (root, ES entitlement) checks deny/allow/cache/ platform-binary/fail-open/audit for the guard, exec telemetry and the file watcher, using small signed payload binaries. It has not run yet: the development Mac has SIP enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 lines
513 B
C++
15 lines
513 B
C++
// Payload for macos_es_live: a tiny signed executable carrying a marker
|
|
// string (MARKER is set per target in tests/meson.build). Appending bytes to
|
|
// a copied system binary, as the Linux live tests do, breaks its code
|
|
// signature and macOS kills it at exec.
|
|
#include <cstdlib>
|
|
|
|
#ifndef MARKER
|
|
#define MARKER "NO-MARKER"
|
|
#endif
|
|
|
|
const char* volatile strawberry_payload_marker = MARKER;
|
|
|
|
int main(int argc, char**) {
|
|
return strawberry_payload_marker[0] == '\0' || argc < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
|
}
|