29 lines
847 B
Nix
29 lines
847 B
Nix
{
|
|
pkgs,
|
|
...
|
|
}:
|
|
{
|
|
name = "pam_honeypot-test";
|
|
hostPkgs = pkgs;
|
|
node.pkgs = pkgs;
|
|
nodes.machine =
|
|
{ ... }:
|
|
{
|
|
imports = [ ./module.nix ];
|
|
};
|
|
testScript = ''
|
|
machine.wait_for_unit("multi-user.target")
|
|
machine.send_key("alt-f2")
|
|
machine.wait_until_succeeds("[ $(fgconsole) = 2 ]")
|
|
machine.wait_for_unit("getty@tty2.service")
|
|
machine.wait_until_succeeds("pgrep -f 'agetty.*tty2'")
|
|
machine.wait_until_tty_matches("2", "login: ")
|
|
machine.send_chars("Admin\n")
|
|
machine.wait_until_tty_matches("2", "login: Admin")
|
|
machine.wait_until_succeeds("pgrep login")
|
|
machine.wait_until_tty_matches("2", "Password: ")
|
|
machine.send_chars("AdminPwdQ1\n")
|
|
machine.wait_until_tty_matches("2", "login: ")
|
|
machine.succeed("journalctl | grep 'log in with the honeypot credentials'")
|
|
'';
|
|
}
|