sops: introduce sops-nix (age), ssh keys from encrypted tarball, .example secrets
This commit is contained in:
parent
8be13b680f
commit
a7ec82579c
9 changed files with 149 additions and 7 deletions
|
|
@ -58,9 +58,9 @@
|
|||
# A previous wwan-autoconnect oneshot service called `mmcli --simple-connect`
|
||||
# with a hardcoded APN and set up routing by hand. It fought NM for the modem
|
||||
# (endless "connecting") and its hardcoded APN broke when the SIM changed.
|
||||
# Removed: connect via the GNOME network applet using the "narayana" GSM
|
||||
# profile (apn=data.narayana). Re-add a service only if headless autoconnect
|
||||
# is needed, and if so set the NM profile's autoconnect=no to avoid contention.
|
||||
# Removed: connect via the GNOME network applet using the carrier's GSM
|
||||
# profile instead. Re-add a service only if headless autoconnect is needed,
|
||||
# and if so set the NM profile's autoconnect=no to avoid contention.
|
||||
|
||||
# IVPN service — installed but not auto-started at boot.
|
||||
# Start manually: `sudo systemctl start ivpn-service`
|
||||
|
|
|
|||
30
modules/sops.nix
Normal file
30
modules/sops.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# sops-nix: decrypt secrets at activation using the root-side age key.
|
||||
# Key installed once via:
|
||||
# sudo install -d -m 700 /var/lib/sops-nix
|
||||
# sudo install -m 600 ~/.config/sops/age/keys.txt /var/lib/sops-nix/key.txt
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
|
||||
# Secret files are gitignored (only .example structure files are tracked),
|
||||
# so they are referenced by absolute path and read at activation, not eval.
|
||||
sops.validateSopsFiles = false;
|
||||
|
||||
# SSH keys travel as one encrypted tarball so filenames stay inside the
|
||||
# encrypted payload. (Re)create with:
|
||||
# tar -C ~/.ssh -cf secrets/ssh-keys.tar <keys...> && sops -e -i secrets/ssh-keys.tar
|
||||
sops.secrets."ssh-keys.tar" = {
|
||||
sopsFile = "/etc/nixos/secrets/ssh-keys.tar";
|
||||
format = "binary";
|
||||
};
|
||||
system.activationScripts.ssh-keys = {
|
||||
deps = [ "setupSecrets" "users" ];
|
||||
text = ''
|
||||
mkdir -p /home/asxpi/.ssh
|
||||
${pkgs.gnutar}/bin/tar --unlink-first -C /home/asxpi/.ssh -xf ${config.sops.secrets."ssh-keys.tar".path}
|
||||
chown -R asxpi:users /home/asxpi/.ssh
|
||||
chmod 700 /home/asxpi/.ssh
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue