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 chronyc can talk to the restricted chronyd via socket
Date: Fri, 11 Sep 2026 13:22:28 GMT	[thread overview]
Message-ID: <178913294843.1.13147594163450288638.tests-selinux-59cff7b143a2@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 59cff7b143a21d62def0ad5543a8770e676b59b8
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2025-03-20T09:44:13+00:00
            Stats  : +13/-1 in 3 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/59cff7b143a21d62def0ad5543a8770e676b59b8?branch=pr775-checkpolicy-revdeps

            Log:
            test if chronyc can talk to the restricted chronyd via socket

Recent selinux-policy + chrony testing revealed that SELinux prevents
communication between chronyc and the restricted chronyd service. The
TC reproduces the situation.

In order to enable this use case, I believe that SELinux policy
should allow the communcation in both directions. The TC looks
for appropriate policy rules.

The TC covers RHEL-82299 and RHEL-82308.

---
diff --git a/selinux-policy/chronyd-and-similar/Makefile b/selinux-policy/chronyd-and-similar/Makefile
index ab9a53b..a26d46f 100644
--- a/selinux-policy/chronyd-and-similar/Makefile
+++ b/selinux-policy/chronyd-and-similar/Makefile
@@ -105,6 +105,8 @@ $(METADATA): Makefile
 	@echo "Bug:             2173604" >> $(METADATA) # RHEL-9
 	@echo "Bug:             2169949" >> $(METADATA) # Fedora-38
 	@echo "Bug:             RHEL-18219" >> $(METADATA) # RHEL-9
+	@echo "Bug:             RHEL-82299" >> $(METADATA) # RHEL-10
+	@echo "Bug:             RHEL-82308" >> $(METADATA) # RHEL-9
 
 	rhts-lint $(METADATA)
 

diff --git a/selinux-policy/chronyd-and-similar/main.fmf b/selinux-policy/chronyd-and-similar/main.fmf
index 6ada2ed..b80882f 100644
--- a/selinux-policy/chronyd-and-similar/main.fmf
+++ b/selinux-policy/chronyd-and-similar/main.fmf
@@ -86,6 +86,8 @@ link:
   - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2173604
   - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2169949
   - verifies: https://issues.redhat.com/browse/RHEL-18219
+  - verifies: https://issues.redhat.com/browse/RHEL-82299
+  - verifies: https://issues.redhat.com/browse/RHEL-82308
 adjust:
   - enabled: false
     when: distro == rhel-4

diff --git a/selinux-policy/chronyd-and-similar/runtest.sh b/selinux-policy/chronyd-and-similar/runtest.sh
index e7c7094..4e09f92 100755
--- a/selinux-policy/chronyd-and-similar/runtest.sh
+++ b/selinux-policy/chronyd-and-similar/runtest.sh
@@ -343,7 +343,7 @@ rlJournalStart
             rlRun "ipcs -m | grep 0x4e545030"
             rlRun "ls -Z /var/run/chronyd.sock | grep :chronyd_var_run_t"
         fi
-        rlRun "restorecon -Rv /run /var -e /var/ARTIFACTS" 0-255
+        rlRun "restorecon -Rv /etc /run /var -e /var/ARTIFACTS" 0-255
         rlSEService ${ROOT_PASSWORD} ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "restart status" 1
         rlRun "chronyc tracking"
         for OUTPUT_FILE in /tmp/chronyc.output /var/lib/chrony/chronyc.output /var/log/chrony/chronyc.output ; do
@@ -419,6 +419,13 @@ rlJournalStart
     rlPhaseEnd
     fi
 
+    if rlSEDefined "chronyd_restricted_t" ; then
+    rlPhaseStartTest "RHEL-82299 + RHEL-82308"
+        rlSESearchRule "allow chronyc_t chronyd_restricted_t : unix_dgram_socket { sendto } [ ]"
+        rlSESearchRule "allow chronyd_restricted_t chronyc_t : unix_dgram_socket { sendto } [ ]"
+    rlPhaseEnd
+    fi
+
     if [ -f ${CHRONYD_RESTRICTED_UNIT_FILE} ]; then
       rlPhaseStartTest "chronyd-restricted -- bz#2169949 + RHEL-18219"
         rlRun "systemctl stop ${SERVICE_NAME}"
@@ -432,6 +439,7 @@ rlJournalStart
         sleep 3
         rlRun "ps -o pid,uid,command,context -C chronyd | grep -1 system_u:system_r:chronyd_restricted_t:"
         rlRun "systemctl status ${CHRONYD_RESTRICTED_SERVICE}"
+        rlRun "chronyc reload sources" 0,1
         rlRun "systemctl restart ${CHRONYD_RESTRICTED_SERVICE}"
         rlRun "systemctl status ${CHRONYD_RESTRICTED_SERVICE}"
         rlRun "systemctl stop ${CHRONYD_RESTRICTED_SERVICE}"

                 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=178913294843.1.13147594163450288638.tests-selinux-59cff7b143a2@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