1SUDOREPLAY(8)             BSD System Manager's Manual            SUDOREPLAY(8)
2

NAME

4     sudoreplay — replay sudo session logs
5

SYNOPSIS

7     sudoreplay [-FhnRS] [-d dir] [-f filter] [-m num] [-s num] ID
8
9     sudoreplay [-h] [-d dir] -l [search expression]
10

DESCRIPTION

12     sudoreplay plays back or lists the output logs created by sudo.  When
13     replaying, sudoreplay can play the session back in real-time, or the
14     playback speed may be adjusted (faster or slower) based on the command
15     line options.
16
17     The ID should either be a six character sequence of digits and upper case
18     letters, e.g., 0100A5, a pattern matching the iolog_file option in the
19     sudoers file, or a path name.  Path names may be relative to the
20     iolog_dir option in the sudoers file (unless overridden by the -d option)
21     or fully qualified, beginning with a ‘/’ character.  When a command is
22     run via sudo with log_output enabled in the sudoers file, a TSID=ID
23     string is logged via syslog or to the sudo log file.  The ID may also be
24     determined using sudoreplay's list mode.
25
26     In list mode, sudoreplay can be used to find the ID of a session based on
27     a number of criteria such as the user, tty or command run.
28
29     In replay mode, if the standard input and output are connected to a ter‐
30     minal and the -n option is not specified, sudoreplay will operate inter‐
31     actively.  In interactive mode, sudoreplay will attempt to adjust the
32     terminal size to match that of the session and write directly to the ter‐
33     minal (not all terminals support this).  Additionally, it will poll the
34     keyboard and act on the following keys:
35
36     ‘\n’ or ‘\r’  Skip to the next replay event; useful for long pauses.
37
38     ‘ ’ (space)   Pause output; press any key to resume.
39
40     ‘<’           Reduce the playback speed by one half.
41
42     ‘>’           Double the playback speed.
43
44     The session can be interrupted via control-C.  When the session has fin‐
45     ished, the terminal is restored to its original size if it was changed
46     during playback.
47
48     The options are as follows:
49
50     -d dir, --directory=dir
51                 Store session logs in dir instead of the default,
52                 /var/log/sudo-io.
53
54     -f filter, --filter=filter
55                 Select which I/O type(s) to display.  By default, sudoreplay
56                 will display the command's standard output, standard error
57                 and tty output.  The filter argument is a comma-separated
58                 list, consisting of one or more of following: stdin, stdout,
59                 stderr, ttyin, and ttyout.
60
61     -F, --follow
62                 Enable “follow mode”.  When replaying a session, sudoreplay
63                 will ignore end-of-file and keep replaying until the log is
64                 complete.  This can be used to replay a session that is still
65                 in progress, similar to “tail -f”.  An I/O log file is con‐
66                 sidered to be complete when the write bits have been cleared
67                 on the session's timing file.  Note that versions of sudo
68                 prior to 1.9.1 do not clear the write bits upon completion.
69
70     -h, --help  Display a short help message to the standard output and exit.
71
72     -l, --list [search expression]
73                 Enable “list mode”.  In this mode, sudoreplay will list
74                 available sessions in a format similar to the sudo log file
75                 format, sorted by file name (or sequence number).  If a
76                 search expression is specified, it will be used to restrict
77                 the IDs that are displayed.  An expression is composed of the
78                 following predicates:
79
80                 command pattern
81                         Evaluates to true if the command run matches the
82                         POSIX extended regular expression pattern.
83
84                 cwd directory
85                         Evaluates to true if the command was run with the
86                         specified current working directory.
87
88                 fromdate date
89                         Evaluates to true if the command was run on or after
90                         date.  See Date and time format for a description of
91                         supported date and time formats.
92
93                 group runas_group
94                         Evaluates to true if the command was run with the
95                         specified runas_group.  Note that unless a
96                         runas_group was explicitly specified when sudo was
97                         run this field will be empty in the log.
98
99                 host hostname
100                         Evaluates to true if the command was run on the spec‐
101                         ified hostname.
102
103                 runas runas_user
104                         Evaluates to true if the command was run as the spec‐
105                         ified runas_user.  Note that sudo runs commands as
106                         user root by default.
107
108                 todate date
109                         Evaluates to true if the command was run on or prior
110                         to date.  See Date and time format for a description
111                         of supported date and time formats.
112
113                 tty tty name
114                         Evaluates to true if the command was run on the spec‐
115                         ified terminal device.  The tty name should be speci‐
116                         fied without the /dev/ prefix, e.g., tty01 instead of
117                         /dev/tty01.
118
119                 user user name
120                         Evaluates to true if the ID matches a command run by
121                         user name.
122
123                 Predicates may be abbreviated to the shortest unique string.
124
125                 Predicates may be combined using and, or and ! operators as
126                 well as ‘(’ and ‘)’ grouping (note that parentheses must gen‐
127                 erally be escaped from the shell).  The and operator is
128                 optional, adjacent predicates have an implied and unless sep‐
129                 arated by an or.
130
131     -m, --max-wait max_wait
132                 Specify an upper bound on how long to wait between key
133                 presses or output data.  By default, sudoreplay will accu‐
134                 rately reproduce the delays between key presses or program
135                 output.  However, this can be tedious when the session
136                 includes long pauses.  When the -m option is specified,
137                 sudoreplay will limit these pauses to at most max_wait sec‐
138                 onds.  The value may be specified as a floating point number,
139                 e.g., 2.5.  A max_wait of zero or less will eliminate the
140                 pauses entirely.
141
142     -n, --non-interactive
143                 Do not prompt for user input or attempt to re-size the termi‐
144                 nal.  The session is written to the standard output, not
145                 directly to the user's terminal.
146
147     -R, --no-resize
148                 Do not attempt to re-size the terminal to match the terminal
149                 size of the session.
150
151     -S, --suspend-wait
152                 Wait while the command was suspended.  By default, sudoreplay
153                 will ignore the time interval between when the command was
154                 suspended and when it was resumed.  If the -S option is spec‐
155                 ified, sudoreplay will wait instead.
156
157     -s, --speed speed_factor
158                 This option causes sudoreplay to adjust the number of seconds
159                 it will wait between key presses or program output.  This can
160                 be used to slow down or speed up the display.  For example, a
161                 speed_factor of 2 would make the output twice as fast whereas
162                 a speed_factor of .5 would make the output twice as slow.
163
164     -V, --version
165                 Print the sudoreplay versions version number and exit.
166
167   Date and time format
168     The time and date may be specified multiple ways, common formats include:
169
170     HH:MM:SS am MM/DD/CCYY timezone
171             24 hour time may be used in place of am/pm.
172
173     HH:MM:SS am Month, Day Year timezone
174             24 hour time may be used in place of am/pm, and month and day
175             names may be abbreviated.  Note that month and day of the week
176             names must be specified in English.
177
178     CCYY-MM-DD HH:MM:SS
179             ISO time format
180
181     DD Month CCYY HH:MM:SS
182             The month name may be abbreviated.
183
184     Either time or date may be omitted, the am/pm and timezone are optional.
185     If no date is specified, the current day is assumed; if no time is speci‐
186     fied, the first second of the specified date is used.  The less signifi‐
187     cant parts of both time and date may also be omitted, in which case zero
188     is assumed.
189
190     The following are all valid time and date specifications:
191
192     now     The current time and date.
193
194     tomorrow
195             Exactly one day from now.
196
197     yesterday
198             24 hours ago.
199
200     2 hours ago
201             2 hours ago.
202
203     next Friday
204             The first second of the Friday in the next (upcoming) week.  Not
205             to be confused with “this Friday” which would match the Friday of
206             the current week.
207
208     last week
209             The current time but 7 days ago.  This is equivalent to “a week
210             ago”.
211
212     a fortnight ago
213             The current time but 14 days ago.
214
215     10:01 am 9/17/2009
216             10:01 am, September 17, 2009.
217
218     10:01 am
219             10:01 am on the current day.
220
221     10      10:00 am on the current day.
222
223     9/17/2009
224             00:00 am, September 17, 2009.
225
226     10:01 am Sep 17, 2009
227             10:01 am, September 17, 2009.
228
229     Note that relative time specifications do not always work as expected.
230     For example, the “next” qualifier is intended to be used in conjunction
231     with a day such as “next Monday”.  When used with units of weeks, months,
232     years, etc the result will be one more than expected.  For example, “next
233     week” will result in a time exactly two weeks from now, which is probably
234     not what was intended.  This will be addressed in a future version of
235     sudoreplay.
236
237   Debugging sudoreplay
238     sudoreplay versions 1.8.4 and higher support a flexible debugging frame‐
239     work that is configured via Debug lines in the sudo.conf(5) file.
240
241     For more information on configuring sudo.conf(5), please refer to its
242     manual.
243

FILES

245     /etc/sudo.conf            Debugging framework configuration
246
247     /var/log/sudo-io          The default I/O log directory.
248
249     /var/log/sudo-io/00/00/01/log
250                               Example session log info.
251
252     /var/log/sudo-io/00/00/01/log.json
253                               Example session log info (JSON format).
254
255     /var/log/sudo-io/00/00/01/stdin
256                               Example session standard input log.
257
258     /var/log/sudo-io/00/00/01/stdout
259                               Example session standard output log.
260
261     /var/log/sudo-io/00/00/01/stderr
262                               Example session standard error log.
263
264     /var/log/sudo-io/00/00/01/ttyin
265                               Example session tty input file.
266
267     /var/log/sudo-io/00/00/01/ttyout
268                               Example session tty output file.
269
270     /var/log/sudo-io/00/00/01/timing
271                               Example session timing file.
272
273     Note that the stdin, stdout and stderr files will be empty unless sudo
274     was used as part of a pipeline for a particular command.
275

EXAMPLES

277     List sessions run by user millert:
278
279           # sudoreplay -l user millert
280
281     List sessions run by user bob with a command containing the string vi:
282
283           # sudoreplay -l user bob command vi
284
285     List sessions run by user jeff that match a regular expression:
286
287           # sudoreplay -l user jeff command '/bin/[a-z]*sh'
288
289     List sessions run by jeff or bob on the console:
290
291           # sudoreplay -l ( user jeff or user bob ) tty console
292

SEE ALSO

294     script(1), sudo.conf(5), sudo(8)
295

AUTHORS

297     Many people have worked on sudo over the years; this version consists of
298     code written primarily by:
299
300           Todd C. Miller
301
302     See the CONTRIBUTORS file in the sudo distribution
303     (https://www.sudo.ws/contributors.html) for an exhaustive list of people
304     who have contributed to sudo.
305

BUGS

307     If you feel you have found a bug in sudoreplay, please submit a bug
308     report at https://bugzilla.sudo.ws/
309

SUPPORT

311     Limited free support is available via the sudo-users mailing list, see
312     https://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search
313     the archives.
314

DISCLAIMER

316     sudoreplay is provided “AS IS” and any express or implied warranties,
317     including, but not limited to, the implied warranties of merchantability
318     and fitness for a particular purpose are disclaimed.  See the LICENSE
319     file distributed with sudo or https://www.sudo.ws/license.html for com‐
320     plete details.
321
322Sudo 1.9.5p2                     May 18, 2020                     Sudo 1.9.5p2
Impressum