xref: /freebsd/share/man/man4/auditpipe.4 (revision aa12cea2ccc6e686d6d31cf67d6bc69cbc1ba744)
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.Dt AUDITPIPE 4
29*aa12cea2SUlrich Spörlein.Os
30673937acSRobert Watson.Sh NAME
31673937acSRobert Watson.Nm auditpipe
32ae91966bSRuslan Ermilov.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,
67ae91966bSRuslan Ermilovasynchronous I/O using
68ae91966bSRuslan Ermilov.Dv SIGIO ,
69ae91966bSRuslan Ermilovand polled operation via
70673937acSRobert Watson.Xr select 2
71673937acSRobert Watsonand
72673937acSRobert Watson.Xr poll 2 .
73673937acSRobert Watson.Pp
74673937acSRobert WatsonApplications may choose to track the global audit trail, or configure local
75673937acSRobert Watsonpreselection parameters independent of the global audit trail parameters.
76673937acSRobert Watson.Ss Audit Pipe Queue Ioctls
77673937acSRobert WatsonThe following ioctls retrieve and set various audit pipe record queue
78673937acSRobert Watsonproperties:
79ae91966bSRuslan Ermilov.Bl -tag -width ".Dv AUDITPIPE_GET_MAXAUDITDATA"
80ae91966bSRuslan Ermilov.It Dv AUDITPIPE_GET_QLEN
81673937acSRobert WatsonQuery the current number of records available for reading on the pipe.
82ae91966bSRuslan Ermilov.It Dv AUDITPIPE_GET_QLIMIT
83673937acSRobert WatsonRetrieve the current maximum number of records that may be queued for reading
84673937acSRobert Watsonon the pipe.
85ae91966bSRuslan Ermilov.It Dv AUDITPIPE_SET_QLIMIT
86673937acSRobert WatsonSet the current maximum number of records that may be queued for reading on
87673937acSRobert Watsonthe pipe.
88673937acSRobert WatsonThe new limit must fall between the queue limit minimum and queue limit
89673937acSRobert Watsonmaximum queryable using the following two ioctls.
90ae91966bSRuslan Ermilov.It Dv AUDITPIPE_GET_QLIMIT_MIN
91673937acSRobert WatsonQuery the lowest possible maximum number of records that may be queued for
92673937acSRobert Watsonreading on the pipe.
93ae91966bSRuslan Ermilov.It Dv AUDITPIPE_GET_QLIMIT_MAX
94673937acSRobert WatsonQuery the highest possible maximum number of records that may be queued for
95673937acSRobert Watsonreading on the pipe.
96ae91966bSRuslan Ermilov.It Dv AUDITPIPE_FLUSH
97673937acSRobert WatsonFlush all outstanding records on the audit pipe; useful after setting initial
98673937acSRobert Watsonpreselection properties to delete records queued during the configuration
99673937acSRobert Watsonprocess which may not match the interests of the user process.
100ae91966bSRuslan Ermilov.It Dv AUDITPIPE_GET_MAXAUDITDATA
1019fe741b8SRobert WatsonQuery the maximum size of an audit record, which is a useful minimum size for
1029fe741b8SRobert Watsona user space buffer intended to hold audit records read from the audit pipe.
103673937acSRobert Watson.El
104673937acSRobert Watson.Ss Audit Pipe Preselection Mode Ioctls
105673937acSRobert WatsonBy default, the audit pipe facility configures pipes to present records
106673937acSRobert Watsonmatched by the system-wide audit trail, configured by
107673937acSRobert Watson.Xr auditd 8 .
108673937acSRobert WatsonHowever, the preselection mechanism for audit pipes can be configured using
109673937acSRobert Watsonalternative criteria, including pipe-local flags and naflags settings, as
110673937acSRobert Watsonwell as auid-specific selection masks.
111673937acSRobert WatsonThis allows applications to track events not captured in the global audit
112673937acSRobert Watsontrail, as well as limit records presented to those of specific interest to
113673937acSRobert Watsonthe application.
114673937acSRobert Watson.Pp
115673937acSRobert WatsonThe following ioctls configure the preselection mode on an audit pipe:
116ae91966bSRuslan Ermilov.Bl -tag -width ".Dv AUDITPIPE_GET_PRESELECT_MODE"
117ae91966bSRuslan Ermilov.It Dv AUDITPIPE_GET_PRESELECT_MODE
118673937acSRobert WatsonReturn the current preselect mode on the audit pipe.
119673937acSRobert WatsonThe ioctl argument should be of type
120673937acSRobert Watson.Vt int .
121ae91966bSRuslan Ermilov.It Dv AUDITPIPE_SET_PRESELECT_MODE
122673937acSRobert WatsonSet the current preselection mode on the audit pipe.
123673937acSRobert WatsonThe ioctl argument should be of type
124673937acSRobert Watson.Vt int .
125673937acSRobert Watson.El
126673937acSRobert Watson.Pp
127673937acSRobert WatsonPossible preselection mode values are:
128ae91966bSRuslan Ermilov.Bl -tag -width ".Dv AUDITPIPE_PRESELECT_MODE_TRAIL"
129ae91966bSRuslan Ermilov.It Dv AUDITPIPE_PRESELECT_MODE_TRAIL
130673937acSRobert WatsonUse the global audit trail preselection parameters to select records for the
131673937acSRobert Watsonaudit pipe.
132ae91966bSRuslan Ermilov.It Dv AUDITPIPE_PRESELECT_MODE_LOCAL
133673937acSRobert WatsonUse local audit pipe preselection; this model is similar to the global audit
1341735925eSJoel Dahltrail configuration model, consisting of global flags and naflags parameters,
135673937acSRobert Watsonas well as a set of per-auid masks.
136673937acSRobert WatsonThese parameters are configured using further ioctls.
137673937acSRobert Watson.El
138673937acSRobert Watson.Pp
139673937acSRobert WatsonAfter changing the audit pipe preselection mode, records selected under
140673937acSRobert Watsonearlier preselection configuration may still be in the audit pipe queue.
141673937acSRobert WatsonThe application may flush the current record queue after changing the
142673937acSRobert Watsonconfiguration to remove possibly undesired records.
143673937acSRobert Watson.Ss Audit Pipe Local Preselection Mode Ioctls
1441735925eSJoel DahlThe following ioctls configure the preselection parameters used when an audit
145673937acSRobert Watsonpipe is configured for the
146673937acSRobert Watson.Dv AUDITPIPE_PRESELECT_MODE_LOCAL
147673937acSRobert Watsonpreselection mode.
148ae91966bSRuslan Ermilov.Bl -tag -width ".Dv AUDITPIPE_GET_PRESELECT_NAFLAGS"
149ae91966bSRuslan Ermilov.It Dv AUDITPIPE_GET_PRESELECT_FLAGS
150673937acSRobert WatsonRetrieve the current default preselection flags for attributable events on
151673937acSRobert Watsonthe pipe.
152673937acSRobert WatsonThese flags correspond to the
153ae91966bSRuslan Ermilov.Va flags
154673937acSRobert Watsonfield in
155673937acSRobert Watson.Xr audit_control 5 .
156673937acSRobert WatsonThe ioctl argument should be of type
157673937acSRobert Watson.Vt u_int .
158ae91966bSRuslan Ermilov.It Dv AUDITPIPE_SET_PRESELECT_FLAGS
159673937acSRobert WatsonSet the current default preselection flags for attributable events on the
160673937acSRobert Watsonpipe.
161673937acSRobert WatsonThese flags correspond to the
162ae91966bSRuslan Ermilov.Va flags
163673937acSRobert Watsonfield in
164673937acSRobert Watson.Xr audit_control 5 .
165673937acSRobert WatsonThe ioctl argument should be of type
166673937acSRobert Watson.Vt u_int .
167ae91966bSRuslan Ermilov.It Dv AUDITPIPE_GET_PRESELECT_NAFLAGS
168673937acSRobert WatsonRetrieve the current default preselection flags for non-attributable events
169673937acSRobert Watsonon the pipe.
170673937acSRobert WatsonThese flags correspond to the
171ae91966bSRuslan Ermilov.Va naflags
172673937acSRobert Watsonfield in
173673937acSRobert Watson.Xr audit_control 5 .
174673937acSRobert WatsonThe ioctl argument should be of type
175673937acSRobert Watson.Vt u_int .
176ae91966bSRuslan Ermilov.It Dv AUDITPIPE_SET_PRESELECT_NAFLAGS
177673937acSRobert WatsonSet the current default preselection flags for non-attributable events on the
178673937acSRobert Watsonpipe.
179673937acSRobert WatsonThese flags correspond to the
180ae91966bSRuslan Ermilov.Va naflags
181673937acSRobert Watsonfield in
182673937acSRobert Watson.Xr audit_control 5 .
183673937acSRobert WatsonThe ioctl argument should be of type
184673937acSRobert Watson.Vt u_int .
185ae91966bSRuslan Ermilov.It Dv AUDITPIPE_GET_PRESELECT_AUID
186673937acSRobert WatsonQuery the current preselection masks for a specific auid on the pipe.
187673937acSRobert WatsonThe ioctl argument should be of type
188b9540a02SRobert Watson.Vt "struct auditpipe_ioctl_preselect" .
189673937acSRobert WatsonThe auid to query is specified via the
190673937acSRobert Watson.Va ap_auid
191673937acSRobert Watsonfield of type
192673937acSRobert Watson.Vt au_id_t ;
193673937acSRobert Watsonthe mask will be returned via
194673937acSRobert Watson.Va ap_mask
195673937acSRobert Watsonof type
196673937acSRobert Watson.Vt au_mask_t .
197ae91966bSRuslan Ermilov.It Dv AUDITPIPE_SET_PRESELECT_AUID
198673937acSRobert WatsonSet the current preselection masks for a specific auid on the pipe.
199673937acSRobert WatsonArguments are identical to
200673937acSRobert Watson.Dv AUDITPIPE_GET_PRESELECT_AUID ,
201673937acSRobert Watsonexcept that the caller should properly initialize the
202673937acSRobert Watson.Va ap_mask
203673937acSRobert Watsonfield to hold the desired preselection mask.
204ae91966bSRuslan Ermilov.It Dv AUDITPIPE_DELETE_PRESELECT_AUID
205673937acSRobert WatsonDelete the current preselection mask for a specific auid on the pipe.
206673937acSRobert WatsonOnce called, events associated with the specified auid will use the default
207673937acSRobert Watsonflags mask.
208673937acSRobert WatsonThe ioctl argument should be of type
209673937acSRobert Watson.Vt au_id_t .
210ae91966bSRuslan Ermilov.It Dv AUDITPIPE_FLUSH_PRESELECT_AUID
211673937acSRobert WatsonDelete all auid specific preselection specifications.
212673937acSRobert Watson.El
213673937acSRobert Watson.Sh EXAMPLES
214ae91966bSRuslan ErmilovThe
215673937acSRobert Watson.Xr praudit 1
216ae91966bSRuslan Ermilovutility
217673937acSRobert Watsonmay be directly executed on
218673937acSRobert Watson.Pa /dev/auditpipe
219673937acSRobert Watsonto review the default audit trail.
220673937acSRobert Watson.Sh SEE ALSO
221673937acSRobert Watson.Xr poll 2 ,
222673937acSRobert Watson.Xr select 2 ,
223673937acSRobert Watson.Xr audit 4 ,
224673937acSRobert Watson.Xr audit_control 5 ,
225673937acSRobert Watson.Xr audit 8 ,
226673937acSRobert Watson.Xr auditd 8
227ae91966bSRuslan Ermilov.Sh HISTORY
228ae91966bSRuslan ErmilovThe OpenBSM implementation was created by McAfee Research, the security
229ae91966bSRuslan Ermilovdivision of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
230ae91966bSRuslan ErmilovIt was subsequently adopted by the TrustedBSD Project as the foundation for
231ae91966bSRuslan Ermilovthe OpenBSM distribution.
232ae91966bSRuslan Ermilov.Pp
233ae91966bSRuslan ErmilovSupport for kernel audit first appeared in
234ae91966bSRuslan Ermilov.Fx 6.2 .
235673937acSRobert Watson.Sh AUTHORS
236673937acSRobert WatsonThe audit pipe facility was designed and implemented by
237673937acSRobert Watson.An Robert Watson Aq rwatson@FreeBSD.org .
238673937acSRobert Watson.Pp
239673937acSRobert WatsonThe Basic Security Module (BSM) interface to audit records and audit event
240673937acSRobert Watsonstream format were defined by Sun Microsystems.
241673937acSRobert Watson.Sh BUGS
242673937acSRobert WatsonSee the
243673937acSRobert Watson.Xr audit 4
244673937acSRobert Watsonmanual page for information on audit-related bugs and limitations.
245673937acSRobert Watson.Pp
246673937acSRobert WatsonThe configurable preselection mechanism mirrors the selection model present
247673937acSRobert Watsonfor the global audit trail.
248673937acSRobert WatsonIt might be desirable to provided a more flexible selection model.
249673937acSRobert Watson.Pp
2500af22117SMike PritchardThe per-pipe audit event queue is fifo, with drops occurring if either the
251673937acSRobert Watsonuser thread provides in sufficient for the record on the queue head, or on
252673937acSRobert Watsonenqueue if there is insufficient room.
253673937acSRobert WatsonIt might be desirable to support partial reads of records, which would be
254673937acSRobert Watsonmore compatible with buffered I/O as implemented in system libraries, and to
255673937acSRobert Watsonallow applications to select which records are dropped, possibly in the style
256673937acSRobert Watsonof preselection.
257