public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Vit Mojzis <vmojzis@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] pr775-checkpolicy-revdeps: libsemanage: Make sure usepassd in semanage.conf works
Date: Fri, 11 Sep 2026 13:18:29 GMT [thread overview]
Message-ID: <178913270940.1.7579129020459082059.tests-selinux-119be8860117@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : tests/selinux
Branch : pr775-checkpolicy-revdeps
Commit : 119be886011738c25e3fae4b2ec5c2684a335cbe
Author : Vit Mojzis <vmojzis@redhat.com>
Date : 2020-11-30T15:56:18+00:00
Stats : +152/-0 in 4 file(s)
URL : https://src.fedoraproject.org/tests/selinux/c/119be886011738c25e3fae4b2ec5c2684a335cbe?branch=pr775-checkpolicy-revdeps
Log:
libsemanage: Make sure usepassd in semanage.conf works
---
diff --git a/libsemanage/usepasswd-in-semanage-conf/Makefile b/libsemanage/usepasswd-in-semanage-conf/Makefile
new file mode 100644
index 0000000..04e5715
--- /dev/null
+++ b/libsemanage/usepasswd-in-semanage-conf/Makefile
@@ -0,0 +1,65 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Makefile of /CoreOS/libsemanage/Sanity/usepasswd-in-semanage-conf
+# Description: Make sure usepasswd option in semanage.conf works properly
+# Author: Vit Mojzis <vmojzis@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Copyright (c) 2020 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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+export TEST=/CoreOS/libsemanage/Sanity/usepasswd-in-semanage-conf
+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: Vit Mojzis <vmojzis@redhat.com>" > $(METADATA)
+ @echo "Name: $(TEST)" >> $(METADATA)
+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
+ @echo "Path: $(TEST_DIR)" >> $(METADATA)
+ @echo "Description: Make sure usepasswd option in semanage.conf works properly" >> $(METADATA)
+ @echo "Type: Sanity" >> $(METADATA)
+ @echo "TestTime: 10m" >> $(METADATA)
+ @echo "RunFor: libsemanage" >> $(METADATA)
+ @echo "Requires: libselinux libselinux-utils libsemanage policycoreutils policycoreutils-python-utils selinux-policy selinux-policy-devel" >> $(METADATA)
+ @echo "Priority: Normal" >> $(METADATA)
+ @echo "License: GPLv2" >> $(METADATA)
+ @echo "Confidential: no" >> $(METADATA)
+ @echo "Destructive: no" >> $(METADATA)
+ @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
+ @echo "Bug: 1871786" >> $(METADATA) # RHEL-8
+
+ rhts-lint $(METADATA)
+
diff --git a/libsemanage/usepasswd-in-semanage-conf/PURPOSE b/libsemanage/usepasswd-in-semanage-conf/PURPOSE
new file mode 100644
index 0000000..2873eec
--- /dev/null
+++ b/libsemanage/usepasswd-in-semanage-conf/PURPOSE
@@ -0,0 +1,6 @@
+PURPOSE of /CoreOS/libsemanage/Sanity/usepasswd-in-semanage-conf
+Author: Vit Mojzis <vmojzis@redhat.com>
+Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1871786
+
+Make sure usepasswd option in semanage.conf works properly
+
diff --git a/libsemanage/usepasswd-in-semanage-conf/main.fmf b/libsemanage/usepasswd-in-semanage-conf/main.fmf
new file mode 100644
index 0000000..7e14f6d
--- /dev/null
+++ b/libsemanage/usepasswd-in-semanage-conf/main.fmf
@@ -0,0 +1,5 @@
+path: /libsemanage/usepasswd-in-semanage-conf
+summary: Make sure usepasswd option in semanage.conf works properly
+relevancy:
+ - "distro = rhel-4, rhel-5, rhel-6: False"
+tier: 2
diff --git a/libsemanage/usepasswd-in-semanage-conf/runtest.sh b/libsemanage/usepasswd-in-semanage-conf/runtest.sh
new file mode 100755
index 0000000..d11a837
--- /dev/null
+++ b/libsemanage/usepasswd-in-semanage-conf/runtest.sh
@@ -0,0 +1,76 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# runtest.sh of /CoreOS/libsemanage/Sanity/usepasswd-in-semanage-conf
+# Description: Make sure usepasswd option in semanage.conf works properly
+# Author: Vit Mojzis <vmojzis@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Copyright (c) 2016 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/bin/rhts-environment.sh || exit 1
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+PACKAGE="libsemanage"
+SEMANAGE_CONF="/etc/selinux/semanage.conf"
+
+rlJournalStart
+ rlPhaseStartSetup
+ rlAssertRpm ${PACKAGE}
+ rlAssertRpm policycoreutils
+ rlAssertRpm selinux-policy
+ rlFileBackup ${SEMANAGE_CONF}
+ rlRun "rpm -qf /usr/sbin/semanage"
+ rlRun "grep -v -e '^#' -e '^$' ${SEMANAGE_CONF}"
+ OUTPUT_FILE=`mktemp`
+ CMP_FILE=`mktemp`
+ rlRun "setenforce 1"
+ rlRun "sestatus"
+ rlPhaseEnd
+
+ rlPhaseStartTest "usepasswd=False"
+ rlRun 'sed -i "s|usepasswd=.*$|usepasswd=False|g" ${SEMANAGE_CONF}'
+ rlRun 'semodule -B' # rebuild file_contexts.homedirs
+ rlRun "semanage fcontext -l 2>&1 > ${CMP_FILE}" # save file contexts for comparison
+ rlRun 'useradd -Z unconfined_u duck'
+ rlRun 'semanage login -l | grep duck' 0
+ rlRun "semanage fcontext -l 2>&1 > ${OUTPUT_FILE}"
+ rlRun "diff ${CMP_FILE} ${OUTPUT_FILE}" 0
+ rlPhaseEnd
+
+ rlPhaseStartTest "usepasswd=True"
+ rlRun 'sed -i "s|usepasswd=.*$|usepasswd=True|g" ${SEMANAGE_CONF}'
+ rlRun 'semodule -B' # rebuild file_contexts.homedirs
+ rlRun "semanage fcontext -l 2>&1 > ${OUTPUT_FILE}" # file context with new selinux login
+ rlRun 'semanage login -d duck'
+ rlRun "semanage fcontext -l 2>&1 > ${CMP_FILE}"
+ rlRun "diff ${CMP_FILE} ${OUTPUT_FILE} | grep duck"
+ rlPhaseEnd
+
+ rlPhaseStartCleanup
+ rlRun "rm -f ${OUTPUT_FILE} ${CMP_FILE}"
+ rlRun "userdel duck"
+ rlFileRestore
+ rlPhaseEnd
+rlJournalPrintText
+rlJournalEnd
+
reply other threads:[~2026-09-11 13:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178913270940.1.7579129020459082059.tests-selinux-119be8860117@fedoraproject.org \
--to=vmojzis@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox