Merge master into staging-next
This commit is contained in:
commit
ff0eba2f8c
@ -402,6 +402,7 @@ in
|
|||||||
unbound = handleTest ./unbound.nix {};
|
unbound = handleTest ./unbound.nix {};
|
||||||
unit-php = handleTest ./web-servers/unit-php.nix {};
|
unit-php = handleTest ./web-servers/unit-php.nix {};
|
||||||
upnp = handleTest ./upnp.nix {};
|
upnp = handleTest ./upnp.nix {};
|
||||||
|
usbguard = handleTest ./usbguard.nix {};
|
||||||
uwsgi = handleTest ./uwsgi.nix {};
|
uwsgi = handleTest ./uwsgi.nix {};
|
||||||
v2ray = handleTest ./v2ray.nix {};
|
v2ray = handleTest ./v2ray.nix {};
|
||||||
vault = handleTest ./vault.nix {};
|
vault = handleTest ./vault.nix {};
|
||||||
|
62
nixos/tests/usbguard.nix
Normal file
62
nixos/tests/usbguard.nix
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import ./make-test-python.nix ({ pkgs, ... }: {
|
||||||
|
name = "usbguard";
|
||||||
|
meta = with pkgs.stdenv.lib.maintainers; {
|
||||||
|
maintainers = [ tnias ];
|
||||||
|
};
|
||||||
|
|
||||||
|
machine =
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
services.usbguard = {
|
||||||
|
enable = true;
|
||||||
|
IPCAllowedUsers = [ "alice" "root" ];
|
||||||
|
|
||||||
|
# As virtual USB devices get attached to the "QEMU USB Hub" we need to
|
||||||
|
# allow Hubs. Otherwise we would have to explicitly allow them too.
|
||||||
|
rules = ''
|
||||||
|
allow with-interface equals { 09:00:00 }
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
imports = [ ./common/user-account.nix ];
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
# create a blank disk image for our fake USB stick
|
||||||
|
with open(machine.state_dir + "/usbstick.img", "wb") as stick:
|
||||||
|
stick.write(b"\x00" * (1024 * 1024))
|
||||||
|
|
||||||
|
# wait for machine to have started and the usbguard service to be up
|
||||||
|
machine.wait_for_unit("usbguard.service")
|
||||||
|
|
||||||
|
with subtest("IPC access control"):
|
||||||
|
# User "alice" is allowed to access the IPC interface
|
||||||
|
machine.succeed("su alice -c 'usbguard list-devices'")
|
||||||
|
|
||||||
|
# User "bob" is not allowed to access the IPC interface
|
||||||
|
machine.fail("su bob -c 'usbguard list-devices'")
|
||||||
|
|
||||||
|
with subtest("check basic functionality"):
|
||||||
|
# at this point we expect that no USB HDD is connected
|
||||||
|
machine.fail("usbguard list-devices | grep -E 'QEMU USB HARDDRIVE'")
|
||||||
|
|
||||||
|
# insert usb device
|
||||||
|
machine.send_monitor_command(
|
||||||
|
f"drive_add 0 id=stick,if=none,file={stick.name},format=raw"
|
||||||
|
)
|
||||||
|
machine.send_monitor_command("device_add usb-storage,id=stick,drive=stick")
|
||||||
|
|
||||||
|
# the attached USB HDD should show up after a short while
|
||||||
|
machine.wait_until_succeeds("usbguard list-devices | grep -E 'QEMU USB HARDDRIVE'")
|
||||||
|
|
||||||
|
# at this point there should be a **blocked** USB HDD
|
||||||
|
machine.succeed("usbguard list-devices | grep -E 'block.*QEMU USB HARDDRIVE'")
|
||||||
|
machine.fail("usbguard list-devices | grep -E ' allow .*QEMU USB HARDDRIVE'")
|
||||||
|
|
||||||
|
# allow storage devices
|
||||||
|
machine.succeed("usbguard allow-device 'with-interface { 08:*:* }'")
|
||||||
|
|
||||||
|
# at this point there should be an **allowed** USB HDD
|
||||||
|
machine.succeed("usbguard list-devices | grep -E ' allow .*QEMU USB HARDDRIVE'")
|
||||||
|
machine.fail("usbguard list-devices | grep -E ' block .*QEMU USB HARDDRIVE'")
|
||||||
|
'';
|
||||||
|
})
|
@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
buildGoModule rec {
|
buildGoModule rec {
|
||||||
pname = "minikube";
|
pname = "minikube";
|
||||||
version = "1.16.0";
|
version = "1.17.0";
|
||||||
|
|
||||||
vendorSha256 = "0nc2f9h77h24f0nvai5wvgmf1gh09dqfwrb6d5qghmq03a459san";
|
vendorSha256 = "sha256-cA0sgH00XawwaOAGCDbabmBE/+5Y87kThXgPe5zwlro=";
|
||||||
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ buildGoModule rec {
|
|||||||
owner = "kubernetes";
|
owner = "kubernetes";
|
||||||
repo = "minikube";
|
repo = "minikube";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "00dn8yy7mna0j8rdcnxbgnd5vkjdkqij8akgqhvbd32kxpqss890";
|
sha256 = "sha256-IQ/AAr5b8ZOaQKkSrU8JsPxjqAwVmT4Kt3hf3e1dMeA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ go-bindata installShellFiles pkg-config which ];
|
nativeBuildInputs = [ go-bindata installShellFiles pkg-config which ];
|
||||||
|
@ -39,12 +39,6 @@ let
|
|||||||
(if (versionOlder version "5.31.1") then ./no-sys-dirs-5.29.patch
|
(if (versionOlder version "5.31.1") then ./no-sys-dirs-5.29.patch
|
||||||
else ./no-sys-dirs-5.31.patch)
|
else ./no-sys-dirs-5.31.patch)
|
||||||
]
|
]
|
||||||
++ optional (versionOlder version "5.29.6")
|
|
||||||
# Fix parallel building: https://rt.perl.org/Public/Bug/Display.html?id=132360
|
|
||||||
(fetchurl {
|
|
||||||
url = "https://rt.perl.org/Public/Ticket/Attachment/1502646/807252/0001-Fix-missing-build-dependency-for-pods.patch";
|
|
||||||
sha256 = "1bb4mldfp8kq1scv480wm64n2jdsqa3ar46cjp1mjpby8h5dr2r0";
|
|
||||||
})
|
|
||||||
++ optional stdenv.isSunOS ./ld-shared.patch
|
++ optional stdenv.isSunOS ./ld-shared.patch
|
||||||
++ optionals stdenv.isDarwin [ ./cpp-precomp.patch ./sw_vers.patch ]
|
++ optionals stdenv.isDarwin [ ./cpp-precomp.patch ./sw_vers.patch ]
|
||||||
++ optional crossCompiling ./MakeMaker-cross.patch;
|
++ optional crossCompiling ./MakeMaker-cross.patch;
|
||||||
@ -174,11 +168,11 @@ let
|
|||||||
priority = 6; # in `buildEnv' (including the one inside `perl.withPackages') the library files will have priority over files in `perl`
|
priority = 6; # in `buildEnv' (including the one inside `perl.withPackages') the library files will have priority over files in `perl`
|
||||||
};
|
};
|
||||||
} // optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) rec {
|
} // optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) rec {
|
||||||
crossVersion = "b4447944a0aeff9590dc023d64f8ddf3de7669fb"; # Dec 22, 2020
|
crossVersion = "4c55233ae95a6aef4d93291fe8ad12709b11e575"; # Jan 21, 2021
|
||||||
|
|
||||||
perl-cross-src = fetchurl {
|
perl-cross-src = fetchurl {
|
||||||
url = "https://github.com/arsv/perl-cross/archive/${crossVersion}.tar.gz";
|
url = "https://github.com/arsv/perl-cross/archive/${crossVersion}.tar.gz";
|
||||||
sha256 = "1cignplkb29kcvkfwshakyij71w8srlfqbnb9pla98vya6r82rnb";
|
sha256 = "04bxn43ir7b4c2bb1z1l71l93hrysjv00h879nm70m99q6vxq2hc";
|
||||||
};
|
};
|
||||||
|
|
||||||
depsBuildBuild = [ buildPackages.stdenv.cc makeWrapper ];
|
depsBuildBuild = [ buildPackages.stdenv.cc makeWrapper ];
|
||||||
@ -214,7 +208,7 @@ in {
|
|||||||
perldevel = common {
|
perldevel = common {
|
||||||
perl = pkgs.perldevel;
|
perl = pkgs.perldevel;
|
||||||
buildPerl = buildPackages.perldevel;
|
buildPerl = buildPackages.perldevel;
|
||||||
version = "5.33.5";
|
version = "5.33.6";
|
||||||
sha256 = "04iprc8qz6vpbgzqgwja5rc3csvmgq1rnnnl382l39hy69fsdqpr";
|
sha256 = "1fx6b2q7wzd0xwy7qkmkvd5bdm09d3zfnynrb6afl9ghd8ww56fv";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, autoreconfHook
|
, autoreconfHook
|
||||||
, installShellFiles
|
, installShellFiles
|
||||||
|
, nixosTests
|
||||||
, asciidoc
|
, asciidoc
|
||||||
, pkg-config
|
, pkg-config
|
||||||
, libxslt
|
, libxslt
|
||||||
@ -73,6 +74,8 @@ stdenv.mkDerivation rec {
|
|||||||
installShellCompletion --zsh --name _usbguard scripts/usbguard-zsh-completion
|
installShellCompletion --zsh --name _usbguard scripts/usbguard-zsh-completion
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.tests = nixosTests.usbguard;
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "The USBGuard software framework helps to protect your computer against BadUSB";
|
description = "The USBGuard software framework helps to protect your computer against BadUSB";
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user