diff --git a/tests/applications/keyring/keyring_init.pm b/tests/applications/keyring/keyring_init.pm deleted file mode 100644 index dde44ec5..00000000 --- a/tests/applications/keyring/keyring_init.pm +++ /dev/null @@ -1,91 +0,0 @@ -use base "installedtest"; -use strict; -use testapi; -use utils; - -# This script will check that the password has been added -# to the system keyring. We will start a wallet application -# and check that the password is listed in that application. - -sub ssh_login_localhost { - my ($user, $pass, $desktop) = @_; - if ($desktop eq "gnome") { - menu_launch_type("terminal"); - assert_screen("apps_run_terminal"); - } - else { - menu_launch_type("konsole"); - assert_screen("konsole_runs"); - } - - # Log to the localhost using the SSH. - type_very_safely("ssh ${user}"); - type_very_safely('@localhost'); - send_key("ret"); - # Confirm to safe the host to known hosts. - type_very_safely("yes\n"); - sleep 1; - # Type the password - type_very_safely("$pass\n"); - sleep 1; - enter_cmd("clear"); - sleep 1; - # Check who is logged in. - enter_cmd("who"); - sleep 1; - # Check that multiple instances are logged in. - assert_screen("keyring_multiple_instances"); - # Log out of ssh - enter_cmd("exit"); -} - -sub run { - my $self = shift; - my $desktop = get_var("DESKTOP"); - my $user = get_var("USER_LOGIN", "test"); - - if ($desktop eq "kde") { - # Perform SSH login to the computer. - ssh_login_localhost($user, "sshpassword", $desktop); - - # Start the KDE wallet application and maximize it. - menu_launch_type("kwalletmanager"); - assert_screen("kwalletmanager_runs"); - send_key("super-pgup"); - - # Navigate to the stored entry and check that - # the credentials are stored there. - assert_and_dclick("keyring_sshkeys_unfold"); - assert_and_dclick("keyring_sshkey_values"); - assert_screen("keyring_keys_values"); - } - else { - # Perform SSH login to the computer. - ssh_login_localhost($user, "sshpassword", $desktop); - - # Start the Seahorse application and maximize it. - menu_launch_type("seahorse"); - assert_screen("apps_run_seahorse"); - send_key("super-up"); - - # Navigate to the stored entry and check - # that the credentials are stored there. - assert_and_click("keyring_seahorse_ssh"); - assert_and_dclick("keyring_seahorse_details"); - assert_screen("keyring_seahorse_details_shown"); - assert_and_click("keyring_seahorse_show_password"); - assert_screen("keyring_seahorse_password_shown"); - } - - # Reboot the machine. - $self->root_console(tty => 3); - enter_cmd("reboot"); -} - -sub test_flags { - return {fatal => 1, milestone => 1}; -} - -1; - -# vim: set sw=4 et: diff --git a/tests/applications/keyring/keyring_passwordless.pm b/tests/applications/keyring/keyring_passwordless.pm index 9572763d..ea817023 100644 --- a/tests/applications/keyring/keyring_passwordless.pm +++ b/tests/applications/keyring/keyring_passwordless.pm @@ -3,18 +3,62 @@ use strict; use testapi; use utils; -# This script will install the necessary things to test the Desktop Keyring on Gnome -# and KDE, i.e.: -# - we will set up the SSHd to accept connections with an SSH key -# - we will create the ssh key for the user +# This script will check that the password has been added +# to the system keyring. We will start a wallet application +# and check that the password is listed in that application. + +sub connect_localhost { + my $user = get_var("USER_LOGIN", "test"); + my ($type) = @_; + # Start the terminal application. + if (get_var("DESKTOP") eq "gnome") { + menu_launch_type("terminal"); + assert_screen("apps_run_terminal"); + } + else { + menu_launch_type("konsole"); + assert_screen("konsole_runs"); + } + + # Use SSH to log onto the localhost without needing + # a password. The log-in process should only require + # the actual command. + + type_very_safely("ssh $user"); + type_very_safely('@localhost'); + send_key("ret"); + sleep 2; + + if ($type ne "reconnect") { + # Answer yes for the upcoming warning. + type_very_safely("yes\n"); + wait_still_screen(2); + + # Open the SSH key. + type_very_safely("sshpassword"); + + # Unlock the password when logged in. + assert_and_click("keyring_open_when_logged"); + assert_and_click("keyring_sshkey_unlock"); + wait_still_screen(2); + } + + # Check that more instances are logged in. + enter_cmd("who\n"); + assert_screen("keyring_multiple_instances"); + + # Exit the terminal app. + enter_cmd("exit"); +} sub run { my $self = shift; my $desktop = get_var("DESKTOP"); - my $user = get_var("USER") || "test"; + my $user = get_var("USER_LOGIN", "test"); + my $pass = get_var("USER_PASSWORD", "weakpassword"); - # Switch to console - $self->root_console(tty => 3); + # We are still at the root console and for the following steps, + # we will need to perform more set up steps. # We install the necessary packages. if ($desktop eq "gnome") { @@ -27,39 +71,39 @@ sub run { enter_cmd('echo "Host *" >> /etc/ssh/ssh_config.d/30-passwordless.conf'); enter_cmd('echo " PasswordAuthentication no" >> /etc/ssh/ssh_config.d/30-passwordless.conf'); - # Enable and start SSHd. - assert_script_run("systemctl enable sshd.service --now"); + # Restart the SSHd. + assert_script_run("systemctl restart sshd.service"); # Check that it is running (the assertion will fail if not) assert_script_run("systemctl status sshd.service --no-pager"); - # Create the SSH keys for the user. - # Change to the normal user - enter_cmd("su -l $user"); - sleep 1; - # Create the SSH key. - enter_cmd("ssh-keygen"); - sleep 1; - # Confirm the location of the key. - send_key("ret"); - sleep 1; - # Create a password for the key. - type_very_safely("sshpassword\n"); - sleep 1; - type_very_safely("sshpassword\n"); - sleep 1; - # Authorize the SSH key. + enter_cmd("su -l $user"); enter_cmd('echo $(cat ~/.ssh/id_ed25519.pub) > ~/.ssh/authorized_keys'); - enter_cmd("exit"); # Return to desktop desktop_vt(); + + # Use SSH to connect to the localhost. + connect_localhost("connect"); + + # Reboot the machine, log onto the session again. + $self->root_console(tty => 3); + enter_cmd("reboot"); + boot_to_login_screen(); + send_key("ret"); + type_very_safely("$pass\n"); + wait_still_screen(3); + send_key("esc"); + + # Reconnect without using password. We still should be + # able to log in. + connect_localhost("reconnect"); } sub test_flags { - return {fatal => 1, milestone => 1}; + return {fatal => 0, always_rollback => 1}; } 1;