]> granicus.if.org Git - sudo/blob - doc/sudoreplay.man.in
Add SPDX-License-Identifier to files.
[sudo] / doc / sudoreplay.man.in
1 .\" Automatically generated from an mdoc input file.  Do not edit.
2 .\"
3 .\" SPDX-License-Identifier: ISC
4 .\"
5 .\" Copyright (c) 2009-2018 Todd C. Miller <Todd.Miller@sudo.ws>
6 .\"
7 .\" Permission to use, copy, modify, and distribute this software for any
8 .\" purpose with or without fee is hereby granted, provided that the above
9 .\" copyright notice and this permission notice appear in all copies.
10 .\"
11 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 .\"
19 .TH "SUDOREPLAY" "@mansectsu@" "October 6, 2018" "Sudo @PACKAGE_VERSION@" "System Manager's Manual"
20 .nh
21 .if n .ad l
22 .SH "NAME"
23 \fBsudoreplay\fR
24 \- replay sudo session logs
25 .SH "SYNOPSIS"
26 .HP 11n
27 \fBsudoreplay\fR
28 [\fB\-hnRS\fR]
29 [\fB\-d\fR\ \fIdir\fR]
30 [\fB\-f\fR\ \fIfilter\fR]
31 [\fB\-m\fR\ \fInum\fR]
32 [\fB\-s\fR\ \fInum\fR]
33 ID
34 .HP 11n
35 \fBsudoreplay\fR
36 [\fB\-h\fR]
37 [\fB\-d\fR\ \fIdir\fR]
38 \fB\-l\fR
39 [search\ expression]
40 .SH "DESCRIPTION"
41 \fBsudoreplay\fR
42 plays back or lists the output logs created by
43 \fBsudo\fR.
44 When replaying,
45 \fBsudoreplay\fR
46 can play the session back in real-time, or the playback speed may be
47 adjusted (faster or slower) based on the command line options.
48 .PP
49 The
50 \fIID\fR
51 should either be a six character sequence of digits and
52 upper case letters, e.g.,
53 \fR0100A5\fR,
54 or a pattern matching the
55 \fIiolog_file\fR
56 option in the
57 \fIsudoers\fR
58 file.
59 When a command is run via
60 \fBsudo\fR
61 with
62 \fIlog_output\fR
63 enabled in the
64 \fIsudoers\fR
65 file, a
66 \fRTSID=ID\fR
67 string is logged via syslog or to the
68 \fBsudo\fR
69 log file.
70 The
71 \fIID\fR
72 may also be determined using
73 \fBsudoreplay\fR's
74 list mode.
75 .PP
76 In list mode,
77 \fBsudoreplay\fR
78 can be used to find the ID of a session based on a number of criteria
79 such as the user, tty or command run.
80 .PP
81 In replay mode, if the standard input and output are connected to a terminal
82 and the
83 \fB\-n\fR
84 option is not specified,
85 \fBsudoreplay\fR
86 will operate interactively.
87 In interactive mode,
88 \fBsudoreplay\fR
89 will attempt to adjust the terminal size to match that of the session and
90 write directly to the terminal (not all terminals support this).
91 Additionally, it will poll the keyboard and act on the following keys:
92 .TP 14n
93 \(oq\fR\en\fR\(cq or \(oq\fR\er\fR\(cq
94 Skip to the next replay event; useful for long pauses.
95 .TP 14n
96 \(oq\fR\ \fR\(cq (space)
97 Pause output; press any key to resume.
98 .TP 14n
99 \(oq<\(cq
100 Reduce the playback speed by one half.
101 .TP 14n
102 \(oq>\(cq
103 Double the playback speed.
104 .PP
105 The session can be interrupted via control-C.
106 When the session has finished, the terminal is restored to its
107 original size if it was changed during playback.
108 .PP
109 The options are as follows:
110 .TP 12n
111 \fB\-d\fR \fIdir\fR, \fB\--directory\fR=\fIdir\fR
112 Store session logs in
113 \fIdir\fR
114 instead of the default,
115 \fI@iolog_dir@\fR.
116 .TP 12n
117 \fB\-f\fR \fIfilter\fR, \fB\--filter\fR=\fIfilter\fR
118 Select which I/O type(s) to display.
119 By default,
120 \fBsudoreplay\fR
121 will display the command's standard output, standard error and tty output.
122 The
123 \fIfilter\fR
124 argument is a comma-separated list, consisting of one or more of following:
125 \fIstdin\fR,
126 \fIstdout\fR,
127 \fIstderr\fR,
128 \fIttyin\fR,
129 and
130 \fIttyout\fR.
131 .TP 12n
132 \fB\-h\fR, \fB\--help\fR
133 Display a short help message to the standard output and exit.
134 .TP 12n
135 \fB\-l\fR, \fB\--list\fR [\fIsearch expression\fR]
136 Enable
137 \(lqlist mode\(rq.
138 In this mode,
139 \fBsudoreplay\fR
140 will list available sessions in a format similar to the
141 \fBsudo\fR
142 log file format, sorted by file name (or sequence number).
143 If a
144 \fIsearch expression\fR
145 is specified, it will be used to restrict the IDs that are displayed.
146 An expression is composed of the following predicates:
147 .PP
148 .RS 12n
149 .PD 0
150 .TP 8n
151 command \fIpattern\fR
152 Evaluates to true if the command run matches the POSIX extended
153 regular expression
154 \fIpattern\fR.
155 .PD
156 .TP 8n
157 cwd \fIdirectory\fR
158 Evaluates to true if the command was run with the specified current
159 working directory.
160 .TP 8n
161 fromdate \fIdate\fR
162 Evaluates to true if the command was run on or after
163 \fIdate\fR.
164 See
165 \fIDate and time format\fR
166 for a description of supported date and time formats.
167 .TP 8n
168 group \fIrunas_group\fR
169 Evaluates to true if the command was run with the specified
170 \fIrunas_group\fR.
171 Note that unless a
172 \fIrunas_group\fR
173 was explicitly specified when
174 \fBsudo\fR
175 was run this field will be empty in the log.
176 .TP 8n
177 runas \fIrunas_user\fR
178 Evaluates to true if the command was run as the specified
179 \fIrunas_user\fR.
180 Note that
181 \fBsudo\fR
182 runs commands as user
183 \fIroot\fR
184 by default.
185 .TP 8n
186 todate \fIdate\fR
187 Evaluates to true if the command was run on or prior to
188 \fIdate\fR.
189 See
190 \fIDate and time format\fR
191 for a description of supported date and time formats.
192 .TP 8n
193 tty \fItty name\fR
194 Evaluates to true if the command was run on the specified terminal device.
195 The
196 \fItty name\fR
197 should be specified without the
198 \fI/dev/\fR
199 prefix, e.g.,
200 \fItty01\fR
201 instead of
202 \fI/dev/tty01\fR.
203 .TP 8n
204 user \fIuser name\fR
205 Evaluates to true if the ID matches a command run by
206 \fIuser name\fR.
207 .PP
208 Predicates may be abbreviated to the shortest unique string.
209 .sp
210 Predicates may be combined using
211 \fIand\fR,
212 \fIor\fR
213 and
214 \fI\&!\fR
215 operators as well as
216 \(oq\&(\(cq
217 and
218 \(oq\&)\(cq
219 grouping (note that parentheses must generally be escaped from the shell).
220 The
221 \fIand\fR
222 operator is optional, adjacent predicates have an implied
223 \fIand\fR
224 unless separated by an
225 \fIor\fR.
226 .RE
227 .TP 12n
228 \fB\-m\fR, \fB\--max-wait\fR \fImax_wait\fR
229 Specify an upper bound on how long to wait between key presses or output data.
230 By default,
231 \fBsudoreplay\fR
232 will accurately reproduce the delays between key presses or program output.
233 However, this can be tedious when the session includes long pauses.
234 When the
235 \fB\-m\fR
236 option is specified,
237 \fBsudoreplay\fR
238 will limit these pauses to at most
239 \fImax_wait\fR
240 seconds.
241 The value may be specified as a floating point number, e.g.,
242 \fI2.5\fR.
243 A
244 \fImax_wait\fR
245 of zero or less will eliminate the pauses entirely.
246 .TP 12n
247 \fB\-n\fR, \fB\--non-interactive\fR
248 Do not prompt for user input or attempt to re-size the terminal.
249 The session is written to the standard output, not directly to
250 the user's terminal.
251 .TP 12n
252 \fB\-R\fR, \fB\--no-resize\fR
253 Do not attempt to re-size the terminal to match the terminal size
254 of the session.
255 .TP 12n
256 \fB\-S\fR, \fB\--suspend-wait\fR
257 Wait while the command was suspended.
258 By default,
259 \fBsudoreplay\fR
260 will ignore the time interval between when the command was suspended
261 and when it was resumed.
262 If the
263 \fB\-S\fR
264 option is specified,
265 \fBsudoreplay\fR
266 will wait instead.
267 .TP 12n
268 \fB\-s\fR, \fB\--speed\fR \fIspeed_factor\fR
269 This option causes
270 \fBsudoreplay\fR
271 to adjust the number of seconds it will wait between key presses or
272 program output.
273 This can be used to slow down or speed up the display.
274 For example, a
275 \fIspeed_factor\fR
276 of
277 \fI2\fR
278 would make the output twice as fast whereas a
279 \fIspeed_factor\fR
280 of
281 \fI.5\fR
282 would make the output twice as slow.
283 .TP 12n
284 \fB\-V\fR, \fB\--version\fR
285 Print the
286 \fBsudoreplay\fR
287 versions version number and exit.
288 .SS "Date and time format"
289 The time and date may be specified multiple ways, common formats include:
290 .TP 8n
291 HH:MM:SS am MM/DD/CCYY timezone
292 24 hour time may be used in place of am/pm.
293 .TP 8n
294 HH:MM:SS am Month, Day Year timezone
295 24 hour time may be used in place of am/pm, and month and day names
296 may be abbreviated.
297 Note that month and day of the week names must be specified in English.
298 .TP 8n
299 CCYY-MM-DD HH:MM:SS
300 ISO time format
301 .TP 8n
302 DD Month CCYY HH:MM:SS
303 The month name may be abbreviated.
304 .PP
305 Either time or date may be omitted, the am/pm and timezone are optional.
306 If no date is specified, the current day is assumed; if no time is
307 specified, the first second of the specified date is used.
308 The less significant parts of both time and date may also be omitted,
309 in which case zero is assumed.
310 .PP
311 The following are all valid time and date specifications:
312 .TP 8n
313 now
314 The current time and date.
315 .TP 8n
316 tomorrow
317 Exactly one day from now.
318 .TP 8n
319 yesterday
320 24 hours ago.
321 .TP 8n
322 2 hours ago
323 2 hours ago.
324 .TP 8n
325 next Friday
326 The first second of the Friday in the next (upcoming) week.
327 Not to be confused with
328 \(lqthis Friday\(rq
329 which would match the Friday of the current week.
330 .TP 8n
331 last week
332 The current time but 7 days ago.
333 This is equivalent to
334 \(lqa week ago\(rq.
335 .TP 8n
336 a fortnight ago
337 The current time but 14 days ago.
338 .TP 8n
339 10:01 am 9/17/2009
340 10:01 am, September 17, 2009.
341 .TP 8n
342 10:01 am
343 10:01 am on the current day.
344 .TP 8n
345 10
346 10:00 am on the current day.
347 .TP 8n
348 9/17/2009
349 00:00 am, September 17, 2009.
350 .TP 8n
351 10:01 am Sep 17, 2009
352 10:01 am, September 17, 2009.
353 .PP
354 Note that relative time specifications do not always work as expected.
355 For example, the
356 \(lqnext\(rq
357 qualifier is intended to be used in conjunction with a day such as
358 \(lqnext Monday\(rq.
359 When used with units of weeks, months, years, etc
360 the result will be one more than expected.
361 For example,
362 \(lqnext week\(rq
363 will result in a time exactly two weeks from now, which is probably
364 not what was intended.
365 This will be addressed in a future version of
366 \fBsudoreplay\fR.
367 .SS "Debugging sudoreplay"
368 \fBsudoreplay\fR
369 versions 1.8.4 and higher support a flexible debugging framework
370 that is configured via
371 \fRDebug\fR
372 lines in the
373 sudo.conf(@mansectform@)
374 file.
375 .PP
376 For more information on configuring
377 sudo.conf(@mansectform@),
378 please refer to its manual.
379 .SH "FILES"
380 .TP 26n
381 \fI@sysconfdir@/sudo.conf\fR
382 Debugging framework configuration
383 .TP 26n
384 \fI@iolog_dir@\fR
385 The default I/O log directory.
386 .TP 26n
387 \fI@iolog_dir@/00/00/01/log\fR
388 Example session log info.
389 .TP 26n
390 \fI@iolog_dir@/00/00/01/stdin\fR
391 Example session standard input log.
392 .TP 26n
393 \fI@iolog_dir@/00/00/01/stdout\fR
394 Example session standard output log.
395 .TP 26n
396 \fI@iolog_dir@/00/00/01/stderr\fR
397 Example session standard error log.
398 .TP 26n
399 \fI@iolog_dir@/00/00/01/ttyin\fR
400 Example session tty input file.
401 .TP 26n
402 \fI@iolog_dir@/00/00/01/ttyout\fR
403 Example session tty output file.
404 .TP 26n
405 \fI@iolog_dir@/00/00/01/timing\fR
406 Example session timing file.
407 .PP
408 Note that the
409 \fIstdin\fR,
410 \fIstdout\fR
411 and
412 \fIstderr\fR
413 files will be empty unless
414 \fBsudo\fR
415 was used as part of a pipeline for a particular command.
416 .SH "EXAMPLES"
417 List sessions run by user
418 \fImillert\fR:
419 .nf
420 .sp
421 .RS 6n
422 # sudoreplay -l user millert
423 .RE
424 .fi
425 .PP
426 List sessions run by user
427 \fIbob\fR
428 with a command containing the string vi:
429 .nf
430 .sp
431 .RS 6n
432 # sudoreplay -l user bob command vi
433 .RE
434 .fi
435 .PP
436 List sessions run by user
437 \fIjeff\fR
438 that match a regular expression:
439 .nf
440 .sp
441 .RS 6n
442 # sudoreplay -l user jeff command '/bin/[a-z]*sh'
443 .RE
444 .fi
445 .PP
446 List sessions run by jeff or bob on the console:
447 .nf
448 .sp
449 .RS 6n
450 # sudoreplay -l ( user jeff or user bob ) tty console
451 .RE
452 .fi
453 .SH "SEE ALSO"
454 script(1),
455 sudo.conf(@mansectform@),
456 sudo(@mansectsu@)
457 .SH "AUTHORS"
458 Many people have worked on
459 \fBsudo\fR
460 over the years; this version consists of code written primarily by:
461 .sp
462 .RS 6n
463 Todd C. Miller
464 .RE
465 .PP
466 See the CONTRIBUTORS file in the
467 \fBsudo\fR
468 distribution (https://www.sudo.ws/contributors.html) for an
469 exhaustive list of people who have contributed to
470 \fBsudo\fR.
471 .SH "BUGS"
472 If you feel you have found a bug in
473 \fBsudoreplay\fR,
474 please submit a bug report at https://bugzilla.sudo.ws/
475 .SH "SUPPORT"
476 Limited free support is available via the sudo-users mailing list,
477 see https://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or
478 search the archives.
479 .SH "DISCLAIMER"
480 \fBsudoreplay\fR
481 is provided
482 \(lqAS IS\(rq
483 and any express or implied warranties, including, but not limited
484 to, the implied warranties of merchantability and fitness for a
485 particular purpose are disclaimed.
486 See the LICENSE file distributed with
487 \fBsudo\fR
488 or https://www.sudo.ws/license.html for complete details.