public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Milos Malik <mmalik@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] pr775-checkpolicy-revdeps: test if tlshd can access network and certificates
Date: Fri, 11 Sep 2026 13:22:23 GMT	[thread overview]
Message-ID: <178913294362.1.873622065931067888.tests-selinux-6026118dccd0@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 6026118dccd0be4909a87b93ea0072baf5ac4fb3
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2025-02-17T15:31:48+00:00
            Stats  : +21/-1 in 3 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/6026118dccd0be4909a87b93ea0072baf5ac4fb3?branch=pr775-checkpolicy-revdeps

            Log:
            test if tlshd can access network and certificates

Recent ktls-utils + NVME testing revealed that SELinux prevents
the tlshd processes from doing the following activities:
 * reading the /etc/resolv.conf file
 * creating and managing a UDP socket
 * searching the /etc/pki/tls/certs directory
 * reading the certificate files under /etc/pki/tls/certs/
 * reading the /proc/sys/net/ipv6/conf/all/disable_ipv6 file
 * searching the /proc/sys/net/ipv6 directory
 * creating and managing a netlink route socket

The TC does not reproduce the situation. There is a dedicated
automated test for this purpose.

In order to enable the expected tlshd functionality, I believe that
SELinux policy should allow these actions. The TC looks for appropriate
policy rules and file context patterns.

The TC covers RHEL-74424.

---
diff --git a/selinux-policy/tlshd-and-similar/Makefile b/selinux-policy/tlshd-and-similar/Makefile
index b6e2928..236ebdf 100644
--- a/selinux-policy/tlshd-and-similar/Makefile
+++ b/selinux-policy/tlshd-and-similar/Makefile
@@ -64,6 +64,7 @@ $(METADATA): Makefile
 	@echo "Releases:        -RHEL4 -RHEL5 -RHEL6 -RHEL7 -RHEL8" >> $(METADATA)
 	@echo "Bug:             RHEL-29439" >> $(METADATA) # RHEL-9
 	@echo "Bug:             RHEL-42672" >> $(METADATA) # RHEL-10
+	@echo "Bug:             RHEL-74424" >> $(METADATA) # RHEL-10
 
 	rhts-lint $(METADATA)
 

diff --git a/selinux-policy/tlshd-and-similar/main.fmf b/selinux-policy/tlshd-and-similar/main.fmf
index f792516..34a61bc 100644
--- a/selinux-policy/tlshd-and-similar/main.fmf
+++ b/selinux-policy/tlshd-and-similar/main.fmf
@@ -31,9 +31,10 @@ tag:
 link:
   - verifies: https://issues.redhat.com/browse/RHEL-29439
   - verifies: https://issues.redhat.com/browse/RHEL-42672
+  - verifies: https://issues.redhat.com/browse/RHEL-74424
 adjust:
   - enabled: false
-    when: distro == rhel-4, rhel-5, rhel-6, rhel-7, rhel-8
+    when: distro == rhel-4, rhel-5, rhel-6, rhel-7, rhel-8, centos-stream-8
     because: the ktls-utils package is not available there
 extra-summary: /CoreOS/selinux-policy/Regression/tlshd-and-similar
 extra-task: /CoreOS/selinux-policy/Regression/tlshd-and-similar

diff --git a/selinux-policy/tlshd-and-similar/runtest.sh b/selinux-policy/tlshd-and-similar/runtest.sh
index 4a2fc48..bf67f0e 100755
--- a/selinux-policy/tlshd-and-similar/runtest.sh
+++ b/selinux-policy/tlshd-and-similar/runtest.sh
@@ -70,6 +70,24 @@ rlJournalStart
         rlSESearchRule "type_transition init_t ${FILE_CONTEXT} : process ${PROCESS_CONTEXT}"
     rlPhaseEnd
 
+    if rlSEDefined "ktlshd_t" ; then
+    rlPhaseStartTest "RHEL-74424"
+        rlSEMatchPathCon "/etc/resolv.conf" "net_conf_t"
+        rlSEMatchPathCon "/etc/pki/tls/certs/ca-cert.pem" "cert_t"
+        rlRun "ls -Z /proc/net/if_inet6 | grep :proc_net_t"
+        rlRun "ls -Z /proc/sys/net/ipv6/conf/all/disable_ipv6 | grep :sysctl_net_t"
+        rlSESearchRule "allow ktlshd_t ktlshd_t : key { write } [ ]"
+        rlSESearchRule "allow ktlshd_t cert_t : dir { search } [ ]"
+        rlSESearchRule "allow ktlshd_t cert_t : file { getattr open read } [ ]"
+        rlSESearchRule "allow ktlshd_t net_conf_t : file { getattr open read } [ ]"
+        rlSESearchRule "allow ktlshd_t proc_net_t : lnk_file { read } [ ]"
+        rlSESearchRule "allow ktlshd_t ktlshd_t : netlink_route_socket { bind create getattr getopt nlmsg_read setopt } [ ]"
+        rlSESearchRule "allow ktlshd_t ktlshd_t : udp_socket { connect create getattr setopt } [ ]"
+        rlSESearchRule "allow ktlshd_t sysctl_net_t : dir { search } [ ]"
+        rlSESearchRule "allow ktlshd_t sysctl_net_t : file { getattr open read } [ ]"
+    rlPhaseEnd
+    fi
+
     if [ -f /usr/lib/systemd/system/${SERVICE_NAME}.service ] ; then
     rlPhaseStartTest "real scenario -- standalone service"
         rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "start status" 1

                 reply	other threads:[~2026-09-11 13:22 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=178913294362.1.873622065931067888.tests-selinux-6026118dccd0@fedoraproject.org \
    --to=mmalik@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