96 lines
3.2 KiB
Perl
96 lines
3.2 KiB
Perl
use base "installedtest";
|
|
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.
|
|
|
|
sub run {
|
|
my $self = shift;
|
|
my $desktop = get_var("DESKTOP");
|
|
# Switch to console
|
|
$self->root_console(tty => 3);
|
|
|
|
# We install the necessary packages.
|
|
assert_script_run("dnf -y install pure-ftpd");
|
|
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");
|
|
|
|
# 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");
|
|
}
|
|
}
|
|
|
|
sub test_flags {
|
|
return {fatal => 1, milestone => 1};
|
|
}
|
|
|
|
1;
|
|
|
|
# vim: set sw=4 et:
|