blob: 4d1dab8e71504e77f8037c5c0112da736efe02ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
{ ... }:
{
name = "pam-lastlog";
nodes.machine =
{ ... }:
{
imports = [ ../common/user-account.nix ];
};
testScript = ''
with subtest("Test legacy lastlog import"):
# create old lastlog file to test import
# empty = nothing will actually be imported, but the service will run
machine.succeed("touch /var/log/lastlog")
machine.wait_for_unit("lastlog2-import.service")
machine.succeed("journalctl -b --grep 'Starting Import lastlog data into lastlog2 database'")
machine.succeed("stat /var/log/lastlog.migrated")
with subtest("Test lastlog entries are created by logins"):
machine.wait_for_unit("multi-user.target")
machine.wait_until_tty_matches("1", "login: ")
machine.send_chars("alice\n")
machine.wait_until_tty_matches("1", "Password: ")
machine.send_chars("foobar\n")
machine.wait_until_succeeds("pgrep -u alice bash")
print(machine.succeed("lastlog2 --active --user alice"))
machine.succeed("stat /var/lib/lastlog/lastlog2.db")
machine.send_chars("exit\n")
'';
}
|