Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add (a potentially much better) timestamp_timeout: with a shorter PIN #5

Open
eugenesvk opened this issue Dec 24, 2022 · 5 comments
Open
Labels
enhancement New feature or request

Comments

@eugenesvk
Copy link

sudo has this timestamp_timeout option that doesn't re-prompt you for a password within, say, 5 minutes of entering a password

It seems that please doesn't have this option yet, but also I'd like to propose another modification that could make this option even better — slightly less convenient, but more secure — by using the concept of PINs, so instead of not re-prompting you for the full password during this timestamp_timeout period, the please command should instead prompt you every time, but not for your full password, but for a secondary, shorter password (aka "PIN")
This way you don't have to risk some wrong copy&paste or something worse doing anything as root within the blessed period

I understand that with proper more granular permissions this might not be as important, but at the same time not everyone will bother with granularity #1, so this is still useful and and improvement over the total passwordlessness!

@edneville
Copy link
Owner

edneville commented Dec 24, 2022 via email

@eugenesvk
Copy link
Author

I'm wondering, would a PIN be implemented differently from 'reason'

These seem to be rather different in their goals and thus implementations, a couple of differences of the top of my head:

  • PIN would be encrypted in a similar way the main password is instead of being stored as a plain text configuration rule (so its input should also be secure, not a -r cli flag saved to history)
  • PIN would apply to all the commands requiring a password (until the timeout elapses) instead of having to be configured for each command in a config

Ideally access should be tailored to principle of least privilege, but some organisations will argue that some people should have full access, similar maybe to a "break-glass" account.

Sure thing, ideal is ideal ;)! But maybe PIN could help even in the case of lesser privileges, especially for repeatable commands that should rightfully require a proper challenge, but just maybe not every single time that challenge should be the full long password?
(though maybe some commands could opt out?)

@edneville
Copy link
Owner

edneville commented Dec 24, 2022 via email

@eugenesvk
Copy link
Author

Would the PIN be generated on first execution where a token doesn't exist, then stored within the token file perhaps (a different/new PIN per tty). This would need to be printed to the user, which might affect stdin/stdout.

Hm, my idea was that the user generates the PIN, so it'd be a special please init pin command that asks for your main password, then asks with the same secure input for a new pin, then saves it to some system keychain or something, so nothing would need to be printed to the user.

Assuming a four-digit PIN

It doesn't have to be this trivial, PINs can also be alpha-numeric, so you can make it arbitrarily complex, the key thing is that it's much less complicated than the main system password

everything else could require a reason.

Here is another difference, I think, this -r approach complicates every single invokation of a command you have to keep in mind beforehand, while with a PIN you just get asked

  • 🆔PIN or 🔏Password: instead of the regular
  • 🔏Password: prompt
    (and you don't even have to think about PIN and type your password on auto pilot, but when you do ten commands that require it, it might be worth switching to something easier)

I know that isn't exactly what you're asking for. I'll keep this open whilst I think about the way to implement.

Thanks!

@edneville
Copy link
Owner

Related c617695, adding token_timeout

@edneville edneville added the enhancement New feature or request label Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants