From fbb9551520a192764f91583744ef909bc566d802 Mon Sep 17 00:00:00 2001 From: Ondrej Mejzlik Date: Oct 27 2020 10:06:12 +0000 Subject: adding user group test --- diff --git a/Regression/bz1715423-tcpdump-pre-creates-user-and-groups/main.fmf b/Regression/bz1715423-tcpdump-pre-creates-user-and-groups/main.fmf new file mode 100644 index 0000000..feeb888 --- /dev/null +++ b/Regression/bz1715423-tcpdump-pre-creates-user-and-groups/main.fmf @@ -0,0 +1,25 @@ +summary: Test for BZ#1715423 (tcpdump %pre creates user and groups) +description: | + Bug summary: tcpdump %pre creates user and groups unconditionally, raising alerts in corporate environment + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1715423 +component: +- tcpdump +test: ./runtest.sh +framework: beakerlib +recommend: +- tcpdump +duration: 5m +enabled: true +tag: +- NoRHEL4 +- NoRHEL5 +- NoRHEL6 +- TIPfail_infra +- TIPpass +- Tier1 +tier: '1' +relevancy: "distro = rhel-4, rhel-5, rhel-6: False\npurpose=gating && distro < rhel-8.2:\ + \ False \n" +extra-nitrate: TC#0604099 +extra-summary: /CoreOS/tcpdump/Regression/bz1715423-tcpdump-pre-creates-user-and-groups +extra-task: /CoreOS/tcpdump/Regression/bz1715423-tcpdump-pre-creates-user-and-groups diff --git a/Regression/bz1715423-tcpdump-pre-creates-user-and-groups/runtest.sh b/Regression/bz1715423-tcpdump-pre-creates-user-and-groups/runtest.sh new file mode 100755 index 0000000..23027dc --- /dev/null +++ b/Regression/bz1715423-tcpdump-pre-creates-user-and-groups/runtest.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/tcpdump/Regression/bz1715423-tcpdump-pre-creates-user-and-groups +# Description: Test for BZ#1715423 (tcpdump %pre creates user and groups) +# Author: Ondrej Mejzlik +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2019 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:-tcpdump} + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE || rlDie "Package $PACKAGE not installed" + rlLog "PC name: $(hostname), $(hostname -A) User: $(whoami)" + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" 0 "Going into tmp directory $TmpDir" + rlPhaseEnd + + rlGetTestState && { + rlPhaseStartTest + rlRun "yum -y reinstall $PACKAGE" 0 "Reinstall $PACKAGE" + rlRun "tail -n 15 /var/log/audit/audit.log | grep 'type=ADD_GROUP.*tcpdump.*failed'" 1 "No selinux groupadd fail" + rlRun "tail -n 15 /var/log/audit/audit.log | grep 'type=ADD_USER.*tcpdump.*failed'" 1 "No selinux useradd fail" + tail -n 15 /var/log/audit/audit.log + rlRun "rpm --scripts -q tcpdump | grep getent" 0 "Getent is used" + rlPhaseEnd + } + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd