Skip to content

sops-nix does not work with ssh key: /run/secrets not generated #955

Description

@Dev380

I'm using sops-nix, and my key config is:

sops.age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];

However, whenever I nixos-rebuild my VPS remotely, I get this:

activating the configuration...
setting up /etc...
sops-install-secrets: Imported /etc/ssh/ssh_host_ed25519_key as age key with fingerprint age15tfjmtl3ls7nfnfjky42r9xz76hknyz6fp0f5fnul3x25rn5wenqz5535x
/nix/store/450siq4ggqplsmfgg8kq9aqf7k39m5wi-sops-install-secrets-0.0.1/bin/sops-install-secrets: failed to decrypt '/nix/store/vc5qf25l8xfp3bwih1d273xxpiphqj72-cloudflare.yaml': Error getting data key: 0 successful groups required, got 0
Activation script snippet 'setupSecrets' failed (1)
Failed to run activate script

I can confirm the key fingerprint is correct with ssh-to-age on /etc/ssh/ssh_host_ed25519_key. I can also confirm that SOPS_AGE_SSH_PRIVATE_KEY_FILE=/etc/ssh/ssh_host_ed25519_key sops -d /nix/store/vc5qf25l8xfp3bwih1d273xxpiphqj72-cloudflare.yaml works, but SOPS_AGE_KEY_FILE=/run/secrets.d/age-keys.txt sops -d /nix/store/vc5qf25l8xfp3bwih1d273xxpiphqj72-cloudflare.yaml doesn't.

I have two ssh keys added to the file that sops is trying to decrypt, one of them corresponding to the key in /etc/ssh/ssh_host_ed25519_key. Decryption works locally and sops updatekeys doesn't do anything since my secret file doesn't have any issue as far as I know.

/run/secrets is not generated due to the failure and therefore all of my services that depend on sops-nix fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions