microsoft / sudo

It's sudo, for Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Support credential caching / timeout, to avoid re-prompting for UAC

zadjii-msft opened this issue · comments

We should support a setting for a "credential timeout" that would allow the user to enter their password once, and then not be prompted for a period of time (e.g. 15 minutes). This would be similar to the sudo behavior on Linux.

We'd need to keep the elevated sudo instance around for the duration of the timeout, and allow multiple clients to connect to the same server instance.

The Linux behaviour scopes this to the terminal (pty) that cached the credentials. You can't sudo in one terminal, then go to a different one and sudo without having to re-enter the password. This is an important security property because otherwise you would be able to sudo again if you did so in any terminal in the last 15 minutes, which is often true. It also means that closing the terminal discards the cached credentials.

When adding support for this, please consider adding the corresponding options -k/--reset-timestamp and -K/--remove-timestamp at the same time. -K invalidates the cached credentials for every terminal, and -k invalidates the cached credentials for the current terminal.

Absolutely! Both of those were in my original spec for sudo. Alas, this is one of those things that we had a whole plan for, just not the engineering resources to get to immediately.