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

How can I simulate what agenix -e does? #7

Open
ParetoOptimalDev opened this issue Aug 1, 2023 · 2 comments
Open

How can I simulate what agenix -e does? #7

ParetoOptimalDev opened this issue Aug 1, 2023 · 2 comments

Comments

@ParetoOptimalDev
Copy link

Right now when I create a file test-age-el.age and try to use it with agenix I get:

decrypting '/nix/store/x31pafpiw2a8c07c3amh52gihzag8yqx-testemacsage.age' to '/run/agenix.d/3/testemacsage'...
Error: No matching keys found

I suppose this has to do with my configuration and not having all public keys.

@ParetoOptimalDev
Copy link
Author

ParetoOptimalDev commented Aug 1, 2023

You just have to get the public keys that age.el does to match the configuration of public keys used in your secrets.nix file. So given:

let
  user1 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL0idNvgGiucWgup/mP78zyC23uFjYq0evcWdjGQUaBH";
  user2 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILI6jSq53F/3hEmSs+oq9L4TwOo1PrDMAgcA1uo1CCV/";
  users = [ user1 user2 ];

  system1 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPJDyIr/FSz1cJdcoW69R+NrWzwGK/+3gJpqD1t8L2zE";
  system2 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKzxQgondgEYcLpcPdJLrTdNgZ2gznOHCAxMdaceTUT1";
  systems = [ system1 system2 ];
in
{
  "secret1.age".publicKeys = [ user1 system1 ];
  "secret2.age".publicKeys = users ++ systems;
}

To modify secret2.age you must have all of users and systems in age-default-recipient if I understand correctly.

This works for me at least, but it's possible you don't need all of them.

@ParetoOptimalDev
Copy link
Author

ParetoOptimalDev commented Aug 1, 2023

Leaving open in case there are other thoughts, ideas, or if this could be useful documentation.

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

1 participant