nixos/test-driver: add backdoor based on systemd-ssh-proxy & AF_VSOCK (#392030)

This commit is contained in:
Jacek Galowicz
2025-05-09 08:03:55 +02:00
committed by GitHub
7 changed files with 100 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ let
mapAttrs
mkDefault
mkIf
mkMerge
mkOption
mkForce
optional
@@ -77,6 +78,14 @@ in
{
options = {
sshBackdoor = {
enable = mkOption {
default = false;
type = types.bool;
description = "Whether to turn on the VSOCK-based access to all VMs. This provides an unauthenticated access intended for debugging.";
};
};
node.type = mkOption {
type = types.raw;
default = baseOS.type;
@@ -172,10 +181,19 @@ in
passthru.nodes = config.nodesCompat;
defaults = mkIf config.node.pkgsReadOnly {
nixpkgs.pkgs = config.node.pkgs;
imports = [ ../../modules/misc/nixpkgs/read-only.nix ];
};
extraDriverArgs = mkIf config.sshBackdoor.enable [
"--dump-vsocks"
];
defaults = mkMerge [
(mkIf config.node.pkgsReadOnly {
nixpkgs.pkgs = config.node.pkgs;
imports = [ ../../modules/misc/nixpkgs/read-only.nix ];
})
(mkIf config.sshBackdoor.enable {
testing.sshBackdoor.enable = true;
})
];
};
}