nixos/tests/munge: init (#452983)
This commit is contained in:
@@ -959,6 +959,7 @@ in
|
|||||||
mtp = runTest ./mtp.nix;
|
mtp = runTest ./mtp.nix;
|
||||||
multipass = runTest ./multipass.nix;
|
multipass = runTest ./multipass.nix;
|
||||||
mumble = runTest ./mumble.nix;
|
mumble = runTest ./mumble.nix;
|
||||||
|
munge = runTest ./munge.nix;
|
||||||
munin = runTest ./munin.nix;
|
munin = runTest ./munin.nix;
|
||||||
# Fails on aarch64-linux at the PDF creation step - need to debug this on an
|
# Fails on aarch64-linux at the PDF creation step - need to debug this on an
|
||||||
# aarch64 machine..
|
# aarch64 machine..
|
||||||
|
|||||||
28
nixos/tests/munge.nix
Normal file
28
nixos/tests/munge.nix
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
name = "munge";
|
||||||
|
meta.maintainers = with lib.maintainers; [ h7x4 ];
|
||||||
|
|
||||||
|
nodes.machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
imports = [ ./common/user-account.nix ];
|
||||||
|
|
||||||
|
services.munge.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript =
|
||||||
|
{ nodes }:
|
||||||
|
let
|
||||||
|
aliceUid = toString nodes.machine.users.users.alice.uid;
|
||||||
|
in
|
||||||
|
''
|
||||||
|
machine.succeed("mkdir -p /etc/munge && echo '${lib.strings.replicate 5 "hunter2"}' > /etc/munge/munge.key && chown munge: /etc/munge/munge.key")
|
||||||
|
machine.systemctl("restart munged.service")
|
||||||
|
machine.wait_for_unit("munged.service")
|
||||||
|
|
||||||
|
machine.succeed("sudo -u bob -- munge -u ${aliceUid} -s 'top secret' -o ./secret.txt")
|
||||||
|
machine.succeed("grep -v 'top secret' ./secret.txt")
|
||||||
|
machine.succeed("sudo -u alice unmunge -i ./secret.txt | grep 'top secret'")
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
libgcrypt,
|
libgcrypt,
|
||||||
zlib,
|
zlib,
|
||||||
bzip2,
|
bzip2,
|
||||||
|
nixosTests,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
@@ -62,6 +63,8 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
rmdir "$out"/{var{/{lib,log}{/munge,},},etc/munge}
|
rmdir "$out"/{var{/{lib,log}{/munge,},},etc/munge}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.tests.nixos = nixosTests.munge;
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = ''
|
description = ''
|
||||||
An authentication service for creating and validating credentials
|
An authentication service for creating and validating credentials
|
||||||
|
|||||||
Reference in New Issue
Block a user