diff --git a/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote/PURPOSE b/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote/PURPOSE new file mode 100644 index 0000000..f63d110 --- /dev/null +++ b/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /CoreOS/lftp/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote +Description: Test for BZ#1793557 (SFTP over LFTP hangs if host key of the remote) +Author: Ondrej Mejzlik +Bug summary: SFTP over LFTP hangs if host key of the remote system doesn't exist +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1793557 diff --git a/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote/main.fmf b/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote/main.fmf new file mode 100644 index 0000000..261d66a --- /dev/null +++ b/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote/main.fmf @@ -0,0 +1,23 @@ +summary: Test for BZ#1793557 (SFTP over LFTP hangs if host key of the remote) +description: | + Bug summary: SFTP over LFTP hangs if host key of the remote system doesn't exist + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1793557 +component: +- lftp +test: ./runtest.sh +framework: beakerlib +recommend: +- lftp +duration: 5m +enabled: true +tag: +- NoRHEL4 +- NoRHEL5 +- NoRHEL6 +- TIPpass +- TIPpass_infra +relevancy: | + distro = rhel-4, rhel-5, rhel-6: False +extra-nitrate: TC#0606177 +extra-summary: /CoreOS/lftp/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote +extra-task: /CoreOS/lftp/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote diff --git a/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote/runtest.sh b/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote/runtest.sh new file mode 100755 index 0000000..06e9098 --- /dev/null +++ b/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote/runtest.sh @@ -0,0 +1,66 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/lftp/Regression/bz1793557-SFTP-over-LFTP-hangs-if-host-key-of-the-remote +# Description: Test for BZ#1793557 (SFTP over LFTP hangs if host key of the remote) +# Author: Ondrej Mejzlik +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2020 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="lftp" +TEST_USER="USER234576" +TEST_PASS="medved" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE || rlDie "Package $PACKAGE not installed" + rlLog "Arch: $(arch), PC name: $(hostname), $(hostname -A) User: $(whoami)" + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" 0 "Going into tmp directory $TmpDir" + rlRun "useradd $TEST_USER" 0 "Adding user $TEST_USER" + rlRun "touch /home/$TEST_USER/testFile" 0 "Create test file" + rlRun "echo $TEST_PASS | passwd $TEST_USER --stdin" 0 "Create password for $TEST_USER" + rlRun "rlFileBackup --missing-ok /root/.ssh/known_hosts" 0 "Back up known_hosts" + rlPhaseEnd + + rlGetTestState && { + rlPhaseStartTest + rlRun "rm -f /home/$TEST_USER/.ssh/known_hosts" 0 "Remove known_hosts" + rlRun "timeout 20 lftp -e 'set sftp:connect-program \"ssh -v -a -x\"; set sftp:auto-confirm yes; cd /home/USER234576; ls; quit' sftp://$TEST_USER:$TEST_PASS@127.0.0.1 &>out.txt" 0 "Run lftp" + cat out.txt + rlAssertExists "/root/.ssh/known_hosts" + rlAssertGrep "127.0.0.1" /root/.ssh/known_hosts + rlAssertGrep "testFile" out.txt + rlPhaseEnd + } + + rlPhaseStartCleanup + # known_hosts may not exist, erro nothing backed up is ok here + rlRun "userdel -rf $TEST_USER" 0 "Removing $TEST_USER" + rlRun "rlFileRestore" 0,16 "Restore known_hosts" + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd