Compare commits

...

3 Commits
rawhide ... f31

Author SHA1 Message Date
Petr Lautrbach 75342558ef setools-4.2.2-2
- setools requires -console, -console-analyses and -gui packages (#1794314)
2020-03-23 21:28:43 +01:00
Petr Lautrbach e6a90d4108 tests: Add local Sanity/sedta to the testsuite 2020-03-23 21:27:07 +01:00
Milos Malik fce8dddc4a Add new test for sedta utility
Basic test which covers the sedta tool.

- test invalid values
- test transitivity, reflexivity, non-existent relation etc
2020-03-23 21:27:07 +01:00
6 changed files with 192 additions and 4 deletions

View File

@ -7,7 +7,7 @@
Name: setools
Version: 4.2.2
Release: 1%{?setools_pre_ver:.%{setools_pre_ver}}%{?dist}
Release: 2%{?setools_pre_ver:.%{setools_pre_ver}}%{?dist}
Summary: Policy analysis tools for SELinux
License: GPLv2
@ -29,8 +29,9 @@ BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: libselinux-devel
# BuildArch:
Requires: python3-%{name} = %{version}-%{release}
Requires: %{name}-console = %{version}-%{release}
Requires: %{name}-console-analyses = %{version}-%{release}
Requires: %{name}-gui = %{version}-%{release}
%description
SETools is a collection of graphical tools, command-line tools, and
@ -137,7 +138,10 @@ Python modules designed to facilitate SELinux policy analysis.
%{_mandir}/man1/apol*
%changelog
* Mon Jul 08 2019 Vit Mojzis <vmojzis@redhat.com> - 4.2.2-1}
* Mon Mar 23 2020 Petr Lautrbach <plautrba@redhat.com> - 4.2.2-2
- setools requires -console, -console-analyses and -gui packages (#1794314)
* Mon Jul 08 2019 Vit Mojzis <vmojzis@redhat.com> - 4.2.2-1
- SETools 4.2.2 release
* Mon May 13 2019 Vit Mojzis <vmojzis@redhat.com> - 4.2.1-3

View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/setools/Sanity/sedta
# Description: Does sedta work as expected? Does it support all features?
# Author: Milos Malik <mmalik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/setools/Sanity/sedta
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE testpolicy.cil
.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: Milos Malik <mmalik@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Does sedta work as expected? Does it support all features?" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 1h" >> $(METADATA)
@echo "RunFor: setools" >> $(METADATA)
@echo "Requires: policycoreutils setools-console-analyses" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHEL6 -RHEL7 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/setools/Sanity/sedta
Description: Does sedta work as expected? Does it support all features?
Author: Milos Malik <mmalik@redhat.com>

88
tests/Sanity/sedta/runtest.sh Executable file
View File

@ -0,0 +1,88 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/setools/Sanity/sedta
# Description: Does sedta work as expected? Does it support all features?
# Author: Milos Malik <mmalik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="setools"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm ${PACKAGE}-console-analyses
OUTPUT_FILE=`mktemp`
rlRun "semodule -i testpolicy.cil"
rlRun "semodule -l | grep testpolicy"
rlPhaseEnd
rlPhaseStartTest "invalid values"
rlRun "sedta -s unknown_t >& ${OUTPUT_FILE}" 1
rlRun "grep -i 'not a valid type' ${OUTPUT_FILE}"
rlRun "sedta -s apmd_t -t unknown_t -S >& ${OUTPUT_FILE}" 1
rlRun "grep -i 'not a valid type' ${OUTPUT_FILE}"
rlRun "sedta -s unknown_t -p /etc/selinux/unknown/policy/policy.31 >& ${OUTPUT_FILE}" 1
rlRun "grep -i 'no such file or directory' ${OUTPUT_FILE}"
rlRun "sedta -s apmd_t -t var_lib_t -A -1 >& ${OUTPUT_FILE}" 1
rlRun "grep -i 'must be positive' ${OUTPUT_FILE}"
rlRun "sedta -s xyz_t >& ${OUTPUT_FILE}"
rlRun "grep -i '^0.*transition.*found' ${OUTPUT_FILE}"
rlPhaseEnd
rlPhaseStartTest "valid values"
# transitivity
rlRun "sedta -s first_t -t second_t -S >& ${OUTPUT_FILE}"
rlRun "grep -i '^1 domain transition path.*found' ${OUTPUT_FILE}"
rlRun "sedta -s second_t -t third_t -S >& ${OUTPUT_FILE}"
rlRun "grep -i '^1 domain transition path.*found' ${OUTPUT_FILE}"
rlRun "sedta -s first_t -t third_t -S >& ${OUTPUT_FILE}"
rlRun "grep -i '^1 domain transition path.*found' ${OUTPUT_FILE}"
# reflexivity
rlRun "sedta -s first_t -t first_t -S >& ${OUTPUT_FILE}"
rlRun "grep -i '^1 domain transition path.*found' ${OUTPUT_FILE}"
rlRun "sedta -s second_t -t second_t -S >& ${OUTPUT_FILE}"
rlRun "grep -i '^1 domain transition path.*found' ${OUTPUT_FILE}"
rlRun "sedta -s third_t -t third_t -S >& ${OUTPUT_FILE}"
rlRun "grep -i '^1 domain transition path.*found' ${OUTPUT_FILE}"
# path is longer than limit
rlRun "sedta -s first_t -t third_t -A 1 >& ${OUTPUT_FILE}"
rlRun "grep -i '^0 domain transition path.*found' ${OUTPUT_FILE}"
# non-existent relation
rlRun "sedta -s first_t -t third_t -S -r >& ${OUTPUT_FILE}"
rlRun "grep -i '^0 domain transition path.*found' ${OUTPUT_FILE}"
# non-existent relation
rlRun "sedta -s third_t -t first_t -S >& ${OUTPUT_FILE}"
rlRun "grep -i '^0 domain transition path.*found' ${OUTPUT_FILE}"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "semodule -r testpolicy"
rlRun "semodule -l | grep testpolicy" 1
rm -f ${OUTPUT_FILE}
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,21 @@
( type xyz_t )
( type first_t )
( type first_exec_t )
( type second_t )
( type second_exec_t )
( type third_t )
( type third_exec_t )
( typetransition first_t second_exec_t process second_t )
( typetransition second_t third_exec_t process third_t )
( allow first_t second_exec_t ( file ( getattr open read execute )))
( allow first_t second_t ( process ( transition )))
( allow second_t third_exec_t ( file ( getattr open read execute )))
( allow second_t third_t ( process ( transition )))
( allow first_t first_exec_t ( file ( entrypoint )))
( allow second_t second_exec_t ( file ( entrypoint )))
( allow third_t third_exec_t ( file ( entrypoint )))

View File

@ -9,3 +9,12 @@
- repo: "https://src.fedoraproject.org/tests/selinux.git"
dest: "selinux"
fmf_filter: "tier: 1 | component: policycoreutils | component: checkpolicy"
# Test to run in classic context
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
tests:
- Sanity/sedta