secrets via agenix

This commit is contained in:
Benjamin Bädorf 2021-10-23 13:24:22 +02:00
parent cd5e19b10e
commit 87a9d94d0a
No known key found for this signature in database
GPG key ID: 4406E80E13CD656C
6 changed files with 38 additions and 7 deletions

View file

@ -11,7 +11,7 @@ in
];
config = {
pub-solar.x-os.keyfile = "/etc/nixos/hosts/chocolatebar/secrets/keyfile.bin";
pub-solar.x-os.keyfile = "keyfile-chocolatebar.bin";
pub-solar.virtualisation.isolateGPU = "rx550x";

View file

@ -12,6 +12,7 @@ in
config = mkIf cfg.enable {
home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
home.packages = [
croc
drone-cli
nmap
python38Packages.ansible

View file

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }:
{ config, pkgs, lib, self, ... }:
let
cfg = config.pub-solar.x-os;
@ -17,8 +17,9 @@ with lib; {
# Use Keyfile to unlock the root partition to avoid keying in twice.
# Allow fstrim to work on it.
age.secrets.luksKeyFile.file = "${self}/secrets/${cfg.keyfile}";
boot.initrd = {
secrets = { "/keyfile.bin" = cfg.keyfile; };
secrets = { "/keyfile.bin" = "/run/secrets/${cfg.keyfile}"; };
luks.devices."cryptroot" = {
keyFile = "/keyfile.bin";
allowDiscards = true;

BIN
secrets/keyfile-biolimo.bin Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,9 +1,38 @@
let
# set ssh public keys here for your system and user
system = "";
user = "";
allKeys = [ system user ];
bbcom = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCmXpOU6vzQiVSSYCoxHYv7wDxC63Qg3dxlAMR6AOzwIABCU5PFFNcO0NWYms/YR7MOViorl+19LCLRABar9JgHU1n+uqxKV6eGph3OPeMp5sN8LAh7C9N+TZj8iJzBxQ3ch+Z/LdmLRwYNJ7KSUI+gwGK6xRS3+z1022Y4P0G0sx7IeCBl4lealQEIIF10ZOfjUdBcLQar7XTc5AxyGKnHCerXHRtccCoadLQujk0AvPXbv3Ma4JwX9X++AnC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7J0UPQmz7rzAn2Lki1CnX9PDdxZneqTxgpBomHJt4H+vXMw13scA4xxEDBvfS5KkjbEJqWLbfklCoER6nV3NPLZ6CBl0Xe/VQBSkqEuUEIXih/oa8emDOGUODNF75ck5NJmKiGg6AFZoeiDa7PZMIxhhOq4vsR2Ty43rztUJ0CMX7iSIk3Eql7kqNdvrJaJ7z0GBsiw== ben@biolimo";
chocolatebar-host = "";
chocolatebar-user = "";
allKeys = [
bbcom
biolimo-host
biolimo-user
chocolatebar-host
chocolatebar-user
];
biolimoKeys = [
bbcom
biolimo-host
biolimo-user
];
chocolatebarKeys = [
bbcom
chocolatebar-host
chocolatebar-user
];
in
{
"secret.age".publicKeys = allKeys;
"keyfile-biolimo.bin".publicKeys = biolimoKeys;
"keyfile-chocolatebar.bin".publicKeys = biolimoKeys;
}