···
environment.systemPackages = [ pkgs.openssl ];
-
in import ./make-test.nix {
nodes.generation1 = { pkgs, config, ... }: {
···
node = "generation${toString gen}";
in nodes.${node}.config.security.dhparams.params.${name}.path;
-
assertParamBits = gen: name: bits: let
-
path = getParamPath gen name;
-
$machine->nest('check bit size of ${path}', sub {
-
my $out = $machine->succeed('openssl dhparam -in ${path} -text');
-
$out =~ /^\s*DH Parameters:\s+\((\d+)\s+bit\)\s*$/m;
-
die "bit size should be ${toString bits} but it is $1 instead."
-
if $1 != ${toString bits};
switchToGeneration = gen: let
node = "generation${toString gen}";
inherit (nodes.${node}.config.system.build) toplevel;
switchCmd = "${toplevel}/bin/switch-to-configuration test";
-
$machine->nest('switch to generation ${toString gen}', sub {
-
$machine->succeed('${switchCmd}');
-
$main::machine = ''$${node};
-
my $machine = $generation1;
-
$machine->waitForUnit('multi-user.target');
-
subtest "verify startup order", sub {
-
$machine->succeed('systemctl is-active foo.service');
-
subtest "check bit sizes of dhparam files", sub {
-
${assertParamBits 1 "foo" 16}
-
${assertParamBits 1 "bar" 17}
-
subtest "check whether bit size has changed", sub {
-
${assertParamBits 2 "foo" 18}
-
subtest "ensure that dhparams file for 'bar' was deleted", sub {
-
$machine->fail('test -e ${getParamPath 1 "bar"}');
-
subtest "ensure that 'security.dhparams.path' has been deleted", sub {
-
'test -e ${nodes.generation3.config.security.dhparams.path}'
-
subtest "check bit sizes dhparam files", sub {
-
${assertParamBits 4 "foo2" 18}
-
${assertParamBits 4 "bar2" 19}
-
subtest "check whether dhparam files are in the Nix store", sub {
-
'expr match ${getParamPath 4 "foo2"} ${builtins.storeDir}',
-
'expr match ${getParamPath 4 "bar2"} ${builtins.storeDir}',
-
subtest "check whether defaultBitSize works as intended", sub {
-
${assertParamBits 5 "foo3" 30}
-
${assertParamBits 5 "bar3" 30}