-#define AUDIT_RECORD_MAGIC 0x828a0f1b
-#define MAX_AUDIT_RECORDS 20
-#define MAXAUDITDATA (0x8000 - 1)
-#define MAX_AUDIT_RECORD_SIZE MAXAUDITDATA
-#define MIN_AUDIT_FILE_SIZE (512 * 1024)
+#define AUDIT_RECORD_MAGIC 0x828a0f1b
+#define MAX_AUDIT_RECORDS 20
+#define MAXAUDITDATA (0x8000 - 1)
+#define MAX_AUDIT_RECORD_SIZE MAXAUDITDATA
+#define MIN_AUDIT_FILE_SIZE (512 * 1024)
* as the kernel does an unsigned compare, plus we want to leave a few blocks
* free so userspace can terminate the log, etc.
*/
* as the kernel does an unsigned compare, plus we want to leave a few blocks
* free so userspace can terminate the log, etc.
*/
-#define AUDIT_TRIGGER_MIN 1
-#define AUDIT_TRIGGER_LOW_SPACE 1 /* Below low watermark. */
-#define AUDIT_TRIGGER_ROTATE_KERNEL 2 /* Kernel requests rotate. */
-#define AUDIT_TRIGGER_READ_FILE 3 /* Re-read config file. */
-#define AUDIT_TRIGGER_CLOSE_AND_DIE 4 /* Terminate audit. */
-#define AUDIT_TRIGGER_NO_SPACE 5 /* Below min free space. */
-#define AUDIT_TRIGGER_ROTATE_USER 6 /* User requests rotate. */
-#define AUDIT_TRIGGER_INITIALIZE 7 /* User initialize of auditd. */
-#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 /* User expiration of trails. */
-#define AUDIT_TRIGGER_MAX 8
+#define AUDIT_TRIGGER_MIN 1
+#define AUDIT_TRIGGER_LOW_SPACE 1 /* Below low watermark. */
+#define AUDIT_TRIGGER_ROTATE_KERNEL 2 /* Kernel requests rotate. */
+#define AUDIT_TRIGGER_READ_FILE 3 /* Re-read config file. */
+#define AUDIT_TRIGGER_CLOSE_AND_DIE 4 /* Terminate audit. */
+#define AUDIT_TRIGGER_NO_SPACE 5 /* Below min free space. */
+#define AUDIT_TRIGGER_ROTATE_USER 6 /* User requests rotate. */
+#define AUDIT_TRIGGER_INITIALIZE 7 /* User initialize of auditd. */
+#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 /* User expiration of trails. */
+#define AUDIT_TRIGGER_MAX 8
-#define AU_DEFAUDITID (uid_t)(-1)
-#define AU_DEFAUDITSID 0
-#define AU_ASSIGN_ASID -1
+#define AU_DEFAUDITID (uid_t)(-1)
+#define AU_DEFAUDITSID 0
+#define AU_ASSIGN_ASID -1
-#define AT_IPC_MSG ((u_char)1) /* Message IPC id. */
-#define AT_IPC_SEM ((u_char)2) /* Semaphore IPC id. */
-#define AT_IPC_SHM ((u_char)3) /* Shared mem IPC id. */
+#define AT_IPC_MSG ((unsigned char)1) /* Message IPC id. */
+#define AT_IPC_SEM ((unsigned char)2) /* Semaphore IPC id. */
+#define AT_IPC_SHM ((unsigned char)3) /* Shared mem IPC id. */
-#define A_OLDGETPOLICY 2
-#define A_OLDSETPOLICY 3
-#define A_GETKMASK 4
-#define A_SETKMASK 5
-#define A_OLDGETQCTRL 6
-#define A_OLDSETQCTRL 7
-#define A_GETCWD 8
-#define A_GETCAR 9
-#define A_GETSTAT 12
-#define A_SETSTAT 13
-#define A_SETUMASK 14
-#define A_SETSMASK 15
-#define A_OLDGETCOND 20
-#define A_OLDSETCOND 21
-#define A_GETCLASS 22
-#define A_SETCLASS 23
-#define A_GETPINFO 24
-#define A_SETPMASK 25
-#define A_SETFSIZE 26
-#define A_GETFSIZE 27
-#define A_GETPINFO_ADDR 28
-#define A_GETKAUDIT 29
-#define A_SETKAUDIT 30
-#define A_SENDTRIGGER 31
-#define A_GETSINFO_ADDR 32
-#define A_GETPOLICY 33
-#define A_SETPOLICY 34
-#define A_GETQCTRL 35
-#define A_SETQCTRL 36
-#define A_GETCOND 37
-#define A_SETCOND 38
-#define A_GETSFLAGS 39
-#define A_SETSFLAGS 40
+#define A_OLDGETPOLICY 2
+#define A_OLDSETPOLICY 3
+#define A_GETKMASK 4
+#define A_SETKMASK 5
+#define A_OLDGETQCTRL 6
+#define A_OLDSETQCTRL 7
+#define A_GETCWD 8
+#define A_GETCAR 9
+#define A_GETSTAT 12
+#define A_SETSTAT 13
+#define A_SETUMASK 14
+#define A_SETSMASK 15
+#define A_OLDGETCOND 20
+#define A_OLDSETCOND 21
+#define A_GETCLASS 22
+#define A_SETCLASS 23
+#define A_GETPINFO 24
+#define A_SETPMASK 25
+#define A_SETFSIZE 26
+#define A_GETFSIZE 27
+#define A_GETPINFO_ADDR 28
+#define A_GETKAUDIT 29
+#define A_SETKAUDIT 30
+#define A_SENDTRIGGER 31
+#define A_GETSINFO_ADDR 32
+#define A_GETPOLICY 33
+#define A_SETPOLICY 34
+#define A_GETQCTRL 35
+#define A_SETQCTRL 36
+#define A_GETCOND 37
+#define A_SETCOND 38
+#define A_GETSFLAGS 39
+#define A_SETSFLAGS 40
+#define A_GETCTLMODE 41
+#define A_SETCTLMODE 42
+#define A_GETEXPAFTER 43
+#define A_SETEXPAFTER 44
-#define AUDIT_CNT 0x0001
-#define AUDIT_AHLT 0x0002
-#define AUDIT_ARGV 0x0004
-#define AUDIT_ARGE 0x0008
-#define AUDIT_SEQ 0x0010
-#define AUDIT_WINDATA 0x0020
-#define AUDIT_USER 0x0040
-#define AUDIT_GROUP 0x0080
-#define AUDIT_TRAIL 0x0100
-#define AUDIT_PATH 0x0200
-#define AUDIT_SCNT 0x0400
-#define AUDIT_PUBLIC 0x0800
-#define AUDIT_ZONENAME 0x1000
-#define AUDIT_PERZONE 0x2000
+#define AUDIT_CNT 0x0001
+#define AUDIT_AHLT 0x0002
+#define AUDIT_ARGV 0x0004
+#define AUDIT_ARGE 0x0008
+#define AUDIT_SEQ 0x0010
+#define AUDIT_WINDATA 0x0020
+#define AUDIT_USER 0x0040
+#define AUDIT_GROUP 0x0080
+#define AUDIT_TRAIL 0x0100
+#define AUDIT_PATH 0x0200
+#define AUDIT_SCNT 0x0400
+#define AUDIT_PUBLIC 0x0800
+#define AUDIT_ZONENAME 0x1000
+#define AUDIT_PERZONE 0x2000
-#define AQ_HIWATER 100
-#define AQ_MAXHIGH 10000
-#define AQ_LOWATER 10
-#define AQ_BUFSZ MAXAUDITDATA
-#define AQ_MAXBUFSZ 1048576
+#define AQ_HIWATER 100
+#define AQ_MAXHIGH 10000
+#define AQ_LOWATER 10
+#define AQ_BUFSZ MAXAUDITDATA
+#define AQ_MAXBUFSZ 1048576
/*
* Type definitions used indicating the length of variable length addresses
* in tokens containing addresses, such as header fields.
*/
/*
* Type definitions used indicating the length of variable length addresses
* in tokens containing addresses, such as header fields.
*/
-#define AU_IPv4 4
-#define AU_IPv6 16
+#define AU_IPv4 4
+#define AU_IPv6 16
+
+/*
+ * Reserved audit class mask indicating which classes are unable to have
+ * events added or removed by unentitled processes.
+ */
+#define AU_CLASS_MASK_RESERVED 0x10000000
+
+/*
+ * Audit control modes
+ */
+#define AUDIT_CTLMODE_NORMAL ((unsigned char)1)
+#define AUDIT_CTLMODE_EXTERNAL ((unsigned char)2)
+
+/*
+ * Audit file expire_after op modes
+ */
+#define AUDIT_EXPIRE_OP_AND ((unsigned char)0)
+#define AUDIT_EXPIRE_OP_OR ((unsigned char)1)
-typedef uid_t au_id_t;
-typedef pid_t au_asid_t;
-typedef u_int16_t au_event_t;
-typedef u_int16_t au_emod_t;
-typedef u_int32_t au_class_t;
-typedef u_int64_t au_asflgs_t __attribute__ ((aligned (8)));
+typedef uid_t au_id_t;
+typedef pid_t au_asid_t;
+typedef u_int16_t au_event_t;
+typedef u_int16_t au_emod_t;
+typedef u_int32_t au_class_t;
+typedef u_int64_t au_asflgs_t __attribute__ ((aligned(8)));
+typedef unsigned char au_ctlmode_t;
- au_id_t ai_auid; /* Audit user ID. */
- au_mask_t ai_mask; /* Audit masks. */
- au_tid_t ai_termid; /* Terminal ID. */
- au_asid_t ai_asid; /* Audit session ID. */
+ au_id_t ai_auid; /* Audit user ID. */
+ au_mask_t ai_mask; /* Audit masks. */
+ au_tid_t ai_termid; /* Terminal ID. */
+ au_asid_t ai_asid; /* Audit session ID. */
- au_id_t ai_auid; /* Audit user ID. */
- au_mask_t ai_mask; /* Audit masks. */
- au_tid_addr_t ai_termid; /* Terminal ID. */
- au_asid_t ai_asid; /* Audit session ID. */
- au_asflgs_t ai_flags; /* Audit session flags. */
+ au_id_t ai_auid; /* Audit user ID. */
+ au_mask_t ai_mask; /* Audit masks. */
+ au_tid_addr_t ai_termid; /* Terminal ID. */
+ au_asid_t ai_asid; /* Audit session ID. */
+ au_asflgs_t ai_flags; /* Audit session flags. */
- pid_t ap_pid; /* ID of target process. */
- au_id_t ap_auid; /* Audit user ID. */
- au_mask_t ap_mask; /* Audit masks. */
- au_tid_t ap_termid; /* Terminal ID. */
- au_asid_t ap_asid; /* Audit session ID. */
+ pid_t ap_pid; /* ID of target process. */
+ au_id_t ap_auid; /* Audit user ID. */
+ au_mask_t ap_mask; /* Audit masks. */
+ au_tid_t ap_termid; /* Terminal ID. */
+ au_asid_t ap_asid; /* Audit session ID. */
- pid_t ap_pid; /* ID of target process. */
- au_id_t ap_auid; /* Audit user ID. */
- au_mask_t ap_mask; /* Audit masks. */
- au_tid_addr_t ap_termid; /* Terminal ID. */
- au_asid_t ap_asid; /* Audit session ID. */
- au_asflgs_t ap_flags; /* Audit session flags. */
+ pid_t ap_pid; /* ID of target process. */
+ au_id_t ap_auid; /* Audit user ID. */
+ au_mask_t ap_mask; /* Audit masks. */
+ au_tid_addr_t ap_termid; /* Terminal ID. */
+ au_asid_t ap_asid; /* Audit session ID. */
+ au_asflgs_t ap_flags; /* Audit session flags. */
- auditinfo_addr_t *as_aia_p; /* Ptr to full audit info. */
- au_mask_t as_mask; /* Process Audit Masks. */
+ auditinfo_addr_t *as_aia_p; /* Ptr to full audit info. */
+ au_mask_t as_mask; /* Process Audit Masks. */
+struct au_expire_after {
+ time_t age; /* Age after which trail files should be expired */
+ size_t size; /* Aggregate trail size when files should be expired */
+ unsigned char op_type; /* Operator used with the above values to determine when files should be expired */
+};
+typedef struct au_expire_after au_expire_after_t;
+
- * Default: Maximum:
- * aq_hiwater: AQ_HIWATER (100) AQ_MAXHIGH (10000)
- * aq_lowater: AQ_LOWATER (10) <aq_hiwater
- * aq_bufsz: AQ_BUFSZ (32767) AQ_MAXBUFSZ (1048576)
- * aq_delay: 20 20000 (not used)
+ * Default: Maximum:
+ * aq_hiwater: AQ_HIWATER (100) AQ_MAXHIGH (10000)
+ * aq_lowater: AQ_LOWATER (10) <aq_hiwater
+ * aq_bufsz: AQ_BUFSZ (32767) AQ_MAXBUFSZ (1048576)
+ * aq_delay: 20 20000 (not used)
- int aq_bufsz; /* Max size of audit record for audit(2). */
- int aq_delay; /* Queue delay (not used). */
- int aq_minfree; /* Minimum filesystem percent free space. */
+ int aq_bufsz; /* Max size of audit record for audit(2). */
+ int aq_delay; /* Queue delay (not used). */
+ int aq_minfree; /* Minimum filesystem percent free space. */
- unsigned int as_version;
- unsigned int as_numevent;
- int as_generated;
- int as_nonattrib;
- int as_kernel;
- int as_audit;
- int as_auditctl;
- int as_enqueue;
- int as_written;
- int as_wblocked;
- int as_rblocked;
- int as_dropped;
- int as_totalsize;
- unsigned int as_memused;
+ unsigned int as_version;
+ unsigned int as_numevent;
+ int as_generated;
+ int as_nonattrib;
+ int as_kernel;
+ int as_audit;
+ int as_auditctl;
+ int as_enqueue;
+ int as_written;
+ int as_wblocked;
+ int as_rblocked;
+ int as_dropped;
+ int as_totalsize;
+ unsigned int as_memused;
-int audit(const void *, int);
-int auditon(int, void *, int);
-int auditctl(const char *);
-int getauid(au_id_t *);
-int setauid(const au_id_t *);
-int getaudit_addr(struct auditinfo_addr *, int);
-int setaudit_addr(const struct auditinfo_addr *, int);
+int audit(const void *, int);
+int auditon(int, void *, int);
+int auditctl(const char *);
+int getauid(au_id_t *);
+int setauid(const au_id_t *);
+int getaudit_addr(struct auditinfo_addr *, int);
+int setaudit_addr(const struct auditinfo_addr *, int);
-int getaudit(struct auditinfo *)
- __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
- __IPHONE_2_0, __IPHONE_6_0);
-int setaudit(const struct auditinfo *)
- __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
- __IPHONE_2_0, __IPHONE_6_0);
+int getaudit(struct auditinfo *)
+__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
+ __IPHONE_2_0, __IPHONE_6_0);
+int setaudit(const struct auditinfo *)
+__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
+ __IPHONE_2_0, __IPHONE_6_0);
-au_asid_t audit_session_join(mach_port_name_t port);
-int audit_session_port(au_asid_t asid, mach_port_name_t *portname);
+au_asid_t audit_session_join(mach_port_name_t port);
+int audit_session_port(au_asid_t asid, mach_port_name_t *portname);