2021-07-22 20:11:56 +00:00
|
|
|
use base "installedtest";
|
|
|
|
use strict;
|
|
|
|
use testapi;
|
|
|
|
use utils;
|
|
|
|
|
|
|
|
sub run {
|
|
|
|
# at this point we have already reached @benzea's step 1:
|
|
|
|
# "Login without a (fingerprint) reader"
|
|
|
|
my $self = shift;
|
|
|
|
my $user = get_var("USER_LOGIN", "test");
|
2022-07-28 20:32:57 +00:00
|
|
|
$self->root_console(tty => 6);
|
2021-07-22 20:11:56 +00:00
|
|
|
script_run 'dnf -y install socat', 180;
|
|
|
|
assert_script_run 'mkdir -p /etc/systemd/system/fprintd.service.d';
|
|
|
|
# configure fprintd dummy reader, see
|
|
|
|
# https://pagure.io/fedora-qa/os-autoinst-distri-fedora/issue/223#comment-732426
|
|
|
|
assert_script_run 'printf \'[Service]\nEnvironment=G_MESSAGES_DEBUG=all\nEnvironment=FP_VIRTUAL_DEVICE=%%t/fprintd-virt\nReadWritePaths=%%t\nDeviceAllow=\' > /etc/systemd/system/fprintd.service.d/dummy.conf';
|
|
|
|
# dummy reader needs SELinux permissive
|
|
|
|
assert_script_run 'printf "SELINUX=permissive\nSELINUXTYPE=targeted" > /etc/selinux/config';
|
|
|
|
# now we reboot and go onto step 2:
|
|
|
|
# "Login with a reader, but no enrolled prints"
|
|
|
|
type_string "reboot\n";
|
|
|
|
assert_screen "graphical_login", 180;
|
2024-09-26 15:57:27 +00:00
|
|
|
dm_perform_login('gnome', 'weakpassword');
|
2022-07-28 20:32:57 +00:00
|
|
|
check_desktop(timeout => 60);
|
2021-07-22 20:11:56 +00:00
|
|
|
wait_still_screen 10;
|
2022-07-28 20:32:57 +00:00
|
|
|
$self->root_console(tty => 5);
|
2021-07-22 20:11:56 +00:00
|
|
|
# now we enroll a fingerprint, we run the enrol process on tty5...
|
|
|
|
type_string "fprintd-enroll $user\n";
|
|
|
|
sleep 2;
|
2022-07-28 20:32:57 +00:00
|
|
|
$self->root_console(tty => 6);
|
2021-07-22 20:11:56 +00:00
|
|
|
# ...and do the scans (we need exactly 5) on tty4.
|
2022-07-28 20:32:57 +00:00
|
|
|
for my $n (1 .. 5) {
|
2021-07-22 20:11:56 +00:00
|
|
|
assert_script_run "echo SCAN $user-finger-1 | socat STDIN UNIX-CONNECT:/run/fprintd-virt";
|
|
|
|
}
|
|
|
|
# now we will reboot and do step 3:
|
|
|
|
# "Login using fingerprint"
|
|
|
|
type_string "reboot\n";
|
|
|
|
assert_screen "graphical_login", 180;
|
2022-07-28 20:32:57 +00:00
|
|
|
$self->root_console(tty => 6);
|
2021-07-22 20:11:56 +00:00
|
|
|
# the GDM tty needs to be active when the scan happens, so we will
|
|
|
|
# schedule the scan to happen in 20 seconds then go deal with gdm
|
|
|
|
type_string "sleep 20; echo SCAN $user-finger-1 | socat STDIN UNIX-CONNECT:/run/fprintd-virt\n";
|
2024-01-09 18:37:57 +00:00
|
|
|
select_console "tty1-console";
|
2021-07-22 20:11:56 +00:00
|
|
|
mouse_hide;
|
|
|
|
send_key_until_needlematch("graphical_login_input", "ret", 3, 5);
|
|
|
|
# now we check that we see the "or scan fingerprint" message, then
|
|
|
|
# just wait for the scan to happen and login to succeed
|
|
|
|
assert_screen "graphical_login_fprint";
|
2022-07-28 20:32:57 +00:00
|
|
|
check_desktop(timeout => 60);
|
|
|
|
$self->root_console(tty => 6);
|
2021-07-22 20:11:56 +00:00
|
|
|
# now we will reboot again and do step 4:
|
|
|
|
# "Password login after failed fingerprint login"
|
|
|
|
type_string "reboot\n";
|
|
|
|
assert_screen "graphical_login", 180;
|
2022-07-28 20:32:57 +00:00
|
|
|
$self->root_console(tty => 6);
|
2021-07-22 20:11:56 +00:00
|
|
|
# we're doing the same as before, but scanning the 'wrong thing'
|
|
|
|
# (note finger-2 not finger-1)
|
|
|
|
type_string "sleep 20; echo SCAN $user-finger-2 | socat STDIN UNIX-CONNECT:/run/fprintd-virt\n";
|
2024-01-09 18:37:57 +00:00
|
|
|
select_console "tty1-console";
|
2021-07-22 20:11:56 +00:00
|
|
|
mouse_hide;
|
|
|
|
send_key_until_needlematch("graphical_login_input", "ret", 3, 5);
|
|
|
|
assert_screen "graphical_login_fprint";
|
|
|
|
# unfortunately we cannot assert the 'scan failed' message as it
|
|
|
|
# does not appear for long enough, so we just have to sleep
|
|
|
|
# another 20 seconds to be sure the scan has happened...
|
|
|
|
sleep 20;
|
|
|
|
# ...and check we're still at the login prompt, then type password
|
|
|
|
assert_screen "graphical_login_input";
|
|
|
|
type_very_safely "weakpassword";
|
|
|
|
send_key "ret";
|
2022-07-28 20:32:57 +00:00
|
|
|
check_desktop(timeout => 60);
|
2021-07-22 20:11:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub test_flags {
|
2022-07-28 20:32:57 +00:00
|
|
|
return {fatal => 1};
|
2021-07-22 20:11:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
# vim: set sw=4 et:
|