about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2017-11-19 20:30:59 +0100
committerGitHub <noreply@github.com>2017-11-19 20:30:59 +0100
commitbdbaaad7de60241f5763cc0735fb6b2a4a727b9e (patch)
treec832ff91e05d4669bed760007b325cc68d8cd1d2 /nixos/tests
parentedcf51a359d87c2ce8cdcfcf8b32b96cfc00ec81 (diff)
parent58374fbaf31f3e248072bb7be7311055b72520a1 (diff)
downloadnixlib-bdbaaad7de60241f5763cc0735fb6b2a4a727b9e.tar
nixlib-bdbaaad7de60241f5763cc0735fb6b2a4a727b9e.tar.gz
nixlib-bdbaaad7de60241f5763cc0735fb6b2a4a727b9e.tar.bz2
nixlib-bdbaaad7de60241f5763cc0735fb6b2a4a727b9e.tar.lz
nixlib-bdbaaad7de60241f5763cc0735fb6b2a4a727b9e.tar.xz
nixlib-bdbaaad7de60241f5763cc0735fb6b2a4a727b9e.tar.zst
nixlib-bdbaaad7de60241f5763cc0735fb6b2a4a727b9e.zip
Merge pull request #29269 from Moredread/test_crypt_with_keyfile
Test opening encrypted filesystem with keyfile
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/installer.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix
index 43b166a38374..8c04b606e481 100644
--- a/nixos/tests/installer.nix
+++ b/nixos/tests/installer.nix
@@ -461,6 +461,47 @@ in {
       '';
     };
 
+  # Test whether opening encrypted filesystem with keyfile
+  # Checks for regression of missing cryptsetup, when no luks device without
+  # keyfile is configured
+  filesystemEncryptedWithKeyfile = makeInstallerTest "filesystemEncryptedWithKeyfile"
+    { createPartitions = ''
+       $machine->succeed(
+          "parted /dev/vda mklabel msdos",
+          "parted /dev/vda -- mkpart primary ext2 1M 50MB", # /boot
+          "parted /dev/vda -- mkpart primary linux-swap 50M 1024M",
+          "parted /dev/vda -- mkpart primary 1024M 1280M", # LUKS with keyfile
+          "parted /dev/vda -- mkpart primary 1280M -1s",
+          "udevadm settle",
+          "mkswap /dev/vda2 -L swap",
+          "swapon -L swap",
+          "mkfs.ext3 -L nixos /dev/vda4",
+          "mount LABEL=nixos /mnt",
+          "mkfs.ext3 -L boot /dev/vda1",
+          "mkdir -p /mnt/boot",
+          "mount LABEL=boot /mnt/boot",
+          "modprobe dm_mod dm_crypt",
+          "echo -n supersecret > /mnt/keyfile",
+          "cryptsetup luksFormat -q /dev/vda3 --key-file /mnt/keyfile",
+          "cryptsetup luksOpen --key-file /mnt/keyfile /dev/vda3 crypt",
+          "mkfs.ext3 -L test /dev/mapper/crypt",
+          "cryptsetup luksClose crypt",
+          "mkdir -p /mnt/test"
+        );
+      '';
+      extraConfig = ''
+        fileSystems."/test" =
+        { device = "/dev/disk/by-label/test";
+          fsType = "ext3";
+          encrypted.enable = true;
+          encrypted.blkDev = "/dev/vda3";
+          encrypted.label = "crypt";
+          encrypted.keyFile = "/mnt-root/keyfile";
+        };
+      '';
+    };
+
+
   swraid = makeInstallerTest "swraid"
     { createPartitions =
         ''