added test tools-should-inform-user-about-pkcs11-group

This commit is contained in:
Karel Srot 2021-04-23 11:48:51 +02:00
commit 30eace5964
2 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,31 @@
summary: tools should inform user about pkcs11 group
description: |
Bug summary: RFE opencryptoki tools should inform the user that he is not in pkcs11 group
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1063763
contact: Karel Srot <ksrot@redhat.com>
component:
- openCryptoki
test: ./runtest.sh
framework: beakerlib
recommend:
- opencryptoki
duration: 5m
enabled: true
tag:
- NoRHEL4
- NoRHEL5
- NoRHEL6
- TIPpass_Security
- Tier2
- Tier2security
tier: '2'
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1063763
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1697494
adjust:
- enabled: false
when: distro == rhel-4, rhel-5, rhel-6
continue: false
extra-nitrate: TC#0598649
extra-summary: /CoreOS/opencryptoki/Sanity/bz1063763-RFE-opencryptoki-tools-should-inform-the-user-that
extra-task: /CoreOS/opencryptoki/Sanity/bz1063763-RFE-opencryptoki-tools-should-inform-the-user-that

View file

@ -0,0 +1,57 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/opencryptoki/Sanity/bz1063763-RFE-opencryptoki-tools-should-inform-the-user-that
# Description: Test for BZ#1063763 (RFE opencryptoki tools should inform the user that)
# Author: Karel Srot <ksrot@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 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="opencryptoki"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlServiceStart pkcsslotd
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "useradd -m bz1063763user"
rlPhaseEnd
rlPhaseStartTest
rlRun -s "su - bz1063763user -c 'pkcsconf -t'" 144
rlAssertGrep "Error initializing the PKCS11 library" $rlRun_LOG
rlAssertGrep "Note: all non-root users that require access to PKCS#11 tokens using opencryptoki must be assigned to the pkcs11 group to be able to communicate with the pkcsslotd daemon." $rlRun_LOG
rlPhaseEnd
rlPhaseStartCleanup
rlLog "Waiting 12 sec for systemd --user process to exit..." && sleep 12
rlRun "userdel -r bz1063763user" 0
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlServiceRestore pkcsslotd
rlPhaseEnd
rlJournalPrintText
rlJournalEnd