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

RFC: Prompting for passphrase for systemd unit #34

Open
hseg opened this issue Jan 24, 2024 · 10 comments
Open

RFC: Prompting for passphrase for systemd unit #34

hseg opened this issue Jan 24, 2024 · 10 comments

Comments

@hseg
Copy link
Contributor

hseg commented Jan 24, 2024

Currently, the systemd configuration doesn't reliably load tokens on startup (confirmed for gpg, suspected for age due to similar semantics).
This is due to the fact that the decryption command needs to prompt for a passphrase, which under the current setup only works with a graphical session (to create a passphrase prompt popup).
Thus, for setups where the user logs into a non-graphical session, if X isn't started quickly enough the prompt attempt will fail (thankfully, this will not prevent pizauth from starting -- the configuration is set to ignore failures at this step). This situation is less than desirable.

Five solutions suggest themselves:

  • Find out how to get prompting to work in a non-graphical context, and write the configuration so as to fall back to that if necessary
  • Only start the service in a graphical context -- involves replacing the WantedBy line with WantedBy=graphical-session.target
  • Have reloading the service also retry restoring tokens -- involves duplicating the ExecStartPost line as a ExecReload line
  • Store gpg key unencrypted
  • Store gpg private key or its passphrase in TPM -- perhaps using the abstraction that's supposed to drop in per-user encrypted credentials systemd/systemd#30968
  • Use gpg's native TPM support -- note: don't know how this one works, incidentally discovered while working out how the other TPM option would need to be implemented

The "modify the configuration" options are less than appealing -- they don't quite match the semantics, and are a bit of a hack. Still, they work (indeed, they're what I'm using right now in the absence of understanding/possibility of the other options).

The above is meant as a brain-dump of my current understanding of the design space, don't yet know what to advocate for.

@ltratt
Copy link
Owner

ltratt commented Jan 25, 2024

I don't know if it's helpful, but I explicitly designed restore to support unexpected ways of getting data into pizauth https://tratt.net/laurie/blog/2023/pizauth_dump_restore.html.

@hseg
Copy link
Contributor Author

hseg commented Jan 25, 2024 via email

@ltratt
Copy link
Owner

ltratt commented Jan 25, 2024

restore is designed to be called as often as you want: it will ignore any problematic data (e.g. that based on a different config) and slurp in what it can. [There are some minor caveats mentioned in the man page due to clock drift. At worst these can cause token refreshing a bit early or late, but it won't compromise security.]

@ltratt
Copy link
Owner

ltratt commented Feb 2, 2024

@hseg Any luck with this?

@hseg
Copy link
Contributor Author

hseg commented Feb 3, 2024 via email

@ltratt
Copy link
Owner

ltratt commented Feb 4, 2024

@hseg np!

@ltratt
Copy link
Owner

ltratt commented May 26, 2024

@hseg Any luck with this?

@hseg
Copy link
Contributor Author

hseg commented May 26, 2024 via email

@hseg
Copy link
Contributor Author

hseg commented Jun 16, 2024 via email

@ltratt
Copy link
Owner

ltratt commented Jun 19, 2024

Thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants