added test bz732756-do-not-add-root-to-pkcs11-group

This commit is contained in:
Karel Srot 2021-04-27 15:59:51 +02:00
commit c0311ac009
2 changed files with 86 additions and 0 deletions

View file

@ -0,0 +1,28 @@
summary: Checks if root is not added to the pkcs11 group
description:
contact: Karel Srot <ksrot@redhat.com>
component:
- opencryptoki
test: ./runtest.sh
framework: beakerlib
recommend:
- opencryptoki
environment:
AVC_ERROR: +no_avc_check
duration: 15m
enabled: true
tag:
- TIPpass_Security
- Tier3
- Tier3security
tier: '3'
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=732756
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=833828
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1054442
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1013017
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=833818
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1058814
extra-nitrate: TC#0111303
extra-summary: /CoreOS/openCryptoki/Regression/bz732756-do-not-add-root-to-pkcs11-group
extra-task: /CoreOS/openCryptoki/Regression/bz732756-do-not-add-root-to-pkcs11-group

View file

@ -0,0 +1,58 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/openCryptoki/Regression/bz732756-do-not-add-root-to-pkcs11-group
# Description: Checks if root is not added to the pkcs11 group and opencryptoki works well in this case
# Author: Miroslav Vadkerti <mvadkert@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 Red Hat, Inc. All rights reserved.
#
# 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="opencryptoki"
ROOT=$(mktemp -d)
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
if rlIsFedora '>=22'; then
# dnf is not able to use system relesever when changing installroot (#1173107)
RELEASEVER=$(. /etc/os-release; echo $VERSION_ID)
rlRun -s "dnf -y install --nogpg --releasever=$RELEASEVER --installroot=$ROOT opencryptoki opencryptoki-swtok 2>&1"
rlAssertNotGrep "group pkcs11 does not exist" $rlRun_LOG
else
rlRun -s "yum -y install --nogpg --installroot=$ROOT opencryptoki opencryptoki-swtok 2>&1"
rlAssertNotGrep "group pkcs11 does not exist" $rlRun_LOG
fi
rlPhaseEnd
rlPhaseStartTest "pkcs11 group should exist but root should not be a member"
rlAssertGrep "^pkcs11" "$ROOT/etc/group" -E
rlAssertNotGrep "^pkcs11.*root" "$ROOT/etc/group" -E
rlPhaseEnd
rlPhaseStartCleanup
rlRun "rm -rf $ROOT"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd