diff --git a/README.md b/README.md index b9f747c..6b92915 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ - `/network` - config for tailscale, and NixOS container with automatic vpn tunneling via PIA - `/pc` - config that a graphical desktop computer should have. Use `de.enable = true;` to enable everthing. - `/server` - config that creates new nixos services or extends existing ones to meet my needs - - `/ssh.nix` - all ssh public host and user keys for all `/machines` - `/machines` - all my NixOS machines along with their machine unique configuration for hardware and services - `/kexec` - a special machine for generating minimal kexec images. Does not import `/common` - `/secrets` - encrypted shared secrets unlocked through `/machines` ssh host keys diff --git a/common/default.nix b/common/default.nix index b88c9f8..f6ca89b 100644 --- a/common/default.nix +++ b/common/default.nix @@ -1,10 +1,5 @@ { config, pkgs, ... }: -let - ssh = import ./ssh.nix; - sshUserKeys = ssh.users; - sshHigherTrustKeys = ssh.higherTrustUserKeys; -in { imports = [ ./backups.nix @@ -15,6 +10,8 @@ in ./boot ./server ./pc + ./machine-info + ./ssh.nix ]; nix.flakes.enable = true; @@ -68,12 +65,12 @@ in "dialout" # serial ]; shell = pkgs.fish; - openssh.authorizedKeys.keys = sshUserKeys; + openssh.authorizedKeys.keys = config.machines.ssh.userKeys; hashedPassword = "$6$TuDO46rILr$gkPUuLKZe3psexhs8WFZMpzgEBGksE.c3Tjh1f8sD0KMC4oV89K2pqAABfl.Lpxu2jVdr5bgvR5cWnZRnji/r/"; uid = 1000; }; users.users.root = { - openssh.authorizedKeys.keys = sshHigherTrustKeys; + openssh.authorizedKeys.keys = config.machines.ssh.deployKeys; }; nix.settings = { trusted-users = [ "root" "googlebot" ]; diff --git a/common/machine-info/default.nix b/common/machine-info/default.nix new file mode 100644 index 0000000..d51c1cb --- /dev/null +++ b/common/machine-info/default.nix @@ -0,0 +1,198 @@ +# Gathers info about each machine to constuct overall configuration +# Ex: Each machine already trusts each others SSH fingerprint already + +{ config, lib, pkgs, ... }: + +let + machines = config.machines.hosts; +in +{ + imports = [ + ./ssh.nix + ./roles.nix + ]; + + options.machines.hosts = lib.mkOption { + type = lib.types.attrsOf + (lib.types.submodule { + options = { + + hostNames = lib.mkOption { + type = lib.types.listOf lib.types.str; + description = '' + List of hostnames for this machine. The first one is the default so it is the target of deployments. + Used for automatically trusting hosts for ssh connections. + ''; + }; + + arch = lib.mkOption { + type = lib.types.enum [ "x86_64-linux" "aarch64-linux" ]; + description = '' + The architecture of this machine. + ''; + }; + + systemRoles = lib.mkOption { + type = lib.types.listOf lib.types.str; # TODO: maybe use an enum? + description = '' + The set of roles this machine holds. Affects secrets available. (TODO add service config as well using this info) + ''; + }; + + hostKey = lib.mkOption { + type = lib.types.str; + description = '' + The system ssh host key of this machine. Used for automatically trusting hosts for ssh connections + and for decrypting secrets with agenix. + ''; + }; + + remoteUnlock = lib.mkOption { + default = null; + type = lib.types.nullOr (lib.types.submodule { + options = { + + hostKey = lib.mkOption { + type = lib.types.str; + description = '' + The system ssh host key of this machine used for luks boot unlocking only. + ''; + }; + + clearnetHost = lib.mkOption { + default = null; + type = lib.types.nullOr lib.types.str; + description = '' + The hostname resolvable over clearnet used to luks boot unlock this machine + ''; + }; + + onionHost = lib.mkOption { + default = null; + type = lib.types.nullOr lib.types.str; + description = '' + The hostname resolvable over tor used to luks boot unlock this machine + ''; + }; + + }; + }); + }; + + userKeys = lib.mkOption { + default = [ ]; + type = lib.types.listOf lib.types.str; + description = '' + The list of user keys. Each key here can be used to log into all other systems as `googlebot`. + + TODO: consider auto populating other programs that use ssh keys such as gitea + ''; + }; + + deployKeys = lib.mkOption { + default = [ ]; + type = lib.types.listOf lib.types.str; + description = '' + The list of deployment keys. Each key here can be used to log into all other systems as `root`. + ''; + }; + + configurationPath = lib.mkOption { + type = lib.types.path; + description = '' + The path to this machine's configuration directory. + ''; + }; + + }; + }); + }; + + config = { + assertions = (lib.concatLists (lib.mapAttrsToList + ( + name: cfg: [ + { + assertion = builtins.length cfg.hostNames > 0; + message = '' + Error with config for ${name} + There must be at least one hostname. + ''; + } + { + assertion = builtins.length cfg.systemRoles > 0; + message = '' + Error with config for ${name} + There must be at least one system role. + ''; + } + { + assertion = cfg.remoteUnlock == null || cfg.remoteUnlock.hostKey != cfg.hostKey; + message = '' + Error with config for ${name} + Unlock hostkey and hostkey cannot be the same because unlock hostkey is in /boot, unencrypted. + ''; + } + { + assertion = cfg.remoteUnlock == null || (cfg.remoteUnlock.clearnetHost != null || cfg.remoteUnlock.onionHost != null); + message = '' + Error with config for ${name} + At least one of clearnet host or onion host must be defined. + ''; + } + { + assertion = cfg.remoteUnlock == null || cfg.remoteUnlock.clearnetHost == null || builtins.elem cfg.remoteUnlock.clearnetHost cfg.hostNames == false; + message = '' + Error with config for ${name} + Clearnet unlock hostname cannot be in the list of hostnames for security reasons. + ''; + } + { + assertion = cfg.remoteUnlock == null || cfg.remoteUnlock.onionHost == null || lib.strings.hasSuffix ".onion" cfg.remoteUnlock.onionHost; + message = '' + Error with config for ${name} + Tor unlock hostname must be an onion address. + ''; + } + { + assertion = builtins.elem "personal" cfg.systemRoles || builtins.length cfg.userKeys == 0; + message = '' + Error with config for ${name} + There must be at least one userkey defined for personal machines. + ''; + } + { + assertion = builtins.elem "deploy" cfg.systemRoles || builtins.length cfg.deployKeys == 0; + message = '' + Error with config for ${name} + Only deploy machines are allowed to have deploy keys for security reasons. + ''; + } + ] + ) + machines)); + + # Set per machine properties automatically using each of their `properties.nix` files respectively + machines.hosts = + let + properties = dir: lib.concatMapAttrs + (name: path: { + ${name} = + import path + // + { configurationPath = builtins.dirOf path; }; + }) + (propertiesFiles dir); + propertiesFiles = dir: + lib.foldl (lib.mergeAttrs) { } (propertiesFiles' dir ""); + propertiesFiles' = dir: dirName: + let + dirContents = builtins.readDir dir; + dirPaths = lib.filter (path: dirContents.${path} == "directory") (lib.attrNames dirContents); + propFiles = builtins.map (p: "${dir}/${p}") (lib.filter (path: path == "properties.nix") (lib.attrNames dirContents)); + in + lib.concatMap (d: propertiesFiles' "${dir}/${d}" d) dirPaths ++ builtins.map (p: { "${dirName}" = p; }) propFiles; + in + properties ../../machines; + }; +} diff --git a/common/machine-info/moduleless.nix b/common/machine-info/moduleless.nix new file mode 100644 index 0000000..2045124 --- /dev/null +++ b/common/machine-info/moduleless.nix @@ -0,0 +1,15 @@ +# Allows getting machine-info outside the scope of nixos configuration + +{ nixpkgs ? import { } +, assertionsModule ? +}: + +{ + machines = + (nixpkgs.lib.evalModules { + modules = [ + ./default.nix + assertionsModule + ]; + }).config.machines; +} diff --git a/common/machine-info/roles.nix b/common/machine-info/roles.nix new file mode 100644 index 0000000..a491c73 --- /dev/null +++ b/common/machine-info/roles.nix @@ -0,0 +1,19 @@ +{ config, lib, ... }: + +# Maps roles to their hosts + +{ + options.machines.roles = lib.mkOption { + type = lib.types.attrsOf (lib.types.listOf lib.types.str); + }; + + config = { + machines.roles = lib.zipAttrs + (lib.mapAttrsToList + (host: cfg: + lib.foldl (lib.mergeAttrs) { } + (builtins.map (role: { ${role} = host; }) + cfg.systemRoles)) + config.machines.hosts); + }; +} diff --git a/common/machine-info/ssh.nix b/common/machine-info/ssh.nix new file mode 100644 index 0000000..b7775d4 --- /dev/null +++ b/common/machine-info/ssh.nix @@ -0,0 +1,44 @@ +{ config, lib, ... }: + +let + machines = config.machines; + + sshkeys = keyType: lib.foldl (l: cfg: l ++ cfg.${keyType}) [ ] (builtins.attrValues machines.hosts); +in +{ + options.machines.ssh = { + userKeys = lib.mkOption { + type = lib.types.listOf lib.types.str; + description = '' + List of user keys aggregated from all machines. + ''; + }; + + deployKeys = lib.mkOption { + default = [ ]; + type = lib.types.listOf lib.types.str; + description = '' + List of deploy keys aggregated from all machines. + ''; + }; + + hostKeysByRole = lib.mkOption { + type = lib.types.attrsOf (lib.types.listOf lib.types.str); + description = '' + Machine host keys divided into their roles. + ''; + }; + }; + + config = { + machines.ssh.userKeys = sshkeys "userKeys"; + machines.ssh.deployKeys = sshkeys "deployKeys"; + + machines.ssh.hostKeysByRole = lib.mapAttrs + (role: hosts: + builtins.map + (host: machines.hosts.${host}.hostKey) + hosts) + machines.roles; + }; +} diff --git a/common/network/default.nix b/common/network/default.nix index 80882e5..a7c879c 100644 --- a/common/network/default.nix +++ b/common/network/default.nix @@ -7,7 +7,6 @@ let in { imports = [ - ./hosts.nix ./pia-openvpn.nix ./pia-wireguard.nix ./ping.nix diff --git a/common/network/hosts.nix b/common/network/hosts.nix deleted file mode 100644 index cef02fb..0000000 --- a/common/network/hosts.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ config, lib, ... }: - -let - system = (import ../ssh.nix).system; - - # hostnames that resolve on clearnet for LUKS unlocking - unlock-clearnet-hosts = { - ponyo = "unlock.ponyo.neet.dev"; - phil = "unlock.phil.neet.dev"; - s0 = "s0"; - }; - - # hostnames that resolve on tor for LUKS unlocking - unlock-onion-hosts = { - liza = "5synsrjgvfzywruomjsfvfwhhlgxqhyofkzeqt2eisyijvjvebnu2xyd.onion"; - router = "jxx2exuihlls2t6ncs7rvrjh2dssubjmjtclwr2ysvxtr4t7jv55xmqd.onion"; - ponyo = "cfamr6artx75qvt7ho3rrbsc7mkucmv5aawebwflsfuorusayacffryd.onion"; - s0 = "r3zvf7f2ppaeithzswigma46pajt3hqytmkg3rshgknbl3jbni455fqd.onion"; - }; -in -{ - programs.ssh.knownHosts = { - ponyo = { - hostNames = [ "ponyo" "ponyo.neet.dev" "git.neet.dev" ]; - publicKey = system.ponyo; - }; - ponyo-unlock = { - hostNames = [ unlock-clearnet-hosts.ponyo unlock-onion-hosts.ponyo ]; - publicKey = system.ponyo-unlock; - }; - phil = { - hostNames = [ "phil" "phil.neet.dev" ]; - publicKey = system.phil; - }; - phil-unlock = { - hostNames = [ unlock-clearnet-hosts.phil ]; - publicKey = system.phil-unlock; - }; - router = { - hostNames = [ "router" "192.168.1.228" ]; - publicKey = system.router; - }; - router-unlock = { - hostNames = [ unlock-onion-hosts.router ]; - publicKey = system.router-unlock; - }; - ray = { - hostNames = [ "ray" ]; - publicKey = system.ray; - }; - s0 = { - hostNames = [ "s0" ]; - publicKey = system.s0; - }; - s0-unlock = { - hostNames = [ unlock-onion-hosts.s0 ]; - publicKey = system.s0-unlock; - }; - }; - - # prebuilt cmds for easy ssh LUKS unlock - environment.shellAliases = - lib.concatMapAttrs (host: addr: { "unlock-over-tor_${host}" = "torsocks ssh root@${addr}"; }) unlock-onion-hosts - // - lib.concatMapAttrs (host: addr: { "unlock_${host}" = "ssh root@${addr}"; }) unlock-clearnet-hosts; -} diff --git a/common/network/pia-openvpn.nix b/common/network/pia-openvpn.nix index 363cddf..35cde8e 100644 --- a/common/network/pia-openvpn.nix +++ b/common/network/pia-openvpn.nix @@ -108,6 +108,6 @@ in }; }; }; - age.secrets."pia-login.conf".file = ../../secrets/pia-login.conf; + age.secrets."pia-login.conf".file = ../../secrets/pia-login.age; }; } diff --git a/common/network/pia-wireguard.nix b/common/network/pia-wireguard.nix index 101f4c6..0232dfb 100644 --- a/common/network/pia-wireguard.nix +++ b/common/network/pia-wireguard.nix @@ -352,6 +352,6 @@ in }; }; - age.secrets."pia-login.conf".file = ../../secrets/pia-login.conf; + age.secrets."pia-login.conf".file = ../../secrets/pia-login.age; }; } diff --git a/common/server/mailserver.nix b/common/server/mailserver.nix index 319c0bf..3b3c47f 100644 --- a/common/server/mailserver.nix +++ b/common/server/mailserver.nix @@ -33,7 +33,7 @@ in inherit domains; loginAccounts = { "jeremy@runyan.org" = { - hashedPasswordFile = "/run/agenix/email-pw"; + hashedPasswordFile = "/run/agenix/hashed-email-pw"; # catchall for all domains aliases = map (domain: "@${domain}") domains; }; @@ -54,7 +54,7 @@ in ]; certificateScheme = 3; # use let's encrypt for certs }; - age.secrets.email-pw.file = ../../secrets/email-pw.age; + age.secrets.hashed-email-pw.file = ../../secrets/hashed-email-pw.age; age.secrets.hashed-robots-email-pw.file = ../../secrets/hashed-robots-email-pw.age; # sendmail to use xxx@domain instead of xxx@mail.domain diff --git a/common/ssh.nix b/common/ssh.nix index cbf0833..9c5ab9e 100644 --- a/common/ssh.nix +++ b/common/ssh.nix @@ -1,44 +1,38 @@ -rec { - users = [ +{ config, lib, pkgs, ... }: + +{ + programs.ssh.knownHosts = lib.filterAttrs (n: v: v != null) (lib.concatMapAttrs + (host: cfg: { + ${host} = { + hostNames = cfg.hostNames; + publicKey = cfg.hostKey; + }; + "${host}-remote-unlock" = + if cfg.remoteUnlock != null then { + hostNames = builtins.filter (h: h != null) [ cfg.remoteUnlock.clearnetHost cfg.remoteUnlock.onionHost ]; + publicKey = cfg.remoteUnlock.hostKey; + } else null; + }) + config.machines.hosts); + + # prebuilt cmds for easy ssh LUKS unlock + environment.shellAliases = + let + unlockHosts = unlockType: lib.concatMapAttrs + (host: cfg: + if cfg.remoteUnlock != null && cfg.remoteUnlock.${unlockType} != null then { + ${host} = cfg.remoteUnlock.${unlockType}; + } else { }) + config.machines.hosts; + in + lib.concatMapAttrs (host: addr: { "unlock-over-tor_${host}" = "torsocks ssh root@${addr}"; }) (unlockHosts "onionHost") + // + lib.concatMapAttrs (host: addr: { "unlock_${host}" = "ssh root@${addr}"; }) (unlockHosts "clearnetHost"); + + # TODO: Old ssh keys I will remove some day... + machines.ssh.userKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMVR/R3ZOsv7TZbICGBCHdjh1NDT8SnswUyINeJOC7QG" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE0dcqL/FhHmv+a1iz3f9LJ48xubO7MZHy35rW9SZOYM" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHSkKiRUUmnErOKGx81nyge/9KqjkPh8BfDk0D3oP586" # nat - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFeTK1iARlNIKP/DS8/ObBm9yUM/3L1Ub4XI5A2r9OzP" # ray - ]; - system = { - ponyo = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMBBlTAIp38RhErU1wNNV5MBeb+WGH0mhF/dxh5RsAXN"; - ponyo-unlock = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC9LQuuImgWlkjDhEEIbM1wOd+HqRv1RxvYZuLXPSdRi"; - ray = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDQM8hwKRgl8cZj7UVYATSLYu4LhG7I0WFJ9m2iWowiB"; - phil = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBlOs6mTZCSJL/XM6NysHN0ZNQAyj2GEwBV2Ze6NxRmr"; - phil-unlock = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAqy9X/m67oXJBX+OMdIqpiLONYc5aQ2nHeEPAaj/vgN"; - router = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFr2IHmWFlaLaLp5dGoSmFEYKA/eg2SwGXAogaOmLsHL"; - router-unlock = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJOw5dTPmtKqiPBH6VKyz5MYBubn8leAh5Eaw7s/O85c"; - s0 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAwiXcUFtAvZCayhu4+AIcF+Ktrdgv9ee/mXSIhJbp4q"; - s0-unlock = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFNiceeFMos5ZXcYem4yFxh8PiZNNnuvhlyLbQLrgIZH"; - }; - - higherTrustUserKeys = [ - "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIEaGIwLiUa6wQLlEF+keQOIYy/tCmJvV6eENzUQjSqW2AAAABHNzaDo=" # ray fido - ]; - - # groups - systems = with system; [ - ponyo - phil - ray - router - s0 - ]; - personal = with system; [ - ray - ]; - servers = with system; [ - ponyo - phil - router - s0 - ]; - storage = with system; [ - s0 ]; } diff --git a/flake.nix b/flake.nix index fe8d979..a05c4af 100644 --- a/flake.nix +++ b/flake.nix @@ -44,97 +44,98 @@ nixpkgs-hostapd-pr.flake = false; }; - outputs = { self, nixpkgs, ... }@inputs: { - - nixosConfigurations = - let - modules = system: with inputs; [ - ./common - simple-nixos-mailserver.nixosModule - agenix.nixosModules.default - dailybuild_modules.nixosModule - archivebox.nixosModule - nix-index-database.nixosModules.nix-index - ({ lib, ... }: { - config.environment.systemPackages = [ - agenix.packages.${system}.agenix - ]; - - # because nixos specialArgs doesn't work for containers... need to pass in inputs a different way - options.inputs = lib.mkOption { default = inputs; }; - options.currentSystem = lib.mkOption { default = system; }; - }) - ]; - - mkSystem = system: nixpkgs: path: - let - allModules = modules system; - - # allow patching nixpkgs, remove this hack once this is solved: https://github.com/NixOS/nix/issues/3920 - patchedNixpkgsSrc = nixpkgs.legacyPackages.${system}.applyPatches { - name = "nixpkgs-patched"; - src = nixpkgs; - patches = [ - inputs.nixpkgs-hostapd-pr + outputs = { self, nixpkgs, ... }@inputs: + let + machines = (import ./common/machine-info/moduleless.nix + { + inherit nixpkgs; + assertionsModule = "${nixpkgs}/nixos/modules/misc/assertions.nix"; + }).machines.hosts; + in + { + nixosConfigurations = + let + modules = system: with inputs; [ + ./common + simple-nixos-mailserver.nixosModule + agenix.nixosModules.default + dailybuild_modules.nixosModule + archivebox.nixosModule + nix-index-database.nixosModules.nix-index + ({ lib, ... }: { + config.environment.systemPackages = [ + agenix.packages.${system}.agenix ]; + + # because nixos specialArgs doesn't work for containers... need to pass in inputs a different way + options.inputs = lib.mkOption { default = inputs; }; + options.currentSystem = lib.mkOption { default = system; }; + }) + ]; + + mkSystem = system: nixpkgs: path: + let + allModules = modules system; + + # allow patching nixpkgs, remove this hack once this is solved: https://github.com/NixOS/nix/issues/3920 + patchedNixpkgsSrc = nixpkgs.legacyPackages.${system}.applyPatches { + name = "nixpkgs-patched"; + src = nixpkgs; + patches = [ + inputs.nixpkgs-hostapd-pr + ]; + }; + patchedNixpkgs = nixpkgs.lib.fix (self: (import "${patchedNixpkgsSrc}/flake.nix").outputs { self = nixpkgs; }); + + in + patchedNixpkgs.lib.nixosSystem { + inherit system; + modules = allModules ++ [ path ]; + + specialArgs = { + inherit allModules; + }; }; - patchedNixpkgs = nixpkgs.lib.fix (self: (import "${patchedNixpkgsSrc}/flake.nix").outputs { self = nixpkgs; }); + in + nixpkgs.lib.mapAttrs + (hostname: cfg: + mkSystem cfg.arch nixpkgs cfg.configurationPath) + machines; - in - patchedNixpkgs.lib.nixosSystem { - inherit system; - modules = allModules ++ [ path ]; - - specialArgs = { - inherit allModules; - }; - }; - in - { - "ray" = mkSystem "x86_64-linux" nixpkgs ./machines/ray/configuration.nix; - # "nat" = mkSystem "aarch64-linux" nixpkgs ./machines/nat/configuration.nix; - "ponyo" = mkSystem "x86_64-linux" nixpkgs ./machines/ponyo/configuration.nix; - "phil" = mkSystem "aarch64-linux" nixpkgs ./machines/phil/configuration.nix; - "router" = mkSystem "x86_64-linux" nixpkgs ./machines/router/configuration.nix; - "s0" = mkSystem "x86_64-linux" nixpkgs ./machines/storage/s0/configuration.nix; - }; - - packages = - let - mkKexec = system: - (nixpkgs.lib.nixosSystem { - inherit system; - modules = [ ./machines/ephemeral/kexec.nix ]; - }).config.system.build.kexec_tarball; - mkIso = system: - (nixpkgs.lib.nixosSystem { - inherit system; - modules = [ ./machines/ephemeral/iso.nix ]; - }).config.system.build.isoImage; - in - { - "x86_64-linux"."kexec" = mkKexec "x86_64-linux"; - "x86_64-linux"."iso" = mkIso "x86_64-linux"; - "aarch64-linux"."kexec" = mkKexec "aarch64-linux"; - "aarch64-linux"."iso" = mkIso "aarch64-linux"; - }; - - deploy.nodes = - let - mkDeploy = configName: hostname: { - inherit hostname; - magicRollback = false; - sshUser = "root"; - profiles.system.path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.${configName}; + packages = + let + mkKexec = system: + (nixpkgs.lib.nixosSystem { + inherit system; + modules = [ ./machines/ephemeral/kexec.nix ]; + }).config.system.build.kexec_tarball; + mkIso = system: + (nixpkgs.lib.nixosSystem { + inherit system; + modules = [ ./machines/ephemeral/iso.nix ]; + }).config.system.build.isoImage; + in + { + "x86_64-linux"."kexec" = mkKexec "x86_64-linux"; + "x86_64-linux"."iso" = mkIso "x86_64-linux"; + "aarch64-linux"."kexec" = mkKexec "aarch64-linux"; + "aarch64-linux"."iso" = mkIso "aarch64-linux"; }; - in - { - s0 = mkDeploy "s0" "s0"; - router = mkDeploy "router" "router"; - ponyo = mkDeploy "ponyo" "ponyo.neet.dev"; - }; + deploy.nodes = + let + mkDeploy = configName: arch: hostname: { + inherit hostname; + magicRollback = false; + sshUser = "root"; + profiles.system.path = inputs.deploy-rs.lib.${arch}.activate.nixos self.nixosConfigurations.${configName}; + }; + in + nixpkgs.lib.mapAttrs + (hostname: cfg: + mkDeploy hostname cfg.arch (builtins.head cfg.hostNames)) + machines; - checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib; - }; + checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib; + }; } diff --git a/machines/ephemeral/minimal.nix b/machines/ephemeral/minimal.nix index 9c45a83..1aad4b2 100644 --- a/machines/ephemeral/minimal.nix +++ b/machines/ephemeral/minimal.nix @@ -1,8 +1,10 @@ -{ pkgs, modulesPath, ... }: +{ config, pkgs, modulesPath, ... }: { imports = [ (modulesPath + "/installer/cd-dvd/channel.nix") + ../../common/machine-info + ../../common/ssh.nix ]; boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "e1000" "e1000e" "virtio_pci" "r8169" ]; @@ -16,6 +18,8 @@ boot.kernelPackages = pkgs.linuxPackages_latest; + system.stateVersion = "21.11"; + # hardware.enableAllFirmware = true; # nixpkgs.config.allowUnfree = true; @@ -38,10 +42,12 @@ services.openssh = { enable = true; - challengeResponseAuthentication = false; - passwordAuthentication = false; + settings = { + KbdInteractiveAuthentication = false; + PasswordAuthentication = false; + }; }; services.getty.autologinUser = "root"; - users.users.root.openssh.authorizedKeys.keys = (import ../../common/ssh.nix).users; + users.users.root.openssh.authorizedKeys.keys = config.machines.ssh.userKeys; } diff --git a/machines/phil/configuration.nix b/machines/phil/default.nix similarity index 100% rename from machines/phil/configuration.nix rename to machines/phil/default.nix diff --git a/machines/phil/properties.nix b/machines/phil/properties.nix new file mode 100644 index 0000000..7fbaf25 --- /dev/null +++ b/machines/phil/properties.nix @@ -0,0 +1,19 @@ +{ + hostNames = [ + "phil" + "phil.neet.dev" + ]; + + arch = "aarch64-linux"; + + systemRoles = [ + "server" + ]; + + hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBlOs6mTZCSJL/XM6NysHN0ZNQAyj2GEwBV2Ze6NxRmr"; + + remoteUnlock = { + hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAqy9X/m67oXJBX+OMdIqpiLONYc5aQ2nHeEPAaj/vgN"; + clearnetHost = "unlock.phil.neet.dev"; + }; +} diff --git a/machines/ponyo/configuration.nix b/machines/ponyo/default.nix similarity index 100% rename from machines/ponyo/configuration.nix rename to machines/ponyo/default.nix diff --git a/machines/ponyo/properties.nix b/machines/ponyo/properties.nix new file mode 100644 index 0000000..23d47cb --- /dev/null +++ b/machines/ponyo/properties.nix @@ -0,0 +1,28 @@ +{ + hostNames = [ + "ponyo" + "ponyo.neet.dev" + "git.neet.dev" + ]; + + arch = "x86_64-linux"; + + systemRoles = [ + "server" + "email-server" + "iodine" + "pia" + "nextcloud" + "dailybot" + "gitea" + ]; + + hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMBBlTAIp38RhErU1wNNV5MBeb+WGH0mhF/dxh5RsAXN"; + + remoteUnlock = { + hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC9LQuuImgWlkjDhEEIbM1wOd+HqRv1RxvYZuLXPSdRi"; + + clearnetHost = "unlock.ponyo.neet.dev"; + onionHost = "cfamr6artx75qvt7ho3rrbsc7mkucmv5aawebwflsfuorusayacffryd.onion"; + }; +} diff --git a/machines/ray/configuration.nix b/machines/ray/default.nix similarity index 100% rename from machines/ray/configuration.nix rename to machines/ray/default.nix diff --git a/machines/ray/properties.nix b/machines/ray/properties.nix new file mode 100644 index 0000000..31b43cb --- /dev/null +++ b/machines/ray/properties.nix @@ -0,0 +1,22 @@ +{ + hostNames = [ + "ray" + ]; + + arch = "x86_64-linux"; + + systemRoles = [ + "personal" + "deploy" + ]; + + hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDQM8hwKRgl8cZj7UVYATSLYu4LhG7I0WFJ9m2iWowiB"; + + userKeys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFeTK1iARlNIKP/DS8/ObBm9yUM/3L1Ub4XI5A2r9OzP" + ]; + + deployKeys = [ + "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIEaGIwLiUa6wQLlEF+keQOIYy/tCmJvV6eENzUQjSqW2AAAABHNzaDo=" + ]; +} diff --git a/machines/router/configuration.nix b/machines/router/default.nix similarity index 100% rename from machines/router/configuration.nix rename to machines/router/default.nix diff --git a/machines/router/properties.nix b/machines/router/properties.nix new file mode 100644 index 0000000..d635bc0 --- /dev/null +++ b/machines/router/properties.nix @@ -0,0 +1,21 @@ +{ + hostNames = [ + "router" + "192.168.1.228" + ]; + + arch = "x86_64-linux"; + + systemRoles = [ + "server" + "wireless" + "router" + ]; + + hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFr2IHmWFlaLaLp5dGoSmFEYKA/eg2SwGXAogaOmLsHL"; + + remoteUnlock = { + hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJOw5dTPmtKqiPBH6VKyz5MYBubn8leAh5Eaw7s/O85c"; + onionHost = "jxx2exuihlls2t6ncs7rvrjh2dssubjmjtclwr2ysvxtr4t7jv55xmqd.onion"; + }; +} diff --git a/machines/storage/s0/configuration.nix b/machines/storage/s0/default.nix similarity index 100% rename from machines/storage/s0/configuration.nix rename to machines/storage/s0/default.nix diff --git a/machines/storage/s0/properties.nix b/machines/storage/s0/properties.nix new file mode 100644 index 0000000..a55b7e1 --- /dev/null +++ b/machines/storage/s0/properties.nix @@ -0,0 +1,20 @@ +{ + hostNames = [ + "s0" + ]; + + arch = "x86_64-linux"; + + systemRoles = [ + "storage" + "server" + "pia" + ]; + + hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAwiXcUFtAvZCayhu4+AIcF+Ktrdgv9ee/mXSIhJbp4q"; + + remoteUnlock = { + hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFNiceeFMos5ZXcYem4yFxh8PiZNNnuvhlyLbQLrgIZH"; + onionHost = "r3zvf7f2ppaeithzswigma46pajt3hqytmkg3rshgknbl3jbni455fqd.onion"; + }; +} diff --git a/secrets/backblaze-s3-backups.age b/secrets/backblaze-s3-backups.age index e499b8f..b5f168e 100644 Binary files a/secrets/backblaze-s3-backups.age and b/secrets/backblaze-s3-backups.age differ diff --git a/secrets/email-pw.age b/secrets/email-pw.age deleted file mode 100644 index e9e6561..0000000 --- a/secrets/email-pw.age +++ /dev/null @@ -1,23 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 xoAm7w uMSr0mNTntr9oRqEtrJ+LJKBxI+s+cTbXYAag6kb/hM -JIylg1Xg08Ar/AuaE5e9O3qgsNAGG48Mw/Zvs8fdGdQ --> ssh-ed25519 mbw8xA ngrNg4m5aiqUyudZ4Y4Y37ApFDXxq2UBOrbEajIdBAg -1Z9hKOwNYe+o64b98WTXR30s8tv5geRCRIKe6Y6F35Y --> ssh-ed25519 2a2Yhw U89mACfmGm2hOOHZfvVfxkWX2G54D5aw1shiyqC6T04 -2TVJ4/do2jbEJZHegTDO8Q/CiLNNT0f3GpSpEWoIHnM --> ssh-ed25519 dMQYog BjQXtlw+fWSg2mzdbvpZdgU/UpQnByvj8QY2vf3f/Qg -S/OFhJGyj3YhmPNiOcmAAAnxkzMwt7PnVvUxSxNWYp0 --> ssh-ed25519 6AT2/g sgzaa1V1+i3ADN/Lgn8LSCL1Mp7tCmNbG6HTo25qzVs -q7Xfxu40RzjQORhZbGfq7U9FolNtWo3eDswxVUJ9uRw --> ssh-ed25519 fwBF+g s3FQ1pwQYfGyQcQAtlpXFNA61BsJrEV+cDnBGot20ic -M74z4r8nz6JvaougCsnyRVyNvLWBtwqhwGC6Oqe1YzI --> ssh-ed25519 yHDAQw XXxh2eQf9tCEQyZKAppYu9M/EAYbsriGR/xK/ca1hE4 -GoNmSmuzuaD6DrhFD4vv+N/K6ySorZQXHqkEy59fFa4 --> ssh-ed25519 VyYH/Q X83OJlxNPRG+kRylIceDDE3hzs5BjbLRYTa4A9t76UE -fdZcV7RRzKxeWQrniKT53UlunCWAuWIP4CAxeIHHbX4 --> ssh-ed25519 hPp1nw eIE4zQqBKr8SIW9Uqxn/HqA/wc4GIrck44k2iYbwSic -wjemabf9WrL7dU0H5T32xKCW9FYogTuA7cTCZlVW9yU --> r|n4m-grease AXlh $ozYI bvs$" -AKr3E49skiQ2WLy320wi3qlafLyGnLTjCvLHz2eK3A ---- qtFNqGCcR6VAQnbPg7n52u1aJYJUDo9lV6Qnz/Y1bq4 -+\ mUYBa2$7Qx+UyiMo,V 1WR(坴e5qq8 A^}C7D$3 \ No newline at end of file diff --git a/secrets/hashed-email-pw.age b/secrets/hashed-email-pw.age new file mode 100644 index 0000000..5ff6644 --- /dev/null +++ b/secrets/hashed-email-pw.age @@ -0,0 +1,10 @@ +age-encryption.org/v1 +-> ssh-ed25519 6AT2/g 93Az2iuqeWL6H/S3XDPXFoEPcrY/n/z9mlSNb5wABkU +LpMPjpDtBrY2aHpqHwT5AY7vtsYHNcOjpz+LFY4TGCg +-> ssh-ed25519 dMQYog 4qT0aF1IHsTtN1avMPWYG5Az2xmEZhVUhqcwyNFdfU4 ++wD0hE035JqYdDgJmkvNXwJyMzXrquA+RsD8QdK3xP8 +-> !vfM7-grease +7nQGFFUWY9UIjfrb+/VfaG0zJ21zmDnDh5khs/0tioJevrrrlhub9Bz8iM/Jsfxy +KUhwV8O8tL/5+30RFSlFRaAB6xPCGg24Yq6E +--- jVsDtz2xpvK/XCHcdN5JVZx5zSxyEAM6D/xJIgN4YfY +v.rK,$ w#VoRUQ} %ri]wnbћ; X3-M}a|.߰EP \ No newline at end of file diff --git a/secrets/hashed-robots-email-pw.age b/secrets/hashed-robots-email-pw.age index c986cf1..2c35b06 100644 Binary files a/secrets/hashed-robots-email-pw.age and b/secrets/hashed-robots-email-pw.age differ diff --git a/secrets/hostapd-pw-CXNK00BF9176.age b/secrets/hostapd-pw-CXNK00BF9176.age index ec16ba1..a23a23d 100644 --- a/secrets/hostapd-pw-CXNK00BF9176.age +++ b/secrets/hostapd-pw-CXNK00BF9176.age @@ -1,16 +1,9 @@ age-encryption.org/v1 --> ssh-ed25519 VyYH/Q 3383IYDpr6jhePY89sI7RO5KY6i5Wr/Miy4Tx1IeZEI -Z4nN390wcZiDQCEJvTBD+v5LetZpjdcVhF8uYIUSkNA --> ssh-ed25519 xoAm7w vO5L5G+aDSXJvD5MLKHtdfo3Ypd//vl7uO644j0S+ig -LRIiQOSb4M9FItfqci10ELYgzkCXhOBaWv8iz2He6zA --> ssh-ed25519 mbw8xA RxxUEOVUfKZyUM7KkUjMm9Z+Ts/et15dMxJm4XVKbzg -hKS82nZ2v88jqxGW1xprsPk67Czn+PLTxIuOrlgXkpw --> ssh-ed25519 2a2Yhw FRSIexkNO39x9h4wLVKscOmBIE5I/rOlNGfX+MdUfGo -1OcV1pJ+/M3wtPnRMDxgcpnsyeFYBqBe5Gbj55dJiCY --> ssh-ed25519 dMQYog lqtpfP3zAArnAF2M9MtUBhFymnG2S15X88YcW949PTI -2po8qHUuVbMIzrZ+q746cb9BQ06emGowJJcIGHdHeH8 --> aH,?XIq9-grease ]Y I]hNq dZyR2f@@ Xl"1A` -U/BZHrNalVSmBUEekZbQ1w95VrFtkskMOuI5lm9thRe2bvTe7Rue382uf0fcfvSE -Jq7+f/b257KiFaUg8Is1WNNMY55Rw0wrnv9yIBMESxCWmgo ---- rUwKbA9SH9XIRdEXLhDIRj+mEu7BV4w7EwkAd4wZPGI -@S*i(jW(W-yF ΃9 \ No newline at end of file +-> ssh-ed25519 VyYH/Q X+fXLJz227KkBLu45rb9mUkkIpENSMtZeEJjl6qj5Xw +AFAFnvsiogoMMwsAJO0DDoaizL9lmCLsF4QHDjmubr0 +-> ssh-ed25519 dMQYog P84+7TBcMFSALTn6FR/aXyqFE9DfOzp38ImkdWj7nE0 +PqOn1OL9Zt0x1pBIYOSKkkS//mbk1OX5pnDGp+OLYeI +-> @?-grease +3JvpmcTxdTgvv6vPL8dXEwjR+g +--- aMYF1SbC+p01YWmg24+Ih78VPQcwzGU/P1cEfgRvXV8 + @$sQ¼zxkNfu; vI0^4.?, 8 \ No newline at end of file diff --git a/secrets/hostapd-pw-experimental-tower.age b/secrets/hostapd-pw-experimental-tower.age index 6dc2457..ff07805 100644 Binary files a/secrets/hostapd-pw-experimental-tower.age and b/secrets/hostapd-pw-experimental-tower.age differ diff --git a/secrets/iodine.age b/secrets/iodine.age index 1d5e29b..3e83fb6 100644 --- a/secrets/iodine.age +++ b/secrets/iodine.age @@ -1,23 +1,10 @@ age-encryption.org/v1 --> ssh-ed25519 xoAm7w CP4pzePo50HW4IbP92NiCEhe4fz6q69c04nZzY97uls -q0ZLpztMhRToqsr0yWpXJG2+7ExjDW2xQuW840gFG74 --> ssh-ed25519 mbw8xA L39AxT7TEaPo94c3SPwqsLk6fgvasrU+RPKQgXZXXnY -6AvJRJ4dtkgCWd+f2y1hJ0nfNz2u8mydmZ9Ymq7ZLZw --> ssh-ed25519 2a2Yhw tJFWqpzbukVDKXmaQvUA6dbdUzguxphaDiZq0+2jFDs -DHT27/cLh2cBcQHOXuV9CyYV6+OEUIuJ5nBB0RYslXg --> ssh-ed25519 dMQYog Fba2ll/kUWO+4KnFP/H7UUikcxU+KpBYvJ1YYbsrom8 -sew8S9ajmoB4uJkxRkLVJPvayYh0bz3IxK2gE8znfl0 --> ssh-ed25519 6AT2/g xsTbT+roSioaX4C7i2/PtmC3sXeIv41y62X+vBhmJ2A -Ju57nxnIXuZTflJ8Aknc61vhiKPOiT34pDaeoGJsYgo --> ssh-ed25519 fwBF+g V0DzCK8NAs2hSeILNos3Wafh2OfkzphGc/+UHxtqFBk -dbExOeSn87sZD5dapKB0qoZjVK36SE0A3ww1S08qeio --> ssh-ed25519 yHDAQw O3FaVzF4vvoRoUoF05Mr0yTIcDbJ2gdAVsIHKz4tFCk -l1rYVVZyNlRfYXPri2jOwS9IUwIEI02lRSw8L4jjjeE --> ssh-ed25519 VyYH/Q CHERKccp9OVM0zMn4EomXJkW2D65wvPOz9V5dshBGD8 -dyxEW+Yzrq+gn2dQEbdNejX6RKTCz0ENe1bWLBb/wEk --> ssh-ed25519 hPp1nw wND54MJv1efUe5HkN4qRlnuX0+BQPYn69YYxPQExBF0 -zZB7mIDsgKmpTz2HtU8+p2UeG98a1cYD72gjoPraFIE --> X6XuI-grease DM 71 -/87RWErV1DecX+zr2HLnmri/cQVoXYcdcg7oPeCmIcY/3g ---- KyKWk2cIfo7bc9RVzjYYfQ66omtJUJI4ite2z9eXa0k -;1^Dx ssh-ed25519 6AT2/g yTW46JmDIftcOqogIDjheXJf2sw/dG2WEJxfCXU/LDk +0Co5/Rn22kmdcPr61ZOrmZJbPFHx2wJ8/YkbDjcjqKo +-> ssh-ed25519 dMQYog RtZT0PwVL4kxUHilOhH2GBp8Z9WfyBkaxB62pjKpHA4 +muMlIt8VYQftMYacfdnQFeejfWpKTEG5gxbFNy97GTc +-> 4|)`7yq-grease P#\5k8 +f +jMegn6ATsj2Ai9B5Xmy+tay1nppwxvF1IGJH+hLNanYMsTIDZypM6UsNdzYQ/3mw +VZ9ooy8TKUgAJ7jsd6IrKw +--- tLaPQWJA0Hh5MrxfhaySURgY02K16IlzvsxKpOWGva0 +5?l'!VNx+cA9l/|S&}Q;_K \ No newline at end of file diff --git a/secrets/nextcloud-pw.age b/secrets/nextcloud-pw.age index 7ecbafa..8459ea4 100644 --- a/secrets/nextcloud-pw.age +++ b/secrets/nextcloud-pw.age @@ -1,24 +1,10 @@ age-encryption.org/v1 --> ssh-ed25519 xoAm7w nxbI6qoO7i4zsLRqt/7P1+sxrWy+iqI/+wpG2gAe6TA -Wt6xkwHMhfwsJ7rtH9PGjVhR45K0SF27S9uR/SJeIzw --> ssh-ed25519 mbw8xA cRw8P7vAvbBzAT35551y4NodC4dgzRhSzXRmckfKCjg -aVVupspcV0jG8ycsXuoW+9lTN16MN7a5jTcLh12qBg4 --> ssh-ed25519 2a2Yhw E+kUd+Y6saJx52Eyy6MkIuH54h4zUMWRe2OwvIYsqC8 -xogfXlNu17ttnxElUI2Ya3Rc8kH3Ajk4AVnBnQ/slfg --> ssh-ed25519 dMQYog GsLYEBZmG9W+1bUPZjGyo1I55x7Xjp18z6D6EZEYZl4 -7VE5glX6in2Wna5sBwP2B2gPewyQ56/yAdMkSsXthaU --> ssh-ed25519 6AT2/g 2pHPOxQSwa7XNhPLpCo3b5VkD7ytu0qsfDE4PN3KQ0E -vEj6igHfl5sQtVUsHXmdNtK2VQin2dDb9XOrUFhyahY --> ssh-ed25519 fwBF+g 6xUfafFpXs1v6PzSBR2q0KATyx1QB20oyZUghh2lOlY -Pzc+lgRzzG2nK59ofhsudsIZyfI2JCHxLjyZYGYcCFo --> ssh-ed25519 yHDAQw bzxN6gY98TJjX0tUzT9fkp8FohD1PR17JQ4HsGSEEkU -Ws5f1wVhJgd7LhWW1TrUXrHiggX1J77It57EqTTBqWw --> ssh-ed25519 VyYH/Q qLxrHDC+Hen/oSivOuRONDZbF/wwIdEYD2Ci3cn5XV0 -qgqRuHSTb0gETpsZj5oJ3RmNEIlgRolmfVIO7hZ34IQ --> ssh-ed25519 hPp1nw rXaGNPqhVQfwR7ZxX2yPI+LXmiJvhoIouFRwPAfUnR8 -RRZCtJSlBGaK54l4tvJm2LT7UL/4yiEBE10adx0j3kU --> qvCWm(-grease /[nA+Vkr d_!rw< 6 sgv)( -UZ9Y+nrSjym+veC9SbnQjkRZmDt3UTkSbtx90slbmrdGIAJ2zLZzRckhriF5z2Jr -9FPuX356sGdy0XGWoUzWCqvmzByL9KIftPY ---- huMR4jZ8uXzj3YnT9sG5EeUTsZyeTnfBWHs8U2CAWMU -JA 1 +SŃHaqT9"~ںV`IĘKA}h[Iu/Q(*^H3:H@JJ \ No newline at end of file +-> ssh-ed25519 6AT2/g hXS7zxzYhlu5GrUAEAnaO+CizpbifjDxIwoAK55cjV0 +xU7Z52cjARU8tmd1AJ9v8+QTQzfL/mNxP/f/bJAzYvo +-> ssh-ed25519 dMQYog 8PEp5TmEOumhWUZvko42sOKpkqOCW9/zCrMqn+fJ2ws +wJo8x6+hyU8iJkTqGVecZ88hG661F3ZvEvVqpJzox5w +-> x-grease tdW'\ +(>9 da%@^H6 +q04xwjRaNOBfNhAvik762vJHio/qTfR6qQW4QsD+wzEidRYRggNdQwTl+G4jkWAu +fx0xZeiI5qVm6WG8lg +--- pHx5BdqI3HubR9wAtPyfMaYbr8uqRwOS1qFJhtC4wuM +vg9sɡ6:`Nl`.PebSNn8C ssh-ed25519 6AT2/g J3H9xUUwUMB7VkHHGtsZaCm/GiyqTFUrEmsuwcrgrhE +tn+zbj5cISZzkUzJcu7JlaqhE4Dr4fhczSJU2kV91AU +-> ssh-ed25519 hPp1nw 370YNPQn4mqeHjOvnIXkm+BzbrRNHkFICJaJhHCSHDQ +WLhDRA8jp50aKkY8t9GvyAHoLxYQD2Bhw3y01hwhoOA +-> ssh-ed25519 dMQYog 1dwQN8hmbLY54OnRTXtcwAXHoYLLNV0IK/rQQ9ZgV2A +gP2HQinVYW72oJRFW69qAeF/iNEEtJqya1iRMOugNKk +-> ~-grease 2%p4s G:$f41y " vZ87PA*| ++hI029392lrjxlsXUI8opFVcUK+JOjgBYGMH +--- juX+tgNpNr8it5QnbcBkR9u88vZkC47L5fIlZQNxPYg +,J}}YB%o~3M׽Hʗ]n0cVs(;axc#ov'k#]oN`Ɯ̿ pҚKk0( \ No newline at end of file diff --git a/secrets/pia-login.conf b/secrets/pia-login.conf deleted file mode 100644 index 3624602..0000000 Binary files a/secrets/pia-login.conf and /dev/null differ diff --git a/secrets/restic-password.age b/secrets/restic-password.age index a83a248..e10f7d0 100644 --- a/secrets/restic-password.age +++ b/secrets/restic-password.age @@ -1,23 +1,20 @@ age-encryption.org/v1 --> ssh-ed25519 xoAm7w YfFXfkiV/OEhL9zmHK3bioQUUzlu9DHyhbzxenTVWWY -PY6ykXYKNxfT4IMIvsdyEg+CMzMllPcacboJ3mj2CXU --> ssh-ed25519 mbw8xA dMVsqzPuMGCSxsjwo0HTq4O4ayY8S0C5UGJ5STaiO3g -YwY4col/fbt5gQF4GBfGTJuaCYEDQG/yPLuS6TDTYAw --> ssh-ed25519 2a2Yhw LOwqoLJtGV4e/vd9h7ks+h2Cu2AcfPs5fObQBjY1qlU -p4vpGEBh1ucCvwwfY+jio1eqZLaz+3UNc+k8qHwvkIc --> ssh-ed25519 dMQYog spGr30/0nW6I8gnlDXB2fNiNm6mW3jVdV0HxbAYOtCI -GEA6ggfl7yv6XYj1/e4wF/xHOTgfC29vXwz3N4wQnNA --> ssh-ed25519 6AT2/g ZA1c7ZNBdi/H02k+LhBol39RoX6uXqvtlAbePJ6/rQk -cgJTVWDBYdfT/4tpjeQLkQlmCh0h42BKtxC80a8RGqE --> ssh-ed25519 fwBF+g 7yzxxo42BMU7z9LWd2Dzo9rq6utpmLgNIy3mUuvIAXI -dazG882otsFAb4Qo9xeG5zM1Xp7LLS6d7eAiQ/ucMsk --> ssh-ed25519 yHDAQw eKxZ3ubH/St4ADh9/V6K04TqJWxvp9Oc+1C4MSFlkgk -p3yCmtEsEieyBHuggp9DbBsSm7xKbevnJLiIbmJafEY --> ssh-ed25519 VyYH/Q sqoBr8012iw3O72fw6fTcBrq6o5vfyAltfO+tqBU21Q -ELlo9KI0y+ixRylkWnDR50eISvGsX3xzwP77+OBhrhw --> ssh-ed25519 hPp1nw 8LfZncfhKV7QKrglch3Sx+/4zErTmdiVSL+a3ZLyzUQ -DlU7/EZaTYLrlUu+Q4A6qDL+v/YKD3JEbCfZkUJ/bwA --> V{dl'-grease `i* Eww uPgzl* f5zjP; -PMMK0yN9kZ9R0+ZyibiQqtJ4kXMCQEqY9Se/80nCkY7zvg2lVHq6UJUD ---- IIg4b0+vVeyISKd7zkVovNeCsUkkX/DhZMDc214vwa8 -ȀISޖjSp^`5S-sFmLe q]9Jf?T7A0KzZ\Y1@htn- \ No newline at end of file +-> ssh-ed25519 yHDAQw LyoiocIPWoX81W5lD5OBD5P48QC3CtVHmpATJTfz70Y +fnRfSV68RLkMc+W6WX5aqxMQxDz7UviTNQqB5KAtKYs +-> ssh-ed25519 dMQYog nQ49ARJDvvVmZEQu1YlYKGba5Dh5U4bGKsLAZfPDqUg +9Rs0zISa1FDT3ngBBwp5vXi8aR+a/Z+BrGIEKVUJWkQ +-> ssh-ed25519 fwBF+g Zap6yPIuauggXP00/It4kYJV2G539vUblQsfwgVzVHg +83K5JgUeHjf6lYv8H3YvsbBzrFOgsQyqLVm4h5Be5gE +-> ssh-ed25519 6AT2/g 7QlvTxNNubo2dRwVwfjxr+9MOge9XIsrJVLeAtpkewg +lxzXO7PIKNzrKwj0KhyHetavLM3zqjbXu4h/S7tDJns +-> ssh-ed25519 VyYH/Q tfgTbXGhdOru7FyVWPVf9tBLcuLZJQWnWZkL8yOjQyg +HIKUKzWhEM0PD+EKpI5asIwQF3Lx8CYeURVce2QAMZU +-> ssh-ed25519 hPp1nw xHd4/TCZAi/zwSL0fj7FVGHkykKAmvh29tJReIAUDFg +/TrZ77mu8vGmudrrPkDgQPiLr2o84lDrsVgY31xMHUQ +-> ssh-ed25519 dMQYog 20tuoqjWl4dQBpEKiiSrbEmwW9ZLml3F8MS7riyu1GI +I/jrnGVCw37hxoKnf/yGPlvGlXPXy+c1sz1ouY44KF8 +-> 0UxZ/o4-grease V+d +VgDtDiYRn+VzFbhXGHjOTbdN/V/vSW7STbKquW96A68DRzKH6yDn/4Ia4tX469eA +y6swdFIvbsPFnldalFKxKhHqjKRSJPLAKeWECe/I +--- ZEnygego6ke0cW4acYxInaRQXXOaKoSNklgTn7KPOfg +ZP|>ˁ+:Nd*Pi+3G JbkcF<0zͽ`W/24{O"FjS^f_ \ No newline at end of file diff --git a/secrets/robots-email-pw.age b/secrets/robots-email-pw.age index 2432e88..e25a5d8 100644 Binary files a/secrets/robots-email-pw.age and b/secrets/robots-email-pw.age differ diff --git a/secrets/sasl_relay_passwd.age b/secrets/sasl_relay_passwd.age index 1a61997..430f395 100644 Binary files a/secrets/sasl_relay_passwd.age and b/secrets/sasl_relay_passwd.age differ diff --git a/secrets/searx.age b/secrets/searx.age index 21e65b9..0835a76 100644 Binary files a/secrets/searx.age and b/secrets/searx.age differ diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 344c0cf..7fe5b8d 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -1,41 +1,41 @@ let - keys = import ../common/ssh.nix; - system = keys.system; - systemsList = keys.systems; - usersList = keys.users; - all = usersList ++ systemsList; + lib = (import { }).lib; + sshKeys = (import ../common/machine-info/moduleless.nix { }).machines.ssh; - wireless = [ - system.router - ] ++ usersList; + # add userkeys to all roles so that I can r/w the secrets from my personal computers + roles = lib.mapAttrs (role: hosts: hosts ++ sshKeys.userKeys) sshKeys.hostKeysByRole; + + # nobody is using this secret but I still need to be able to r/w it + nobody = sshKeys.userKeys; in -{ - # TODO: Minimum necessary access to keys +with roles; + +{ # email - "email-pw.age".publicKeys = all; - "sasl_relay_passwd.age".publicKeys = all; - "hashed-robots-email-pw.age".publicKeys = all; - "robots-email-pw.age".publicKeys = all; + "hashed-email-pw.age".publicKeys = email-server; + "sasl_relay_passwd.age".publicKeys = email-server; + "hashed-robots-email-pw.age".publicKeys = email-server; + "robots-email-pw.age".publicKeys = gitea; # vpn - "iodine.age".publicKeys = all; - "pia-login.conf".publicKeys = all; + "iodine.age".publicKeys = iodine; + "pia-login.age".publicKeys = pia; # cloud - "nextcloud-pw.age".publicKeys = all; - "smb-secrets.age".publicKeys = all; + "nextcloud-pw.age".publicKeys = nextcloud; + "smb-secrets.age".publicKeys = personal; # services - "searx.age".publicKeys = all; - "spotifyd.age".publicKeys = all; - "wolframalpha.age".publicKeys = all; + "searx.age".publicKeys = nobody; + "spotifyd.age".publicKeys = personal; + "wolframalpha.age".publicKeys = dailybot; # hostapd "hostapd-pw-experimental-tower.age".publicKeys = wireless; "hostapd-pw-CXNK00BF9176.age".publicKeys = wireless; # backups - "backblaze-s3-backups.age".publicKeys = all; - "restic-password.age".publicKeys = all; + "backblaze-s3-backups.age".publicKeys = personal ++ server; + "restic-password.age".publicKeys = personal ++ server; } diff --git a/secrets/smb-secrets.age b/secrets/smb-secrets.age index a162c96..9d75bf5 100644 Binary files a/secrets/smb-secrets.age and b/secrets/smb-secrets.age differ diff --git a/secrets/spotifyd.age b/secrets/spotifyd.age index 34cb47f..d834570 100644 --- a/secrets/spotifyd.age +++ b/secrets/spotifyd.age @@ -1,24 +1,10 @@ age-encryption.org/v1 --> ssh-ed25519 xoAm7w nK+/qKKiipFhaF8SlrPA+1MXBmL0g3X+VX0o2eDurXk -vyeRKIBbBpNQ6fg2GnUe/rSzwZEg9pajaTygFCTEd84 --> ssh-ed25519 mbw8xA u1l5e1uS2/U5ha5EGAp4x790uKJyRN4L7vPKLkGcqRA -bGAA/pFSsNT+ZGOEVxqz5tfORvbdZ2HU/+1QpS6r1hI --> ssh-ed25519 2a2Yhw 9liF3i4BNYAS3N/wCIwD/ks0UEYzEQNBtISNostxoXU -L8zcyadtJyMl+H5ndJDc2eZS8nHDfUb/dER+hSTS9sw --> ssh-ed25519 dMQYog YgBTvIkJEm7IrC75tuLsRyRJDe4bJvMFXlxbfW8E+Bw -2synWFO1aCMPup44qx9m9+Q3VIHyReJEmgaSXXdeNdY --> ssh-ed25519 6AT2/g XWEVpDjWhUgz8kQn26jOlK9pmzyaLY/zZHHCL3zmOTY -LISRuoS5+PXLqN8UfMp6W2lhntejObGWeVGMQmZ8GaQ --> ssh-ed25519 fwBF+g v/YxEBKCPcrsw17S7qxVfZZMfmOiA4+PPTPEsLuNFl0 -Gqu0LoYGraAQoRuCaMxLKZYFxxPTqJXno+gtIfPwS+w --> ssh-ed25519 yHDAQw ETqeum+DKSj8P8+GYt6aqplIElw71E8qS7XFEfdk9Hs -5fDPFlLpm5uoM9ASrxyEnJDURLpjvLcap/TTbrnes48 --> ssh-ed25519 VyYH/Q JgQLP5848LEJNjEYDtWO+pildvixJwr548a3WDuUk3c -K9RH2E+vmsemxFuoENVDOyU2APB0JGKWLCRv1YFwblE --> ssh-ed25519 hPp1nw 2H3olp3s1Ong037spS7tekMKwB8FemQYdWXAvdLBjEY -4BhO0GhFC/zqGUs1R4yigIuLtLaWswrmv/9lFuQ+jXI --> 5y'BWp-grease 4\h10!^" 47#Gqf VQbey`1 -pRs8xYTuqqZ+6B5W2+zAWCXMpgO2k2/x77RKjCmbf48p0LM ---- ymSK6Hd6lQSBtkIPdfWdMoI+ty8BMo+QM5FC/fQsIpY -/eB.`+B6 -&%}+"<2Ѱ~@QtmLdIJŒu L\{Dc1Ō@{7 d \ No newline at end of file +-> ssh-ed25519 yHDAQw R1weIMur0s9HsBBwNn+XyBNfAB8CrQf6QEzIJFklcG8 +DTK0seypjzSX1B2ce2IWyYwygBeeKlbFpYgzH7i1DHA +-> ssh-ed25519 dMQYog DU9sxA0/cG/O9EG3JYFjL1d2OiqOSZvFjZ1S2zTTWDw +nGlUCvjpUp50ykTIUzSQ19uj2tiVMPo1Ois8xFSWB58 +-> z%z.3-grease lF#S +H+5548VgikG9upeHi2GIQ3U71TC0ds+dn8yWOoixHnRhiYZRIhODffjI3D8T18gk +1mjtW+c34E+ALRkSIf5iWwChJxsomS6LiMS3sqtJg4c +--- o2hgAcfMDZyGIehN07CO7OjSCrmwUDRTrwxAKmGcfAY + ssh-ed25519 xoAm7w uiG2dFOijKdrdBXfdbO36C58tRkmz4MjBX8rEGfsl1Y -eIOekwe5iDZZUcVYEXie+j5qok84fIx1cF8Sna0GdZY --> ssh-ed25519 mbw8xA IGrOTs8sVX3qZQ6l0160q/xYsAvFEj69kN1Dj7yKYi8 -EnhYbIDhGyirnlsbUCk3GOVzE7QTMkncRFmpiRAOvs0 --> ssh-ed25519 2a2Yhw wl2vaJQ1gXLb46y/IXJMgCYUvhW3cgjJ10+fLhoS/Bw -EOwsKVzPjbYWXQ+c8KWVd4FadamJrn3+qDb5G4R6Moc --> ssh-ed25519 dMQYog QAVPULFTcffOptY4nML8/DyYb95IqBOomztdNaRN1g0 -qfSGtU3pl/7fMCjZM8syfLvgHhyd38AA/SICm3maHbI --> ssh-ed25519 6AT2/g oaH9KRPHLkl1WXKIvtP7liWf8Apy1yEf41UHkFvdJjk -Rpfn7Gt6bORSI2qITHC7HAb1zlzOK4gDh3Ya7JwUUzk --> ssh-ed25519 fwBF+g ilPZbir/rHhDv+drBmEsVEgjmIJHeISK9cZGltytClc -ODhQutW6IMHsFw+wQC4n6TOMCbydrPUWXlfwgQelpZs --> ssh-ed25519 yHDAQw xbtvz5r0XfNY/cKWiIuUKO5tt+iGZMbc0d/PT4HhyGs -g/3IKnsKniQ3aB++htgM1JUmfsDzWWJ4lylAw5rBpyI --> ssh-ed25519 VyYH/Q yhDle9FTAXot4gB23F7rOLNqJ1j3PMZmk7OMbKaGayE -j2XnSG589GUmvM4NunfgbcvdDBCpDJ6GubxI2UR3IE4 --> ssh-ed25519 hPp1nw I86wd3J4YZTlis1s/Q6SQP7j492NVe64DWu6Pe8ujFI -jgkh4YTEuBE1qCTooWPWZxQri8KSPYnWYkIhcEhIAIM --> C+QwV1[-grease 7bFy^.lq Y) 5 -Vw2f+pwTja8b9veFqdxVZSMGsgii+SMUfn9eAVqTjEAmWxawSQ ---- V75Y+46buomIjWtz/zwOBNkZ9ZAKcKV3NDy42NDjPU4 -CrFA -B62-̍D s&H  \ No newline at end of file +-> ssh-ed25519 6AT2/g xp04CsJvlYhBZS5W/MSDLWGiNCegAjg4XPv43wU5u0g +i6q0YgKOFGaHOKVYMppNtcvjCFfHHqOS9M+oh2mqc1M +-> ssh-ed25519 dMQYog Mk90WFb+fYCFV7afu3+VbuAtOlvRAgpJGFGqn4ZWGjE +wHeScgV248lHiL0B/QEraD4QOBudezhJPrppY50u7S8 +-> G/9-grease +0hCyP7pGu5xkk4eWJTpLWy6f8Zuo8wmgBSNFK7bgzfYdW29mdOrO2Ey3Oa2Gvtji +rze9v27gMUFRXOqPHNmaSjAneCwtcqTMReV+LZr9q9FN6qZnzAE +--- /SN6cSyrvbDEHTiIvv4MdoVkIjz3yZkvtr2SVBE1rRk +=1fJX~DcaF@ݹc=89;sv \ No newline at end of file