Fix error handling and add nixos test
This commit is contained in:
parent
c06b3a7142
commit
ef60878471
6 changed files with 335 additions and 20 deletions
29
test.nix
Normal file
29
test.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
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'")
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue