From 5c48ef9c1e16f96db88c9f6fe5fb7fe5466f4c48 Mon Sep 17 00:00:00 2001 From: Hermenix Date: Fri, 20 Nov 2026 01:34:41 +0000 Subject: [PATCH] diagnix: let the hermenix VM log in hermenix had no shell route to lab hosts, so a hard freeze (bigbox1, Nov 19 18:21 ET) could only be read through slinuxm's warning-level journal window, which misses the info-level tail before the crash. - hosts.nix: a dedicated hermenix-diagnix key, separate from the hermenix agenix key, accepted only from hl-fwdesk's addresses (10.0.10.11, 10.0.101.101) and the guest address 10.77.0.2. - default.nix: keyLine takes the key; new skyg.nixos.common.diagnix.hermenix.enable (default true) adds the hermenix key line with the same restrict,pty + slice limits. - hl-fwdesk hermenix.nix: lanAccess to 10.0.10.0/24 port 22. --- hosts/hl-fwdesk/services/hermenix.nix | 1 + modules/nixos/common/diagnix/default.nix | 12 +++++++++--- modules/nixos/common/diagnix/hosts.nix | 5 +++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/hosts/hl-fwdesk/services/hermenix.nix b/hosts/hl-fwdesk/services/hermenix.nix index 00080a4..477190c 100644 --- a/hosts/hl-fwdesk/services/hermenix.nix +++ b/hosts/hl-fwdesk/services/hermenix.nix @@ -41,6 +41,7 @@ in { address = "10.0.101.3"; port = 8080; } { address = "10.0.101.3"; port = 9102; } { address = "10.0.101.8"; port = 3000; } + { address = "10.0.10.0/24"; port = 22; } ]; publish = [ diff --git a/modules/nixos/common/diagnix/default.nix b/modules/nixos/common/diagnix/default.nix index 58b31e0..58a3af6 100644 --- a/modules/nixos/common/diagnix/default.nix +++ b/modules/nixos/common/diagnix/default.nix @@ -9,7 +9,7 @@ let # This host runs nbot, so its own containers connect from random private IPs. hasNbot = options.services ? nbot && config.services.nbot.enable; - keyLine = from: ''restrict,pty,from="${from}" ${cfg.publicKey}''; + keyLine = from: key: ''restrict,pty,from="${from}" ${key}''; runtime = if config.virtualisation.docker.enable then "${config.virtualisation.docker.package}/bin/docker" @@ -63,6 +63,11 @@ in default = data.publicKey; description = "nbot's client public key for diagnix."; }; + hermenix.enable = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Let the hermenix VM log in as diagnix too."; + }; }; config = lib.mkIf cfg.enable { @@ -75,9 +80,10 @@ in shell = pkgs.bash; extraGroups = [ "systemd-journal" ]; openssh.authorizedKeys.keys = - [ (keyLine (lib.concatStringsSep "," data.nbotHosts)) ] + [ (keyLine (lib.concatStringsSep "," data.nbotHosts) cfg.publicKey) ] # Containers on this host: any private IP outside the LAN. - ++ lib.optional hasNbot (keyLine "!${data.lanSubnet},10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"); + ++ lib.optional hasNbot (keyLine "!${data.lanSubnet},10.0.0.0/8,172.16.0.0/12,192.168.0.0/16" cfg.publicKey) + ++ lib.optional cfg.hermenix.enable (keyLine (lib.concatStringsSep "," data.hermenix.from) data.hermenix.publicKey); }; # A runaway command can't starve the host. diff --git a/modules/nixos/common/diagnix/hosts.nix b/modules/nixos/common/diagnix/hosts.nix index 906f00d..350a199 100644 --- a/modules/nixos/common/diagnix/hosts.nix +++ b/modules/nixos/common/diagnix/hosts.nix @@ -10,6 +10,11 @@ # nbot-goose secret, sent to containers via agent_env on fwdesk. publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPKsgkysVa3BiJQkUjiyESwjoi9ZMmUiWEB66JlbgIrO nbot-diagnix"; + hermenix = { + publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKSYYLaAYJKifV3oOwnF7taNV4ko+A+A/r4oHgpKBwRW hermenix-diagnix"; + from = [ "10.0.10.11" "10.0.101.101" "10.77.0.2" ]; + }; + hosts = { hl-bigbox1 = { address = "bigbox1.lab.internal"; hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFl5xiH4aFlmDWdoU+KmERLYOeOQK2aKP7jenY2G3rFb"; }; hl-bigbox2 = { address = "bigbox2.lab.internal"; hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL6l6VqQ23PkGkWVABBoLp1KA6PzkX5oKTy5RBHbQXet"; };