!XLCFfvFhUkYwOMLbVx:nixos.org

agenix

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

Load older messages


SenderMessageTime
21 Sep 2023
@dedmunwalk:matrix.orgdedmunwalk joined the room.23:06:27
22 Sep 2023
@willpower3309:matrix.orgwillmckinnonI'm trying to encrypt my user password with my user's public key, however it fails because I need to set age.identityPaths, but wouldn't that be set to point to the /etc/ssh directory, where system keys would live?04:04:29
@willpower3309:matrix.orgwillmckinnonI'm confused because if I've encrypted it with the user key, wouldn't it want to check the ~/.ssh directory, where the user private key is?04:07:24
@willpower3309:matrix.orgwillmckinnonThat said, I don't want to set the identityPaths to the user key directory because I also want to encrypt some keys with the system key04:08:18
@uep:matrix.orguepagenix decryption is done by system keys04:15:03
@uep:matrix.orguepyou add userkeys as well, but those are used when editing the secrets04:15:27
@uep:matrix.orguepthe system needs to decrypt the user password in order to set it, perhaps when creating the user, and the home dir may not even exist yet04:16:13
@stelcodes:matrix.orgstelcodes> I'm trying to encrypt my user password with my user's public key, however it fails because I need to set age.identityPaths, but wouldn't that be set to point to the /etc/ssh directory, where system keys would live? Do you have `services.openssh.enable = true;` in your config?04:20:43
@uep:matrix.orguepI think they've encrypted it only with the user key, and not the system key, so it's not finding a suitable private key in the paths04:40:45
@uep:matrix.orguep willmckinnon: if that doesn't already solve it for you, can you share some of your config for secrets.nix (the pubkeys for that secret) and where you're using it in configuration (I assume users.users.<you>.passwordFile = …) 04:50:22
@willpower3309:matrix.orgwillmckinnon
In reply to @stelcodes:matrix.org

I'm trying to encrypt my user password with my user's public key, however it fails because I need to set age.identityPaths, but wouldn't that be set to point to the /etc/ssh directory, where system keys would live?

Do you have services.openssh.enable = true; in your config?

No, Im using this machine just as a client, don't have a use case to ssh into it
05:00:19
@willpower3309:matrix.orgwillmckinnon
In reply to @uep:matrix.org
agenix decryption is done by system keys
I see, why can we specify user keys then? Trying to understand some of the design choices
05:01:17
@willpower3309:matrix.orgwillmckinnonIn the readme for example, it shows the user keys being used for a file in a secrets.nix05:01:40
@uep:matrix.orguepso the age cli can decrypt them when you edit the secrets05:01:49
@willpower3309:matrix.orgwillmckinnonSo it's for the age cli, not the system config?05:02:13
@uep:matrix.orguepexactly05:02:25
@willpower3309:matrix.orgwillmckinnonI see, thanks05:02:32
@uep:matrix.orguepYou can generate a host key (ssh or otherwise) and use that, without needing to have ssh service running all the time05:03:39
@willpower3309:matrix.orgwillmckinnonYup! Thats what I had been doing, just hadnt realized we needed to explicity specify its location (and that it had to be used over a user key)05:04:30
@uep:matrix.orguepgood pickup that this is why the path doesn't exist (and there's probably not a system key to use at all yet)05:04:42
@willpower3309:matrix.orgwillmckinnon

one more question, more about nix probably and less about agenix

let
  systemServer = builtins.readFile ../hosts/server/ssh_host_ed25519_key.pub;

in
{
  "rootPassword.age".publicKeys = [ systemServer ];
}

results in error: cannot convert a thunk to JSON. Where am I going wrong here? For organization I thought id store my public host keys in a folder along with the host config

05:05:36
@uep:matrix.orguep you probably want to put that in a string context to make it evaluate … = [ "${systemServer}" ] 05:07:25
@uep:matrix.orguepbut I'm not sure exacrl05:07:31
@uep:matrix.orguep * but I'm not sure exactly05:07:34
@willpower3309:matrix.orgwillmckinnonhmm still getting the same error, maybe ill try in the nixos matrix room05:08:25
@willpower3309:matrix.orgwillmckinnonthanks anyway!05:08:28
@stelcodes:matrix.orgstelcodesIs that text in a file called secrets.nix in the cwd? I don't see anything wrong with that code.05:21:26
@uep:matrix.orguep likely answer has been found in the main channel, I'll let willmckinnon relay back here 05:25:17
@uep:matrix.orguepmakes sense to me though05:25:32
@uep:matrix.orguep as for the confusion about the purpose of adding user keys, I wonder if calling the variable editors rather than users in the example config would help ? 05:28:09

Show newer messages


Back to Room ListRoom Version: 6