-
Notifications
You must be signed in to change notification settings - Fork 4
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
NixOS Service Configuration via flake.nix
#143
Comments
Ah it seems there are also additional tools to go about this. See https://systemd.io/CREDENTIALS/ |
If we can set env variables for a service to use then that would be the best option. Ideally we only need to configure a password and recovery code via nix. It's too clunky to require adding a file at whatever location just to have the service work. But we can't specify the secret inside the nix config. However I think it would be reasonable to configure it via nix to set |
Have a read of the README.md of https://gitlab.com/MatrixAI/Engineering/Infrastructure/Tetra - search for "credentials", all the info about how secrets are configured for Nix services was the case for mimir and similar services. |
With the exporting the recovery code part, we can probably do a lot of things here too. Namely:
The thing though is that all of these options depend on a feature in Polykey-CLI to export the key. It should probably be only a file based output, as that can be parsed later and used for the other methods. So this is needed. Maybe an option like |
This option could work as
With this option it gives the user much more flexibility, but we need to remember that this is a one time thing and that the file that is outputted will probably be readable in the user space, so perhaps a warning or notice should be issued to the user for them to protect it appropriately.
Probably the most direct option, we could just print out the value when the rebuild is issued. Problem is the user might not see it as the flake output generally hides this under an abstraction, and is only accessible when doing |
Firstly the question is what to do about stdout when running the agent program.
Given that it assumed a secure terminal, but now it's part of a service + it's better to instead allow the user to also supply the recovery code instead of a password.
Alternatively we can redirect the output of stdout to a secure location.
27 Feb 2024 20:18:49 Brynley Llewellyn-Roux ***@***.***>:
…
** Feeding the code back into a file in `/run/keys/...`
*
This option could work as */run/keys* is already R/W protected, and only *root* and ***@***.**** can access it. Also means we won't have to worry about extra logic.
** Having a configuration entry in the module to change the directory to output it to
*
With this option it gives the user much more flexibility, but we need to remember that this is a one time thing and that the file that is outputted will probably be readable in the user space, so perhaps a warning or notice should be issued to the user for them to protect it appropriately.
** Outputting the code during the rebuilding of the Nix configuration (the user would then save this?)
*
Probably the most direct option, we could just print out the value when the rebuild is issued. Problem is the user might not see it as the flake output generally hides this under an abstraction, and is only accessible when doing *--verbose*. Also could be visible in system logs. So I'm not sure.
—
Reply to this email directly, view it on GitHub[#143 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAE4OHMH36QVKG4FU2Y2IPTYV2OZRAVCNFSM6AAAAABD5BXXYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRYGEZDGOJRGA].
You are receiving this because you commented.
[Tracking image][https://github.com/notifications/beacon/AAE4OHNWJLIVJZIZXK2Z7E3YV2OZRA5CNFSM6AAAAABD5BXXYCWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTVJ4YAM.gif]
|
Needs to be categorised under the issue 17. |
I am making a driveby comment here. But I believe you should not expect the existence of I think that is only for |
Ok see: https://chat.openai.com/c/cba1fdba-4a58-402f-92d3-6bba5fa53777 in our team gpt. It does actually have something similar to what I'm saying above. |
This is the wrong place to discuss the secret zero problem. We should be discussing this in the orchestrator first (as it pertains to our platforms) - then in the nixpkgs repos. |
Based on the chatgpt discussion - I think this means we would distinguish 2 kinds of modules:
User-level systemd services is actually not available in NixOS. This is outside the domain of NixOS. |
This is already done. |
I think this is relevant to our recent discussion. 2. Should be available, and both should be enabled through a custom module configuration and made available to our flake transition. |
Ok upon reviewing this issue, the title of this issue is inaccurate in relation to the PR #138 that closed this issue. This is because #138 is about defining a service/program module configuration for PK CLI that can be consumed through the flakes system (which came after introducing flake.nix in #124). Instead of re-opening this issue, I'm going to retitle this be about service configuration. The actual secret zero problem of PK CLI in a NixOS/Linux and general OS situation, can only be solved by connecting the PK agent start authentication (root key generation) to the session creation/login of the OS. This is done through the OS keychain, but PK can also be the OS keychain too. On Linux, that means making use of the PAM framework. This will be discussed further in a separate issue. |
polykey.service
Secret Zeroflake.nix
An old issue MatrixAI/Polykey#201 is actually the issue by which the secret zero problem can begin to be solved at the OS session level. The concept of secret zero is always relative. PK's secret zero is the root key (and it so happens that the root password is the secret zero of the root key). But when the "security context" changes, then the secret zero is relative to that. So if we "situating" PK inside single-user NixOS platform. Then we can secret zero is the login password of the user session. But if we are talking about a single-user encrypted NixOS platform, then the secret zero might be the root password of the disk that is needed prior to stage-2 booting. |
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
The text was updated successfully, but these errors were encountered: