1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-13 02:14:21 +00:00

Rewrite the suite to use SSH instead of FTP.

This commit is contained in:
Lukáš Růžička 2024-04-26 14:52:36 +02:00 committed by Lukas Ruzicka
parent 22e9217855
commit 192101428e
90 changed files with 548 additions and 504 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

View File

@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 384,
"ypos": 122,
"width": 130,
"xpos": 226,
"ypos": 271,
"width": 164,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_seahorse_details"
"keyring_askpass_password"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 KiB

View File

@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 607,
"ypos": 734,
"width": 66,
"xpos": 543,
"ypos": 236,
"width": 170,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_button_connect"
"keyring_askpass_yesno"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

View File

@ -1,15 +0,0 @@
{
"area": [
{
"xpos": 253,
"ypos": 163,
"width": 87,
"height": 67,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_test_file"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

View File

@ -1,15 +0,0 @@
{
"area": [
{
"xpos": 521,
"ypos": 304,
"width": 195,
"height": 47,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_keys_values"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

View File

@ -1,15 +0,0 @@
{
"area": [
{
"xpos": 217,
"ypos": 736,
"width": 82,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_location_line"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

View File

@ -1,15 +0,0 @@
{
"area": [
{
"ypos": 106,
"height": 61,
"type": "match",
"width": 71,
"xpos": 572
}
],
"properties": [],
"tags": [
"keyring_open_location"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 KiB

View File

@ -1,15 +0,0 @@
{
"area": [
{
"xpos": 605,
"ypos": 106,
"width": 71,
"height": 61,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_open_location"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

View File

@ -1,15 +0,0 @@
{
"area": [
{
"xpos": 404,
"ypos": 468,
"width": 132,
"height": 15,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_remember_password"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

View File

@ -1,15 +0,0 @@
{
"area": [
{
"xpos": 689,
"ypos": 436,
"width": 21,
"height": 14,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_reveal_password"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 KiB

View File

@ -1,16 +0,0 @@
{
"area": [
{
"xpos": 668,
"ypos": 578,
"width": 100,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_save_connect",
"keyring_save_next"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1,10 +1,10 @@
{
"area": [
{
"xpos": 648,
"ypos": 424,
"width": 65,
"height": 79,
"xpos": 442,
"ypos": 261,
"width": 126,
"height": 19,
"type": "match"
}
],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 338,
"ypos": 111,
"width": 169,
"height": 26,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_seahorse_login_details"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -1,15 +0,0 @@
{
"area": [
{
"xpos": 189,
"ypos": 261,
"width": 27,
"height": 15,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_select_ftp"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

View File

@ -1,15 +0,0 @@
{
"area": [
{
"xpos": 508,
"ypos": 356,
"width": 76,
"height": 23,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_select_registered"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"ypos": 292,
"height": 37,
"xpos": 183,
"type": "match",
"width": 42
}
],
"properties": [],
"tags": [
"keyring_sftp_logged"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 KiB

View File

@ -1,15 +0,0 @@
{
"area": [
{
"xpos": 446,
"ypos": 236,
"width": 105,
"height": 22,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_show_values"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

View File

@ -1,15 +0,0 @@
{
"area": [
{
"xpos": 286,
"ypos": 117,
"width": 77,
"height": 50,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_test_file"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 382,
"ypos": 434,
"width": 136,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"nautilus_autounlock_password"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 KiB

View File

@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 6,
"ypos": 188,
"width": 82,
"xpos": 361,
"ypos": 104,
"width": 141,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_open_network"
"nautilus_connection_established"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 KiB

View File

@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 39,
"ypos": 307,
"width": 40,
"xpos": 260,
"ypos": 608,
"width": 138,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_maps_unfold"
"nautilus_enter_address"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 KiB

View File

@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 60,
"ypos": 331,
"width": 131,
"xpos": 258,
"ypos": 610,
"width": 140,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_ftp_localhost"
"nautilus_enter_address"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 109,
"ypos": 559,
"width": 109,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"nautilus_other_locations"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

View File

@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 746,
"ypos": 41,
"width": 126,
"xpos": 381,
"ypos": 434,
"width": 142,
"height": 21,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_add_network_folder"
"nautilus_remember_password"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"height": 17,
"ypos": 495,
"width": 52,
"type": "match",
"xpos": 587
}
],
"properties": [],
"tags": [
"nautilus_unlock"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 KiB

View File

@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 599,
"ypos": 201,
"width": 66,
"xpos": 587,
"ypos": 495,
"width": 52,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_button_connect"
"nautilus_unlock"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 KiB

View File

@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 40,
"ypos": 498,
"width": 112,
"xpos": 554,
"ypos": 444,
"width": 49,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_other_location"
"keyring_askpass_confirm"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 379,
"ypos": 322,
"width": 167,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_askpass_password"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB

View File

@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 707,
"ypos": 577,
"width": 46,
"xpos": 381,
"ypos": 414,
"width": 92,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"kde_button_next"
"keyring_askpass_remember"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"ypos": 265,
"width": 118,
"height": 19,
"type": "match",
"xpos": 380
}
],
"properties": [],
"tags": [
"keyring_askpass_yesno"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 KiB

View File

@ -0,0 +1,16 @@
{
"area": [
{
"type": "match",
"xpos": 453,
"height": 19,
"ypos": 347,
"width": 138,
"match": 90
}
],
"properties": [],
"tags": [
"keyring_askpass_yesno"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 KiB

View File

@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 563,
"ypos": 502,
"xpos": 59,
"ypos": 382,
"width": 42,
"height": 16,
"height": 37,
"type": "match"
}
],
"properties": [],
"tags": [
"kde_button_ok"
"keyring_sftp_logged"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 KiB

View File

@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 428,
"ypos": 565,
"width": 125,
"xpos": 450,
"ypos": 284,
"width": 103,
"height": 17,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_remember_forever"
"keyring_wallet_password"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 62,
"ypos": 308,
"width": 94,
"height": 16,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_wallet_password_details"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 456,
"ypos": 245,
"width": 91,
"height": 19,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_wallet_password_reveal"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 26,
"ypos": 284,
"width": 86,
"height": 20,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_wallet_password_stored"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 43,
"xpos": 23,
"ypos": 258,
"width": 69,
"width": 117,
"height": 18,
"type": "match"
}
],
"properties": [],
"tags": [
"keyring_passwords_unfold"
"keyring_wallet_passwords_unfold"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

View File

@ -3,87 +3,49 @@ 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 install an FTP server.
# - we will set it up so that logins can be made.
# - we will log into the FTP server and make the system to remember the credentials.
# - we will restart the machine and check that the credentials are still remembered.
# - we will open SeaHorse or KDE Wallet to check that the credentials are stored.
# This script will do the following:
# - install Seahorse when on Gnome
# - enable the sshd.service
# - create an SSH key for the installed user (~ test)
# - set up the SSH key password for that key
# - it will set a milestone
sub run {
my $self = shift;
my $desktop = get_var("DESKTOP");
# Switch to console
my $user = get_var("USER") || "test";
# Switch to console to perform several setting tasks.
$self->root_console(tty => 3);
# We install the necessary packages.
assert_script_run("dnf -y install pure-ftpd");
# Install Seahorse on Gnome.
# On KDE, similar application is already installed in the system.
if ($desktop eq "gnome") {
assert_script_run("dnf -y install seahorse");
}
# Download the configuration file for FTP and unpack it.
download_testdata("configuration");
assert_script_run("mv -f /home/test/configuration/pure-ftpd.conf /etc/pure-ftpd/");
assert_script_run("chown root:root /etc/pure-ftpd/pure-ftpd.conf");
assert_script_run("chmod 644 /etc/pure-ftpd/pure-ftpd.conf");
# Enable and start sshd.service and check that is is running.
assert_script_run("systemctl enable sshd.service --now");
assert_script_run("systemctl status sshd.service --no-pager");
# Set up the system.
# Add a group for the FTP and the user that will own the FTP stuff
assert_script_run("groupadd ftpusers");
assert_script_run("useradd -g ftpusers -d /dev/null -s /sbin/nologin ftpuser");
# Create a directory to hold the FTP content, set rights and create the content.
assert_script_run("mkdir /ftpdata");
assert_script_run("chown -R ftpuser:ftpusers /ftpdata");
assert_script_run("echo 'This is a test file' > /ftpdata/testfile.txt");
# Enable the FTP service in the firewall.
assert_script_run("firewall-cmd --add-service=ftp --permanent");
assert_script_run("firewall-cmd --reload");
# Set up the FTP server.
# Create a virtual FTP user called tucnak.
enter_cmd("pure-pw useradd tucnak -u ftpuser -g ftpusers -d /ftpdata");
sleep(2);
# Set its password, wait between attempts so that the system has time
# to react to the input.
type_string("weakpassword\n"); # To pass the password entry.
sleep(2);
type_string("weakpassword\n");
sleep(2);
# Create PureFTP database to the settings.
assert_script_run("pure-pw mkdb");
# Check that the settings are done correctly
assert_script_run("pure-pw list | egrep 'tucnak\\s+/ftpdata'");
assert_script_run("pure-pw show tucnak");
# Enable and start the server.
assert_script_run("systemctl enable pure-ftpd.service --now");
# Check that it is running (the assertion will fail if not)
assert_script_run("systemctl status pure-ftpd.service --no-pager");
# Return to desktop
desktop_vt();
# Start the file explorer application based on what system we are
# running, Gnome or KDE.
my $app = "nautilus";
my $key = "up";
if (get_var("DESKTOP") eq "kde") {
$app = "dolphin";
$key = "pgup";
}
menu_launch_type($app);
send_key("super-$key");
wait_still_screen(3);
# Check that it has started
if (get_var("DESKTOP") eq "kde") {
assert_screen("dolphin_runs");
}
else {
assert_screen("apps_run_files");
}
# Create the SSH keys with password for the regular user.
# Switch to that user's account.
enter_cmd("su -l $user");
sleep 2;
# Create the SSH key in the default location with
# the default cipher and also set up the password
# for that key.
enter_cmd("ssh-keygen");
sleep 2;
send_key("ret");
sleep 2;
type_very_safely("sshpassword\n");
sleep 2;
type_very_safely("sshpassword\n");
sleep 2;
# Logout the regular user and return
# back to the root console.
enter_cmd("exit");
}
sub test_flags {

View File

@ -1,89 +0,0 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script will
# - use the file application to log onto the localhost's
# ftp server while we will ask the system to remember the login credentials.
# - check that the credentials have been stored in the system
# - reboot the computer and check that the system still remembers them
# and that we can do the FTP again without credentials.
sub run {
my $self = shift;
my $desktop = get_var("DESKTOP");
if ($desktop eq "kde") {
# The Dolphin application is already started, so we begin
# with clicking on Network to open the network folders.
# We want to add a new connection and go through the
# password addition process.
assert_and_click("keyring_open_network");
assert_and_click("keyring_add_network_folder");
assert_and_click("keyring_select_ftp");
assert_and_click("kde_button_next");
# We will set up the connection.
type_very_safely("FTPConnect");
send_key("tab");
type_very_safely("tucnak");
send_key("tab");
type_very_safely("127.0.0.1");
assert_and_click("keyring_save_connect");
# Type password to connect
type_very_safely("weakpassword");
# Reveal it so that we can check it is correctly
# written, when there are failures because of that
# (I have seen a couple of mistypes during development).
assert_and_click("keyring_reveal_password");
assert_and_click("keyring_remember_password");
assert_and_click("kde_button_ok");
# We have added the network location and an icon
# has been created to access it. Click on that icon.
assert_and_click("keyring_open_location");
# While double click would sometimes fail here, we
# want to confirm opening the icon using the
# Enter key.
send_key("ret");
# Check that we have opened the location and that
# we can see the FTP content.
assert_screen("keyring_test_file");
# Close the application.
send_key("alt-f4");
}
else {
# The Nautilus application is already started, so we begin
# with clicking on Other locations.
# We want to add a new connection and go through the
# password addition process.
assert_and_click("keyring_other_location");
assert_and_click("keyring_location_line");
type_very_safely("ftp://127.0.0.1");
assert_and_click("keyring_button_connect");
# We will set up the connection.
assert_and_click("keyring_select_registered");
send_key("tab");
type_very_safely("tucnak");
send_key("tab");
type_very_safely("weakpassword");
# Reveal it so that we can check it is correctly
# written, when there are failures because of that
# (I have seen a couple of mistypes during development).
assert_and_click("keyring_remember_forever");
assert_and_click("keyring_button_connect");
# Check that we have opened the location and that
# we can see the FTP content.
assert_screen("keyring_test_file");
# Close the application.
send_key("alt-f4");
}
}
sub test_flags {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et:

View File

@ -1,54 +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 run {
my $self = shift;
my $desktop = get_var("DESKTOP");
if ($desktop eq "kde") {
# 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_passwords_unfold");
assert_and_dclick("keyring_maps_unfold");
assert_and_click("keyring_ftp_localhost");
assert_and_click("keyring_show_values");
assert_screen("keyring_keys_values");
}
else {
# 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_login");
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:

View File

@ -0,0 +1,167 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script will do the following:
# - it will establish a connection to the system via sftp
# - it will ask for password to the system and store that password
# - it will check that the password was stored in the keyring
# - it will reboot the system
# - it will re-establish the connection without asking for the password
my $user = get_var("USER_LOGIN", "test");
my $pass = get_var("USER_PASSWORD", "weakpassword");
my $desktop = get_var("DESKTOP", "gnome");
# On KDE, it is possible that Konsole interacts with keyring when
# certain variables are set in the system. This subroutine sets up
# those variables.
sub export_kde_vars {
enter_cmd('export SSH_ASKPASS=/usr/bin/ksshaskpass');
sleep 2;
enter_cmd('export SSH_ASKPASS_REQUIRE=prefer');
sleep 2;
}
# This will handle the connection to the localhost. The process is different
# for KDE and Gnome, as currently Gnome does not save passwords to keyring
# from terminal and the KDE has a bug KNetAttach that prevents Dolphin from
# establishing the connection like Nautilus does.
sub connect_localhost {
my $type = shift;
# For Gnome, we will use Nautilus to establish an SFTP
# connection to the localhost.
if (get_var("DESKTOP") eq "gnome") {
# Start Nautilus.
menu_launch_type("nautilus");
assert_screen("apps_run_files");
# Add a new network connection.
assert_and_click("nautilus_other_locations");
assert_and_click("nautilus_enter_address");
my $connection = "ssh://$user" . '@localhost';
type_very_safely("$connection\n");
# When we connect for the first time, a password
# dialogue should appear in which we need to type
# in the password. We will also try to remember the
# password and confirm the connection.
if ($type ne "reconnect") {
wait_still_screen(3);
type_very_safely($pass);
assert_and_click("nautilus_remember_password");
assert_and_click("nautilus_unlock");
}
# When the connection has been established,
# a new connection icon will appear.
assert_screen("nautilus_connection_established");
}
else {
# On KDE, Dolphin has a bug that prevents the application
# from connecting easily (as in Gnome). Manually, this is
# not a big deal, as one could react accordingly, but with
# automation, this approach is basically useless.
# Therefore, we will use a different approach - we will enable
# CLI keyring integration and perform an SFTP connection
# in Konsole.
menu_launch_type("konsole");
assert_screen("konsole_runs");
# Export the environmental variables, this is needed for the process
# to work correctly.
export_kde_vars();
# Connect the sftp.
my $command = "sftp $user" . '@localhost';
enter_cmd($command);
# If performed for the first time, also deal with the
# password storing which is a little painful on KDE.
if ($type ne "reconnect") {
# First, we check that the yes no dialogue is present
# and type "yes" into it.
assert_screen("keyring_askpass_yesno");
type_very_safely("yes\n");
# Then similarly to Gnome, the password dialogue will appear
# and we type in the password. Also, we click on Remember
# and confirm with the OK button.
assert_screen("keyring_askpass_password");
type_very_safely("$pass");
assert_and_click("keyring_askpass_remember");
assert_and_click("keyring_askpass_confirm");
}
# Check that we have logged in and exit the application.
assert_and_click("keyring_sftp_logged");
type_very_safely("bye\n");
}
}
sub check_stored {
# This subroutine will run the keyring application on either
# desktop and check that the password has been stored there.
# On KDE, we will use the KWalletManager.
if (get_var("DESKTOP") eq "kde") {
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_wallet_passwords_unfold");
assert_and_dclick("keyring_wallet_password_stored");
assert_and_click("keyring_wallet_password_details");
assert_and_click("keyring_wallet_password_reveal");
assert_screen("keyring_wallet_password");
}
else {
# 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_login");
assert_and_dclick("keyring_seahorse_login_details");
assert_screen("keyring_seahorse_details_shown");
assert_and_click("keyring_seahorse_show_password");
assert_screen("keyring_seahorse_password_shown");
}
}
sub run {
my $self = shift;
# We are still at the root console, but for the following steps,
# there is nothing we should be doing there, so we switch back
# to the graphical desktop.
desktop_vt();
# Lets connect to localhost via SSH. This should result in
# asking for a password and storing the credentials for later use.
# The following routine uses different approaches on different
# desktops.
connect_localhost("connect");
# Check that the password has been stored.
check_stored();
# Reboot the machine, log onto the session again.
$self->root_console(tty => 3);
enter_cmd("reboot");
# Boot to login screen and type in the password.
boot_to_login_screen();
# On Gnome, press Enter to open the password field.
send_key("ret") if ($desktop eq "gnome");
type_very_safely("$pass\n");
wait_still_screen(3);
# Fix the Activity mode. No effect on KDE.
send_key("esc");
# Repeat the connection procedure, but skip the password
# handling process as this will be done by the keyring.
connect_localhost("reconnect");
}
sub test_flags {
return {fatal => 0, always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,132 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script will do the following:
# - set up the system for paswordless connection using
# the SSH authorized keys.
# - open the ssh key and establish the connection
# - store that password in the keyring
# - reboot the system
# - re-establish the connection, this time without the need to open the password
my $desktop = get_var("DESKTOP");
my $user = get_var("USER_LOGIN", "test");
my $pass = get_var("USER_PASSWORD", "weakpassword");
sub export_kde_vars {
# On KDE, it is possible to update and reuse the keyring
# on Konsole if correct environmental variables are set.
# Set them now.
enter_cmd('export SSH_ASKPASS=/usr/bin/ksshaskpass');
sleep 2;
enter_cmd('export SSH_ASKPASS_REQUIRE=prefer');
sleep 2;
}
sub connect_localhost {
my $type = shift;
# Start the terminal application. On KDE also export the variables.
if (get_var("DESKTOP") eq "gnome") {
menu_launch_type("terminal");
assert_screen("apps_run_terminal");
}
else {
menu_launch_type("konsole");
assert_screen("konsole_runs");
export_kde_vars();
}
# Establish the SFTP connection to the localhost.
# A dialogue should appear to collect credentials to open
# the SSH key.
my $command = "sftp $user" . '@localhost';
enter_cmd($command);
sleep 2;
# When connecting for the first time, we will remember
# the key password and store it in the keyring.
if ($type ne "reconnect") {
if ($desktop eq "gnome") {
type_very_safely("yes\n");
wait_still_screen(2);
type_very_safely("sshpassword");
assert_and_click("nautilus_autounlock_password");
assert_and_click("nautilus_unlock");
}
else {
type_very_safely("yes\n");
wait_still_screen(2);
type_very_safely("sshpassword");
assert_and_click("keyring_askpass_remember");
assert_and_click("keyring_askpass_confirm");
}
}
# The connection should have been established if everything has worked
# so far.
assert_screen("keyring_sftp_logged");
# Finish the connection.
enter_cmd("bye");
# Exit the terminal app.
enter_cmd("exit");
}
sub run {
my $self = shift;
# 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") {
assert_script_run("dnf -y install seahorse");
}
# Set up the SSH daemon
# Create a drop-in configuration file.
enter_cmd("touch /etc/ssh/ssh_config.d/30-passwordless.conf");
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');
# 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");
# 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.
$self->root_console(tty => 3);
enter_cmd("reboot");
# Log in.
boot_to_login_screen();
send_key("ret") if ($desktop eq "gnome");
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 => 0, always_rollback => 1};
}
1;
# vim: set sw=4 et:

View File

@ -1,59 +0,0 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script will open the File application and attempt
# to reconnect to the FTP server, this time without
# having to put credentials into the process.
sub run {
my $self = shift;
my $pw = get_var("USER_PASSWORD") // "weakpassword";
my $desktop = get_var("DESKTOP");
# Check that the machine has been rebooted
# and log in.
boot_to_login_screen();
send_key("ret") if (get_var("DESKTOP") eq "gnome");
type_very_safely("$pw\n");
wait_still_screen(5);
if ($desktop eq "kde") {
# Start the file exploring application
menu_launch_type("dolphin");
send_key("super-pgup");
# Open the network location and check
# that the FTP content is accessible.
assert_and_click("keyring_open_network");
assert_and_click("keyring_open_location");
send_key("ret");
assert_screen("keyring_test_file");
}
else {
# Start the file exploring application
send_key("esc");
menu_launch_type("nautilus");
send_key("super-up");
# Open the network location and check
# that the FTP content is accessible.
assert_and_click("keyring_other_location");
assert_and_click("keyring_location_line");
type_very_safely("ftp://127.0.0.1");
assert_and_click("keyring_button_connect");
# Check that we have opened the location and that
# we can see the FTP content.
assert_screen("keyring_test_file");
}
}
sub test_flags {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et: