Skip to content

Commit

Permalink
auth_keep: do not ask for reauth if new process shares same UID/paren…
Browse files Browse the repository at this point in the history
…t/cgroup/tty

sudo keeps a record of authenticated processes via either the controlling
TTY (default) or the parent process id.

Implement the same caching behaviour, but stricter: if a process
is authenticated for auth_keep, do not expunge it when it exits
if it was tracked via PID FD (to make it safe against reuse attacks).

Then, if another process comes along, skip re-auth and allow it
if it shared the same UID, parent process id, cgroup id and
controlling terminal (and all processes are newer than the controlling
terminal ctime). PID FDs must be used all the way through,
otherwise there's no caching.

This is much stricter than sudo, as all conditions must be met.
But it still allows to fulfill the main use case, which is to
run multiple commands on the same terminal without being asked
for the password again and again.

Unlike sudo, we also do not refresh the countdown on each use.

Fixes #472
  • Loading branch information
bluca committed Dec 18, 2024
1 parent c1369cd commit 6aff8c0
Show file tree
Hide file tree
Showing 3 changed files with 835 additions and 8 deletions.
Loading

0 comments on commit 6aff8c0

Please sign in to comment.