public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/caddy] rawhide: Add SELinux file context httpd_log_t for Caddy log directory
Date: Thu, 02 Jul 2026 18:15:20 GMT	[thread overview]
Message-ID: <178301612059.1.1241308381063546541.rpms-caddy-9ed1414f6036@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/caddy
            Branch : rawhide
            Commit : 9ed1414f6036fe54d31af6286327b45929230deb
            Author : Rénich Bon Ćirić <renich@woralelandia.com>
            Date   : 2026-07-02T10:15:49-06:00
            Stats  : +3/-1 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/caddy/c/9ed1414f6036fe54d31af6286327b45929230deb?branch=rawhide

            Log:
            Add SELinux file context httpd_log_t for Caddy log directory

When custom file-based logging is configured under /var/log/caddy, the caddy service fails to start with a permission denied error in SELinux-enforcing mode. This is because caddy runs in the httpd_t domain but the log directory defaults to the var_log_t label.

This patch registers the file context /var/log/caddy(/.*)? as httpd_log_t in the SELinux database upon package installation and removes it upon uninstall.

Co-developed-by: Gemini AI <renich+gemini@woralelandia.com>
Signed-off-by: Rénich Bon Ćirić <renich@woralelandia.com>

---
diff --git a/caddy.spec b/caddy.spec
index c9a89eb..64fde99 100644
--- a/caddy.spec
+++ b/caddy.spec
@@ -127,7 +127,8 @@ if [ -x /usr/sbin/semanage -a -x /usr/sbin/restorecon ]; then
     semanage fcontext --add --type httpd_sys_content_t '%{_datadir}/caddy(/.*)?'        2> /dev/null || :
     semanage fcontext --add --type httpd_config_t      '%{_sysconfdir}/caddy(/.*)?'     2> /dev/null || :
     semanage fcontext --add --type httpd_var_lib_t     '%{_sharedstatedir}/caddy(/.*)?' 2> /dev/null || :
-    restorecon -r %{_bindir}/caddy %{_datadir}/caddy %{_sysconfdir}/caddy %{_sharedstatedir}/caddy || :
+    semanage fcontext --add --type httpd_log_t         '%{_localstatedir}/log/caddy(/.*)?' 2> /dev/null || :
+    restorecon -r %{_bindir}/caddy %{_datadir}/caddy %{_sysconfdir}/caddy %{_sharedstatedir}/caddy %{_localstatedir}/log/caddy || :
 fi
 if [ -x /usr/sbin/semanage ]; then
     # QUIC
@@ -156,6 +157,7 @@ if [ $1 -eq 0 ]; then
         semanage fcontext --delete --type httpd_sys_content_t '%{_datadir}/caddy(/.*)?'        2> /dev/null || :
         semanage fcontext --delete --type httpd_config_t      '%{_sysconfdir}/caddy(/.*)?'     2> /dev/null || :
         semanage fcontext --delete --type httpd_var_lib_t     '%{_sharedstatedir}/caddy(/.*)?' 2> /dev/null || :
+        semanage fcontext --delete --type httpd_log_t         '%{_localstatedir}/log/caddy(/.*)?' 2> /dev/null || :
         # QUIC
         semanage port     --delete --type http_port_t --proto udp 80   2> /dev/null || :
         semanage port     --delete --type http_port_t --proto udp 443  2> /dev/null || :

                 reply	other threads:[~2026-07-02 18:15 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=178301612059.1.1241308381063546541.rpms-caddy-9ed1414f6036@fedoraproject.org \
    --to=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