Commit graph

315 commits

Author SHA1 Message Date
Felix Scheinost
dddc664d4a feat: rekey only specific identity
Currently rekey re-encrypts all files.

For my personal use-case, agenix would ideally only files that require rekeying, i.e. files where the identities changed.
But I don’t think there’s an (easy) way to achieve that with `age` currently, as there’s no way to get the current recipients from an encrypted file?

This change would allow the user to manually specifiy that only secrets that contain a given identity should be rekeyed.

In my use-case this is handy as when I add a new server I want all secrets that are shared between servers (where the new identity was added) to be rekeyed, but I don’t want all secrets that are personal to different servers to also be rekeyed.
2024-10-25 15:06:07 +02:00
Ryan Mulligan
f6291c5935
Merge pull request #280 from Kreyren/patch-3
age-home: Use curly-brackets for XDG_RUNTIME_DIR
2024-08-10 05:45:04 -07:00
Jacob Hrbek
e3413992fb age-home: Use curly-brackets for XDG_RUNTIME_DIR
To avoid having to do 4fd99eae63/nixos/secrets.nix (L25C9-L29C116) while using agenix in user services.
2024-08-10 05:05:53 +02:00
Ryan Mulligan
3f1dae074a
Merge pull request #277 from fzakaria/import-module-remove
Remove import for NixOS/HM modules
2024-07-30 04:30:03 -07:00
Farid Zakaria
40012e5ed4 Remove import for NixOS/HM modules
When using `files` on a NixOS option in the `nix repl` it fails to
follow the attribute of agenix module.

Discussing with @roberth has explained that this is a "common bug" on
account of mis-using the `import` for modules.

From what I understand, the `import` statement brings it into the
current context so you lose the attribute of where it's defined.

Here is what I currently see:
```
nix-repl> options.age.ageBin.files
[
  "/nix/store/8kpmdb63f5i9mwdyirqki7hvvglgy1va-source/machines/nyx/configuration.nix"
]

```

After this change, the value in agenix is reported instead.
```
❯ nix repl --extra-experimental-features 'flakes repl-flake' \
           --override-input agenix /home/fmzakari/code/github.com/ryantm/agenix .

nix-repl> options.age.ageBin.files
[
  "/nix/store/99gc8rhgw43k201k34pshcsygdvbhmpy-source/modules/age.nix"
]
```
2024-07-29 08:15:01 -07:00
Ryan Mulligan
de96bd907d
Merge pull request #265 from Kreyren/patch-1
README: Add warning about HNDL and PQS in threat model
2024-07-09 10:30:05 -07:00
KREYREN
760751b6d1
README: Add warning about HNDL and PQS in theat model 2024-06-19 15:37:53 +00:00
Ryan Mulligan
3a56735779
Merge pull request #187 from oddlama/main
fix: always treat link destinations as files to ensure an error when the destination is a directory
2024-06-14 06:18:04 -07:00
Nathan Henrie
c2fc0762bb
Merge pull request #241 from sternenseemann/nix-2.3-install-check
agenix: fix installCheckPhase with Nix 2.3
2024-05-24 08:40:46 -06:00
oddlama
08ed896eb6
fix: always treat link destinations as files to ensure error when destination is a directory.
This can happen if for example a secret is used in the initrd, which
materializes it as a directory, which then causes agenix to silently
create an incorrect link when switching to stage2. This ensures that
agenix will abort with an error.
2024-05-21 15:08:15 +02:00
Nathan Henrie
8d37c5bdea
Merge pull request #259 from hansemschnokeloch/patch-1
Fix typo
2024-05-09 15:32:35 -06:00
hansemschnokeloch
63a57d8dfb
Fix typo 2024-05-09 22:25:29 +02:00
Jörg Thalheim
07479c2e73
update link to nixos wiki (#258) 2024-05-07 10:12:37 -07:00
Ryan Mulligan
24a7ea3905
Merge pull request #256 from spectre256/main
fix: allow for newlines in keys
2024-04-26 05:59:12 -07:00
Ellis Gibbons
2c1d1fb134
fix: allow for newlines in keys 2024-04-12 17:50:07 -04:00
Cole Helbling
1381a759b2
Merge pull request #254 from oluceps/fix-doc
doc: fix wrong `ssh-keyscan` usage
2024-04-02 10:31:00 -07:00
oluceps
3fd98a2c3b
doc: fix wrong ssh-keyscan usage 2024-04-03 01:00:02 +08:00
Ryan Mulligan
8cb01a0e71
Merge pull request #244 from kraem/fix/rage_to_age_docs
fix: update docs for 5c1198a
2024-02-13 05:27:47 -08:00
kraem
1f62cef426 fix: update docs for 5c1198a 2024-02-07 08:48:49 +01:00
sternenseemann
1746e4f5ec agenix: fix installCheckPhase with Nix 2.3
As opposed to e.g. Nix 2.18, Nix 2.3 doesn't try to create a fallback
store in $HOME if $NIX_STORE_DIR and $NIX_STATE_DIR aren't writable.
2024-02-01 13:30:22 +01:00
Ryan Mulligan
417caa847f
Merge pull request #232 from ryantm/rtm-12-23-test
dev: reland add direct tests for agenix
2023-12-24 08:04:03 -08:00
Ryan Mulligan
a23aa271be dev: reland add direct tests for agenix
Why
===
* We'd like some tests for the CLI
* Last time we tried it failed on macos

What changed
===
* This time, we try to create the temp diretory in a way that works
with macos too
2023-12-23 14:47:15 -08:00
Ryan Mulligan
bc24f2e510 Revert "Revert "contrib: add direct tests for agenix ""
This reverts commit 08dc5068e6.
2023-12-23 14:43:03 -08:00
Ryan Mulligan
457669db42
Merge pull request #230 from ryantm/rtm-12-20-age
feat: switch from rage to age
2023-12-23 14:40:41 -08:00
Nathan Henrie
6ce42cc768 Fix CI for darwin
nix-darwin is detecting `/etc/nix/nix.conf` from the
cachix/install-nix-action and refusing to overwrite it, failing the
nix-darwin activation and therefore the rest of CI.

This commit `mv`s the existing `nix.conf` to avoid the above, and then
adds support for new-style nix commands and flakes to the nix-darwin
configuration to allow their subsequent use in CI.

It also removes the nix config from the `cachix/install-nix-action`
step, which was duplicated effort since we are blowing it away with
nix-darwin anyway.

Relevant:

- https://github.com/LnL7/nix-darwin/issues/149
2023-12-23 14:10:44 -08:00
Ryan Mulligan
23d4d5d291 maybe this fixes darwin checks? 2023-12-23 14:10:06 -08:00
Ryan Mulligan
b6aa6180db test removing installer 2023-12-23 14:10:06 -08:00
Ryan Mulligan
58017c0c93 update inputs 2023-12-23 14:10:06 -08:00
Ryan Mulligan
bd86c06961 fix doc build 2023-12-23 14:10:02 -08:00
Ryan Mulligan
eb3b5cf4fd update nixpkgs 2023-12-23 14:09:16 -08:00
Ryan Mulligan
5c1198a352 feat: switch from rage to age
Why
===
* Someone said age works better with password protected keys,
requiring entering the password less often.
* We switched to rage from age in
07ce686870
because it was limiting recipients to 20. This was fixed
https://github.com/FiloSottile/age/issues/139

What changed
===
* Switch from rage back to age (the reference implementation) in all
the spots
* Update the docs to show how to switch back to Rage
* Skip keys that are empty files, which fixes the integration test.
2023-12-23 14:09:16 -08:00
Ryan Mulligan
9bc80dc4ce
Merge pull request #229 from ryantm/rtm-12-20-flake
dev: remove i686 support; simplify flake
2023-12-23 14:08:24 -08:00
Ryan Mulligan
d0d4ad5be6
Merge pull request #231 from ryantm/revert-163-rtm-2-21-recursive-nix
Revert "contrib: add direct tests for agenix "
2023-12-22 07:48:36 -08:00
Ryan Mulligan
08dc5068e6
Revert "contrib: add direct tests for agenix " 2023-12-22 07:48:06 -08:00
Ryan Mulligan
17090d105a
Merge pull request #163 from ryantm/rtm-2-21-recursive-nix
contrib: add direct tests for agenix
2023-12-20 13:19:59 -08:00
Ryan Mulligan
097aa18b59 contrib: add direct tests for agenix
These tests are MUCH faster than the NixOS tests.
2023-12-20 13:06:57 -08:00
Ryan Mulligan
344f985526 dev: remove i686 support; simplify flake
Why
===
* flake.nix had a lot of almost redundant lines in it.
* i686 support is probably being dropped soon in nixpkgs
https://github.com/NixOS/nixpkgs/pull/266164

What changed
==
* Add new input nix-systems/default which represents the default
systems typically used in the Nix community
* Define and use an eachSystem function that simplifies the flake.nix file
2023-12-20 08:56:05 -08:00
Ryan Mulligan
564595d0ad version 0.15.0 2023-12-20 08:33:16 -08:00
Ryan Mulligan
b7e0494b10
Merge pull request #224 from SamueleFacenda/SamueleFacenda-change-keys-functions
Update keys functions in agenix.sh
2023-12-20 08:17:38 -08:00
Samuele Facenda
9d3b37a117 fix: update keys functions in agenix.sh
The functions was always called with `$FILE` as first argument, but inside the argument is ignored. This change doesn' have any impact, but can solve problems caused by the keys function called with an argument different from `$FILE`
2023-12-20 08:08:56 -08:00
Ryan Mulligan
93cec0ce6e dev: add security label category 2023-12-20 08:03:06 -08:00
Ryan Mulligan
221a1f22e5 dev: add release-drafter 2023-12-20 07:52:23 -08:00
Ryan Mulligan
6cb7cd66c2
Merge pull request #221 from CobaltCause/edit-mkdir-p
create leading directories if they don't exist
2023-12-20 07:42:34 -08:00
Ryan Mulligan
13ac9ac6d6
Merge pull request #176 from shivak/patch-1
only backup cleartext file if it exists
2023-11-28 16:08:36 -08:00
Shiva Kaul
4c48606094 only backup cleartext file if it exists
Avoids complaints from `cp` about nonexistent files.
2023-11-28 16:05:48 -08:00
Charles Hall
65fe5959c3
create leading directories if they don't exist
This works for files without directories too because `dirname` prints
`.` in that case.
2023-11-03 15:25:24 -07:00
Charles Hall
05591973d7
use named variable instead of numbered one 2023-11-03 14:53:33 -07:00
Ryan Mulligan
daf42cb35b
Merge pull request #208 from ryantm/revert-206-feature/remove-trailing-newlines-from-keys
Revert "feat: remove empty newlines from jq query"
2023-10-08 07:32:09 -07:00
Ryan Mulligan
dbc533ddc2
Revert "feat: remove empty newlines from jq query" 2023-10-08 07:31:54 -07:00
Ryan Mulligan
e2f339274d
Merge pull request #206 from timhae/feature/remove-trailing-newlines-from-keys
feat: remove empty newlines from jq query
2023-10-08 05:25:24 -07:00