Skip to content

Commit db3a6b3

Browse files
committed
Skip the Files Sudo Ignores When Naming a Timestamp Override
The scan for a timestamp option set elsewhere read every file under /etc/sudoers.d, including the ones sudo skips: a name holding a dot, and a name ending in a tilde. This run's own staged file is dot-prefixed, so a leftover from a killed run would be named as an override that sudo never reads.
1 parent 6048cdd commit db3a6b3

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

host-setup/linux/install-tools.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,8 +1111,10 @@ configure_sudo_timestamp() {
11111111

11121112
# Another file setting either option is named rather than merged into, since which one wins is the order sudo reads them in and not something this can decide.
11131113
local elsewhere
1114+
# A name holding a dot or ending in a tilde is one sudo skips, this run's own staged file included, so a setting in it is an override sudo never reads.
11141115
elsewhere=$("${SUDO[@]}" grep -rnsE '^[[:space:]]*Defaults.*timestamp_(type|timeout)' \
1115-
--exclude="${SUDOERS_FILE##*/}" /etc/sudoers /etc/sudoers.d 2> /dev/null) || elsewhere=""
1116+
--exclude='*.*' --exclude='*~' --exclude="${SUDOERS_FILE##*/}" \
1117+
/etc/sudoers /etc/sudoers.d 2> /dev/null) || elsewhere=""
11161118
if [[ -n $elsewhere ]]; then
11171119
warn "A timestamp option is already set elsewhere, and the file sudo reads last wins:"
11181120
local line

0 commit comments

Comments
 (0)