xref: /freebsd/share/man/man4/auditpipe.4 (revision 673937ac0875a095b0c4d0e06eafa41b28a131ff)
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
43673937acSRobert Watsonunwieldy for live montoring 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:
77673937acSRobert Watson.Bl -tag -width AUDITPIPE_GET_QLIMIT_MIN
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.
98673937acSRobert Watson.El
99673937acSRobert Watson.Ss Audit Pipe Preselection Mode Ioctls
100673937acSRobert WatsonBy default, the audit pipe facility configures pipes to present records
101673937acSRobert Watsonmatched by the system-wide audit trail, configured by
102673937acSRobert Watson.Xr auditd 8 .
103673937acSRobert WatsonHowever, the preselection mechanism for audit pipes can be configured using
104673937acSRobert Watsonalternative criteria, including pipe-local flags and naflags settings, as
105673937acSRobert Watsonwell as auid-specific selection masks.
106673937acSRobert WatsonThis allows applications to track events not captured in the global audit
107673937acSRobert Watsontrail, as well as limit records presented to those of specific interest to
108673937acSRobert Watsonthe application.
109673937acSRobert Watson.Pp
110673937acSRobert WatsonThe following ioctls configure the preselection mode on an audit pipe:
111673937acSRobert Watson.Bl -tag -width AUDITPIPE_GET_PRESELECT_MODE
112673937acSRobert Watson.It AUDITPIPE_GET_PRESELECT_MODE
113673937acSRobert WatsonReturn the current preselect mode on the audit pipe.
114673937acSRobert WatsonThe ioctl argument should be of type
115673937acSRobert Watson.Vt int .
116673937acSRobert Watson.It AUDITPIPE_SET_PRESELECT_MODE
117673937acSRobert WatsonSet the current preselection mode on the audit pipe.
118673937acSRobert WatsonThe ioctl argument should be of type
119673937acSRobert Watson.Vt int .
120673937acSRobert Watson.El
121673937acSRobert Watson.Pp
122673937acSRobert WatsonPossible preselection mode values are:
123673937acSRobert Watson.Bl -tag -width AUDITPIPE_PRESELECT_MODE_TRAIL
124673937acSRobert Watson.It AUDITPIPE_PRESELECT_MODE_TRAIL
125673937acSRobert WatsonUse the global audit trail preselection parameters to select records for the
126673937acSRobert Watsonaudit pipe.
127673937acSRobert Watson.It AUDITPIPE_PRESELECT_MODE_LOCAL
128673937acSRobert WatsonUse local audit pipe preselection; this model is similar to the global audit
129673937acSRobert Watsontrail configuration model, consisting of global flags and naflags paramaters,
130673937acSRobert Watsonas well as a set of per-auid masks.
131673937acSRobert WatsonThese parameters are configured using further ioctls.
132673937acSRobert Watson.El
133673937acSRobert Watson.Pp
134673937acSRobert WatsonAfter changing the audit pipe preselection mode, records selected under
135673937acSRobert Watsonearlier preselection configuration may still be in the audit pipe queue.
136673937acSRobert WatsonThe application may flush the current record queue after changing the
137673937acSRobert Watsonconfiguration to remove possibly undesired records.
138673937acSRobert Watson.Ss Audit Pipe Local Preselection Mode Ioctls
139673937acSRobert WatsonThe following ioctls configure the preselection paramaters used when an audit
140673937acSRobert Watsonpipe is configured for the
141673937acSRobert Watson.Dv AUDITPIPE_PRESELECT_MODE_LOCAL
142673937acSRobert Watsonpreselection mode.
143673937acSRobert Watson.Bl -tag -width AUDITPIPE_GET_PRESELECT_NAFLAGS
144673937acSRobert Watson.It AUDITPIPE_GET_PRESELECT_FLAGS
145673937acSRobert WatsonRetrieve the current default preselection flags for attributable events on
146673937acSRobert Watsonthe pipe.
147673937acSRobert WatsonThese flags correspond to the
148673937acSRobert Watson.Dv flags
149673937acSRobert Watsonfield in
150673937acSRobert Watson.Xr audit_control 5 .
151673937acSRobert WatsonThe ioctl argument should be of type
152673937acSRobert Watson.Vt u_int .
153673937acSRobert Watson.It AUDITPIPE_SET_PRESELECT_FLAGS
154673937acSRobert WatsonSet the current default preselection flags for attributable events on the
155673937acSRobert Watsonpipe.
156673937acSRobert WatsonThese flags correspond to the
157673937acSRobert Watson.Dv flags
158673937acSRobert Watsonfield in
159673937acSRobert Watson.Xr audit_control 5 .
160673937acSRobert WatsonThe ioctl argument should be of type
161673937acSRobert Watson.Vt u_int .
162673937acSRobert Watson.It AUDITPIPE_GET_PRESELECT_NAFLAGS
163673937acSRobert WatsonRetrieve the current default preselection flags for non-attributable events
164673937acSRobert Watsonon the pipe.
165673937acSRobert WatsonThese flags correspond to the
166673937acSRobert Watson.Dv naflags
167673937acSRobert Watsonfield in
168673937acSRobert Watson.Xr audit_control 5 .
169673937acSRobert WatsonThe ioctl argument should be of type
170673937acSRobert Watson.Vt u_int .
171673937acSRobert Watson.It AUDITPIPE_SET_PRESELECT_NAFLAGS
172673937acSRobert WatsonSet the current default preselection flags for non-attributable events on the
173673937acSRobert Watsonpipe.
174673937acSRobert WatsonThese flags correspond to the
175673937acSRobert Watson.Dv naflags
176673937acSRobert Watsonfield in
177673937acSRobert Watson.Xr audit_control 5 .
178673937acSRobert WatsonThe ioctl argument should be of type
179673937acSRobert Watson.Vt u_int .
180673937acSRobert Watson.It AUDITPIPE_GET_PRESELECT_AUID
181673937acSRobert WatsonQuery the current preselection masks for a specific auid on the pipe.
182673937acSRobert WatsonThe ioctl argument should be of type
183673937acSRobert Watson.Vt struct auditpipe_preselect .
184673937acSRobert WatsonThe auid to query is specified via the
185673937acSRobert Watson.Va ap_auid
186673937acSRobert Watsonfield of type
187673937acSRobert Watson.Vt au_id_t ;
188673937acSRobert Watsonthe mask will be returned via
189673937acSRobert Watson.Va ap_mask
190673937acSRobert Watsonof type
191673937acSRobert Watson.Vt au_mask_t .
192673937acSRobert Watson.It AUDITPIPE_SET_PRESELECT_AUID
193673937acSRobert WatsonSet the current preselection masks for a specific auid on the pipe.
194673937acSRobert WatsonArguments are identical to
195673937acSRobert Watson.Dv AUDITPIPE_GET_PRESELECT_AUID,
196673937acSRobert Watsonexcept that the caller should properly initialize the
197673937acSRobert Watson.Va ap_mask
198673937acSRobert Watsonfield to hold the desired preselection mask.
199673937acSRobert Watson.It AUDITPIPE_DELETE_PRESELECT_AUID
200673937acSRobert WatsonDelete the current preselection mask for a specific auid on the pipe.
201673937acSRobert WatsonOnce called, events associated with the specified auid will use the default
202673937acSRobert Watsonflags mask.
203673937acSRobert WatsonThe ioctl argument should be of type
204673937acSRobert Watson.Vt au_id_t .
205673937acSRobert Watson.It AUDITPIPE_FLUSH_PRESELECT_AUID
206673937acSRobert WatsonDelete all auid specific preselection specifications.
207673937acSRobert Watson.El
208673937acSRobert Watson.Sh EXAMPLES
209673937acSRobert Watson.Xr praudit 1
210673937acSRobert Watsonmay be directly executed on
211673937acSRobert Watson.Pa /dev/auditpipe
212673937acSRobert Watsonto review the default audit trail.
213673937acSRobert Watson.Sh SEE ALSO
214673937acSRobert Watson.Xr poll 2 ,
215673937acSRobert Watson.Xr select 2 ,
216673937acSRobert Watson.Xr audit 4 ,
217673937acSRobert Watson.Xr audit_control 5 ,
218673937acSRobert Watson.Xr audit 8 ,
219673937acSRobert Watson.Xr auditd 8
220673937acSRobert Watson.Sh AUTHORS
221673937acSRobert WatsonThe audit pipe facility was designed and implemented by
222673937acSRobert Watson.An Robert Watson Aq rwatson@FreeBSD.org .
223673937acSRobert Watson.Pp
224673937acSRobert WatsonThe Basic Security Module (BSM) interface to audit records and audit event
225673937acSRobert Watsonstream format were defined by Sun Microsystems.
226673937acSRobert Watson.Sh HISTORY
227673937acSRobert WatsonThe OpenBSM implementation was created by McAfee Research, the security
228673937acSRobert Watsondivision of McAfee Inc., under contract to Apple Computer Inc. in 2004.
229673937acSRobert WatsonIt was subsequently adopted by the TrustedBSD Project as the foundation for
230673937acSRobert Watsonthe OpenBSM distribution.
231673937acSRobert Watson.Pp
232673937acSRobert WatsonSupport for kernel audit first appeared in
233673937acSRobert Watson.Fx 6.2 .
234673937acSRobert Watson.Sh BUGS
235673937acSRobert WatsonSee the
236673937acSRobert Watson.Xr audit 4
237673937acSRobert Watsonmanual page for information on audit-related bugs and limitations.
238673937acSRobert Watson.Pp
239673937acSRobert WatsonThe configurable preselection mechanism mirrors the selection model present
240673937acSRobert Watsonfor the global audit trail.
241673937acSRobert WatsonIt might be desirable to provided a more flexible selection model.
242673937acSRobert Watson.Pp
243673937acSRobert WatsonThe per-pipe audit event queue is fifo, with drops occuring if either the
244673937acSRobert Watsonuser thread provides in sufficient for the record on the queue head, or on
245673937acSRobert Watsonenqueue if there is insufficient room.
246673937acSRobert WatsonIt might be desirable to support partial reads of records, which would be
247673937acSRobert Watsonmore compatible with buffered I/O as implemented in system libraries, and to
248673937acSRobert Watsonallow applications to select which records are dropped, possibly in the style
249673937acSRobert Watsonof preselection.
250