Bug 1708897 - There is no /var/cache/nginx, selinux file contexts
Summary: There is no /var/cache/nginx, selinux file contexts
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 32
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-11 13:21 UTC by Georg Sauthoff
Modified: 2021-05-25 18:14 UTC (History)
12 users (show)

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


Attachments (Terms of Use)

Description Georg Sauthoff 2019-05-11 13:21:47 UTC
Description of problem:
After installing nginx ('A high performance web server and reverse proxy server'), when using it as reverse-proxy, one needs to configure a directory for the proxy cache (cf. `proxy_cache_path`).

The directory /var/cache/nginx would be a good default choice, but it doesn't exist and there aren't any selinux filecontexts for it.

Version-Release number of selected component (if applicable):
nginx-1.14.2-1.fc29.x86_64

How reproducible:
always

Steps to Reproduce:
1. install nginx
2. add to the config: proxy_cache_path /var/cache/nginx/manpath levels=1:2 keys_zone=foo_cache:10m max_size=10g inactive=60m use_temp_path=off;
3. configure caching for a `server {}` config
4. access some urls

Actual results:
selinux AVC

Expected results:
No selinux AVC, /var/cache/nginx is available after nginx installation. And requests are being cached.

Additional info:
Note that there are already some cache directories for some other http daemons:

# semanage fcontext -l | grep http | grep cache
[..]
/var/cache/httpd(/.*)?                             all files          system_u:object_r:httpd_cache_t:s0 
/var/cache/lighttpd(/.*)?                          all files          system_u:object_r:httpd_cache_t:s0 
[..]

The seemingly generic /var/cache/httpd can't be used by nginx because the unix permissions are too strict:


# ls -ldZ /var/cache/httpd
drwx------. 1 apache apache system_u:object_r:httpd_cache_t:s0 10 2019-04-02 17:46 /var/cache/httpd
# ls -ldZ /var/cache/httpd/proxy 
drwx------. 1 apache apache system_u:object_r:httpd_cache_t:s0 0 2019-05-11 14:27 /var/cache/httpd/proxy

Thus, as a work-around, one has to execute the following steps to use nginx as reverse-proxy (on a system with enabled selinux):

# mkdir /var/cache/nginx
# semanage fcontext -a -t httpd_cache_t '/var/cache/nginx(/.*)?'
# restorecon -rv /var/cache/nginx

Comment 1 Ben Cotton 2019-10-31 19:21:19 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
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 '29'.

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 29 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 2 Felix Kaechele 2019-11-01 04:04:17 UTC
Reassigning this to selinux-policy-targeted as this makes sense from my perspective and I support this change as the package maintainer of nginx.
I'll add the path as %ghost to the spec file in the next update of the package.

Comment 3 Lukas Vrabec 2019-11-01 16:43:12 UTC
commit dee19b8b41fcf9ca57e9e019b30b112a7546c030 (HEAD -> rawhide, origin/rawhide, origin/HEAD)
Author: Lukas Vrabec <lvrabec>
Date:   Fri Nov 1 17:42:31 2019 +0100

    Label /var/cache/nginx as httpd_cache_t
    
    Resolves: rhbz#1708897

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

Comment 5 Fedora Program Management 2021-04-29 17:15:34 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 6 Ben Cotton 2021-05-25 18:14:00 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.