Skip to content

Commit

Permalink
feat: switch from rage to age
Browse files Browse the repository at this point in the history
Why
===
* Someone said age works better with password protected keys,
requiring entering the password less often.
* We switched to rage from age in
07ce686
because it was limiting recipients to 20. This was fixed
FiloSottile/age#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.
  • Loading branch information
ryantm committed Dec 21, 2023
1 parent 17090d1 commit c8748c0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ All files in the Nix store are readable by any system user, so it is not a suita

## Notices

* Password-protected ssh keys: since the underlying tool age/rage do not support ssh-agent, password-protected ssh keys do not work well. For example, if you need to rekey 20 secrets you will have to enter your password 20 times.
* Password-protected ssh keys: since age does not support ssh-agent, password-protected ssh keys do not work well. For example, if you need to rekey 20 secrets you will have to enter your password 20 times.

## Installation

Expand Down Expand Up @@ -487,7 +487,7 @@ Example of a secret with a name different from its attrpath:
#### `age.ageBin`

`age.ageBin` the string of the path to the `age` binary. Usually, you
don't need to change this. Defaults to `rage/bin/rage`.
don't need to change this. Defaults to `age/bin/age`.

Overriding `age.ageBin` example:

Expand Down Expand Up @@ -587,13 +587,13 @@ improved upon by reading the identities from the age file.)

#### Overriding age binary

The agenix CLI uses `rage` by default as its age implemenation, you
can use the reference implementation `age` with Flakes like this:
The agenix CLI uses `age` by default as its age implemenation, you
can use the `rage` implementation with Flakes like this:

```nix
{pkgs,agenix,...}:{
environment.systemPackages = [
(agenix.packages.x86_64-linux.default.override { ageBin = "${pkgs.age}/bin/age"; })
(agenix.packages.x86_64-linux.default.override { ageBin = "${pkgs.rage}/bin/rage"; })
];
}
```
Expand Down
2 changes: 1 addition & 1 deletion doc/notices.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Notices {#notices}

* Password-protected ssh keys: since the underlying tool age/rage do not support ssh-agent, password-protected ssh keys do not work well. For example, if you need to rekey 20 secrets you will have to enter your password 20 times.
* Password-protected ssh keys: since age does not support ssh-agent, password-protected ssh keys do not work well. For example, if you need to rekey 20 secrets you will have to enter your password 20 times.
2 changes: 1 addition & 1 deletion doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Example of a secret with a name different from its attrpath:
### `age.ageBin`

`age.ageBin` the string of the path to the `age` binary. Usually, you
don't need to change this. Defaults to `rage/bin/rage`.
don't need to change this. Defaults to `age/bin/age`.

Overriding `age.ageBin` example:

Expand Down
2 changes: 1 addition & 1 deletion modules/age-home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ with lib; let
'';
in {
options.age = {
package = mkPackageOption pkgs "rage" {};
package = mkPackageOption pkgs "age" {};

secrets = mkOption {
type = types.attrsOf secretType;
Expand Down
5 changes: 3 additions & 2 deletions modules/age.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ with lib; let
IDENTITIES=()
for identity in ${toString cfg.identityPaths}; do
test -r "$identity" || continue
test -s "$identity" || continue
IDENTITIES+=(-i)
IDENTITIES+=("$identity")
done
Expand Down Expand Up @@ -189,9 +190,9 @@ in {
options.age = {
ageBin = mkOption {
type = types.str;
default = "${pkgs.rage}/bin/rage";
default = "${pkgs.age}/bin/age";
defaultText = literalExpression ''
"''${pkgs.rage}/bin/rage"
"''${pkgs.age}/bin/age"
'';
description = ''
The age executable to use.
Expand Down
4 changes: 2 additions & 2 deletions pkgs/agenix.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
lib,
stdenv,
rage,
age,
jq,
nix,
mktemp,
diffutils,
substituteAll,
ageBin ? "${rage}/bin/rage",
ageBin ? "${age}/bin/age",
shellcheck,
}: let
bin = "${placeholder "out"}/bin/agenix";
Expand Down

0 comments on commit c8748c0

Please sign in to comment.