!XLCFfvFhUkYwOMLbVx:nixos.org

agenix

379 Members
age-encrypted secrets for NixOS https://github.com/ryantm/agenix/99 Servers

Load older messages


SenderMessageTime
26 Oct 2023
@charles:computer.surgeryCharles ⚡️
In reply to @charles:computer.surgery
I wonder if this would be worth upstreaming in some capacity? Maybe with some more configurability, since the secrets directory is a little hardcoded
In particular I mean the little NixOS module in flake.nix and the mkSecret and mkSecrets functions (mainly the latter, the former is mostly just implementation details) in secrets.nix
09:06:09
27 Oct 2023
@federicodschonborn:matrix.orgFederico Damián Schonborn changed their profile picture.01:24:47
29 Oct 2023
@charles:computer.surgeryCharles ⚡️

I stripped out the library functions to a standalone file so it's easier to steal:

  • https://or.computer.surgery/charles/servy-fleet/-/blob/60273f09fe0853a8d42ace9287878d4bbe08fae1/lib/secrets.nix

Here's how I use it:

  • https://or.computer.surgery/charles/servy-fleet/-/blob/60273f09fe0853a8d42ace9287878d4bbe08fae1/flake.nix#L77-78
  • https://or.computer.surgery/charles/servy-fleet/-/blob/60273f09fe0853a8d42ace9287878d4bbe08fae1/secrets.nix
04:07:43
@charles:computer.surgeryCharles ⚡️

why does this happen?

$ nix eval '.#nixosConfigurations.blue.config.age.secrets."garage/rpc".file'                                              /nix/store/5figp7jxkcwhw790j79p64533vl2d7pb-source/secrets/garage/rpc.age
$ git checkout HEAD^
$ nix eval '.#nixosConfigurations.blue.config.age.secrets."garage/rpc".file'                                              /nix/store/5p5zlykmcrbmyhik4xgxilng1h3xcqan-source/secrets/garage/rpc.age

the hashes are different but the contents of the file are the same

04:37:03
@charles:computer.surgeryCharles ⚡️ *

why does this happen?

$ nix eval '.#nixosConfigurations.blue.config.age.secrets."garage/rpc".file'
/nix/store/5figp7jxkcwhw790j79p64533vl2d7pb-source/secrets/garage/rpc.age
$ git checkout HEAD^
$ nix eval '.#nixosConfigurations.blue.config.age.secrets."garage/rpc".file'
/nix/store/5p5zlykmcrbmyhik4xgxilng1h3xcqan-source/secrets/garage/rpc.age

the hashes are different but the contents of the file are the same

04:37:33
@charles:computer.surgeryCharles ⚡️ the goal is to have a systemd restartTriggers for a service that uses an agenix secret, and this does work, but it restarts every time instead of just when it changes 04:38:43
@charles:computer.surgeryCharles ⚡️ maybe i should builtins.readFile it so the restartTriggers just has the ciphertext? 04:39:39
@charles:computer.surgeryCharles ⚡️no that doesn't work because the contents can't be a nix string04:42:07
@charles:computer.surgeryCharles ⚡️ builtins.hashFileing it worked 04:49:19
@jacekpoz:jacekpoz.pljacekpoz 11:13:09
@jacekpoz:jacekpoz.pljacekpoz 11:13:14
@jacekpoz:jacekpoz.pljacekpoz 11:58:31
@jacekpoz:jacekpoz.pljacekpoz 11:58:40
@jacekpoz:jacekpoz.pljacekpoz 13:45:23
@jacekpoz:jacekpoz.pljacekpoz 13:45:31
@jacekpoz:jacekpoz.pljacekpoz 17:43:51
@jacekpoz:jacekpoz.pljacekpoz 17:43:59
@jacekpoz:jacekpoz.pljacekpoz 17:45:02
@jacekpoz:jacekpoz.pljacekpoz 20:54:25
@jacekpoz:jacekpoz.pljacekpoz 20:54:34
31 Oct 2023
@peter-lustig:matrix.orgpeter-lustig

If I have two hosts, laptop and personal computer that should be able to do remote deployments to a server, how should the top section of this secrets.nix file look like? I do the deployments with nixos-rebuild --target-host, and I am a bit confused on how I would achieve this:

let
  server = "";
in
{
  "hedgedoc-environment-file.age".publicKeys = [ server ];
  "discord-bot-token.age".publicKeys = [ server ];
}
09:15:32
@k900:0upti.meK900 ⚡️The server's SSH host key09:20:56
@peter-lustig:matrix.orgpeter-lustig
In reply to @k900:0upti.me
The server's SSH host key
just the public key of the server?
09:23:36
@k900:0upti.meK900 ⚡️Yes09:23:44
@peter-lustig:matrix.orgpeter-lustigbut if i want to do remote deployments do I not need the public keys of the machines as well09:24:09
@peter-lustig:matrix.orgpeter-lustiglaptop and pc09:24:12
@k900:0upti.meK900 ⚡️No09:24:19
@k900:0upti.meK900 ⚡️Well09:24:21
@k900:0upti.meK900 ⚡️It depends on whether you want to edit those files in the future09:24:31
@peter-lustig:matrix.orgpeter-lustig
In reply to @k900:0upti.me
It depends on whether you want to edit those files in the future
i guess I would just ssh onto the server and then do the agenix -e stuff
09:24:51

Show newer messages


Back to Room ListRoom Version: 6