-
Notifications
You must be signed in to change notification settings - Fork 150
Add support for age plugins #186
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
base: main
Are you sure you want to change the base?
Conversation
| The age executable to use. | ||
| ''; | ||
| }; | ||
| pluginPackages = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking perhaps it would be nicer to name this path, similar to systemd.services.<name>.path. On the other hand, the name pluginPackages communicates more intent and I believe is more discoverable. Thoughts? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think pluginPackages or just plugins are preferable: intent is clearer, as you said, and it is more discoverable by users who might not know age plugins are just executables in PATH.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree plugins should be used in this case.
| pluginPackages = mkOption { | |
| plugins = mkOption { |
|
Have a look at this old PR #134 in which I tried the exact same thing just to arrive at the conclusion that this is probably not what I wanted. |
This is only related to using this with
|
|
So, those efforts have died and this still seems a simple and viable approach. Perhaps time to re-open and reconsider? |
|
@koenw This is the exact same way I implemented plugin support in my test config! Even works with ragenix (even though that one is actually suppose to have plugin support; it looks as if the plugins aren't being put in the path from what I saw). When I manually overwritten the ageBin and appended the plugins to the PATH, it made it function properly). However, I do wish there was a similar way of implementing this for the HomeManager module; |
nicoonoclaste
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems entirely sensible to me, and a badly-needed feature, especially in environments where SSH host keys might not be available early-enough during boot.
The case I ran into is simply because the secrets-containing ZFS dataset isn't yet mounted during the first activation (though I expect many other root-on-tmpfs setups would run into the same issue) but this also enables setups where the SSH host keys are either provided via agenix or sealed to the TPM.
| The age executable to use. | ||
| ''; | ||
| }; | ||
| pluginPackages = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think pluginPackages or just plugins are preferable: intent is clearer, as you said, and it is more discoverable by users who might not know age plugins are just executables in PATH.
|
It seems to me rather reasonable to only support non-interactive plugins which can run on first activation. To support to plugins which require certain services to run, I believe the most reasonable solution would be to:
I believe that could reasonably wait until a follow-up PR though. Footnotes
|
|
@koenw are you still continuing to work on this pr? If not, we DigitalBrewStudios will take over to finish this pr and get it out as it's important for our internal policies which I can't share. |
I'm not working on this atm, I'm using my personal fork which works for me for now. It would ofc be wonderful if there were some proper upstreamed solution, so please feel free :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested if this works but I am restricting this pr from being merged there is one small nitpick.
Also please resolve the merge conflicts.
| test -f "${secretType.file}" || echo '[agenix] WARNING: encrypted file ${secretType.file} does not exist!' | ||
| test -d "$(dirname "$TMP_FILE")" || echo "[agenix] WARNING: $(dirname "$TMP_FILE") does not exist!" | ||
| LANG=${config.i18n.defaultLocale or "C"} ${ageBin} --decrypt "''${IDENTITIES[@]}" -o "$TMP_FILE" "${secretType.file}" | ||
| LANG=${config.i18n.defaultLocale or "C"} PATH=${lib.makeBinPath cfg.pluginPackages} ${ageBin} --decrypt "''${IDENTITIES[@]}" -o "$TMP_FILE" "${secretType.file}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| LANG=${config.i18n.defaultLocale or "C"} PATH=${lib.makeBinPath cfg.pluginPackages} ${ageBin} --decrypt "''${IDENTITIES[@]}" -o "$TMP_FILE" "${secretType.file}" | |
| LANG=${config.i18n.defaultLocale or "C"} PATH=${lib.makeBinPath cfg.plugins} ${ageBin} --decrypt "''${IDENTITIES[@]}" -o "$TMP_FILE" "${secretType.file}" |
| The age executable to use. | ||
| ''; | ||
| }; | ||
| pluginPackages = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree plugins should be used in this case.
| pluginPackages = mkOption { | |
| plugins = mkOption { |
First of all thanks for the software :)
When
nixos-rebuild-ing my system flake with secrets encrypted to/with my Yubikey, (r)age gave the error that it was unable to find the pluginage-plugin-yubikeyin it's $PATH even though I was able to run it myself. This is because any installed plugins would be unavailable in the build environment.I have added an option to the agenix module to specify the age plugin packages that should be available in the build environment. This fixed the error for me and I am now able to successfully
nixos-rebuildwith secrets decrypted from my Yubikey.I'm still finding my way with Nix so please let me know if you need any changes (or if this is totally not the right approach at all).
Thanks!