run0: implement sudo options -k/-K/-v#42465
Conversation
|
Claude review: no issues found 🎉 |
11aa7d0 to
9076174
Compare
|
Now Also added a new commit introducing There is a bit of an odd behavior if there is no polkit agent running — polkit refuses to revoke the surrogate temporary authorization from the old unix-process subject granted using pkttyagent. I'm not sure if there's anything too interesting to do about that from our side and in fact maybe polkit really should just allow this to be revoked. I think I'll take the discussion there. E.g. w/ pkttyagent: |
4bb1968 to
a82db28
Compare
This is meant to mirror sudo's -k/--reset-timestamp and -K/--remove-timestamp options, which revoke the temporary authorization provided by the timestamp files in /var/run/sudo/ts. To achieve the same effect in run0, we ask polkit to revoke our temporary authorization. If used with a command, run0 will revoke the temporary auth and then immediately authorize the user again, just like sudo -k. All the bus calls are completed synchronously, as they need to complete before authorizing the user anyway. Like sudo, the effect of -k/--reset-timestamp is to revoke only the tmpauthz that polkit would have used to authorize the command, if available. The -K/--remove-timestamp option will revoke all temporary authorizations across all ttys.
This is meant to mirror sudo's -v/--validate options, which autohrize the user without running a command.
These are the flag names used by sudo with similar effect.
This implements a close facsimile of sudo's -k/-K/-v options, which manipulate the temporary authorizations used by sudo. Use like
run0 -k whoamito always re-auth, or justrun0 -kto revoke a prior temporary authorization.Depends on polkit-org/polkit#662 due to a bug in polkit.Now it should work ok despite the bug.