1SUDOREPLAY(8) BSD System Manager's Manual SUDOREPLAY(8)
2
4 sudoreplay — replay sudo session logs
5
7 sudoreplay [-hnR] [-d dir] [-f filter] [-m num] [-s num] ID
8
9 sudoreplay [-h] [-d dir] -l [search expression]
10
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, or a pattern matching the iolog_file option in the
19 sudoers file. When a command is run via sudo with log_output enabled in
20 the sudoers file, a TSID=ID string is logged via syslog or to the sudo
21 log file. The ID may also be determined using sudoreplay's list mode.
22
23 In list mode, sudoreplay can be used to find the ID of a session based on
24 a number of criteria such as the user, tty or command run.
25
26 In replay mode, if the standard input and output are connected to a ter‐
27 minal and the -n option is not specified, sudoreplay will operate inter‐
28 actively. In interactive mode, sudoreplay will attempt to adjust the
29 terminal size to match that of the session and write directly to the ter‐
30 minal (not all terminals support this). Additionally, it will poll the
31 keyboard and act on the following keys:
32
33 ‘\n’ or ‘\r’ Skip to the next replay event; useful for long pauses.
34
35 ‘ ’ (space) Pause output; press any key to resume.
36
37 ‘<’ Reduce the playback speed by one half.
38
39 ‘>’ Double the playback speed.
40
41 The session can be interrupted via control-C. When the session has fin‐
42 ished, the terminal is restored to its original size if it was changed
43 during playback.
44
45 The options are as follows:
46
47 -d dir, --directory=dir
48 Store session logs in dir instead of the default,
49 /var/log/sudo-io.
50
51 -f filter, --filter=filter
52 Select which I/O type(s) to display. By default, sudoreplay
53 will display the command's standard output, standard error
54 and tty output. The filter argument is a comma-separated
55 list, consisting of one or more of following: stdin, stdout,
56 stderr, ttyin, and ttyout.
57
58 -h, --help Display a short help message to the standard output and exit.
59
60 -l, --list [search expression]
61 Enable “list mode”. In this mode, sudoreplay will list
62 available sessions in a format similar to the sudo log file
63 format, sorted by file name (or sequence number). If a
64 search expression is specified, it will be used to restrict
65 the IDs that are displayed. An expression is composed of the
66 following predicates:
67
68 command pattern
69 Evaluates to true if the command run matches the
70 POSIX extended regular expression pattern.
71
72 cwd directory
73 Evaluates to true if the command was run with the
74 specified current working directory.
75
76 fromdate date
77 Evaluates to true if the command was run on or after
78 date. See Date and time format for a description of
79 supported date and time formats.
80
81 group runas_group
82 Evaluates to true if the command was run with the
83 specified runas_group. Note that unless a
84 runas_group was explicitly specified when sudo was
85 run this field will be empty in the log.
86
87 runas runas_user
88 Evaluates to true if the command was run as the spec‐
89 ified runas_user. Note that sudo runs commands as
90 user root by default.
91
92 todate date
93 Evaluates to true if the command was run on or prior
94 to date. See Date and time format for a description
95 of supported date and time formats.
96
97 tty tty name
98 Evaluates to true if the command was run on the spec‐
99 ified terminal device. The tty name should be speci‐
100 fied without the /dev/ prefix, e.g. tty01 instead of
101 /dev/tty01.
102
103 user user name
104 Evaluates to true if the ID matches a command run by
105 user name.
106
107 Predicates may be abbreviated to the shortest unique string.
108
109 Predicates may be combined using and, or and ! operators as
110 well as ‘(’ and ‘)’ grouping (note that parentheses must gen‐
111 erally be escaped from the shell). The and operator is
112 optional, adjacent predicates have an implied and unless sep‐
113 arated by an or.
114
115 -m, --max-wait max_wait
116 Specify an upper bound on how long to wait between key
117 presses or output data. By default, sudoreplay will accu‐
118 rately reproduce the delays between key presses or program
119 output. However, this can be tedious when the session
120 includes long pauses. When the -m option is specified,
121 sudoreplay will limit these pauses to at most max_wait sec‐
122 onds. The value may be specified as a floating point number,
123 e.g. 2.5. A max_wait of zero or less will eliminate the
124 pauses entirely.
125
126 -n, --non-interactive
127 Do not prompt for user input or attempt to re-size the termi‐
128 nal. The session is written to the standard output, not
129 directly to the user's terminal.
130
131 -R, --no-resize
132 Do not attempt to re-size the terminal to match the terminal
133 size of the session.
134
135 -s, --speed speed_factor
136 This option causes sudoreplay to adjust the number of seconds
137 it will wait between key presses or program output. This can
138 be used to slow down or speed up the display. For example, a
139 speed_factor of 2 would make the output twice as fast whereas
140 a speed_factor of .5 would make the output twice as slow.
141
142 -V, --version
143 Print the sudoreplay versions version number and exit.
144
145 Date and time format
146 The time and date may be specified multiple ways, common formats include:
147
148 HH:MM:SS am MM/DD/CCYY timezone
149 24 hour time may be used in place of am/pm.
150
151 HH:MM:SS am Month, Day Year timezone
152 24 hour time may be used in place of am/pm, and month and day
153 names may be abbreviated. Note that month and day of the week
154 names must be specified in English.
155
156 CCYY-MM-DD HH:MM:SS
157 ISO time format
158
159 DD Month CCYY HH:MM:SS
160 The month name may be abbreviated.
161
162 Either time or date may be omitted, the am/pm and timezone are optional.
163 If no date is specified, the current day is assumed; if no time is speci‐
164 fied, the first second of the specified date is used. The less signifi‐
165 cant parts of both time and date may also be omitted, in which case zero
166 is assumed.
167
168 The following are all valid time and date specifications:
169
170 now The current time and date.
171
172 tomorrow
173 Exactly one day from now.
174
175 yesterday
176 24 hours ago.
177
178 2 hours ago
179 2 hours ago.
180
181 next Friday
182 The first second of the Friday in the next (upcoming) week. Not
183 to be confused with “this Friday” which would match the Friday of
184 the current week.
185
186 last week
187 The current time but 7 days ago. This is equivalent to “a week
188 ago”.
189
190 a fortnight ago
191 The current time but 14 days ago.
192
193 10:01 am 9/17/2009
194 10:01 am, September 17, 2009.
195
196 10:01 am
197 10:01 am on the current day.
198
199 10 10:00 am on the current day.
200
201 9/17/2009
202 00:00 am, September 17, 2009.
203
204 10:01 am Sep 17, 2009
205 10:01 am, September 17, 2009.
206
207 Note that relative time specifications do not always work as expected.
208 For example, the “next” qualifier is intended to be used in conjunction
209 with a day such as “next Monday”. When used with units of weeks, months,
210 years, etc the result will be one more than expected. For example, “next
211 week” will result in a time exactly two weeks from now, which is probably
212 not what was intended. This will be addressed in a future version of
213 sudoreplay.
214
215 Debugging sudoreplay
216 sudoreplay versions 1.8.4 and higher support a flexible debugging frame‐
217 work that is configured via Debug lines in the sudo.conf(5) file.
218
219 For more information on configuring sudo.conf(5), please refer to its
220 manual.
221
223 /etc/sudo.conf Debugging framework configuration
224
225 /var/log/sudo-io The default I/O log directory.
226
227 /var/log/sudo-io/00/00/01/log
228 Example session log info.
229
230 /var/log/sudo-io/00/00/01/stdin
231 Example session standard input log.
232
233 /var/log/sudo-io/00/00/01/stdout
234 Example session standard output log.
235
236 /var/log/sudo-io/00/00/01/stderr
237 Example session standard error log.
238
239 /var/log/sudo-io/00/00/01/ttyin
240 Example session tty input file.
241
242 /var/log/sudo-io/00/00/01/ttyout
243 Example session tty output file.
244
245 /var/log/sudo-io/00/00/01/timing
246 Example session timing file.
247
248 Note that the stdin, stdout and stderr files will be empty unless sudo
249 was used as part of a pipeline for a particular command.
250
252 List sessions run by user millert:
253
254 # sudoreplay -l user millert
255
256 List sessions run by user bob with a command containing the string vi:
257
258 # sudoreplay -l user bob command vi
259
260 List sessions run by user jeff that match a regular expression:
261
262 # sudoreplay -l user jeff command '/bin/[a-z]*sh'
263
264 List sessions run by jeff or bob on the console:
265
266 # sudoreplay -l ( user jeff or user bob ) tty console
267
269 script(1), sudo.conf(5), sudo(8)
270
272 Many people have worked on sudo over the years; this version consists of
273 code written primarily by:
274
275 Todd C. Miller
276
277 See the CONTRIBUTORS file in the sudo distribution
278 (https://www.sudo.ws/contributors.html) for an exhaustive list of people
279 who have contributed to sudo.
280
282 If you feel you have found a bug in sudoreplay, please submit a bug
283 report at https://bugzilla.sudo.ws/
284
286 Limited free support is available via the sudo-users mailing list, see
287 https://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search
288 the archives.
289
291 sudoreplay is provided “AS IS” and any express or implied warranties,
292 including, but not limited to, the implied warranties of merchantability
293 and fitness for a particular purpose are disclaimed. See the LICENSE
294 file distributed with sudo or https://www.sudo.ws/license.html for com‐
295 plete details.
296
297Sudo 1.8.23 March 8, 2018 Sudo 1.8.23