Bugzilla – Bug 779
Sudo default 5 minutes password caching ignored when laptop is suspended
Last modified: 2019-04-08 13:59:55 MDT
The caching of the password is enabled for 5 minutes. When I leave the terminal open after having issued a command with sudo and then suspend for a longer period of time, for example two hours, I can resume and then issue a command with sudo in the open terminal without being asked for the password.
FreeBSD doesn't appear to have a monotonic clock that runs while the machine is suspended. The choice is between using a clock that can run backward, potentially defeating the point of the timestamp file, or one that cannot run backward but that is not incremented while suspended. Currently, sudo uses the second option. On most other systems, the monotonic clock either runs while suspended or an alternate clock is available which does. I consider this a FreeBSD failing, rather than a sudo one.
This is not fixable until FreeBSD provides a monotonic clock that runs while suspended, like CLOCK_BOOTTIME on Linux.