Imported Upstream version 1.7.6p1
[debian/sudo] / sudoreplay.pod
1 Copyright (c) 2009-2010 Todd C. Miller <Todd.Miller@courtesan.com>
2
3 Permission to use, copy, modify, and distribute this software for any
4 purpose with or without fee is hereby granted, provided that the above
5 copyright notice and this permission notice appear in all copies.
6
7 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
16 =pod
17
18 =head1 NAME
19
20 sudoreplay - replay sudo session logs
21
22 =head1 SYNOPSIS
23
24 B<sudoreplay> [B<-h>] [B<-d> I<directory>] [B<-f> I<filter>] [B<-m> I<max_wait>] [B<-s> I<speed_factor>] ID
25
26 B<sudoreplay> [B<-h>] [B<-d> I<directory>] -l [search expression]
27
28 =head1 DESCRIPTION
29
30 B<sudoreplay> plays back or lists the session logs created by
31 B<sudo>.  When replaying, B<sudoreplay> can play the session back
32 in real-time, or the playback speed may be adjusted (faster or
33 slower) based on the command line options.  The I<ID> should be
34 a six character sequence of digits and upper case letters, e.g.
35 0100A5, which is logged by B<sudo> when a command is run with
36 session logging enabled.
37
38 In list mode, B<sudoreplay> can be used to find the ID of a session
39 based on a number of criteria such as the user, tty or command run.
40
41 In replay mode, if the standard output has not been redirected,
42 B<sudoreplay> will act on the following keys:
43
44 =over 8
45
46 =item ' ' (space)
47
48 Pause output; press any key to resume.
49
50 =item '<'
51
52 Reduce the playback speed by one half.
53
54 =item '>'
55
56 Double the playback speed.
57
58 =back
59
60 =head1 OPTIONS
61
62 B<sudoreplay> accepts the following command line options:
63
64 =over 12
65
66 =item -d I<directory>
67
68 Use I<directory> to for the session logs instead of the default,
69 F</var/log/sudo-io>.
70
71 =item -f I<filter>
72
73 By default, B<sudoreplay> will play back the command's standard
74 output, standard error and tty output.  The I<-f> option can be
75 used to select which of these to output.  The I<filter> argument
76 is a comma-separated list, consisting of one or more of following:
77 I<stdout>, I<stderr>, and I<ttyout>.
78
79 =item -h
80
81 The B<-h> (I<help>) option causes B<sudoreplay> to print a short
82 help message to the standard output and exit.
83
84 =item -l [I<search expression>]
85
86 Enable "list mode".  In this mode, B<sudoreplay> will list available
87 session IDs.  If a I<search expression> is specified, it will be
88 used to restrict the IDs that are displayed.  An expression is
89 composed of the following predicates:
90
91 =over 8
92
93 =item command I<command pattern>
94
95 Evaluates to true if the command run matches I<command pattern>.
96 On systems with POSIX regular expression support, the pattern may
97 be an extended regular expression.  On systems without POSIX regular
98 expression support, a simple substring match is performed instead.
99
100 =item cwd I<directory>
101
102 Evaluates to true if the command was run with the specified current
103 working directory.
104
105 =item fromdate I<date>
106
107 Evaluates to true if the command was run on or after I<date>.
108 See L<"Date and time format"> for a description of supported
109 date and time formats.
110
111 =item group I<runas_group>
112
113 Evaluates to true if the command was run with the specified
114 I<runas_group>.  Note that unless a I<runas_group> was explicitly
115 specified when B<sudo> was run this field will be empty in the log.
116
117 =item runas I<runas_user>
118
119 Evaluates to true if the command was run as the specified I<runas_user>.
120 Note that B<sudo> runs commands as user I<root> by default.
121
122 =item todate I<date>
123
124 Evaluates to true if the command was run on or prior to I<date>.
125 See L<"Date and time format"> for a description of supported
126 date and time formats.
127
128 =item tty I<tty>
129
130 Evaluates to true if the command was run on the specified terminal
131 device.  The I<tty> should be specified without the F</dev/> prefix,
132 e.g.  F<tty01> instead of F</dev/tty01>.
133
134 =item user I<user name>
135
136 Evaluates to true if the ID matches a command run by I<user name>.
137
138 =back
139
140 Predicates may be abbreviated to the shortest unique string (currently
141 all predicates may be shortened to a single character).
142
143 Predicates may be combined using I<and>, I<or> and I<!> operators
144 as well as C<'('> and C<')'> for grouping (note that parentheses
145 must generally be escaped from the shell).  The I<and> operator is
146 optional, adjacent predicates have an implied I<and> unless separated
147 by an I<or>.
148
149 =item -m I<max_wait>
150
151 Specify an upper bound on how long to wait between key presses or
152 output data.  By default, B<sudo_replay> will accurately reproduce
153 the delays between key presses or program output.  However, this
154 can be tedious when the session includes long pauses.  When the
155 I<-m> option is specified, B<sudoreplay> will limit these pauses
156 to at most I<max_wait> seconds.  The value may be specified as a
157 floating point number, .e.g. I<2.5>.
158
159 =item -s I<speed_factor>
160
161 This option causes B<sudoreplay> to adjust the number of seconds
162 it will wait between key presses or program output.  This can be
163 used to slow down or speed up the display.  For example, a
164 I<speed_factor> of I<2> would make the output twice as fast whereas
165 a I<speed_factor> of <.5> would make the output twice as slow.
166
167 =item -V
168
169 The B<-V> (version) option causes B<sudoreplay> to print its version number
170 and exit.
171
172 =back
173
174 =head2 Date and time format
175
176 The time and date may be specified multiple ways, common formats include:
177
178 =over 8
179
180 =item HH:MM:SS am MM/DD/CCYY timezone
181
182 24 hour time may be used in place of am/pm.
183
184 =item HH:MM:SS am Month, Day Year timezone
185
186 24 hour time may be used in place of am/pm, and month and day names
187 may be abbreviated.  Note that month and day of the week names must
188 be specified in English.
189
190 =item CCYY-MM-DD HH:MM:SS
191
192 ISO time format
193
194 =item DD Month CCYY HH:MM:SS
195
196 The month name may be abbreviated.
197
198 =back
199
200 Either time or date may be omitted, the am/pm and timezone are
201 optional.  If no date is specified, the current day is assumed; if
202 no time is specified, the first second of the specified date is
203 used.  The less significant parts of both time and date may also
204 be omitted, in which case zero is assumed.  For example, the following
205 are all valid:
206
207 The following are all valid time and date specifications:
208
209 =over 8
210
211 =item now
212
213 The current time and date.
214
215 =item tomorrow
216
217 Exactly one day from now.
218
219 =item yesterday
220
221 24 hours ago.
222
223 =item 2 hours ago
224
225 2 hours ago.
226
227 =item next Friday
228
229 The first second of the next Friday.
230
231 =item this week
232
233 The current time but the first day of the coming week.
234
235 =item a fortnight ago
236
237 The current time but 14 days ago.
238
239 =item 10:01 am 9/17/2009
240
241 10:01 am, September 17, 2009.
242
243 =item 10:01 am
244
245 10:01 am on the current day.
246
247 =item 10
248
249 10:00 am on the current day.
250
251 =item 9/17/2009
252
253 00:00 am, September 17, 2009.
254
255 =item 10:01 am Sep 17, 2009
256
257 10:01 am, September 17, 2009.
258
259 =back
260
261 =head1 FILES
262
263 =over 24
264
265 =item F</var/log/sudo-io>
266
267 The default I/O log directory.
268
269 =item F</var/log/sudo-io/00/00/01/log>
270
271 Example session log info.
272
273 =item F</var/log/sudo-io/00/00/01/stdin>
274
275 Example session standard input log.
276
277 =item F</var/log/sudo-io/00/00/01/stdout>
278
279 Example session standard output log.
280
281 =item F</var/log/sudo-io/00/00/01/stderr>
282
283 Example session standard error log.
284
285 =item F</var/log/sudo-io/00/00/01/ttyin>
286
287 Example session tty input file.
288
289 =item F</var/log/sudo-io/00/00/01/ttyout>
290
291 Example session tty output file.
292
293 =item F</var/log/sudo-io/00/00/01/timing>
294
295 Example session timing file.
296
297 =back
298
299 Note that the I<stdin>, I<stdout> and I<stderr> files will be empty
300 unless B<sudo> was used as part of a pipeline for a particular
301 command.
302
303 =head1 EXAMPLES
304
305 List sessions run by user I<millert>:
306
307  sudoreplay -l user millert
308
309 List sessions run by user I<bob> with a command containing the string vi:
310
311  sudoreplay -l user bob command vi
312
313 List sessions run by user I<jeff> that match a regular expression:
314
315  sudoreplay -l user jeff command '/bin/[a-z]*sh'
316
317 List sessions run by jeff or bob on the console:
318
319  sudoreplay -l ( user jeff or user bob ) tty console
320
321 =head1 SEE ALSO
322
323 L<sudo(8)>, L<script(1)>
324
325 =head1 AUTHOR
326
327 Todd C. Miller
328
329 =head1 BUGS
330
331 If you feel you have found a bug in B<sudoreplay>, please submit a bug report
332 at http://www.sudo.ws/sudo/bugs/
333
334 =head1 SUPPORT
335
336 Limited free support is available via the sudo-users mailing list,
337 see http://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or
338 search the archives.
339
340 =head1 DISCLAIMER
341
342 B<sudoreplay> is provided ``AS IS'' and any express or implied warranties,
343 including, but not limited to, the implied warranties of merchantability
344 and fitness for a particular purpose are disclaimed.  See the LICENSE
345 file distributed with B<sudo> or http://www.sudo.ws/sudo/license.html
346 for complete details.