repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
sops.nixNix45 lines2.0 KiBraw download
# modules/hosts/laptop/sops.nix — sops-nix: secrets encrypted in this repo, decrypted
# at activation into /run/secrets (root-only tmpfs; per-secret owner/mode).
#
# System secrets have their own key, so the user's key cannot open them
# (.sops.yaml):
#   secrets/system/*   host key (/var/lib/sops-nix/key.txt, root 0600, made with
#                      age-keygen on this machine) + the offline admin recovery key
#   secrets/*          the user's key (~/.config/sops/age/keys.txt), for
#                      modules/home/sops.nix — never readable from here
#
# Edit a system secret as root, with the host key:
#
#   sudo env SOPS_AGE_KEY_FILE=/var/lib/sops-nix/key.txt TMPDIR=/dev/shm sops secrets/system/<file>
#
# Lost host key: decrypt with the admin key (offline, see .sops.yaml), make a
# new host key, swap its public half into .sops.yaml and `sops updatekeys`
# every file in secrets/system/.
#
# No SSH host key is used: sshd is not enabled on this machine, so there is
# none to derive an age key from (sshKeyPaths is emptied below for that reason).
#
# Declaring a secret (each one names its file; there is no default file, so a
# system secret cannot silently come from the user's secrets/secrets.yaml):
#   sops.secrets.my-token = { sopsFile = ../../../secrets/system/secrets.yaml; };   # → /run/secrets/my-token, root:root 0400
#   sops.secrets."ssd.key" = { sopsFile = …; path = "/etc/secrets/ssd.key"; };      # the LUKS key, if it moves into sops
#   sops.secrets.wifi-psk = { sopsFile = …; owner = user; };                        # readable by the user
# then add the value with the sudo command above, and `nh os switch`.
{ ... }:
{
  flake.nixosModules.laptop-sops =
  { inputs, user, ... }:
  {
    imports = [ inputs.sops-nix.nixosModules.sops ];

    sops = {
      age = {
        keyFile = "/var/lib/sops-nix/key.txt";
        sshKeyPaths = [ ];
        generateKey = false; # made by hand once (see .sops.yaml); never a silent fresh one
      };
      gnupg.sshKeyPaths = [ ];
    };
  }
  ;
}