nixos/tests/logkeys: init
This commit is contained in:
@@ -853,6 +853,7 @@ in
|
||||
localsend = runTest ./localsend.nix;
|
||||
locate = runTest ./locate.nix;
|
||||
login = runTest ./login.nix;
|
||||
logkeys = runTest ./logkeys.nix;
|
||||
logrotate = runTest ./logrotate.nix;
|
||||
loki = runTest ./loki.nix;
|
||||
#logstash = handleTest ./logstash.nix {};
|
||||
|
||||
34
nixos/tests/logkeys.nix
Normal file
34
nixos/tests/logkeys.nix
Normal file
@@ -0,0 +1,34 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
name = "logkeys";
|
||||
meta.maintainers = with lib.maintainers; [ h7x4 ];
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [ ./common/user-account.nix ];
|
||||
|
||||
services.getty.autologinUser = "alice";
|
||||
|
||||
services.logkeys = {
|
||||
enable = true;
|
||||
device = "virtio-kbd";
|
||||
};
|
||||
|
||||
# logkeys doesn't support specifying a device in `by-path`.
|
||||
# In order not to make the test dependend on the ordering of the input event devices,
|
||||
# we'll create a custom symlink before starting the service.
|
||||
systemd.services.logkeys.serviceConfig.ExecStartPre = [
|
||||
"+${lib.getExe' pkgs.coreutils "ln"} -s /dev/input/by-path/pci-0000:00:0a.0-event-kbd /dev/input/virtio-kbd"
|
||||
];
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("getty@tty1.service")
|
||||
machine.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
|
||||
machine.wait_for_unit("logkeys.service")
|
||||
|
||||
machine.send_chars("hello world\n")
|
||||
machine.wait_until_succeeds("grep 'hello world' /var/log/logkeys.log")
|
||||
'';
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
which,
|
||||
procps,
|
||||
kbd,
|
||||
nixosTests,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
@@ -38,6 +39,8 @@ stdenv.mkDerivation {
|
||||
|
||||
preConfigure = "./autogen.sh";
|
||||
|
||||
passthru.tests.nixos = nixosTests.logkeys;
|
||||
|
||||
meta = with lib; {
|
||||
description = "GNU/Linux keylogger that works";
|
||||
license = licenses.gpl3;
|
||||
|
||||
Reference in New Issue
Block a user