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.
This commit is contained in:
1 parent
4c9d8f88cb
commit
5c48ef9c1e
3 files changed
+15
-3
No files matched your search
@@ -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 = [
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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"; };
|
||||
|
||||
Reference in new issue
Block a user