1 .\" Automatically generated from an mdoc input file. Do not edit.
3 .\" Copyright (c) 2017-2018 Todd C. Miller <Todd.Miller@sudo.ws>
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .TH "SUDOERS_TIMESTAMP" "@mansectform@" "October 7, 2018" "Sudo @PACKAGE_VERSION@" "File Formats Manual"
21 \fBsudoers_timestamp\fR
22 \- Sudoers Time Stamp Format
26 plugin uses per-user time stamp files for credential caching.
27 Once a user has been authenticated, they may use
29 without a password for a short period of time
31 minutes unless overridden by the
32 \fItimestamp_timeout\fR
37 uses a separate record for each terminal, which means that
38 a user's login sessions are authenticated separately.
41 option can be used to select the type of time stamp record
45 A multi-record time stamp file format was introduced in
47 1.8.10 that uses a single file per user.
48 Previously, a separate file was used for each user and terminal
49 combination unless tty-based time stamps were disabled.
50 The new format is extensible and records of multiple types and versions
51 may coexist within the same file.
53 All records, regardless of type or version, begin with a 16-bit version
54 number and a 16-bit record size.
56 Time stamp records have the following structure:
60 /* Time stamp entry types */
61 #define TS_GLOBAL 0x01 /* not restricted by tty or ppid */
62 #define TS_TTY 0x02 /* restricted by tty */
63 #define TS_PPID 0x03 /* restricted by ppid */
64 #define TS_LOCKEXCL 0x04 /* special lock record */
66 /* Time stamp flags */
67 #define TS_DISABLED 0x01 /* entry disabled */
68 #define TS_ANYUID 0x02 /* ignore uid, only valid in key */
70 struct timestamp_entry {
71 unsigned short version; /* version number */
72 unsigned short size; /* entry size */
73 unsigned short type; /* TS_GLOBAL, TS_TTY, TS_PPID */
74 unsigned short flags; /* TS_DISABLED, TS_ANYUID */
75 uid_t auth_uid; /* uid to authenticate as */
76 pid_t sid; /* session ID associated with tty/ppid */
77 struct timespec start_time; /* session/ppid start time */
78 struct timespec ts; /* time stamp (CLOCK_MONOTONIC) */
80 dev_t ttydev; /* tty device number */
81 pid_t ppid; /* parent pid */
87 The timestamp_entry struct fields are as follows:
90 The version number of the timestamp_entry struct.
91 New entries are created with a version number of 2.
92 Records with different version numbers may coexist in the
93 same file but are not inter-operable.
96 The size of the record in bytes.
99 The record type, currently
107 Zero or more record flags which can be bit-wise ORed together.
110 for records disabled via
115 which is used only when matching records.
118 The user ID that was used for authentication.
119 Depending on the value of the
124 options, the user ID may be that of the invoking user, the root user,
125 the default runas user or the target user.
128 The ID of the user's terminal session, if present.
129 The session ID is only used when matching records of type
133 The start time of the session leader for records of type
135 or of the parent process for records of type
139 is used to help prevent re-use of a time stamp record after a
141 Not all systems support a method to easily retrieve a process's
147 version 1.8.22 for the second revision of the timestamp_entry struct.
150 The actual time stamp.
151 A monotonic time source (which does not move backward) is used if the
155 uses a monotonic timer that increments even while the system
159 is updated each time a command is run via
161 If the difference between
163 and the current time is less than the value of the
164 \fItimestamp_timeout\fR
165 option, no password is required.
168 The device number of the terminal associated with the session for
173 The ID of the parent process for records of type
178 versions 1.8.10 through 1.8.14, the entire time stamp file was
179 locked for exclusive access when reading or writing to the file.
182 1.8.15, individual records are locked in the time stamp file instead
183 of the entire file and the lock is held for a longer period of time.
184 This scheme is described below.
186 The first record in the time stamp file is of type
190 record to prevent more than one
192 process from adding a new record at the same time.
193 Once the desired time stamp record has been located or created (and
197 The lock on the individual time stamp record, however, is held until
198 authentication is complete.
201 to avoid prompting for a password multiple times when it
202 is used more than once in a pipeline.
206 cannot be locked for a long period of time since doing so would
210 Instead, a separate lock record is used to prevent multiple
212 processes using the same terminal (or parent process ID) from
213 prompting for a password as the same time.
215 sudoers(@mansectform@),
220 used a single zero-length file per user and the file's modification
221 time was used as the time stamp.
224 added restrictions on the ownership of the time stamp files and
225 directory as well as sanity checks on the time stamp itself.
226 Notable changes were introduced in the following
232 Support for tty-based time stamp file was added
233 by appending the terminal name to the time stamp file name.
237 The time stamp file was replaced by a per-user directory which
238 contained any tty-based time stamp files.
241 The target user name was added to the time stamp file name when the
247 Information about the terminal device was stored in
248 tty-based time stamp files for sanity checking.
249 This included the terminal device numbers, inode number and, on systems
250 where it was not updated when the device was written to, the inode change time.
251 This helped prevent re-use of the time stamp file after logout.
254 The terminal session ID was added to tty-based time stamp files to
255 prevent re-use of the time stamp by the same user in a different
257 It also helped prevent re-use of the time stamp file on systems where
258 the terminal device's inode change time was updated by writing.
261 A new, multi-record time stamp file format was introduced that uses a
262 single file per user.
263 The terminal device's change time was not included since most
264 systems now update the change time after a write is performed
265 as required by POSIX.
268 Individual records are locked in the time stamp file instead of the
269 entire file and the lock is held until authentication is complete.
272 The start time of the terminal session leader or parent process is
273 now stored in non-global time stamp records.
274 This prevents re-use of the time stamp file after logout in most cases.
276 Support was added for the kernel-based tty time stamps available in
278 which do not use an on-disk time stamp file.
280 Many people have worked on
282 over the years; this version consists of code written primarily by:
288 See the CONTRIBUTORS file in the
290 distribution (https://www.sudo.ws/contributors.html) for an
291 exhaustive list of people who have contributed to
294 If you feel you have found a bug in
296 please submit a bug report at https://bugzilla.sudo.ws/
298 Limited free support is available via the sudo-users mailing list,
299 see https://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or
305 and any express or implied warranties, including, but not limited
306 to, the implied warranties of merchantability and fitness for a
307 particular purpose are disclaimed.
308 See the LICENSE file distributed with
310 or https://www.sudo.ws/license.html for complete details.