Added Sanity/writeable-suid-guid test
This commit is contained in:
parent
e0f84373c8
commit
d40a70bd73
64
tests/Sanity/writeable-suid-guid/Makefile
Normal file
64
tests/Sanity/writeable-suid-guid/Makefile
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Makefile of /tools/python-jsonpointer/Sanity/writeable-suid-guid
|
||||||
|
# Description: Test for BZ#1025583 (python-jsonpointer creates a world writeable directory)
|
||||||
|
# Author: Milos Prchlik <mprchlik@redhat.com>, Jan Kuřík <jkurik@redhat.com>
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014-2021 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# This copyrighted material is made available to anyone wishing
|
||||||
|
# to use, modify, copy, or redistribute it subject to the terms
|
||||||
|
# and conditions of the GNU General Public License version 2.
|
||||||
|
#
|
||||||
|
# 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, write to the Free
|
||||||
|
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
# Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
export TEST=/tools/python-jsonpointer/Sanity/writeable-suid-guid
|
||||||
|
export TESTVERSION=1.0
|
||||||
|
|
||||||
|
BUILT_FILES=
|
||||||
|
|
||||||
|
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||||
|
|
||||||
|
.PHONY: all install download clean
|
||||||
|
|
||||||
|
run: $(FILES) build
|
||||||
|
./runtest.sh
|
||||||
|
|
||||||
|
build: $(BUILT_FILES)
|
||||||
|
test -x runtest.sh || chmod a+x runtest.sh
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *~ $(BUILT_FILES)
|
||||||
|
|
||||||
|
|
||||||
|
include /usr/share/rhts/lib/rhts-make.include
|
||||||
|
|
||||||
|
$(METADATA): Makefile
|
||||||
|
@echo "Owner: Jan Kuřík <jkurik@redhat.com>" > $(METADATA)
|
||||||
|
@echo "Name: $(TEST)" >> $(METADATA)
|
||||||
|
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||||
|
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||||
|
@echo "Description: Test for suid files" >> $(METADATA)
|
||||||
|
@echo "Type: Sanity" >> $(METADATA)
|
||||||
|
@echo "TestTime: 15m" >> $(METADATA)
|
||||||
|
@echo "RunFor: python-jsonpointer" >> $(METADATA)
|
||||||
|
@echo "Requires: python-jsonpointer python3-jsonpointer" >> $(METADATA)
|
||||||
|
@echo "Releases: -RHEL4 -RHEL6 -RHELClient5 -RHELServer5" >> $(METADATA)
|
||||||
|
@echo "Priority: Normal" >> $(METADATA)
|
||||||
|
@echo "License: GPLv2" >> $(METADATA)
|
||||||
|
@echo "Confidential: no" >> $(METADATA)
|
||||||
|
@echo "Destructive: no" >> $(METADATA)
|
||||||
|
|
||||||
|
rhts-lint $(METADATA)
|
3
tests/Sanity/writeable-suid-guid/PURPOSE
Normal file
3
tests/Sanity/writeable-suid-guid/PURPOSE
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
PURPOSE of /tools/python-jsonpointer/Sanity/writeable-suid-guid
|
||||||
|
Description: Test for suid files
|
||||||
|
Author: Milos Prchlik <mprchlik@redhat.com>, Jan Kuřík <jkurik@redhat.com>
|
13
tests/Sanity/writeable-suid-guid/main.fmf
Normal file
13
tests/Sanity/writeable-suid-guid/main.fmf
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
summary: Test for suid files
|
||||||
|
description: ''
|
||||||
|
contact: Jan Kuřík <jkurik@redhat.com>
|
||||||
|
component:
|
||||||
|
- python-jsonpointer
|
||||||
|
test: ./runtest.sh
|
||||||
|
framework: beakerlib
|
||||||
|
recommend:
|
||||||
|
- python-jsonpointer
|
||||||
|
- python3-jsonpointer
|
||||||
|
duration: 15m
|
||||||
|
extra-summary: /tools/python-jsonpointer/Sanity/writeable-suid-guid
|
||||||
|
extra-task: /tools/python-jsonpointer/Sanity/writeable-suid-guid
|
72
tests/Sanity/writeable-suid-guid/runtest.sh
Executable file
72
tests/Sanity/writeable-suid-guid/runtest.sh
Executable file
@ -0,0 +1,72 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# runtest.sh of /tools/python-jsonpointer/Sanity/writeable-suid-guid
|
||||||
|
# Description: Test for suid files
|
||||||
|
# Author: Milos Prchlik <mprchlik@redhat.com>, Jan Kuřík <jkurik@redhat.com>
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014-2021 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# This copyrighted material is made available to anyone wishing
|
||||||
|
# to use, modify, copy, or redistribute it subject to the terms
|
||||||
|
# and conditions of the GNU General Public License version 2.
|
||||||
|
#
|
||||||
|
# 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, write to the Free
|
||||||
|
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
# Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
# Include Beaker environment
|
||||||
|
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||||
|
|
||||||
|
PACKAGE="python-jsonpointer"
|
||||||
|
|
||||||
|
rlJournalStart
|
||||||
|
rlPhaseStartSetup
|
||||||
|
if rpm -q --quiet python-jsonpointer; then
|
||||||
|
PACKAGE="python-jsonpointer"
|
||||||
|
elif rpm -q --quiet python3-jsonpointer; then
|
||||||
|
PACKAGE="python3-jsonpointer"
|
||||||
|
else
|
||||||
|
rlDie "No python's jsonpointer package is installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rlAssertRpm ${PACKAGE}
|
||||||
|
rlRun "T=\$(mktemp -d)"
|
||||||
|
rlRun "pushd ${T}" || rlDie "Can not 'cd' into a temporary directory"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartTest
|
||||||
|
rlRun -s "find $(rpm -ql ${PACKAGE} | tr '\n' ' ') \
|
||||||
|
\\( -perm -4000 -fprintf suid.txt '%#m %u:%g %p\\\\n' \\) , \
|
||||||
|
\\( -perm -2000 -fprintf guid.txt '%#m %u:%g %p\\\\n' \\) , \
|
||||||
|
\\( -perm -1000 -fprintf sticky.txt '%#m %u:%g %p\\\\n' \\) , \
|
||||||
|
\\( -type d -perm -0002 -fprintf writeable-d.txt '%#m %u:%g %p\\\\n' \\) , \
|
||||||
|
\\( -type f -perm -0002 -fprintf writeable-f.txt '%#m %u:%g %p\\\\n' \\) \
|
||||||
|
" 0 "Search for world-writable, SUID, GUID or sticky bit files and directories"
|
||||||
|
for f in suid.txt guid.txt sticky.txt writeable-d.txt writeable-f.txt; do
|
||||||
|
if [[ -s ${f} ]]; then
|
||||||
|
rlLogInfo "${f} contains the following files:"
|
||||||
|
rlLogInfo "$(cat ${f})"
|
||||||
|
rlFail "${PACKAGE} files/dirs should not contain SUID, GUID, sticky or world" \
|
||||||
|
"writeable files"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartCleanup
|
||||||
|
rlRun "popd"
|
||||||
|
rlRun "rm -rf ${T}"
|
||||||
|
rlPhaseEnd
|
||||||
|
rlJournalPrintText
|
||||||
|
rlJournalEnd
|
Loading…
Reference in New Issue
Block a user