diff --git a/Regression/bz2125311-rsync-daemon-fail-on-3-1-3/main.fmf b/Regression/bz2125311-rsync-daemon-fail-on-3-1-3/main.fmf new file mode 100644 index 0000000..6c50eeb --- /dev/null +++ b/Regression/bz2125311-rsync-daemon-fail-on-3-1-3/main.fmf @@ -0,0 +1,29 @@ +summary: 'Test for: BZ#2125311 (rsync-daemon fail on 3.1.3)' +description: rsync-daemon fail on 3.1.3 +contact: Ondrej Mejzlik +test: ./runtest.sh +framework: beakerlib +duration: 5m +enabled: true +tag: + - NoRHEL6 + - NoRHEL7 + - Tier1 +adjust: + - enabled: false + when: distro < rhel-7 + continue: false +component: + - rsync +recommend: + - rsync + - rsync-daemon + - selinux-policy-devel + - attr +tier: '1' +link: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2125311 + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2139119 + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2139118 +extra-nitrate: TC#0614419 +id: 003d5db0-98da-4a07-a335-f19d16c95a93 diff --git a/Regression/bz2125311-rsync-daemon-fail-on-3-1-3/rsyncd.conf b/Regression/bz2125311-rsync-daemon-fail-on-3-1-3/rsyncd.conf new file mode 100644 index 0000000..a1d8d14 --- /dev/null +++ b/Regression/bz2125311-rsync-daemon-fail-on-3-1-3/rsyncd.conf @@ -0,0 +1,9 @@ +uid = root +gid = root +use chroot = false +read only = false + +[test] +path = XXX +comment = testing area + diff --git a/Regression/bz2125311-rsync-daemon-fail-on-3-1-3/runtest.sh b/Regression/bz2125311-rsync-daemon-fail-on-3-1-3/runtest.sh new file mode 100755 index 0000000..abaaf91 --- /dev/null +++ b/Regression/bz2125311-rsync-daemon-fail-on-3-1-3/runtest.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/rsync/Regression/bz2125311-rsync-daemon-fail-on-3-1-3 +# Description: Test for BZ#2125311 (rsync-daemon fail on 3.1.3) +# Author: Ondrej Mejzlik +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2022 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=${PACKAGE:-rsync} + +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" + TESTDIR=$(pwd) + rlRun "pushd $TmpDir" 0 "Going into tmp directory $TmpDir" + TESTING_PATH=$TmpDir/test + rlRun "mkdir $TESTING_PATH" 0 "Create test dir for rsync" + rlRun "touch $TESTING_PATH/file{1..10} $TESTING_PATH/user.asd" 0 "Create test files" + rlRun "semanage fcontext -a -t rsync_data_t \"$TmpDir(/.*)?\"" 0 "Set selinux context" + rlRun "restorecon -Rv $TmpDir" 0 "Restorecon" + rlRun "setsebool -P rsync_client on" 0 "Set selinux boolean" + ls $TESTING_PATH + rlRun "rlFileBackup /etc/rsyncd.conf" 0 "Back up /etc/rsyncd.conf" + rlRun "cp $TESTDIR/rsyncd.conf /etc/rsyncd.conf" 0 "Copy custom config" + rlRun "sed -i \"s|XXX|$TESTING_PATH|\" /etc/rsyncd.conf" 0 "Configure rsyncd test area" + cat /etc/rsyncd.conf + rlServiceStart 'rsyncd' + rlPhaseEnd + + rlGetTestState && { + rlPhaseStartTest 'Sanity checks' + rlRun "mkdir received" 0 "Create client test dir" + rlRun "rsync -a -vvv 127.0.0.1::test received" 0 "Sanity test connection" + rlAssertExists "./received/file1" + + rlRun "touch send" 0 "Create test file to send" + rlRun "rsync -a -vvv ./send 127.0.0.1::test" 0 "Send file back to server" + rlAssertExists "$TESTING_PATH/send" + rlPhaseEnd + + rlPhaseStartTest 'Test the bug' + # delete and filer must be used together to cause the bug. + rlRun "rsync -a -vvv --delete --filter '-x user.*' received/* 127.0.0.1::test &> out" 0 "Run rsync" + cat out + rlAssertNotGrep 'ERROR' out + rlAssertNotGrep 'protocol incompatibility' out + rlAssertGrep 'received' out + rlPhaseEnd + } + + rlPhaseStartCleanup + rlRun "rlFileRestore" 0 "Restore /etc/rsyncd.conf" + rlServiceRestore 'rsyncd' + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd