|
|
0d07814 |
#!/bin/bash
|
|
|
0d07814 |
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
|
|
0d07814 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
0d07814 |
#
|
|
|
0d07814 |
# runtest.sh of /CoreOS/libselinux/Regression/container-selinux_crond
|
|
|
0d07814 |
# Description: Does installing container-selinux break crond?
|
|
|
0d07814 |
# Author: Vit Mojzis <vmojzis@redhat.com>
|
|
|
0d07814 |
#
|
|
|
0d07814 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
0d07814 |
#
|
|
|
0d07814 |
# Copyright (c) 2020 Red Hat, Inc. All rights reserved.
|
|
|
0d07814 |
#
|
|
|
0d07814 |
# This copyrighted material is made available to anyone wishing
|
|
|
0d07814 |
# to use, modify, copy, or redistribute it subject to the terms
|
|
|
0d07814 |
# and conditions of the GNU General Public License version 2.
|
|
|
0d07814 |
#
|
|
|
0d07814 |
# This program is distributed in the hope that it will be
|
|
|
0d07814 |
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
0d07814 |
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
0d07814 |
# PURPOSE. See the GNU General Public License for more details.
|
|
|
0d07814 |
#
|
|
|
0d07814 |
# You should have received a copy of the GNU General Public
|
|
|
0d07814 |
# License along with this program; if not, write to the Free
|
|
|
0d07814 |
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
0d07814 |
# Boston, MA 02110-1301, USA.
|
|
|
0d07814 |
#
|
|
|
0d07814 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
0d07814 |
|
|
|
0d07814 |
# Include Beaker environment
|
|
|
0d07814 |
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
|
|
0d07814 |
|
|
|
0d07814 |
PACKAGE="libselinux"
|
|
|
0d07814 |
|
|
|
0d07814 |
rlJournalStart
|
|
|
0d07814 |
rlPhaseStartSetup
|
|
|
0d07814 |
rlAssertRpm ${PACKAGE}
|
|
|
0d07814 |
rlAssertRpm cronie
|
|
|
0d07814 |
rlAssertRpm container-selinux
|
|
|
0d07814 |
rlRun "setenforce 1"
|
|
|
0d07814 |
rlRun "sestatus"
|
|
|
0d07814 |
OUTPUT_FILE=`mktemp`
|
|
|
0d07814 |
rlFileBackup /etc/crontab
|
|
|
0d07814 |
rlPhaseEnd
|
|
|
0d07814 |
|
|
|
0d07814 |
rlPhaseStartTest "#1879368"
|
|
|
0d07814 |
rlRun "echo '* * * * * root date > /tmp/date' >> /etc/crontab"
|
|
|
0d07814 |
rlRun "restorecon -v /etc/crontab"
|
|
|
0d07814 |
rlRun "systemctl restart crond"
|
|
|
0d07814 |
# check if crond encountered any SELinux related issues
|
|
|
0d07814 |
rlRun "systemctl status crond | tee ${OUTPUT_FILE}"
|
|
|
0d07814 |
rlRun "cat ${OUTPUT_FILE} | grep -i 'SELinux'" 1
|
|
|
0d07814 |
rlRun "sleep 90"
|
|
|
0d07814 |
rlRun "cat /tmp/date &>${OUTPUT_FILE}"
|
|
|
0d07814 |
rlRun "sleep 90"
|
|
|
0d07814 |
# check that the job is still running
|
|
|
0d07814 |
rlRun "diff /tmp/date ${OUTPUT_FILE}" 1
|
|
|
0d07814 |
rlPhaseEnd
|
|
|
0d07814 |
|
|
|
0d07814 |
rlPhaseStartCleanup
|
|
|
0d07814 |
rlRun "rm -f ${OUTPUT_FILE}"
|
|
|
0d07814 |
rlFileRestore
|
|
|
0d07814 |
rlRun "restorecon /etc/crontab"
|
|
|
0d07814 |
rlRun "systemctl restart crond"
|
|
|
0d07814 |
rlPhaseEnd
|
|
|
0d07814 |
rlJournalPrintText
|
|
|
0d07814 |
rlJournalEnd
|