Specification
The below specification is with regards to secret zero problem, however the actual PR solving this is just introducing the service configuration. For now, the "secret zero" of PK which is the root password, is just expected to exist in the home directory.
It seems we are running into the secret zero problem with regard to the new Polykey Agent nix service. When running pk agent start for the first time, it is required that a password is supplied to initialise the agent. However that password needs to be managed by something, and appropriately stored somewhere. Currently, the service will look for a password file under /root/.local/share/pass, but this is unoptimal for our situation. Keeping it in a place which is more secure and standardised will be ideal. Possibly /run/credentials or /run/keys.
My proposal is that there are a few solutions to solving this problem.
- Systemd supports the configuration directive
EnvironmentFile which lets the service pull environment variables from a specified file. We could then in the service configuration use that environment variable in the setup script; or
- We set the
Environment directive inside the Systemd service to pull from a given environment variable accessible to the system, but not from a file. Perhaps we inject the password somehow when building the system, but with flakes that doesn't seem likely; or
- We use
systemd-ask-password which lets the user enter a password to be used in the service. This could be a simple way of specifying it safely.
Additionally, the Polykey Agent normally outputs a recovery code upon the initial setup of the agent. This will need to also be stored somewhere safe. A new CLI flag will need to be created to output the recovery codes to a specified directory (something similar to -pf).
@tegefaulkes @amydevs
Tasks
- A flag inside of Polykey-CLI will need to be added to allow the secret output directory to change.
- The service will need to be configured to use one of the solutions above and use the password in the service.
- Documentation will need to be written up on how to set up the agent with the given solution.
Specification
The below specification is with regards to secret zero problem, however the actual PR solving this is just introducing the service configuration. For now, the "secret zero" of PK which is the root password, is just expected to exist in the home directory.
@tegefaulkes @amydevs
Tasks