xref: /freebsd/share/man/man4/auditpipe.4 (revision 9fe741b8952fbafa26d05bc7b52e1c0ba74b2185)
1673937acSRobert Watson.\" Copyright (c) 2006 Robert N. M. Watson
2673937acSRobert Watson.\" All rights reserved.
3673937acSRobert Watson.\"
4673937acSRobert Watson.\" Redistribution and use in source and binary forms, with or without
5673937acSRobert Watson.\" modification, are permitted provided that the following conditions
6673937acSRobert Watson.\" are met:
7673937acSRobert Watson.\" 1. Redistributions of source code must retain the above copyright
8673937acSRobert Watson.\"    notice, this list of conditions and the following disclaimer.
9673937acSRobert Watson.\" 2. Redistributions in binary form must reproduce the above copyright
10673937acSRobert Watson.\"    notice, this list of conditions and the following disclaimer in the
11673937acSRobert Watson.\"    documentation and/or other materials provided with the distribution.
12673937acSRobert Watson.\"
13673937acSRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14673937acSRobert Watson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15673937acSRobert Watson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16673937acSRobert Watson.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17673937acSRobert Watson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18673937acSRobert Watson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19673937acSRobert Watson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20673937acSRobert Watson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21673937acSRobert Watson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22673937acSRobert Watson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23673937acSRobert Watson.\" SUCH DAMAGE.
24673937acSRobert Watson.\"
25673937acSRobert Watson.\" $FreeBSD$
26673937acSRobert Watson.\"
27673937acSRobert Watson.Dd May 5, 2006
28673937acSRobert Watson.Os
29673937acSRobert Watson.Dt AUDITPIPE 4
30673937acSRobert Watson.Sh NAME
31673937acSRobert Watson.Nm auditpipe
32673937acSRobert Watson.Nd Pseudo-device for live audit event tracking
33673937acSRobert Watson.Sh SYNOPSIS
34673937acSRobert Watson.Cd "options AUDIT"
35673937acSRobert Watson.Sh DESCRIPTION
36673937acSRobert WatsonWhile audit trail files
37673937acSRobert Watsongenerated with
38673937acSRobert Watson.Xr audit 4
39673937acSRobert Watsonand maintained by
40673937acSRobert Watson.Xr auditd 8
41673937acSRobert Watsonprovide a reliable long-term store for audit log information, current log
42673937acSRobert Watsonfiles are owned by the audit daemon until terminated making them somewhat
431735925eSJoel Dahlunwieldy for live monitoring applications such as host-based intrusion
44673937acSRobert Watsondetection.
45673937acSRobert WatsonFor example, the log may be cycled and new records written to a new file
46673937acSRobert Watsonwithout notice to applications that may be accessing the file.
47673937acSRobert Watson.Pp
48673937acSRobert WatsonThe audit facility provides an audit pipe facility for applications requiring
49673937acSRobert Watsondirect access to live BSM audit data for the purposes of real-time
50673937acSRobert Watsonmonitoring.
51673937acSRobert WatsonAudit pipes are available via a clonable special device,
52673937acSRobert Watson.Pa /dev/auditpipe ,
53673937acSRobert Watsonsubject to the permissions on the device node, and provide a
54673937acSRobert Watson.Qq tee
55673937acSRobert Watsonof the audit event stream.
56673937acSRobert WatsonAs the device is clonable, more than one instance of the device may be opened
57673937acSRobert Watsonat a time; each device instance will provide independent access to all
58673937acSRobert Watsonrecords.
59673937acSRobert Watson.Pp
60673937acSRobert WatsonThe audit pipe device provides discrete BSM audit records; if the read buffer
61673937acSRobert Watsonpassed by the application is too small to hold the next record in the
62673937acSRobert Watsonsequence, it will be dropped.
63673937acSRobert WatsonUnlike audit data written to the audit trail, the reliability of record
64673937acSRobert Watsondelivery is not guaranteed.
65673937acSRobert WatsonIn particular, when an audit pipe queue fills, records will be dropped.
66673937acSRobert WatsonAudit pipe devices are blocking by default, but support non-blocking I/O,
67673937acSRobert Watsonasynchronous I/O using SIGIO, and polled operation via
68673937acSRobert Watson.Xr select 2
69673937acSRobert Watsonand
70673937acSRobert Watson.Xr poll 2 .
71673937acSRobert Watson.Pp
72673937acSRobert WatsonApplications may choose to track the global audit trail, or configure local
73673937acSRobert Watsonpreselection parameters independent of the global audit trail parameters.
74673937acSRobert Watson.Ss Audit Pipe Queue Ioctls
75673937acSRobert WatsonThe following ioctls retrieve and set various audit pipe record queue
76673937acSRobert Watsonproperties:
779fe741b8SRobert Watson.Bl -tag -width AUDITPIPE_GET_MAXAUDITDATA
78673937acSRobert Watson.It AUDITPIPE_GET_QLEN
79673937acSRobert WatsonQuery the current number of records available for reading on the pipe.
80673937acSRobert Watson.It AUDITPIPE_GET_QLIMIT
81673937acSRobert WatsonRetrieve the current maximum number of records that may be queued for reading
82673937acSRobert Watsonon the pipe.
83673937acSRobert Watson.It AUDITPIPE_SET_QLIMIT
84673937acSRobert WatsonSet the current maximum number of records that may be queued for reading on
85673937acSRobert Watsonthe pipe.
86673937acSRobert WatsonThe new limit must fall between the queue limit minimum and queue limit
87673937acSRobert Watsonmaximum queryable using the following two ioctls.
88673937acSRobert Watson.It AUDITPIPE_GET_QLIMIT_MIN
89673937acSRobert WatsonQuery the lowest possible maximum number of records that may be queued for
90673937acSRobert Watsonreading on the pipe.
91673937acSRobert Watson.It AUDITPIPE_GET_QLIMIT_MAX
92673937acSRobert WatsonQuery the highest possible maximum number of records that may be queued for
93673937acSRobert Watsonreading on the pipe.
94673937acSRobert Watson.It AUDITPIPE_FLUSH
95673937acSRobert WatsonFlush all outstanding records on the audit pipe; useful after setting initial
96673937acSRobert Watsonpreselection properties to delete records queued during the configuration
97673937acSRobert Watsonprocess which may not match the interests of the user process.
989fe741b8SRobert Watson.It AUDITPIPE_GET_MAXAUDITDATA
999fe741b8SRobert WatsonQuery the maximum size of an audit record, which is a useful minimum size for
1009fe741b8SRobert Watsona user space buffer intended to hold audit records read from the audit pipe.
101673937acSRobert Watson.El
102673937acSRobert Watson.Ss Audit Pipe Preselection Mode Ioctls
103673937acSRobert WatsonBy default, the audit pipe facility configures pipes to present records
104673937acSRobert Watsonmatched by the system-wide audit trail, configured by
105673937acSRobert Watson.Xr auditd 8 .
106673937acSRobert WatsonHowever, the preselection mechanism for audit pipes can be configured using
107673937acSRobert Watsonalternative criteria, including pipe-local flags and naflags settings, as
108673937acSRobert Watsonwell as auid-specific selection masks.
109673937acSRobert WatsonThis allows applications to track events not captured in the global audit
110673937acSRobert Watsontrail, as well as limit records presented to those of specific interest to
111673937acSRobert Watsonthe application.
112673937acSRobert Watson.Pp
113673937acSRobert WatsonThe following ioctls configure the preselection mode on an audit pipe:
114673937acSRobert Watson.Bl -tag -width AUDITPIPE_GET_PRESELECT_MODE
115673937acSRobert Watson.It AUDITPIPE_GET_PRESELECT_MODE
116673937acSRobert WatsonReturn the current preselect mode on the audit pipe.
117673937acSRobert WatsonThe ioctl argument should be of type
118673937acSRobert Watson.Vt int .
119673937acSRobert Watson.It AUDITPIPE_SET_PRESELECT_MODE
120673937acSRobert WatsonSet the current preselection mode on the audit pipe.
121673937acSRobert WatsonThe ioctl argument should be of type
122673937acSRobert Watson.Vt int .
123673937acSRobert Watson.El
124673937acSRobert Watson.Pp
125673937acSRobert WatsonPossible preselection mode values are:
126673937acSRobert Watson.Bl -tag -width AUDITPIPE_PRESELECT_MODE_TRAIL
127673937acSRobert Watson.It AUDITPIPE_PRESELECT_MODE_TRAIL
128673937acSRobert WatsonUse the global audit trail preselection parameters to select records for the
129673937acSRobert Watsonaudit pipe.
130673937acSRobert Watson.It AUDITPIPE_PRESELECT_MODE_LOCAL
131673937acSRobert WatsonUse local audit pipe preselection; this model is similar to the global audit
1321735925eSJoel Dahltrail configuration model, consisting of global flags and naflags parameters,
133673937acSRobert Watsonas well as a set of per-auid masks.
134673937acSRobert WatsonThese parameters are configured using further ioctls.
135673937acSRobert Watson.El
136673937acSRobert Watson.Pp
137673937acSRobert WatsonAfter changing the audit pipe preselection mode, records selected under
138673937acSRobert Watsonearlier preselection configuration may still be in the audit pipe queue.
139673937acSRobert WatsonThe application may flush the current record queue after changing the
140673937acSRobert Watsonconfiguration to remove possibly undesired records.
141673937acSRobert Watson.Ss Audit Pipe Local Preselection Mode Ioctls
1421735925eSJoel DahlThe following ioctls configure the preselection parameters used when an audit
143673937acSRobert Watsonpipe is configured for the
144673937acSRobert Watson.Dv AUDITPIPE_PRESELECT_MODE_LOCAL
145673937acSRobert Watsonpreselection mode.
146673937acSRobert Watson.Bl -tag -width AUDITPIPE_GET_PRESELECT_NAFLAGS
147673937acSRobert Watson.It AUDITPIPE_GET_PRESELECT_FLAGS
148673937acSRobert WatsonRetrieve the current default preselection flags for attributable events on
149673937acSRobert Watsonthe pipe.
150673937acSRobert WatsonThese flags correspond to the
151673937acSRobert Watson.Dv flags
152673937acSRobert Watsonfield in
153673937acSRobert Watson.Xr audit_control 5 .
154673937acSRobert WatsonThe ioctl argument should be of type
155673937acSRobert Watson.Vt u_int .
156673937acSRobert Watson.It AUDITPIPE_SET_PRESELECT_FLAGS
157673937acSRobert WatsonSet the current default preselection flags for attributable events on the
158673937acSRobert Watsonpipe.
159673937acSRobert WatsonThese flags correspond to the
160673937acSRobert Watson.Dv flags
161673937acSRobert Watsonfield in
162673937acSRobert Watson.Xr audit_control 5 .
163673937acSRobert WatsonThe ioctl argument should be of type
164673937acSRobert Watson.Vt u_int .
165673937acSRobert Watson.It AUDITPIPE_GET_PRESELECT_NAFLAGS
166673937acSRobert WatsonRetrieve the current default preselection flags for non-attributable events
167673937acSRobert Watsonon the pipe.
168673937acSRobert WatsonThese flags correspond to the
169673937acSRobert Watson.Dv naflags
170673937acSRobert Watsonfield in
171673937acSRobert Watson.Xr audit_control 5 .
172673937acSRobert WatsonThe ioctl argument should be of type
173673937acSRobert Watson.Vt u_int .
174673937acSRobert Watson.It AUDITPIPE_SET_PRESELECT_NAFLAGS
175673937acSRobert WatsonSet the current default preselection flags for non-attributable events on the
176673937acSRobert Watsonpipe.
177673937acSRobert WatsonThese flags correspond to the
178673937acSRobert Watson.Dv naflags
179673937acSRobert Watsonfield in
180673937acSRobert Watson.Xr audit_control 5 .
181673937acSRobert WatsonThe ioctl argument should be of type
182673937acSRobert Watson.Vt u_int .
183673937acSRobert Watson.It AUDITPIPE_GET_PRESELECT_AUID
184673937acSRobert WatsonQuery the current preselection masks for a specific auid on the pipe.
185673937acSRobert WatsonThe ioctl argument should be of type
186673937acSRobert Watson.Vt struct auditpipe_preselect .
187673937acSRobert WatsonThe auid to query is specified via the
188673937acSRobert Watson.Va ap_auid
189673937acSRobert Watsonfield of type
190673937acSRobert Watson.Vt au_id_t ;
191673937acSRobert Watsonthe mask will be returned via
192673937acSRobert Watson.Va ap_mask
193673937acSRobert Watsonof type
194673937acSRobert Watson.Vt au_mask_t .
195673937acSRobert Watson.It AUDITPIPE_SET_PRESELECT_AUID
196673937acSRobert WatsonSet the current preselection masks for a specific auid on the pipe.
197673937acSRobert WatsonArguments are identical to
198673937acSRobert Watson.Dv AUDITPIPE_GET_PRESELECT_AUID,
199673937acSRobert Watsonexcept that the caller should properly initialize the
200673937acSRobert Watson.Va ap_mask
201673937acSRobert Watsonfield to hold the desired preselection mask.
202673937acSRobert Watson.It AUDITPIPE_DELETE_PRESELECT_AUID
203673937acSRobert WatsonDelete the current preselection mask for a specific auid on the pipe.
204673937acSRobert WatsonOnce called, events associated with the specified auid will use the default
205673937acSRobert Watsonflags mask.
206673937acSRobert WatsonThe ioctl argument should be of type
207673937acSRobert Watson.Vt au_id_t .
208673937acSRobert Watson.It AUDITPIPE_FLUSH_PRESELECT_AUID
209673937acSRobert WatsonDelete all auid specific preselection specifications.
210673937acSRobert Watson.El
211673937acSRobert Watson.Sh EXAMPLES
212673937acSRobert Watson.Xr praudit 1
213673937acSRobert Watsonmay be directly executed on
214673937acSRobert Watson.Pa /dev/auditpipe
215673937acSRobert Watsonto review the default audit trail.
216673937acSRobert Watson.Sh SEE ALSO
217673937acSRobert Watson.Xr poll 2 ,
218673937acSRobert Watson.Xr select 2 ,
219673937acSRobert Watson.Xr audit 4 ,
220673937acSRobert Watson.Xr audit_control 5 ,
221673937acSRobert Watson.Xr audit 8 ,
222673937acSRobert Watson.Xr auditd 8
223673937acSRobert Watson.Sh AUTHORS
224673937acSRobert WatsonThe audit pipe facility was designed and implemented by
225673937acSRobert Watson.An Robert Watson Aq rwatson@FreeBSD.org .
226673937acSRobert Watson.Pp
227673937acSRobert WatsonThe Basic Security Module (BSM) interface to audit records and audit event
228673937acSRobert Watsonstream format were defined by Sun Microsystems.
229673937acSRobert Watson.Sh HISTORY
230673937acSRobert WatsonThe OpenBSM implementation was created by McAfee Research, the security
231673937acSRobert Watsondivision of McAfee Inc., under contract to Apple Computer Inc. in 2004.
232673937acSRobert WatsonIt was subsequently adopted by the TrustedBSD Project as the foundation for
233673937acSRobert Watsonthe OpenBSM distribution.
234673937acSRobert Watson.Pp
235673937acSRobert WatsonSupport for kernel audit first appeared in
236673937acSRobert Watson.Fx 6.2 .
237673937acSRobert Watson.Sh BUGS
238673937acSRobert WatsonSee the
239673937acSRobert Watson.Xr audit 4
240673937acSRobert Watsonmanual page for information on audit-related bugs and limitations.
241673937acSRobert Watson.Pp
242673937acSRobert WatsonThe configurable preselection mechanism mirrors the selection model present
243673937acSRobert Watsonfor the global audit trail.
244673937acSRobert WatsonIt might be desirable to provided a more flexible selection model.
245673937acSRobert Watson.Pp
246673937acSRobert WatsonThe per-pipe audit event queue is fifo, with drops occuring if either the
247673937acSRobert Watsonuser thread provides in sufficient for the record on the queue head, or on
248673937acSRobert Watsonenqueue if there is insufficient room.
249673937acSRobert WatsonIt might be desirable to support partial reads of records, which would be
250673937acSRobert Watsonmore compatible with buffered I/O as implemented in system libraries, and to
251673937acSRobert Watsonallow applications to select which records are dropped, possibly in the style
252673937acSRobert Watsonof preselection.
253