Bug 1789868 - SELinux prevents systemd from managing httpd log directories
Summary: SELinux prevents systemd from managing httpd log directories
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 32
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
Assignee: Nikola Knazekova
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-01-10 15:35 UTC by fedora.dm0
Modified: 2021-05-25 18:41 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-3.14.5-28.fc32
Clone Of:
Environment:
Last Closed: 2021-05-25 18:41:18 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description fedora.dm0 2020-01-10 15:35:54 UTC
Description of problem:
I tried to start lighttpd with systemd when booting with an empty /var.  Since lighttpd doesn't try to create the log directory, I let systemd manage it with the following service addition.  The SELinux policy prevents this.

User=lighttpd
Group=lighttpd
LogsDirectory=lighttpd
LogsDirectoryMode=0750

Version-Release number of selected component (if applicable):
lighttpd-1.4.54-2.fc31.x86_64
selinux-policy-targeted-3.14.4-43.fc31.noarch
systemd-243.5-1.fc31.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Add the above lines to lighttpd.service (and enable it)
2. Configure var.state_dir="/run/lighttpd" to fix permissions
3. Boot with empty /var, or start the service after deleting /var/log/lighttpd

Actual results:
Jan 10 10:06:05 io audit[8669]: AVC avc:  denied  { create } for  pid=8669 comm="(lighttpd)" name="lighttpd" scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:httpd_log_t:s0 tclass=dir permissive=1
Jan 10 10:06:05 io kernel: audit: type=1400 audit(1578668765.717:4733): avc:  denied  { create } for  pid=8669 comm="(lighttpd)" name="lighttpd" scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:httpd_log_t:s0 tclass=dir permissive=1
Jan 10 10:06:05 io kernel: audit: type=1400 audit(1578668765.717:4734): avc:  denied  { setattr } for  pid=8669 comm="(lighttpd)" name="lighttpd" dev="tmpfs" ino=323355 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:httpd_log_t:s0 tclass=dir permissive=1
Jan 10 10:06:05 io audit[8669]: AVC avc:  denied  { setattr } for  pid=8669 comm="(lighttpd)" name="lighttpd" dev="tmpfs" ino=323355 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:httpd_log_t:s0 tclass=dir permissive=1

Expected results:
The service should start with functioning logs.

Comment 1 Lukas Vrabec 2020-01-30 16:49:30 UTC
commit 9e0b4dd06e1de366a0ca53e879bf3069a64b654b (HEAD -> rawhide, origin/rawhide)
Author: Nikola Knazekova <nknazeko>
Date:   Thu Jan 30 11:47:16 2020 +0100

    Allow init_t to create apache log dirs.
    
    PR for new apache create log dirs macro: https://github.com/fedora-selinux/selinux-policy-contrib/pull/194
    
    Fixed Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1789868
    
    $ rpm -qa selinux-policy
    selinux-policy-3.14.5-20.fc32.noarch
    
    $ sesearch -A -s init_t -t httpd_log_t -p create -c dir
    
    Scratch build installed
    
    $ rpm -qa selinux-policy
    selinux-policy-3.14.5-21.fc32.100.noarch
    
    $ sesearch -A -s init_t -t httpd_log_t -p create -c dir
    allow init_t httpd_log_t:dir { add_name create link remove_name rename reparent rmdir setattr unlink write };

Comment 2 Ben Cotton 2020-02-11 17:22:13 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 32 development cycle.
Changing version to 32.

Comment 3 Fedora Program Management 2021-04-29 17:20:41 UTC
This message is a reminder that Fedora 32 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 32 on 2021-05-25.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '32'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 32 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Ben Cotton 2021-05-25 18:41:18 UTC
Fedora 32 changed to end-of-life (EOL) status on 2021-05-25. Fedora 32 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.