diff --git a/lib/LTP/utils.pm b/lib/LTP/utils.pm index 2abccd008e25..3d089668a69d 100644 --- a/lib/LTP/utils.pm +++ b/lib/LTP/utils.pm @@ -38,6 +38,8 @@ our @EXPORT = qw( get_default_pkg install_from_repo prepare_whitelist_environment + setup_localhost_sshd + setup_ftp ); sub loadtest_kernel { @@ -527,4 +529,27 @@ sub prepare_whitelist_environment { return $environment; } +sub setup_localhost_sshd { + assert_script_run "ssh-keygen -t rsa -P '' -C 'root\@localhost' -f /root/.ssh/id_rsa"; + assert_script_run "cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys"; + assert_script_run "ssh-keyscan -H localhost >> /root/.ssh/known_hosts"; + + permit_root_ssh; + +} + +sub setup_ftp { + my $results = script_run("command -v vsftpd"); + if (!$results) { + assert_script_run("sed -i 's/^write_enable.*\$/write_enable=YES/' /etc/vsftpd.conf"); + assert_script_run("systemctl restart vsftpd"); + } + + my $results = script_run("test -e /etc/pam.d/vsftpd"); + if ($results) { + assert_script_run("echo 'auth required pam_unix.so' >> /etc/pam.d/vsftpd"); + assert_script_run("echo 'account required pam_unix.so' >> /etc/pam.d/vsftpd"); + } +} + 1; diff --git a/tests/kernel/boot_ltp.pm b/tests/kernel/boot_ltp.pm index 80425aef2db6..c718ef7768e8 100644 --- a/tests/kernel/boot_ltp.pm +++ b/tests/kernel/boot_ltp.pm @@ -50,6 +50,11 @@ sub run { select_console('root-console') if get_var('LTP_DEBUG'); select_serial_terminal; + if (get_var('LTP_COMMAND_FILE') eq "net.tcp_cmds") { + setup_localhost_sshd; + setup_ftp; + } + # Debug code for poo#81142 script_run('gzip -9 framebuffer.dat.gz'); upload_logs('framebuffer.dat.gz', failok => 1); diff --git a/tests/kernel/install_ltp.pm b/tests/kernel/install_ltp.pm index 710573e6f4be..4ab48f8c7dd8 100644 --- a/tests/kernel/install_ltp.pm +++ b/tests/kernel/install_ltp.pm @@ -388,6 +388,8 @@ sub run { } setup_network; + setup_localhost_sshd; + setup_ftp; # we don't run LVM tests in 32bit, thus not generating the runtest file # for 32 bit packages