public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: libsemanage: Make sure usepassd in semanage.conf works
@ 2026-09-11 13:18 Vit Mojzis
  0 siblings, 0 replies; only message in thread
From: Vit Mojzis @ 2026-09-11 13:18 UTC (permalink / raw)
  To: git-commits

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
+

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-11 13:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 13:18 [tests/selinux] pr775-checkpolicy-revdeps: libsemanage: Make sure usepassd in semanage.conf works Vit Mojzis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox